Pass caller LLM runtime options
All checks were successful
build / build (push) Successful in 27s

This commit is contained in:
robert
2026-05-21 13:58:18 -03:00
parent 7317b41755
commit c009b2f081
3 changed files with 20 additions and 7 deletions

View File

@@ -116,6 +116,9 @@ class AgentBuilder(A2AAgent[BuilderConfig, NoAuth]):
llm_base_url=creds.base_url, llm_base_url=creds.base_url,
llm_api_key=creds.api_key, llm_api_key=creds.api_key,
llm_model=creds.model, llm_model=creds.model,
llm_temperature_mode=creds.temperature_mode,
llm_temperature=creds.temperature,
llm_extra_body=creds.extra_body,
)) ))
user_msg = ( user_msg = (

View File

@@ -30,6 +30,9 @@ class BuilderContext:
llm_base_url: str | None = None llm_base_url: str | None = None
llm_api_key: str | None = None llm_api_key: str | None = None
llm_model: str | None = None llm_model: str | None = None
llm_temperature_mode: str | None = None
llm_temperature: float | None = None
llm_extra_body: dict[str, Any] | None = None
SYSTEM_PROMPT = """\ SYSTEM_PROMPT = """\
@@ -219,12 +222,19 @@ def build_agent_builder(ctx: BuilderContext) -> Any:
tools = build_tools(ToolContext( tools = build_tools(ToolContext(
bucket=ctx.bucket, settings=settings, cp_jwt=ctx.cp_jwt, bucket=ctx.bucket, settings=settings, cp_jwt=ctx.cp_jwt,
)) ))
model = ChatOpenAI( model_kwargs: dict[str, Any] = {
model=ctx.llm_model or settings.litellm_model, "model": ctx.llm_model or settings.litellm_model,
base_url=ctx.llm_base_url or (settings.litellm_url + "/v1"), "base_url": ctx.llm_base_url or (settings.litellm_url + "/v1"),
api_key=ctx.llm_api_key or settings.litellm_key, "api_key": ctx.llm_api_key or settings.litellm_key,
temperature=0.0, "stream_usage": True,
}
if ctx.llm_temperature_mode != "omit":
model_kwargs["temperature"] = (
ctx.llm_temperature if ctx.llm_temperature is not None else 0.0
) )
if ctx.llm_extra_body:
model_kwargs["extra_body"] = dict(ctx.llm_extra_body)
model = ChatOpenAI(**model_kwargs)
kwargs: dict[str, Any] = { kwargs: dict[str, Any] = {
"model": model, "model": model,
"tools": tools, "tools": tools,

View File

@@ -1,4 +1,4 @@
a2a-pack>=0.1.14 a2a-pack>=0.1.15
httpx>=0.27 httpx>=0.27
boto3>=1.34 boto3>=1.34
deepagents>=0.5.0 deepagents>=0.5.0