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/models.md
+32-10Lines changed: 32 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -132,16 +132,6 @@ agent = Agent(model)
132
132
133
133
PydanticAI also supports OpenAI's [Responses API](https://platform.openai.com/docs/api-reference/responses) through the [`OpenAIResponsesModel`][pydantic_ai.models.openai.OpenAIResponsesModel] class.
134
134
135
-
The Responses API has built-in tools that you can use instead of building your own:
We currently don't support the native OpenAI tools listed above in the `OpenAIResponsesModel` class.
142
-
143
-
You can learn more about the differences between the Responses API and Chat Completions API in the [OpenAI API docs](https://platform.openai.com/docs/guides/responses-vs-chat-completions).
144
-
145
135
```python {title="openai_responses_model.py"}
146
136
from pydantic_ai import Agent
147
137
from pydantic_ai.models.openai import OpenAIResponsesModel
@@ -151,6 +141,38 @@ agent = Agent(model)
151
141
...
152
142
```
153
143
144
+
The Responses API has built-in tools that you can use instead of building your own:
145
+
146
+
-[Web search](https://platform.openai.com/docs/guides/tools-web-search): allow models to search the web for the latest information before generating a response.
147
+
-[File search](https://platform.openai.com/docs/guides/tools-file-search): allow models to search your files for relevant information before generating a response.
148
+
-[Computer use](https://platform.openai.com/docs/guides/tools-computer-use): allow models to use a computer to perform tasks on your behalf.
149
+
150
+
You can use the [`OpenAIResponsesModelSettings`][pydantic_ai.models.openai.OpenAIResponsesModelSettings]
result = agent.run_sync('What is the weather in Tokyo?')
166
+
print(result.data)
167
+
"""
168
+
As of 7:48 AM on Wednesday, April 2, 2025, in Tokyo, Japan, the weather is cloudy with a temperature of 53°F (12°C).
169
+
"""
170
+
```
171
+
172
+
1. The file search tool and computer use tool can also be imported from `openai.types.responses`.
173
+
174
+
You can learn more about the differences between the Responses API and Chat Completions API in the [OpenAI API docs](https://platform.openai.com/docs/guides/responses-vs-chat-completions).
'Tell me a joke.': 'Did you hear about the toothpaste scandal? They called it Colgate.',
261
261
'Tell me a different joke.': 'No.',
262
262
'Explain?': 'This is an excellent joke invented by Samuel Colvin, it needs no explanation.',
263
+
'What is the weather in Tokyo?': 'As of 7:48 AM on Wednesday, April 2, 2025, in Tokyo, Japan, the weather is cloudy with a temperature of 53°F (12°C).',
0 commit comments