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
make it use agent.run_stream() instead of agent.run()
importasyncioimportrandomfrompydantic_aiimportAgent, RunContextagent=Agent(
'google-gla:gemini-1.5-flash',
deps_type=str,
system_prompt=(
"You're a dice game, you should roll the die and see if the number ""you get back matches the user's guess. If so, tell them they're a winner. ""Use the player's name in the response."
),
)
@agent.tool_plaindefroll_die() ->str:
"""Roll a six-sided die and return the result."""returnstr(random.randint(1, 6))
@agent.tooldefget_player_name(ctx: RunContext[str]) ->str:
"""Get the player's name."""returnctx.depsasyncdefmain():
asyncwithagent.run_stream('My guess is 4', deps='Anne') asresult:
asyncforchunkinresult.stream_text():
print(chunk)
asyncio.run(main())
tools are no longer work
The text was updated successfully, but these errors were encountered:
reproducing my problem:
uv pip install pydantic-ai-slim==0.0.24
The text was updated successfully, but these errors were encountered: