Closed tituslhy closed 1 month ago
@tituslhy Might need more details to replicate this? What is MultiAgentSystem
? Is there some minimum workflow that replicates this?
Empty response from a query engine really only happens when zero results are retrieved. Perhaps it's not loading your existing chroma collection properly?
Oh sorry. MultiAgentSystem is just the name of the workflow. Here's a minimally reproducible example:
llm = OpenAI()
embed_model = OpenAIEmbedding()
db_path = "./path/to/db"
chroma_client = chromadb.PersistentClient(path=db_path)
chroma_collection = chroma_client.get_or_create_collection(name="DefinitionsTool")
vector_store = ChromaVectorStore(chroma_collection=chroma_collection)
index = VectorStoreIndex.from_vector_store(vector_store, embed_model=embed_model)
query_engine = index.as_query_engine(
similarity_top_k = 4,
llm = llm
)
tools = [
QueryEngineTool(
query_engine = query_engine,
metadata = ToolMetadata(
name = "Definitions_Tool",
description = """Use this tool to answer questions related to definitions such as
what is "yield"."""
)
)
]
agent_worker = FunctionCallingAgentWorker.from_tools(tools=tools)
agent = agent_worker.as_agent()
class MultiAgentSystem(Workflow):
def __init__(self):
self.rag_agent = agent
@step
async def process_query(self, ev: StartEvent) -> RAGEvent:
.... #some code here to route to RAGEvent
@step
async def get_definitions(self, ev: RAGEvent) -> StopEvent
response = await self.rag_agent.achat(ev.query)
return StopEvent(str(response))
This all works. When I use the query engine to query, or chat with the agent or run the task via workflow - I get the correct results. It's only once I deployed the workflow to llama-deploy that my RAG tool starts returning me empty responses for the exact same question - actually for any question.
I think this might be a ChromaDB problem. I changed the vector database to Qdrant and it immediately worked ok. Closing the issue.
I've tested my code on the following levels:
deploy_core.py
deploy_workflow.py
Testing code on a Jupyter Notebook:
The output I got in my terminal was:
Not too sure why this is happening. I'm using ChromaDB as my vector database to do this.