Skip to content

Commit 18102d6

Browse files
pavanjavapavanmantha
and
pavanmantha
authored
Llama deploy and fastapi support (#23)
* -product pitch presentation * -llama-deploy implementation, -implemented fastapi for all templates, -partial implementation of docker for templates * implemented the llama-deploy and workflows with simplemq and rabbitmq * - modified the docs --------- Co-authored-by: pavanmantha <[email protected]>
1 parent 7e1c0c9 commit 18102d6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1009
-159
lines changed

bootstraprag/cli.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import click
22
import shutil
33
from pathlib import Path
4-
import os
5-
import zipfile
64
from InquirerPy import inquirer
75

86

@@ -36,7 +34,9 @@ def create(project_name, framework, template, observability):
3634
'rag-with-hyde',
3735
'rag-with-flare',
3836
'rag-with-self-correction',
39-
'llama-agents-with-simpleq'
37+
'llama-deploy-with-simplemq',
38+
'llama-deploy-with-rabbitmq',
39+
'llama-deploy-with-kafka'
4040
]
4141
elif framework == 'None':
4242
framework = 'qdrant'

bootstraprag/templates/llamaindex/llama_agents_with_kafka/readme.md

-1
This file was deleted.

bootstraprag/templates/llamaindex/llama_agents_with_rabbitmq/readme.md

-1
This file was deleted.

bootstraprag/templates/llamaindex/llama_agents_with_simpleq/agents_core.py

-50
This file was deleted.

bootstraprag/templates/llamaindex/llama_agents_with_simpleq/main.py

-28
This file was deleted.

bootstraprag/templates/llamaindex/llama_agents_with_simpleq/rag_operations.py

-64
This file was deleted.

bootstraprag/templates/llamaindex/llama_agents_with_simpleq/requirements.txt

-11
This file was deleted.

bootstraprag/templates/llamaindex/llama_agents_with_simpleq/.env bootstraprag/templates/llamaindex/llama_deploy_with_kafka/.env

+4
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ WARN = 30
1919
INFO = 20
2020
DEBUG = 10
2121
NOTSET = 0
22+
23+
# allowed values deploy_rag_workflow_with_retry_query_engine,
24+
# deploy_rag_workflow_with_retry_source_query_engine, deploy_rag_workflow_with_retry_guideline_query_engine
25+
ENABLED_WORKFLOW='deploy_rag_workflow_with_retry_source_query_engine'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from llama_deploy import (
2+
deploy_core,
3+
ControlPlaneConfig,
4+
SimpleMessageQueueConfig,
5+
)
6+
7+
8+
async def main():
9+
await deploy_core(
10+
control_plane_config=ControlPlaneConfig(),
11+
message_queue_config=SimpleMessageQueueConfig(),
12+
)
13+
14+
15+
if __name__ == "__main__":
16+
import asyncio
17+
18+
asyncio.run(main())
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import os
2+
3+
from llama_deploy import (
4+
deploy_workflow,
5+
WorkflowServiceConfig,
6+
ControlPlaneConfig
7+
)
8+
from workflows.retry_query_engine_workflow import build_rag_workflow_with_retry_query_engine
9+
from dotenv import load_dotenv, find_dotenv
10+
11+
12+
_ = load_dotenv(find_dotenv())
13+
14+
15+
async def deploy_rag_workflow_with_retry_query_engine():
16+
rag_workflow = build_rag_workflow_with_retry_query_engine()
17+
try:
18+
await deploy_workflow(
19+
workflow=rag_workflow,
20+
workflow_config=WorkflowServiceConfig(
21+
host="127.0.0.1",
22+
port=8002,
23+
# service name matches the name of the workflow used in Agentic Workflow
24+
service_name="rag_workflow_with_retry_query_engine",
25+
description="RAG workflow",
26+
),
27+
# Config controlled by env vars
28+
control_plane_config=ControlPlaneConfig()
29+
)
30+
except Exception as e:
31+
print(e)
32+
33+
if __name__ == "__main__":
34+
import asyncio
35+
import nest_asyncio
36+
37+
nest_asyncio.apply()
38+
try:
39+
# deployment of workflow is driven by environmental variables
40+
# if os.environ['ENABLED_WORKFLOW'] == 'deploy_rag_workflow_with_retry_query_engine':
41+
# asyncio.run(deploy_rag_workflow_with_retry_query_engine())
42+
# elif os.environ['ENABLED_WORKFLOW'] == 'deploy_rag_workflow_with_retry_source_query_engine':
43+
# asyncio.run(deploy_rag_workflow_with_retry_source_query_engine())
44+
# else:
45+
# asyncio.run(deploy_rag_workflow_with_retry_guideline_query_engine())
46+
asyncio.run(deploy_rag_workflow_with_retry_query_engine())
47+
except Exception as e:
48+
print(e)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import os
2+
3+
from llama_deploy import (
4+
deploy_workflow,
5+
WorkflowServiceConfig,
6+
ControlPlaneConfig
7+
)
8+
from workflows.retry_query_engine_workflow import build_rag_workflow_with_retry_query_engine
9+
from workflows.retry_source_query_engine_workflow import build_rag_workflow_with_retry_source_query_engine
10+
from workflows.retry_guideline_query_engine_workflow import build_rag_workflow_with_retry_guideline_query_engine
11+
from dotenv import load_dotenv, find_dotenv
12+
13+
14+
_ = load_dotenv(find_dotenv())
15+
16+
17+
async def deploy_rag_workflow_with_retry_source_query_engine():
18+
rag_workflow = build_rag_workflow_with_retry_source_query_engine()
19+
try:
20+
await deploy_workflow(
21+
workflow=rag_workflow,
22+
workflow_config=WorkflowServiceConfig(
23+
host="127.0.0.1",
24+
port=8003,
25+
# service name matches the name of the workflow used in Agentic Workflow
26+
service_name="rag_workflow_with_retry_source_query_engine",
27+
description="RAG workflow",
28+
),
29+
# Config controlled by env vars
30+
control_plane_config=ControlPlaneConfig()
31+
)
32+
except Exception as e:
33+
print(e)
34+
35+
36+
if __name__ == "__main__":
37+
import asyncio
38+
import nest_asyncio
39+
40+
nest_asyncio.apply()
41+
try:
42+
# deployment of workflow is driven by environmental variables
43+
# if os.environ['ENABLED_WORKFLOW'] == 'deploy_rag_workflow_with_retry_query_engine':
44+
# asyncio.run(deploy_rag_workflow_with_retry_query_engine())
45+
# elif os.environ['ENABLED_WORKFLOW'] == 'deploy_rag_workflow_with_retry_source_query_engine':
46+
# asyncio.run(deploy_rag_workflow_with_retry_source_query_engine())
47+
# else:
48+
# asyncio.run(deploy_rag_workflow_with_retry_guideline_query_engine())
49+
asyncio.run(deploy_rag_workflow_with_retry_source_query_engine())
50+
except Exception as e:
51+
print(e)

0 commit comments

Comments
 (0)