-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RAG is not Working in a team of Agents #1668
Comments
Interesting! I used LanceDB and not ChromaDB. But still got stuck lol |
Hey @MuhammadAhsaanAbbasi @Cipher-unhsiV this worked for me perfectly. I had to play around with instructions and also added the role of the rag agent
|
@manthanguptaa , See if I copied this code so it's just load the document & don't run the below code after loading the document. |
@MuhammadAhsaanAbbasi please check if you PgVector is working or not. You will have to make sure the infra is up on your side. The code is working on my side and looks perfect. |
Hello guys, I used team of agents & want to used Embedding RAG in team of Agents how can I implement it.
This is my code let's check the code & also some other problem then provide me a solution of this:
app/agent_team.py
------------------------------------------------------------------------------
type: ignore
import os
import typer
from rich.prompt import Prompt
from typing import Optional
from dotenv import load_dotenv
--- phi imports ---
from phi.agent import Agent
from phi.model.openai import OpenAIChat
from phi.storage.agent.sqlite import SqlAgentStorage
from phi.tools.duckduckgo import DuckDuckGo
from phi.tools.yfinance import YFinanceTools
from phi.embedder.openai import OpenAIEmbedder
from phi.document.chunking.agentic import AgenticChunking
from phi.knowledge.pdf import PDFUrlKnowledgeBase
from phi.vectordb.chroma import ChromaDb
load_dotenv()
vector_db = ChromaDb(
collection="recipes",
embedder=OpenAIEmbedder(model="text-embedding-3-small"),
)
knowledge_base = PDFUrlKnowledgeBase(
urls=["https://phi-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf"],
vector_db=vector_db,
chunking_strategy=AgenticChunking(max_chunk_size=1000),
num_documents=5,
)
Load the knowledge base (comment out after first run)
knowledge_base.load(recreate=False)
YFinance Agent
finance_agent = Agent(
name="Finance Agent",
role="Get financial data",
tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, company_info=True)],
show_tool_calls=True,
)
DuckDuckGo Agent
web_agent = Agent(
name="Web Agent",
role="Search the web for information",
tools=[DuckDuckGo()],
show_tool_calls=True,
)
RAG Agent
ragAgent = Agent(
knowledge_base=knowledge_base,
search_knowledge=True,
)
agent_team = Agent(
name="Multi-Capability Team",
team=[finance_agent, web_agent, ragAgent],
instructions=[
"Use the Finance Agent for financial data queries.",
"Use the Web Agent for general web searches.",
"Use the RAG Agent to retrieve information from the knowledge base.",
],
show_tool_calls=True,
markdown=True,
debug_mode=True
)
agent_team.print_response("What's the current stock price of AAPL and can you find a recipe for Thai green curry?", stream=True)
When I don't commit the line of command # Load the knowledge base (comment out after first run)
knowledge_base.load(recreate=False) so it's doesn't execute the below code & when I committed so it's agent doesn't retrieve information from Knowledgebase & give me answer using web search tool
I attached two documents first when I don't commit a line of knowledge_base.load(recreate=False) & second when I commit the line.
@cpunion @chug2k @ofri @sroecker @adieyal & all team members of Phidata please look at down my issue & help me out to resolve this issue.
The text was updated successfully, but these errors were encountered: