-
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
Multi agent framework not working as expected , issue with yfinance lib as well internally #1700
Comments
@GauravKasat , the problem is with your prompt / instruction under multi_agent . First you have created duckduckgo web agent to get information from web via an instruction and then yfinance to get close to accurate information. But the real problem starts when you created a multi-agent which involves both the above agents and gave a very specific instruction to use the duckduckgo tool again. When creating a multi-agents you need to give a broad / global instruction rather than tool specific instruction. The moment you instructed multi-agent to use duckduckgo it prioritizes information from duckduckgo than yfinance and the search result from duckduckgo may not have updated information. problem 2 : agents=[web_agent,yfinance_agent] the order matters a lot gaurav. Probable solution : Change the prompt / instruction in multi-agent as follows : "Use the agents and get the real time information of APPL {specify date} " , use your best knowledge gaurav and never ever prefer one tool over other while creating a multi-agents which follows a linear path. So change the instruction and try it again. |
@mahikshith I have changed the order as well as specifically written to use yfin agent to fetch current prices and for normal search use web agent. Yet its still failing to fetch correct price. def yfintool(symbol): yfinance agentyfinance_agent = Agent( multi_agent = Agent( multi_agent.print_response("What is the current market price for AAPL on 5 jan 2025? Also Share the analyst recommendations",stream=True)` |
Hello @GauravKasat ! @mahikshith is right. For an Agent team, please provide very explicit instructions for the best result. Additionally, Llama 3 8b is not the best model for function calling. Please consider using models like GPT 4o, Sonnet 3.5 or Gemini 2.0 for consistent function calling |
Hello @ysolanky I have tried using multiple explicit instruction and various prompts as well. Also changed the model to gpt4o. Not gettiing the results i want. Could you try the same thing once or maybe give some prompt for multi agent which you think would work , i have tried multiple prompts . i am not getting the results which are correct. |
@GauravKasat since you are already using yfinance to get accurate results . I guess there is no point in using duckduckgo inside the multi agent , you could have simply used yfinance as a agent. If you still want to use multi-agent probably try with tavilly as a web-search agent |
Even i am just using yfinance aget only , its not fetching correct results . @mahikshith can you also try once |
Yes crewai is working fine , some issue with phidata maybe.
…On Fri, Jan 10, 2025 at 10:36 AM 7atrey ***@***.***> wrote:
I've run into a similar error as well. For the following code, it's unable
to fetch result for lots of companies like Swiggy, Tata, Samsung, etc. It
just fails to even find Swiggy on yfinance.
from phi.agent import Agent
from phi.tools.yfinance import YFinanceTools
from phi.model.ollama import Ollama
agent = Agent(
tools=[YFinanceTools(stock_price=True, analyst_recommendations=True,
stock_fundamentals=True)],
show_tool_calls=True,
model = Ollama(id="llama3.2"),
description="You are an investment analyst that researches stock prices,
analyst recommendations, and stock fundamentals.",
instructions=["Format your response using markdown and use tables to
display data where possible."],
)
agent.print_response("Share the Swiggy stock price and analyst
recommendations", markdown=True)
—
Reply to this email directly, view it on GitHub
<#1700 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKMUF4PYMLG6Y4IAAGZPAED2J5IOLAVCNFSM6AAAAABUUB2PZGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOBRG43TIMRSGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I am using yfinance agent alone using below code .
from phi.agent import Agent
from phi.tools.yfinance import YFinanceTools
agent = Agent(
tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, stock_fundamentals=True)],
show_tool_calls=True,
description="You are an investment analyst that researches stock prices, analyst recommendations, and stock fundamentals.",
instructions=["Format your response using markdown and use tables to display data where possible."],
)
agent.print_response("Share the AAPL stock price and analyst recommendations", markdown=True)
i am getting correct prices which is
But when i am using agentic workflow adding web search as well , its fetching wrong prices. I suspect there is no clear distinction by multiagent (master agent) which agent should be used to fetch the prices and we are getting wrong prices.
Multi agent code
"""
from phi.agent import Agent
from phi.model.groq import Groq
from phi.tools.yfinance import YFinanceTools
from phi.tools.duckduckgo import DuckDuckGo
import phi.api
from phi.playground import Playground, serve_playground_app
import yfinance as yf
#web agent
web_agent = Agent(
name="Web Search agent",
role="Search the web for the required information",
model=Groq(
id="llama3-8b-8192",
),
tools=[DuckDuckGo()],
instructions=[""" You can use the DuckDuckGo tool to search the web. Always include the Sources in your response"""],
show_tool_calls=True,
markdown=True
)
def yfintool(symbol):
stockz = yf.Ticker(symbol)
return stockz.info['currentPrice']
yfinance agent
yfinance_agent = Agent(
name="YFinance agent",
role="Get the financial data for the required information",
model=Groq(id="llama3-8b-8192"),
tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, stock_fundamentals=True)],
show_tool_calls=True,
description="You are an investment analyst that researches stock prices, analyst recommendations, and stock fundamentals.",
instructions=["Format your response in markdown and use tables to display data where possible."],
markdown=True
)
multi_agent = Agent(
agents=[web_agent,yfinance_agent],
model=Groq(id="llama3-8b-8192"),
instructions=[ """You can use the DuckDuckGo tool to search the web. Always include the Sources in your response""",
"""Format your response in markdown and use tables to display data where possible"""],
show_tool_calls=True,
markdown=True
)
multi_agent.print_response("What is the current market price for AAPL? Also Share the analyst recommendations",stream=True)
"""
Has anyone else encountered this?
The text was updated successfully, but these errors were encountered: