Adapters API Reference¶
Wrap a pydantic-ai Agent to conform to the agent callable contract.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
Any
|
A pydantic-ai |
required |
Example
Source code in src/pytest_agent_eval/adapters/pydantic_ai.py
__call__(history: list[dict[str, Any]]) -> tuple[str, list[str]]
async
¶
Run the agent and normalise output to (reply, tool_calls).
Source code in src/pytest_agent_eval/adapters/pydantic_ai.py
Wrap a LangChain Runnable to conform to the agent callable contract.
Expects the runnable to accept {"messages": [...]} and return an
AIMessage or object with a content attribute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
runnable
|
Any
|
A LangChain Runnable (e.g. a compiled graph or chain). |
required |
Example
Source code in src/pytest_agent_eval/adapters/langchain.py
__call__(history: list[dict[str, Any]]) -> tuple[str, list[str]]
async
¶
Run the runnable and normalise output to (reply, tool_calls).
Source code in src/pytest_agent_eval/adapters/langchain.py
Wrap an AsyncOpenAI client to conform to the agent callable contract.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
Any
|
An |
required |
model
|
str
|
Model name to use for completions (e.g. |
required |
system_prompt
|
str | None
|
Optional system prompt prepended to every call. |
None
|
Example
Source code in src/pytest_agent_eval/adapters/openai.py
__call__(history: list[dict[str, Any]]) -> tuple[str, list[str]]
async
¶
Run a chat completion and normalise to (reply, tool_calls).
Source code in src/pytest_agent_eval/adapters/openai.py
__init__(client: Any, model: str, system_prompt: str | None = None) -> None
¶
Store the OpenAI client, model name, and optional system prompt.