{ "test_id": "tests/integration/responses/test_file_search.py::test_response_file_search_streaming_events[openai_client-txt=openai/gpt-4o]", "request": { "method": "POST", "url": "https://api.openai.com/v1/v1/chat/completions", "headers": {}, "body": { "model": "gpt-4o", "messages": [ { "role": "user", "content": "What are the marketing updates?" }, { "role": "assistant", "content": "", "tool_calls": [ { "index": 0, "id": "call_Vdxnbo2D8ds3BuKCon8XUt9P", "type": "function", "function": { "name": "knowledge_search", "arguments": "{\"query\":\"marketing updates October 2023\"}" } } ] }, { "role": "tool", "tool_call_id": "call_Vdxnbo2D8ds3BuKCon8XUt9P", "content": [ { "type": "text", "text": "knowledge_search tool found 4 chunks:\nBEGIN of knowledge_search tool results.\n" }, { "type": "text", "text": "[1] document_id: file-284290576316, score: 0.0041403203176098744, attributes: {'region': 'us', 'category': 'marketing', 'date': 1672531200.0, 'filename': 'us_marketing_q1.txt', 'chunk_id': 'a40d303b-40f6-42c8-a616-7a6276329426', 'document_id': 'file-284290576316', 'token_count': 21.0, 'metadata_token_count': 32.0} (cite as <|file-284290576316|>)\nUS promotional campaigns for Q1 2023. Revenue increased by 15% in the US region.\n" }, { "type": "text", "text": "[2] document_id: file-284290576317, score: 0.0040829994744857705, attributes: {'region': 'us', 'category': 'engineering', 'date': 1680307200.0, 'filename': 'us_engineering_q2.txt', 'chunk_id': '084e15ad-480a-eae8-9242-391c53854867', 'document_id': 'file-284290576317', 'token_count': 18.0, 'metadata_token_count': 32.0} (cite as <|file-284290576317|>)\nUS technical updates for Q2 2023. New features deployed in the US region.\n" }, { "type": "text", "text": "[3] document_id: file-284290576318, score: 0.00404441899677229, attributes: {'region': 'eu', 'category': 'marketing', 'date': 1672531200.0, 'filename': 'eu_marketing_q1.txt', 'chunk_id': 'a1b887d4-0741-1542-6e7d-0e156f032a31', 'document_id': 'file-284290576318', 'token_count': 17.0, 'metadata_token_count': 32.0} (cite as <|file-284290576318|>)\nEuropean advertising campaign results for Q1 2023. Strong growth in EU markets.\n" }, { "type": "text", "text": "[4] document_id: file-284290576319, score: 0.0028188758700165135, attributes: {'region': 'asia', 'category': 'sales', 'date': 1688169600.0, 'filename': 'asia_sales_q3.txt', 'chunk_id': 'fc497e92-16bb-9869-2360-de27e3da396f', 'document_id': 'file-284290576319', 'token_count': 17.0, 'metadata_token_count': 31.0} (cite as <|file-284290576319|>)\nAsia Pacific revenue figures for Q3 2023. Record breaking quarter in Asia.\n" }, { "type": "text", "text": "END of knowledge_search tool results.\n" }, { "type": "text", "text": "The above results were retrieved to help answer the user's query: \"marketing updates October 2023\". Use them as supporting information only in answering this query. Cite sources immediately at the end of sentences before punctuation, using `<|file-id|>` format (e.g., 'This is a fact <|file-Cn3MSNn72ENTiiq11Qda4A|>.'). Do not add extra punctuation. Use only the file IDs provided (do not invent new ones).\n" } ] } ], "stream": true, "stream_options": { "include_usage": true }, "tools": [ { "type": "function", "function": { "name": "knowledge_search", "description": "Search for information in a database.", "parameters": { "type": "object", "properties": { "query": { "type": "string", "description": "The query to search for. Can be a natural language sentence or keywords." } }, "required": [ "query" ] } } } ] }, "endpoint": "/v1/chat/completions", "model": "gpt-4o" }, "response": { "body": [ { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "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_a788c5aef0", "usage": null, "obfuscation": "wGaQAOIsXOZCVf" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": "I", "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_a788c5aef0", "usage": null, "obfuscation": "T2UPJpu5tzg4WQo" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " couldn't", "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_a788c5aef0", "usage": null, "obfuscation": "c0XZP7k" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " find", "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_a788c5aef0", "usage": null, "obfuscation": "UTuZfgrjJ7n" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " any", "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_a788c5aef0", "usage": null, "obfuscation": "ONJb2p7XA6PO" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " specific", "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_a788c5aef0", "usage": null, "obfuscation": "DNVS1Cu" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " updates", "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_a788c5aef0", "usage": null, "obfuscation": "mZZQbqBN" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " related", "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_a788c5aef0", "usage": null, "obfuscation": "dA5WYIwS" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " to", "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_a788c5aef0", "usage": null, "obfuscation": "hppAMImGw3HWW" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " marketing", "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_a788c5aef0", "usage": null, "obfuscation": "D46oXs" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "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_a788c5aef0", "usage": null, "obfuscation": "wz0UnUEMm7nE" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " October", "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_a788c5aef0", "usage": null, "obfuscation": "8SR4cWe8" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "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_a788c5aef0", "usage": null, "obfuscation": "4vriwglgm2xfG9o" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": "202", "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_a788c5aef0", "usage": null, "obfuscation": "6UNpvCtF1tsth" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": "3", "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_a788c5aef0", "usage": null, "obfuscation": "egJJmaTQnL8WN5c" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "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_a788c5aef0", "usage": null, "obfuscation": "sp4mscAND9IocFq" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " If", "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_a788c5aef0", "usage": null, "obfuscation": "KWkoVURsct5Sd" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " you", "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_a788c5aef0", "usage": null, "obfuscation": "4t0ymlI01aIR" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " have", "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_a788c5aef0", "usage": null, "obfuscation": "4lNnVAx9lW0" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " more", "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_a788c5aef0", "usage": null, "obfuscation": "ibkwqRYjYjx" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " specific", "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_a788c5aef0", "usage": null, "obfuscation": "fEaoMHs" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " queries", "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_a788c5aef0", "usage": null, "obfuscation": "kQJWfd2c" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " or", "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_a788c5aef0", "usage": null, "obfuscation": "skCiCGMfSvOZU" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " regions", "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_a788c5aef0", "usage": null, "obfuscation": "6VicmwwL" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "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_a788c5aef0", "usage": null, "obfuscation": "JnMhCOzbFYEnu" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " mind", "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_a788c5aef0", "usage": null, "obfuscation": "lyarAUpgeHz" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "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_a788c5aef0", "usage": null, "obfuscation": "R9Z74wDTUIa2lR7" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " please", "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_a788c5aef0", "usage": null, "obfuscation": "iv8M60sbf" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " let", "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_a788c5aef0", "usage": null, "obfuscation": "a2cuP0FBBnbj" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " me", "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_a788c5aef0", "usage": null, "obfuscation": "InWxgJH6RVlEp" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [ { "delta": { "content": " know", "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_a788c5aef0", "usage": null, "obfuscation": "DCmgsIzZvnx" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "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_a788c5aef0", "usage": null, "obfuscation": "OtrPmAHH6KI7YKL" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "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_a788c5aef0", "usage": null, "obfuscation": "fYb9dwXLnK" } }, { "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", "__data__": { "id": "rec-6d20aac5318b", "choices": [], "created": 0, "model": "gpt-4o-2024-08-06", "object": "chat.completion.chunk", "service_tier": "default", "system_fingerprint": "fp_a788c5aef0", "usage": { "completion_tokens": 32, "prompt_tokens": 820, "total_tokens": 852, "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": "60RapaK2mCEpn" } } ], "is_streaming": true }, "id_normalization_mapping": {} }