You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/agents.md
+4-22Lines changed: 4 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ The [`Agent`][pydantic_ai.Agent] class is well documented, but in essence you ca
11
11
* One or more [retrievers](#retrievers) — functions that the LLM may call to get information while generating a response
12
12
* An optional structured [result type](results.md) — the structured datatype the LLM must return at the end of a run
13
13
* A [dependency](dependencies.md) type constraint — system prompt functions, retrievers and result validators may all use dependencies when they're run
14
-
* Agents may optionally also have a default [model](models/index.md) associated with them, the model to use can also be defined when running the agent
14
+
* Agents may optionally also have a default [model](api/models/base.md) associated with them, the model to use can also be defined when running the agent
15
15
16
16
In typing terms, agents are generic in their dependency and result types, e.g. an agent which required `#!python Foobar` dependencies and returned data of type `#!python list[str]` results would have type `#!python Agent[Foobar, list[str]]`.
_(This example is complete, it can be run "as is")_
352
352
353
-
The return type of retriever can any valid JSON object ([`JsonData`][pydantic_ai.dependencies.JsonData]) as some models (e.g. Gemini) support semi-structured return values, some expect text (OpenAI) but seem to be just as good at extracting meaning from the data, if a Python is returned and the model expects a string, the value will be serialized to JSON
353
+
The return type of retriever can any valid JSON object ([`JsonData`][pydantic_ai.dependencies.JsonData]) as some models (e.g. Gemini) support semi-structured return values, some expect text (OpenAI) but seem to be just as good at extracting meaning from the data, if a Python is returned and the model expects a string, the value will be serialized to JSON.
354
+
355
+
If a retriever has a single parameter that can be represented as an object in JSON schema (e.g. dataclass, TypedDict, pydantic model), the schema for the retriever is simplified to be just that object. (TODO example)
354
356
355
357
## Reflection and self-correction
356
358
@@ -478,23 +480,3 @@ else:
478
480
1. Define a retriever that will raise `ModelRetry` repeatedly in this case.
479
481
480
482
_(This example is complete, it can be run "as is")_
0 commit comments