Set agent seed for deterministic output across runs #3792
Replies: 1 comment 1 reply
-
|
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: The Hello! I see you're looking to get deterministic outputs from your LLM agent. While The Here is how you can adjust your code: from google.generativeai import types
agent_kwargs = {
"name": agent_name,
"model": model,
"description": description,
"instruction": instruction,
"tools": tools or [],
"output_schema": output_schema,
"generation_config": types.GenerationConfig(
temperature=0.0
)
}Or, more simply, using a dictionary: agent_kwargs = {
"name": agent_name,
"model": model,
"description": description,
"instruction": instruction,
"tools": tools or [],
"output_schema": output_schema,
"generation_config": {"temperature": 0.0}
}Please note that while this will make the output deterministic for the specific model version you are using, the output is not guaranteed to be the same across different model versions. Let me know if you have any other questions! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey guys
I was wondering if anyone knew how to set up the seed for LLM agents. I have been experimenting with following code but can't seem to get the right setting nor find it online.
agent_kwargs = {
"name": agent_name,
"model": model,
"description": description,
"instruction": instruction,
"tools": tools or [],
"output_schema": output_schema,
"generate_content_config": types.GenerateContentConfig(
seed=0
)
}
Beta Was this translation helpful? Give feedback.
All reactions