This commit is contained in:
@@ -238,7 +238,7 @@ class AdkAgentRuntime:
|
||||
instruction=lambda _context: instructions,
|
||||
tools=agent_tools,
|
||||
before_tool_callback=control.before_tool,
|
||||
generate_content_config=self._content_config(),
|
||||
generate_content_config=self._content_config(role),
|
||||
)
|
||||
runner = Runner(
|
||||
app_name=APP_NAME,
|
||||
@@ -293,13 +293,13 @@ class AdkAgentRuntime:
|
||||
or f"{role.name} ended without calling a tool that ends its turn."
|
||||
)
|
||||
|
||||
def _content_config(self) -> types.GenerateContentConfig | None:
|
||||
if self._model_timeout_seconds is None:
|
||||
def _content_config(self, role: RoleSpec) -> types.GenerateContentConfig | None:
|
||||
# A role whose replies are long is given longer than the default.
|
||||
seconds = role.model_timeout_seconds or self._model_timeout_seconds
|
||||
if seconds is None:
|
||||
return None
|
||||
return types.GenerateContentConfig(
|
||||
http_options=types.HttpOptions(
|
||||
timeout=int(self._model_timeout_seconds * 1000)
|
||||
)
|
||||
http_options=types.HttpOptions(timeout=int(seconds * 1000))
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user