From 674140fe89be441a8e88e9295f7679b2601f8749 Mon Sep 17 00:00:00 2001 From: Ashwin Bharambe Date: Thu, 9 Oct 2025 21:12:50 -0700 Subject: [PATCH] feat(responses): implement usage tracking in streaming responses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implementation changes: - Add usage accumulation to StreamingResponseOrchestrator - Enable stream_options to receive usage in streaming chunks - Track usage across multi-turn responses with tool execution - Convert between chat completion and response usage formats - Extract usage accumulation into helper method for clarity Test changes: - Add usage assertions to streaming and non-streaming tests - Update test recordings with actual usage data from OpenAI 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../meta_reference/responses/streaming.py | 59 + ...3792ad086e12affe4c5f21f268f714d1fa41d.json | 273 +++++ ...49616ff9261866ca6d343d1482723e9c38c81.json | 948 +++++++++++++++ ...c2116ef34b6d673c83743a9e22a2b56f08eb2.json | 35 +- ...355b6a1d6c57e467f136f45586b73bf95766d.json | 513 ++++++-- ...33902301c4d00406b1098a4e295b736806b38.json | 1066 +++++++++-------- ...96e65fa55f4ddf217d2bd3c92eeb85bee5251.json | 894 ++++++++++++++ ...234d8026087d4416c90a082bd6efb53d00f11.json | 273 +++++ ...10393b3c19a3c7fe28b4f773dcf0af15b0c99.json | 19 +- .../responses/test_basic_responses.py | 17 + 10 files changed, 3485 insertions(+), 612 deletions(-) create mode 100644 tests/integration/responses/recordings/56a01bed56ba10824a14930eda83792ad086e12affe4c5f21f268f714d1fa41d.json create mode 100644 tests/integration/responses/recordings/5a1a11d0b4987b7e5f654a3a22149616ff9261866ca6d343d1482723e9c38c81.json create mode 100644 tests/integration/responses/recordings/d058ce92a083c160c08eb29e7b396e65fa55f4ddf217d2bd3c92eeb85bee5251.json create mode 100644 tests/integration/responses/recordings/dca42c8244f72a79450c018f63c234d8026087d4416c90a082bd6efb53d00f11.json diff --git a/llama_stack/providers/inline/agents/meta_reference/responses/streaming.py b/llama_stack/providers/inline/agents/meta_reference/responses/streaming.py index 9487edc61..fc749638e 100644 --- a/llama_stack/providers/inline/agents/meta_reference/responses/streaming.py +++ b/llama_stack/providers/inline/agents/meta_reference/responses/streaming.py @@ -35,12 +35,16 @@ from llama_stack.apis.agents.openai_responses import ( OpenAIResponseOutputMessageFunctionToolCall, OpenAIResponseOutputMessageMCPListTools, OpenAIResponseText, + OpenAIResponseUsage, + OpenAIResponseUsageInputTokensDetails, + OpenAIResponseUsageOutputTokensDetails, WebSearchToolTypes, ) from llama_stack.apis.inference import ( Inference, OpenAIAssistantMessageParam, OpenAIChatCompletion, + OpenAIChatCompletionChunk, OpenAIChatCompletionToolCall, OpenAIChoice, OpenAIMessageParam, @@ -100,6 +104,8 @@ class StreamingResponseOrchestrator: self.final_messages: list[OpenAIMessageParam] = [] # mapping for annotations self.citation_files: dict[str, str] = {} + # Track accumulated usage across all inference calls + self.accumulated_usage: OpenAIResponseUsage | None = None async def create_response(self) -> AsyncIterator[OpenAIResponseObjectStream]: # Initialize output messages @@ -137,6 +143,9 @@ class StreamingResponseOrchestrator: stream=True, temperature=self.ctx.temperature, response_format=response_format, + stream_options={ + "include_usage": True, + }, ) # Process streaming chunks and build complete response @@ -201,6 +210,7 @@ class StreamingResponseOrchestrator: status="completed", text=self.text, output=output_messages, + usage=self.accumulated_usage, ) # Emit response.completed @@ -243,6 +253,51 @@ class StreamingResponseOrchestrator: return function_tool_calls, non_function_tool_calls, approvals, next_turn_messages + def _accumulate_chunk_usage(self, chunk: OpenAIChatCompletionChunk) -> None: + """Accumulate usage from a streaming chunk into the response usage format.""" + if not chunk.usage: + return + + if self.accumulated_usage is None: + # Convert from chat completion format to response format + self.accumulated_usage = OpenAIResponseUsage( + input_tokens=chunk.usage.prompt_tokens, + output_tokens=chunk.usage.completion_tokens, + total_tokens=chunk.usage.total_tokens, + input_tokens_details=( + OpenAIResponseUsageInputTokensDetails(cached_tokens=chunk.usage.prompt_tokens_details.cached_tokens) + if chunk.usage.prompt_tokens_details + else None + ), + output_tokens_details=( + OpenAIResponseUsageOutputTokensDetails( + reasoning_tokens=chunk.usage.completion_tokens_details.reasoning_tokens + ) + if chunk.usage.completion_tokens_details + else None + ), + ) + else: + # Accumulate across multiple inference calls + self.accumulated_usage = OpenAIResponseUsage( + input_tokens=self.accumulated_usage.input_tokens + chunk.usage.prompt_tokens, + output_tokens=self.accumulated_usage.output_tokens + chunk.usage.completion_tokens, + total_tokens=self.accumulated_usage.total_tokens + chunk.usage.total_tokens, + # Use latest non-null details + input_tokens_details=( + OpenAIResponseUsageInputTokensDetails(cached_tokens=chunk.usage.prompt_tokens_details.cached_tokens) + if chunk.usage.prompt_tokens_details + else self.accumulated_usage.input_tokens_details + ), + output_tokens_details=( + OpenAIResponseUsageOutputTokensDetails( + reasoning_tokens=chunk.usage.completion_tokens_details.reasoning_tokens + ) + if chunk.usage.completion_tokens_details + else self.accumulated_usage.output_tokens_details + ), + ) + async def _process_streaming_chunks( self, completion_result, output_messages: list[OpenAIResponseOutput] ) -> AsyncIterator[OpenAIResponseObjectStream | ChatCompletionResult]: @@ -266,6 +321,10 @@ class StreamingResponseOrchestrator: chat_response_id = chunk.id chunk_created = chunk.created chunk_model = chunk.model + + # Accumulate usage from chunks (typically in final chunk with stream_options) + self._accumulate_chunk_usage(chunk) + for chunk_choice in chunk.choices: # Emit incremental text content as delta events if chunk_choice.delta.content: diff --git a/tests/integration/responses/recordings/56a01bed56ba10824a14930eda83792ad086e12affe4c5f21f268f714d1fa41d.json b/tests/integration/responses/recordings/56a01bed56ba10824a14930eda83792ad086e12affe4c5f21f268f714d1fa41d.json new file mode 100644 index 000000000..74f40e724 --- /dev/null +++ b/tests/integration/responses/recordings/56a01bed56ba10824a14930eda83792ad086e12affe4c5f21f268f714d1fa41d.json @@ -0,0 +1,273 @@ +{ + "test_id": "tests/integration/responses/test_basic_responses.py::test_response_streaming_basic[client_with_models-txt=openai/gpt-4o-earth]", + "request": { + "method": "POST", + "url": "https://api.openai.com/v1/v1/chat/completions", + "headers": {}, + "body": { + "model": "gpt-4o", + "messages": [ + { + "role": "user", + "content": "Which planet do humans live on?" + } + ], + "stream": true, + "stream_options": { + "include_usage": true + } + }, + "endpoint": "/v1/chat/completions", + "model": "gpt-4o" + }, + "response": { + "body": [ + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-56a01bed56ba", + "choices": [ + { + "delta": { + "content": "", + "function_call": null, + "refusal": null, + "role": "assistant", + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "hA9E1EFNDdppk3" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-56a01bed56ba", + "choices": [ + { + "delta": { + "content": "Hum", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "waalMD9oTwIyd" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-56a01bed56ba", + "choices": [ + { + "delta": { + "content": "ans", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "vyTLO6JSApar2" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-56a01bed56ba", + "choices": [ + { + "delta": { + "content": " live", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "KQU8fOkg5R6" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-56a01bed56ba", + "choices": [ + { + "delta": { + "content": " on", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "j7D1acmtXVxh1" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-56a01bed56ba", + "choices": [ + { + "delta": { + "content": " Earth", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "F4dwv7pOew" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-56a01bed56ba", + "choices": [ + { + "delta": { + "content": ".", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "4xPS4mauTagzkxj" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-56a01bed56ba", + "choices": [ + { + "delta": { + "content": null, + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": "stop", + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "pjCVonxRXx" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-56a01bed56ba", + "choices": [], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": { + "completion_tokens": 6, + "prompt_tokens": 14, + "total_tokens": 20, + "completion_tokens_details": { + "accepted_prediction_tokens": 0, + "audio_tokens": 0, + "reasoning_tokens": 0, + "rejected_prediction_tokens": 0 + }, + "prompt_tokens_details": { + "audio_tokens": 0, + "cached_tokens": 0 + } + }, + "obfuscation": "" + } + } + ], + "is_streaming": true + }, + "id_normalization_mapping": {} +} diff --git a/tests/integration/responses/recordings/5a1a11d0b4987b7e5f654a3a22149616ff9261866ca6d343d1482723e9c38c81.json b/tests/integration/responses/recordings/5a1a11d0b4987b7e5f654a3a22149616ff9261866ca6d343d1482723e9c38c81.json new file mode 100644 index 000000000..a6c2830e3 --- /dev/null +++ b/tests/integration/responses/recordings/5a1a11d0b4987b7e5f654a3a22149616ff9261866ca6d343d1482723e9c38c81.json @@ -0,0 +1,948 @@ +{ + "test_id": "tests/integration/responses/test_basic_responses.py::test_response_streaming_basic[client_with_models-txt=openai/gpt-4o-saturn]", + "request": { + "method": "POST", + "url": "https://api.openai.com/v1/v1/chat/completions", + "headers": {}, + "body": { + "model": "gpt-4o", + "messages": [ + { + "role": "user", + "content": "Which planet has rings around it with a name starting with letter S?" + } + ], + "stream": true, + "stream_options": { + "include_usage": true + } + }, + "endpoint": "/v1/chat/completions", + "model": "gpt-4o" + }, + "response": { + "body": [ + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": "", + "function_call": null, + "refusal": null, + "role": "assistant", + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "UKZMfDO4alqdUr" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": "The", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "PauvZTS9JhHJQ" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " planet", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "I1PMKwlor" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " with", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "NKus7N8SshY" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " rings", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "hjPcORfLsk" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " around", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "ceeQx9iTw" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " it", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "8ad9CC6rmF939" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " and", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "9zCNPfknf9Wk" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " a", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "d0Aa4FFslxFL5t" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " name", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "xWj2hnWGsbL" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " starting", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "1pyuTcJ" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " with", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "l7uhYGpUcE1" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " the", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "aj5jkF7RI6jc" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " letter", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "1Hqbz5J84" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " \"", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "IpvA6bGSmegM9" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": "S", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "EzbeTEiigNgr1WP" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": "\"", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "SpfVHvAhaLPtgf" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " is", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "Tz0BHfbZzwIU8" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " Saturn", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "v62Yi0Uy5" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": ".", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "FaYqJrpzivGOEw6" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " Saturn", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "ni5aiHptn" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " is", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "2Xbu8coUEl3nE" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " well", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "nOPBJSLkxK9" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": "-known", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "65uX75JvoU" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " for", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "RgOnunwbvzQQ" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " its", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "s9LwMsjnLC8q" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " prominent", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "mPdj0V" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " and", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "hvjs7fxAOSUX" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " beautiful", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "WVtGRs" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " ring", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "B0ahJwERcG6" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": " system", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "PRkj9JNVV" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": ".", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "cvQVcsFDMfrfnVh" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [ + { + "delta": { + "content": null, + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": "stop", + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "kBSMtrCs6N" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-5a1a11d0b498", + "choices": [], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": { + "completion_tokens": 31, + "prompt_tokens": 21, + "total_tokens": 52, + "completion_tokens_details": { + "accepted_prediction_tokens": 0, + "audio_tokens": 0, + "reasoning_tokens": 0, + "rejected_prediction_tokens": 0 + }, + "prompt_tokens_details": { + "audio_tokens": 0, + "cached_tokens": 0 + } + }, + "obfuscation": "QRz5sPimoUuAGY0" + } + } + ], + "is_streaming": true + }, + "id_normalization_mapping": {} +} diff --git a/tests/integration/responses/recordings/8dd4f0615edfc30423d90b13daac2116ef34b6d673c83743a9e22a2b56f08eb2.json b/tests/integration/responses/recordings/8dd4f0615edfc30423d90b13daac2116ef34b6d673c83743a9e22a2b56f08eb2.json index 2c4804610..371de1124 100644 --- a/tests/integration/responses/recordings/8dd4f0615edfc30423d90b13daac2116ef34b6d673c83743a9e22a2b56f08eb2.json +++ b/tests/integration/responses/recordings/8dd4f0615edfc30423d90b13daac2116ef34b6d673c83743a9e22a2b56f08eb2.json @@ -41,9 +41,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_f33640a400", "usage": null, - "obfuscation": "zftbFaqu4Bi" + "obfuscation": "eQtIB22UP5y" } }, { @@ -68,9 +68,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_f33640a400", "usage": null, - "obfuscation": "ItcaW7b3D9" + "obfuscation": "xVnzycGrGY" } }, { @@ -95,9 +95,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_f33640a400", "usage": null, - "obfuscation": "n9CzCrtHvG" + "obfuscation": "iCxzQ9UFRl" } }, { @@ -122,9 +122,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_f33640a400", "usage": null, - "obfuscation": "fWwHGFYy" + "obfuscation": "lVzetb7n" } }, { @@ -149,9 +149,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_f33640a400", "usage": null, - "obfuscation": "kdNkbMvQY5" + "obfuscation": "Oi2xzNkyQQ" } }, { @@ -176,9 +176,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_f33640a400", "usage": null, - "obfuscation": "DhWaK87" + "obfuscation": "SBQnBFp" } }, { @@ -203,9 +203,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_f33640a400", "usage": null, - "obfuscation": "ocA1GIrZyPFW" + "obfuscation": "CtftBIpiBh2x" } }, { @@ -230,12 +230,13 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_f33640a400", "usage": null, - "obfuscation": "jlCQlW0" + "obfuscation": "xN1HF2a" } } ], "is_streaming": true - } + }, + "id_normalization_mapping": {} } diff --git a/tests/integration/responses/recordings/cc0156eadb588e2cdfb9d4d0db0355b6a1d6c57e467f136f45586b73bf95766d.json b/tests/integration/responses/recordings/cc0156eadb588e2cdfb9d4d0db0355b6a1d6c57e467f136f45586b73bf95766d.json index 4b45ffb7f..4f5a941bc 100644 --- a/tests/integration/responses/recordings/cc0156eadb588e2cdfb9d4d0db0355b6a1d6c57e467f136f45586b73bf95766d.json +++ b/tests/integration/responses/recordings/cc0156eadb588e2cdfb9d4d0db0355b6a1d6c57e467f136f45586b73bf95766d.json @@ -41,9 +41,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "zqLiclPltu3" + "obfuscation": "wl1L4ubkZC2" } }, { @@ -68,9 +68,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "grzpYaHPM8" + "obfuscation": "MKXxbHEqGM" } }, { @@ -95,9 +95,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "zEX86j" + "obfuscation": "RXhSL9" } }, { @@ -122,9 +122,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "fvu80DBX" + "obfuscation": "RTRK7mJP" } }, { @@ -149,9 +149,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "iIA0sN8" + "obfuscation": "6EhZvCD" } }, { @@ -176,9 +176,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "fohE4v" + "obfuscation": "qiNxmx" } }, { @@ -203,9 +203,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "9jaVkFkWKk" + "obfuscation": "RNXYcBmW82" } }, { @@ -215,7 +215,7 @@ "choices": [ { "delta": { - "content": " and", + "content": ",", "function_call": null, "refusal": null, "role": null, @@ -230,9 +230,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "4XV7CDgbt" + "obfuscation": "dRGyq9aos4Ao" } }, { @@ -242,7 +242,7 @@ "choices": [ { "delta": { - "content": " a", + "content": " whose", "function_call": null, "refusal": null, "role": null, @@ -257,9 +257,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "8q9WqFBh4Y0" + "obfuscation": "iHNHPzN" } }, { @@ -284,9 +284,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "wUB8pf8C" + "obfuscation": "CWIF5di5" } }, { @@ -296,7 +296,7 @@ "choices": [ { "delta": { - "content": " starting", + "content": " starts", "function_call": null, "refusal": null, "role": null, @@ -311,9 +311,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "TX3B" + "obfuscation": "TQurN8" } }, { @@ -338,9 +338,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "KuxjVC7G" + "obfuscation": "NcKx1q81" } }, { @@ -365,9 +365,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "dX94lMG2M" + "obfuscation": "EQ0qBHCjl" } }, { @@ -392,9 +392,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "N6f05V" + "obfuscation": "cjvz4i" } }, { @@ -419,9 +419,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "Gf1gjnyVAI" + "obfuscation": "brfeAXs8FX" } }, { @@ -446,9 +446,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "TQ2IiLZtvxzh" + "obfuscation": "RQJHhiH9GkeD" } }, { @@ -458,7 +458,7 @@ "choices": [ { "delta": { - "content": "\"", + "content": ",\"", "function_call": null, "refusal": null, "role": null, @@ -473,9 +473,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "aHvCedShvKO" + "obfuscation": "ZF32Jc9E2G" } }, { @@ -500,9 +500,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "fhDv1M3NuQ" + "obfuscation": "G2odltRd0L" } }, { @@ -527,9 +527,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "xwJPIP" + "obfuscation": "2Osmry" } }, { @@ -554,9 +554,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "75QYRcPV0IuE" + "obfuscation": "7SNbKabEykCr" } }, { @@ -581,9 +581,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "A4Rh3S" + "obfuscation": "H350qD" } }, { @@ -608,9 +608,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "Bohe93xwDk" + "obfuscation": "YJTtTjmwSX" } }, { @@ -635,9 +635,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "6f77oxEV" + "obfuscation": "73nC8tFe" } }, { @@ -662,9 +662,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "RCyK7L4" + "obfuscation": "nHEeUa9" } }, { @@ -689,9 +689,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "s8cnTAnao" + "obfuscation": "9W2IOivfJ" } }, { @@ -716,9 +716,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "uI9KpovPR" + "obfuscation": "WlCJ1unfP" } }, { @@ -743,9 +743,63 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "pWL" + "obfuscation": "LY2" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cc0156eadb58", + "choices": [ + { + "delta": { + "content": " and", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "vw5KZwo9J" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cc0156eadb58", + "choices": [ + { + "delta": { + "content": " complex", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "YUfqU" } }, { @@ -770,9 +824,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "jupSPBuU" + "obfuscation": "WAHNZQCW" } }, { @@ -797,9 +851,333 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "ZZ5e4f" + "obfuscation": "iCsrlh" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cc0156eadb58", + "choices": [ + { + "delta": { + "content": ",", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "OssepLC4D5xV" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cc0156eadb58", + "choices": [ + { + "delta": { + "content": " which", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "KYxhInr" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cc0156eadb58", + "choices": [ + { + "delta": { + "content": " is", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "vsMjIHuV1f" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cc0156eadb58", + "choices": [ + { + "delta": { + "content": " the", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "a4hilLjNF" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cc0156eadb58", + "choices": [ + { + "delta": { + "content": " most", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "PSmGYjCZ" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cc0156eadb58", + "choices": [ + { + "delta": { + "content": " extensive", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "sdu" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cc0156eadb58", + "choices": [ + { + "delta": { + "content": " and", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "ruUKcQ2AO" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cc0156eadb58", + "choices": [ + { + "delta": { + "content": " visible", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "G6PXg" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cc0156eadb58", + "choices": [ + { + "delta": { + "content": " in", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "uYj8td6Yf5" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cc0156eadb58", + "choices": [ + { + "delta": { + "content": " our", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "jEDd7GvP7" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cc0156eadb58", + "choices": [ + { + "delta": { + "content": " solar", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "crXMLcu" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cc0156eadb58", + "choices": [ + { + "delta": { + "content": " system", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "8wRexB" } }, { @@ -824,9 +1202,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "GyHY0sipKZ24" + "obfuscation": "VQpIxgZRp9bP" } }, { @@ -851,12 +1229,13 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_f33640a400", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "gMrZjfo" + "obfuscation": "1PL6rSg" } } ], "is_streaming": true - } + }, + "id_normalization_mapping": {} } diff --git a/tests/integration/responses/recordings/cfb27eb6c636dbb47914c8a64ce33902301c4d00406b1098a4e295b736806b38.json b/tests/integration/responses/recordings/cfb27eb6c636dbb47914c8a64ce33902301c4d00406b1098a4e295b736806b38.json index cebc7784e..9a2f06e5e 100644 --- a/tests/integration/responses/recordings/cfb27eb6c636dbb47914c8a64ce33902301c4d00406b1098a4e295b736806b38.json +++ b/tests/integration/responses/recordings/cfb27eb6c636dbb47914c8a64ce33902301c4d00406b1098a4e295b736806b38.json @@ -41,9 +41,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "QkSIkoiTOS1" + "obfuscation": "CwOGJzeqTKT" } }, { @@ -68,9 +68,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "DOqREgwuNg" + "obfuscation": "x6sByZbDLo" } }, { @@ -95,9 +95,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "yJ9PGa" + "obfuscation": "cD1cuD" } }, { @@ -122,9 +122,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "zC2Xdthd" + "obfuscation": "ZlLRDEjR" } }, { @@ -149,9 +149,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "G0pYw5o" + "obfuscation": "A53LHLV" } }, { @@ -176,9 +176,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "IjkljW" + "obfuscation": "IgjseK" } }, { @@ -203,495 +203,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "AR8N8tyzSS" - } - }, - { - "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", - "__data__": { - "id": "rec-cfb27eb6c636", - "choices": [ - { - "delta": { - "content": " that", - "function_call": null, - "refusal": null, - "role": null, - "tool_calls": null - }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 0, - "model": "gpt-4o-2024-08-06", - "object": "chat.completion.chunk", - "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", - "usage": null, - "obfuscation": "fMyNrHLU" - } - }, - { - "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", - "__data__": { - "id": "rec-cfb27eb6c636", - "choices": [ - { - "delta": { - "content": " starts", - "function_call": null, - "refusal": null, - "role": null, - "tool_calls": null - }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 0, - "model": "gpt-4o-2024-08-06", - "object": "chat.completion.chunk", - "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", - "usage": null, - "obfuscation": "4T058X" - } - }, - { - "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", - "__data__": { - "id": "rec-cfb27eb6c636", - "choices": [ - { - "delta": { - "content": " with", - "function_call": null, - "refusal": null, - "role": null, - "tool_calls": null - }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 0, - "model": "gpt-4o-2024-08-06", - "object": "chat.completion.chunk", - "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", - "usage": null, - "obfuscation": "D0FWMg0S" - } - }, - { - "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", - "__data__": { - "id": "rec-cfb27eb6c636", - "choices": [ - { - "delta": { - "content": " the", - "function_call": null, - "refusal": null, - "role": null, - "tool_calls": null - }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 0, - "model": "gpt-4o-2024-08-06", - "object": "chat.completion.chunk", - "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", - "usage": null, - "obfuscation": "gwQyvChVa" - } - }, - { - "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", - "__data__": { - "id": "rec-cfb27eb6c636", - "choices": [ - { - "delta": { - "content": " letter", - "function_call": null, - "refusal": null, - "role": null, - "tool_calls": null - }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 0, - "model": "gpt-4o-2024-08-06", - "object": "chat.completion.chunk", - "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", - "usage": null, - "obfuscation": "sAivxs" - } - }, - { - "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", - "__data__": { - "id": "rec-cfb27eb6c636", - "choices": [ - { - "delta": { - "content": " \"", - "function_call": null, - "refusal": null, - "role": null, - "tool_calls": null - }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 0, - "model": "gpt-4o-2024-08-06", - "object": "chat.completion.chunk", - "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", - "usage": null, - "obfuscation": "Ug3SBdBtXT" - } - }, - { - "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", - "__data__": { - "id": "rec-cfb27eb6c636", - "choices": [ - { - "delta": { - "content": "S", - "function_call": null, - "refusal": null, - "role": null, - "tool_calls": null - }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 0, - "model": "gpt-4o-2024-08-06", - "object": "chat.completion.chunk", - "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", - "usage": null, - "obfuscation": "rWlDgafj9MG1" - } - }, - { - "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", - "__data__": { - "id": "rec-cfb27eb6c636", - "choices": [ - { - "delta": { - "content": "\"", - "function_call": null, - "refusal": null, - "role": null, - "tool_calls": null - }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 0, - "model": "gpt-4o-2024-08-06", - "object": "chat.completion.chunk", - "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", - "usage": null, - "obfuscation": "Lk9aiP8l0tF" - } - }, - { - "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", - "__data__": { - "id": "rec-cfb27eb6c636", - "choices": [ - { - "delta": { - "content": " is", - "function_call": null, - "refusal": null, - "role": null, - "tool_calls": null - }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 0, - "model": "gpt-4o-2024-08-06", - "object": "chat.completion.chunk", - "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", - "usage": null, - "obfuscation": "LbOmBFXrOX" - } - }, - { - "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", - "__data__": { - "id": "rec-cfb27eb6c636", - "choices": [ - { - "delta": { - "content": " Saturn", - "function_call": null, - "refusal": null, - "role": null, - "tool_calls": null - }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 0, - "model": "gpt-4o-2024-08-06", - "object": "chat.completion.chunk", - "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", - "usage": null, - "obfuscation": "epMAJA" - } - }, - { - "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", - "__data__": { - "id": "rec-cfb27eb6c636", - "choices": [ - { - "delta": { - "content": ".", - "function_call": null, - "refusal": null, - "role": null, - "tool_calls": null - }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 0, - "model": "gpt-4o-2024-08-06", - "object": "chat.completion.chunk", - "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", - "usage": null, - "obfuscation": "SjwLVhnbcAm2" - } - }, - { - "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", - "__data__": { - "id": "rec-cfb27eb6c636", - "choices": [ - { - "delta": { - "content": " Saturn", - "function_call": null, - "refusal": null, - "role": null, - "tool_calls": null - }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 0, - "model": "gpt-4o-2024-08-06", - "object": "chat.completion.chunk", - "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", - "usage": null, - "obfuscation": "NxcyWd" - } - }, - { - "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", - "__data__": { - "id": "rec-cfb27eb6c636", - "choices": [ - { - "delta": { - "content": " is", - "function_call": null, - "refusal": null, - "role": null, - "tool_calls": null - }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 0, - "model": "gpt-4o-2024-08-06", - "object": "chat.completion.chunk", - "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", - "usage": null, - "obfuscation": "vx89Mstejp" - } - }, - { - "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", - "__data__": { - "id": "rec-cfb27eb6c636", - "choices": [ - { - "delta": { - "content": " well", - "function_call": null, - "refusal": null, - "role": null, - "tool_calls": null - }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 0, - "model": "gpt-4o-2024-08-06", - "object": "chat.completion.chunk", - "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", - "usage": null, - "obfuscation": "prPl11i1" - } - }, - { - "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", - "__data__": { - "id": "rec-cfb27eb6c636", - "choices": [ - { - "delta": { - "content": " known", - "function_call": null, - "refusal": null, - "role": null, - "tool_calls": null - }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 0, - "model": "gpt-4o-2024-08-06", - "object": "chat.completion.chunk", - "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", - "usage": null, - "obfuscation": "jKkHLyK" - } - }, - { - "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", - "__data__": { - "id": "rec-cfb27eb6c636", - "choices": [ - { - "delta": { - "content": " for", - "function_call": null, - "refusal": null, - "role": null, - "tool_calls": null - }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 0, - "model": "gpt-4o-2024-08-06", - "object": "chat.completion.chunk", - "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", - "usage": null, - "obfuscation": "kknDMcH1x" - } - }, - { - "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", - "__data__": { - "id": "rec-cfb27eb6c636", - "choices": [ - { - "delta": { - "content": " its", - "function_call": null, - "refusal": null, - "role": null, - "tool_calls": null - }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 0, - "model": "gpt-4o-2024-08-06", - "object": "chat.completion.chunk", - "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", - "usage": null, - "obfuscation": "kCTzATqVl" - } - }, - { - "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", - "__data__": { - "id": "rec-cfb27eb6c636", - "choices": [ - { - "delta": { - "content": " prominent", - "function_call": null, - "refusal": null, - "role": null, - "tool_calls": null - }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 0, - "model": "gpt-4o-2024-08-06", - "object": "chat.completion.chunk", - "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", - "usage": null, - "obfuscation": "KLT" + "obfuscation": "HNhBKUdzVd" } }, { @@ -716,9 +230,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "Bri2thQRN" + "obfuscation": "yyrjtF0Yx" } }, { @@ -728,7 +242,7 @@ "choices": [ { "delta": { - "content": " visually", + "content": " a", "function_call": null, "refusal": null, "role": null, @@ -743,9 +257,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "TBpU" + "obfuscation": "2bsmkUq6Ij7" } }, { @@ -755,7 +269,7 @@ "choices": [ { "delta": { - "content": " striking", + "content": " name", "function_call": null, "refusal": null, "role": null, @@ -770,9 +284,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "jQ74" + "obfuscation": "TyzB6BeF" } }, { @@ -782,7 +296,7 @@ "choices": [ { "delta": { - "content": " ring", + "content": " starting", "function_call": null, "refusal": null, "role": null, @@ -797,9 +311,9 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "LgcpvD08" + "obfuscation": "tFPS" } }, { @@ -809,7 +323,7 @@ "choices": [ { "delta": { - "content": " system", + "content": " with", "function_call": null, "refusal": null, "role": null, @@ -824,9 +338,198 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "SMYx4u" + "obfuscation": "EwcmUb5N" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cfb27eb6c636", + "choices": [ + { + "delta": { + "content": " the", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "8Xt7xAB6s" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cfb27eb6c636", + "choices": [ + { + "delta": { + "content": " letter", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "v060rG" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cfb27eb6c636", + "choices": [ + { + "delta": { + "content": " '", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "TwGel6PLh2m" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cfb27eb6c636", + "choices": [ + { + "delta": { + "content": "S", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "HrqU2h6UedMf" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cfb27eb6c636", + "choices": [ + { + "delta": { + "content": "'", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "n8EUM38yEJBO" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cfb27eb6c636", + "choices": [ + { + "delta": { + "content": " is", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "1Fvb9G5oDb" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cfb27eb6c636", + "choices": [ + { + "delta": { + "content": " Saturn", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "BqDize" } }, { @@ -851,9 +554,333 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "kyeLgfCNRzfj" + "obfuscation": "xOzwnnEPxvqR" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cfb27eb6c636", + "choices": [ + { + "delta": { + "content": " Saturn", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "IJLbNA" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cfb27eb6c636", + "choices": [ + { + "delta": { + "content": " is", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "fiCQvNwYrI" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cfb27eb6c636", + "choices": [ + { + "delta": { + "content": " well", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "FfcB9Tr4" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cfb27eb6c636", + "choices": [ + { + "delta": { + "content": "-known", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "NH32E3Z" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cfb27eb6c636", + "choices": [ + { + "delta": { + "content": " for", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "U4h8YRO0k" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cfb27eb6c636", + "choices": [ + { + "delta": { + "content": " its", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "dXuOkekfM" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cfb27eb6c636", + "choices": [ + { + "delta": { + "content": " prominent", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "9JR" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cfb27eb6c636", + "choices": [ + { + "delta": { + "content": " and", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "KImTUtiGh" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cfb27eb6c636", + "choices": [ + { + "delta": { + "content": " extensive", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "bSB" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cfb27eb6c636", + "choices": [ + { + "delta": { + "content": " ring", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "Btdj7pRz" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cfb27eb6c636", + "choices": [ + { + "delta": { + "content": " system", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "JNm6Ur" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-cfb27eb6c636", + "choices": [ + { + "delta": { + "content": ".", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_1827dd0c55", + "usage": null, + "obfuscation": "iIbOG6wbokEy" } }, { @@ -878,12 +905,13 @@ "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", - "system_fingerprint": "fp_cbf1785567", + "system_fingerprint": "fp_1827dd0c55", "usage": null, - "obfuscation": "V0mLEEM" + "obfuscation": "yMGiTZI" } } ], "is_streaming": true - } + }, + "id_normalization_mapping": {} } diff --git a/tests/integration/responses/recordings/d058ce92a083c160c08eb29e7b396e65fa55f4ddf217d2bd3c92eeb85bee5251.json b/tests/integration/responses/recordings/d058ce92a083c160c08eb29e7b396e65fa55f4ddf217d2bd3c92eeb85bee5251.json new file mode 100644 index 000000000..08f05bb4f --- /dev/null +++ b/tests/integration/responses/recordings/d058ce92a083c160c08eb29e7b396e65fa55f4ddf217d2bd3c92eeb85bee5251.json @@ -0,0 +1,894 @@ +{ + "test_id": "tests/integration/responses/test_basic_responses.py::test_response_non_streaming_basic[client_with_models-txt=openai/gpt-4o-saturn]", + "request": { + "method": "POST", + "url": "https://api.openai.com/v1/v1/chat/completions", + "headers": {}, + "body": { + "model": "gpt-4o", + "messages": [ + { + "role": "user", + "content": "Which planet has rings around it with a name starting with letter S?" + } + ], + "stream": true, + "stream_options": { + "include_usage": true + } + }, + "endpoint": "/v1/chat/completions", + "model": "gpt-4o" + }, + "response": { + "body": [ + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": "", + "function_call": null, + "refusal": null, + "role": "assistant", + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "z56q5oZHGZKdtw" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": "The", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "LmzSBsnBqMCfY" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " planet", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "0cyvj0Txx" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " with", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "7NDFvRwCV4H" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " rings", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "cXFnChS2le" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " around", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "KjBEmV3kP" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " it", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "HRuZPETdawxRE" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " that", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "oWgRcLBEtgJ" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " starts", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "57Wb5VAIC" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " with", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "PIJlSXUHBpa" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " the", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "z1j4e36eJaU4" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " letter", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "jDq6ugLXW" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " \"", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "Tl7ZVn6xaBP3M" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": "S", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "Jgd6CpJfjXpHnNW" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": "\"", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "OYepkOsMHU8jw5" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " is", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "6UnjEo5YWE1zb" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " Saturn", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "ljnq8v7G7" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": ".", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "d79gDV0DqNlOO51" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " Saturn", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "bwM1CRrwC" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " is", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "uTygnf5A75n5i" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " well", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "J2mPiUrRBrP" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " known", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "ySgqipG0Qe" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " for", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "KiyTURpCBdJM" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " its", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "JBRXJQhWdglI" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " prominent", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "0mjYkG" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " and", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "hR3bcUfNkRTx" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " extensive", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "18tm6k" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " ring", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "ZIL4ZROICo4" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": " system", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "EVoEpQkJL" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": ".", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "cE7oSZixhWV42Kn" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [ + { + "delta": { + "content": null, + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": "stop", + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "Dl1rR45BAF" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-d058ce92a083", + "choices": [], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": { + "completion_tokens": 29, + "prompt_tokens": 21, + "total_tokens": 50, + "completion_tokens_details": { + "accepted_prediction_tokens": 0, + "audio_tokens": 0, + "reasoning_tokens": 0, + "rejected_prediction_tokens": 0 + }, + "prompt_tokens_details": { + "audio_tokens": 0, + "cached_tokens": 0 + } + }, + "obfuscation": "FXirZrSNkvTrASR" + } + } + ], + "is_streaming": true + }, + "id_normalization_mapping": {} +} diff --git a/tests/integration/responses/recordings/dca42c8244f72a79450c018f63c234d8026087d4416c90a082bd6efb53d00f11.json b/tests/integration/responses/recordings/dca42c8244f72a79450c018f63c234d8026087d4416c90a082bd6efb53d00f11.json new file mode 100644 index 000000000..b4861d29a --- /dev/null +++ b/tests/integration/responses/recordings/dca42c8244f72a79450c018f63c234d8026087d4416c90a082bd6efb53d00f11.json @@ -0,0 +1,273 @@ +{ + "test_id": "tests/integration/responses/test_basic_responses.py::test_response_non_streaming_basic[client_with_models-txt=openai/gpt-4o-earth]", + "request": { + "method": "POST", + "url": "https://api.openai.com/v1/v1/chat/completions", + "headers": {}, + "body": { + "model": "gpt-4o", + "messages": [ + { + "role": "user", + "content": "Which planet do humans live on?" + } + ], + "stream": true, + "stream_options": { + "include_usage": true + } + }, + "endpoint": "/v1/chat/completions", + "model": "gpt-4o" + }, + "response": { + "body": [ + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-dca42c8244f7", + "choices": [ + { + "delta": { + "content": "", + "function_call": null, + "refusal": null, + "role": "assistant", + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "uWM4CTrTBdhbyI" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-dca42c8244f7", + "choices": [ + { + "delta": { + "content": "Hum", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "JuK3luIjXIAR0" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-dca42c8244f7", + "choices": [ + { + "delta": { + "content": "ans", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "mKYRNnis1mCZ4" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-dca42c8244f7", + "choices": [ + { + "delta": { + "content": " live", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "SrAIMLQQ8Gj" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-dca42c8244f7", + "choices": [ + { + "delta": { + "content": " on", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "2fzicdQg1s2C8" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-dca42c8244f7", + "choices": [ + { + "delta": { + "content": " Earth", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "saIKgW0kJK" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-dca42c8244f7", + "choices": [ + { + "delta": { + "content": ".", + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "y4Bq9fWigLsde0J" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-dca42c8244f7", + "choices": [ + { + "delta": { + "content": null, + "function_call": null, + "refusal": null, + "role": null, + "tool_calls": null + }, + "finish_reason": "stop", + "index": 0, + "logprobs": null + } + ], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": null, + "obfuscation": "5VaLcoYLcc" + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "rec-dca42c8244f7", + "choices": [], + "created": 0, + "model": "gpt-4o-2024-08-06", + "object": "chat.completion.chunk", + "service_tier": "default", + "system_fingerprint": "fp_cbf1785567", + "usage": { + "completion_tokens": 6, + "prompt_tokens": 14, + "total_tokens": 20, + "completion_tokens_details": { + "accepted_prediction_tokens": 0, + "audio_tokens": 0, + "reasoning_tokens": 0, + "rejected_prediction_tokens": 0 + }, + "prompt_tokens_details": { + "audio_tokens": 0, + "cached_tokens": 0 + } + }, + "obfuscation": "" + } + } + ], + "is_streaming": true + }, + "id_normalization_mapping": {} +} diff --git a/tests/integration/responses/recordings/f06eb8bec25da44281fda0ff56610393b3c19a3c7fe28b4f773dcf0af15b0c99.json b/tests/integration/responses/recordings/f06eb8bec25da44281fda0ff56610393b3c19a3c7fe28b4f773dcf0af15b0c99.json index 693efddea..96b83aaa8 100644 --- a/tests/integration/responses/recordings/f06eb8bec25da44281fda0ff56610393b3c19a3c7fe28b4f773dcf0af15b0c99.json +++ b/tests/integration/responses/recordings/f06eb8bec25da44281fda0ff56610393b3c19a3c7fe28b4f773dcf0af15b0c99.json @@ -43,7 +43,7 @@ "service_tier": "default", "system_fingerprint": "fp_f33640a400", "usage": null, - "obfuscation": "zz0dWhiq9Lc" + "obfuscation": "zV8s7dKVA0e" } }, { @@ -70,7 +70,7 @@ "service_tier": "default", "system_fingerprint": "fp_f33640a400", "usage": null, - "obfuscation": "apZyVste9l" + "obfuscation": "DoxBbL71uu" } }, { @@ -97,7 +97,7 @@ "service_tier": "default", "system_fingerprint": "fp_f33640a400", "usage": null, - "obfuscation": "bKzudmyiZd" + "obfuscation": "3kPw1tJtBy" } }, { @@ -124,7 +124,7 @@ "service_tier": "default", "system_fingerprint": "fp_f33640a400", "usage": null, - "obfuscation": "OgfYmGnf" + "obfuscation": "GYMVbcCI" } }, { @@ -151,7 +151,7 @@ "service_tier": "default", "system_fingerprint": "fp_f33640a400", "usage": null, - "obfuscation": "nWM9P08zaL" + "obfuscation": "0alfiwg16c" } }, { @@ -178,7 +178,7 @@ "service_tier": "default", "system_fingerprint": "fp_f33640a400", "usage": null, - "obfuscation": "gno9CMj" + "obfuscation": "Wug4Phl" } }, { @@ -205,7 +205,7 @@ "service_tier": "default", "system_fingerprint": "fp_f33640a400", "usage": null, - "obfuscation": "iheIwJKTdAVV" + "obfuscation": "cIZ0eTIUOj4x" } }, { @@ -232,10 +232,11 @@ "service_tier": "default", "system_fingerprint": "fp_f33640a400", "usage": null, - "obfuscation": "X6N8Z47" + "obfuscation": "FbdywkT" } } ], "is_streaming": true - } + }, + "id_normalization_mapping": {} } diff --git a/tests/integration/responses/test_basic_responses.py b/tests/integration/responses/test_basic_responses.py index 17d50d348..b69888554 100644 --- a/tests/integration/responses/test_basic_responses.py +++ b/tests/integration/responses/test_basic_responses.py @@ -23,6 +23,14 @@ def test_response_non_streaming_basic(compat_client, text_model_id, case): assert len(output_text) > 0 assert case.expected.lower() in output_text + # Verify usage is reported + assert response.usage is not None, "Response should include usage information" + assert response.usage.input_tokens > 0, "Input tokens should be greater than 0" + assert response.usage.output_tokens > 0, "Output tokens should be greater than 0" + assert response.usage.total_tokens == response.usage.input_tokens + response.usage.output_tokens, ( + "Total tokens should equal input + output tokens" + ) + retrieved_response = compat_client.responses.retrieve(response_id=response.id) assert retrieved_response.output_text == response.output_text @@ -73,6 +81,15 @@ def test_response_streaming_basic(compat_client, text_model_id, case): assert len(output_text) > 0, "Response should have content" assert case.expected.lower() in output_text, f"Expected '{case.expected}' in response" + # Verify usage is reported in final response + assert chunk.response.usage is not None, "Completed response should include usage information" + assert chunk.response.usage.input_tokens > 0, "Input tokens should be greater than 0" + assert chunk.response.usage.output_tokens > 0, "Output tokens should be greater than 0" + assert ( + chunk.response.usage.total_tokens + == chunk.response.usage.input_tokens + chunk.response.usage.output_tokens + ), "Total tokens should equal input + output tokens" + # Use validator for common checks validator = StreamingValidator(events) validator.assert_basic_event_sequence()