Use A2A DeepAgents model resolver
This commit is contained in:
18
agent.py
18
agent.py
@@ -6,10 +6,9 @@ import re
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
from deepagents import create_deep_agent
|
from a2a_pack.deepagents import create_a2a_deep_agent
|
||||||
from langchain_core.messages import BaseMessage
|
from langchain_core.messages import BaseMessage
|
||||||
from langchain_core.tools import StructuredTool
|
from langchain_core.tools import StructuredTool
|
||||||
from langchain_openai import ChatOpenAI
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from a2a_pack import (
|
from a2a_pack import (
|
||||||
@@ -123,18 +122,9 @@ class BlogOpenapiAgent(A2AAgent):
|
|||||||
),
|
),
|
||||||
"messages": [],
|
"messages": [],
|
||||||
}
|
}
|
||||||
model_kwargs: dict[str, Any] = {
|
graph = create_a2a_deep_agent(
|
||||||
"model": creds.model,
|
ctx,
|
||||||
"base_url": creds.base_url,
|
creds=creds,
|
||||||
"api_key": creds.api_key,
|
|
||||||
}
|
|
||||||
if creds.temperature_mode != "omit" and creds.temperature is not None:
|
|
||||||
model_kwargs["temperature"] = creds.temperature
|
|
||||||
if creds.extra_body:
|
|
||||||
model_kwargs["extra_body"] = dict(creds.extra_body)
|
|
||||||
model = ChatOpenAI(**model_kwargs)
|
|
||||||
graph = create_deep_agent(
|
|
||||||
model=model,
|
|
||||||
tools=self._operation_tools(ctx),
|
tools=self._operation_tools(ctx),
|
||||||
system_prompt=self._system_prompt(),
|
system_prompt=self._system_prompt(),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user