Skip to content

Commit 2ac2eaf

Browse files
committed
update docstring
1 parent 9e09c32 commit 2ac2eaf

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pydantic_ai_slim/pydantic_ai/models/openai.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,10 +1111,11 @@ def _map_tool_definition(self, f: ToolDefinition) -> responses.FunctionToolParam
11111111
def _get_previous_response_id_and_new_messages(
11121112
self, messages: list[ModelMessage]
11131113
) -> tuple[str | None, list[ModelMessage]]:
1114-
# In `auto` mode, the history is trimmed up to (but not including)
1115-
# the latest ModelResponse with a valid `provider_response_id`.
1116-
# This is then passed as `previous_response_id` in the next request
1117-
# to maintain context along with the trimmed history.
1114+
# When `openai_previous_response_id` is set to 'auto', the most recent
1115+
# `provider_response_id` from the message history is selected and all
1116+
# earlier messages are omitted. This allows the OpenAI SDK to reuse
1117+
# server-side history for efficiency. The returned tuple contains the
1118+
# `previous_response_id` (if found) and the trimmed list of messages.
11181119
previous_response_id = None
11191120
trimmed_messages: list[ModelMessage] = []
11201121
for m in reversed(messages):

0 commit comments

Comments
 (0)