You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to test out Crawl4ai with the sample code available at https://docs.phidata.com/tools/crawl4ai#crawl4ai. I have tried with both Deepseek and Mistral with pretty much the same result which, at the end, produced no result for me from the Agent. I did gave up 2 days ago and today I was watching "YourTechBud Codes" on Youtube talking about tool calling in Pydantic AI with a similar issue where the Agent invokes the model multiple time and that tends to happen with open source llm and not OPENAI and Sonnet. I went back to phidata and found "tool_call_limit" to which I set to 1 and everything finally works. Below is the error and it will keep on invoking the model to call the tool up to about 10 times before giving up. I'm not if the issue is the same as with Pydantic AI.
`from phi.agent import Agent
from phi.model.deepseek import DeepSeekChat
from phi.tools.crawl4ai_tools import Crawl4aiTools
import os
from dotenv import load_dotenv
load_dotenv()
DEEPSEEK_API_KEY = os.getenv('DEEPSEEK_API_KEY')
agent = Agent(
model=DeepSeekChat(
temperature=1.0,
api_key=DEEPSEEK_API_KEY,
),
tools=[Crawl4aiTools(max_length=None)],
# tool_call_limit=1,
instructions=[
"Always use tools to fulfil the user query.",
],
show_tool_calls=True
)
agent.print_response("Tell me about https://github.com/phidatahq/phidata.")
`
@josephtrinh@bigpo I tried the code you shared with tool_call_limit=1 and without it. I got the correct result in both scenarios. The first example you shared looks like the crawling is unsuccessful and the agent is retrying until it's successful and in the 2nd situation it succeeded in the first try. You can try to add debug_mode=True and see the tool calls and how its working under the hood
I was trying to test out Crawl4ai with the sample code available at https://docs.phidata.com/tools/crawl4ai#crawl4ai. I have tried with both Deepseek and Mistral with pretty much the same result which, at the end, produced no result for me from the Agent. I did gave up 2 days ago and today I was watching "YourTechBud Codes" on Youtube talking about tool calling in Pydantic AI with a similar issue where the Agent invokes the model multiple time and that tends to happen with open source llm and not OPENAI and Sonnet. I went back to phidata and found "tool_call_limit" to which I set to 1 and everything finally works. Below is the error and it will keep on invoking the model to call the tool up to about 10 times before giving up. I'm not if the issue is the same as with Pydantic AI.
`from phi.agent import Agent
from phi.model.deepseek import DeepSeekChat
from phi.tools.crawl4ai_tools import Crawl4aiTools
import os
from dotenv import load_dotenv
load_dotenv()
DEEPSEEK_API_KEY = os.getenv('DEEPSEEK_API_KEY')
agent = Agent(
model=DeepSeekChat(
temperature=1.0,
api_key=DEEPSEEK_API_KEY,
),
tools=[Crawl4aiTools(max_length=None)],
# tool_call_limit=1,
instructions=[
"Always use tools to fulfil the user query.",
],
show_tool_calls=True
)
agent.print_response("Tell me about https://github.com/phidatahq/phidata.")
`
tool_call_limit not set
tool_call_limit=1
The issue fix for Pydantic AI
pydantic/pydantic-ai#142
The text was updated successfully, but these errors were encountered: