Skip to content

Commit

Permalink
cr
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdai committed Aug 3, 2024
1 parent 44308a4 commit 7d27291
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 28 deletions.
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ services:
build:
context: .
dockerfile: ./Dockerfile
secrets:
- id_ed25519
healthcheck:
test: wget --no-verbose --tries=1 http://0.0.0.0:8001/ || exit 1
interval: 30s
Expand All @@ -58,6 +60,8 @@ services:
build:
context: .
dockerfile: ./Dockerfile
secrets:
- id_ed25519
healthcheck:
test: wget --no-verbose --tries=1 http://0.0.0.0:8002/is_worker_running || exit 1
interval: 30s
Expand All @@ -84,6 +88,8 @@ services:
build:
context: .
dockerfile: ./Dockerfile
secrets:
- id_ed25519
healthcheck:
test: wget --no-verbose --tries=1 http://0.0.0.0:8003/is_worker_running || exit 1
interval: 30s
Expand All @@ -110,6 +116,8 @@ services:
build:
context: .
dockerfile: ./Dockerfile
secrets:
- id_ed25519
healthcheck:
test: wget --no-verbose --tries=1 http://0.0.0.0:8004/is_worker_running || exit 1
interval: 30s
Expand All @@ -118,3 +126,6 @@ services:
timeout: 10s
volumes:
rabbitmq:
secrets:
id_ed25519:
file: ~/.ssh/id_ed25519
30 changes: 17 additions & 13 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ streamlit = "^1.36.0"
llama-index-readers-file = "^0.1.30"
llama-index-embeddings-openai = "^0.1.11"
llama-index-program-openai = "^0.1.7"
llama-agents = {version = "^0.0.12", extras = ["rabbitmq"]}
llama-agents = {git = "[email protected]:run-llama/llama-agents.git", rev = "nerdai-fix-pipeline-orchestrator", extras = ["rabbitmq"]}
snowflake-sqlalchemy = "^1.6.1"

[tool.poetry.group.dev.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion snowflake_cybersyn_demo/agent_services/funny_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def get_the_secret_fact() -> str:
agent_server = AgentService(
agent=agent,
message_queue=message_queue,
description="Cannot get timeseries data of specified good, but can handle all other queries.",
description="Do not select for any queries regarding timeseries data. Can be used for everything but that.",
service_name="funny_agent",
host=funny_agent_host,
port=int(funny_agent_port) if funny_agent_port else None,
Expand Down
22 changes: 9 additions & 13 deletions snowflake_cybersyn_demo/core_services/control_plane.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import uvicorn
from llama_agents import ControlPlaneServer, PipelineOrchestrator
from llama_agents.orchestrators.router import RouterOrchestrator
from llama_agents.message_queues.rabbitmq import RabbitMQMessageQueue
from llama_index.core.query_pipeline import QueryPipeline, RouterComponent
from llama_index.core.selectors import PydanticSingleSelector
Expand Down Expand Up @@ -40,24 +41,19 @@
time_series_getter_agent_component,
],
)
timeseries_pipeline_orchestrator = PipelineOrchestrator(timeseries_task_pipeline)
timeseries_task_pipeline_desc = (
"Only used for getting timeseries data from the database."
)

pipeline = QueryPipeline(
chain=[
RouterComponent(
selector=PydanticSingleSelector.from_defaults(llm=OpenAI()),
choices=[
funny_agent_server.description,
timeseries_task_pipeline_desc,
],
components=[funny_agent_component, timeseries_task_pipeline],
)
]
)
general_pipeline = QueryPipeline(chain=[funny_agent_component])
general_pipeline_orchestrator = PipelineOrchestrator(general_pipeline)

pipeline_orchestrator = PipelineOrchestrator(pipeline)
pipeline_orchestrator = RouterOrchestrator(
selector=PydanticSingleSelector.from_defaults(llm=OpenAI()),
orchestrators=[timeseries_pipeline_orchestrator, general_pipeline_orchestrator],
choices=[timeseries_task_pipeline_desc, funny_agent_server.description],
)

# setup control plane
control_plane = ControlPlaneServer(
Expand Down

0 comments on commit 7d27291

Please sign in to comment.