diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/README.md b/instrumentation/elastic-opentelemetry-instrumentation-openai/README.md index 98ab69a..b154684 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/README.md +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/README.md @@ -24,11 +24,11 @@ This instrumentation supports *0-code* / *autoinstrumentation*: ``` opentelemetry-instrument python use_openai.py -# You can record more information about prompts as span events by enabling content capture. +# You can record more information about prompts as log events by enabling content capture. OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true opentelemetry-instrument python use_openai.py -# You can record more information about prompts as log events by enabling content capture. -OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true ELASTIC_OTEL_GENAI_EVENTS=log opentelemetry-instrument python use_openai.py +# You can record more information about prompts as span events by enabling content capture. +OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true ELASTIC_OTEL_GENAI_EVENTS=span opentelemetry-instrument python use_openai.py ``` Or manual instrumentation: diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/__init__.py b/instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/__init__.py index 6a12e27..0a9be4c 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/__init__.py +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/__init__.py @@ -87,25 +87,25 @@ def _instrument(self, **kwargs): ) # we support 3 values for deciding how to send events: - # - "latest" to match latest semconv, as 1.27.0 it's span - # - "log" to send log events - # - "span" to send span events (default) + # - "latest" to match latest semconv, as 1.28.0 it's log + # - "log" to send log events (default) + # - "span" to send span events genai_events = os.environ.get(ELASTIC_OTEL_GENAI_EVENTS, "latest").lower() - self.event_kind = "log" if genai_events == "log" else "span" + self.event_kind = "span" if genai_events == "span" else "log" tracer_provider = kwargs.get("tracer_provider") self.tracer = get_tracer( __name__, __version__, tracer_provider, - schema_url=Schemas.V1_27_0.value, + schema_url=Schemas.V1_28_0.value, ) meter_provider = kwargs.get("meter_provider") self.meter = get_meter( __name__, __version__, meter_provider, - schema_url=Schemas.V1_27_0.value, + schema_url=Schemas.V1_28_0.value, ) event_logger_provider = kwargs.get("event_logger_provider") self.event_logger = get_event_logger(__name__, event_logger_provider) diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/helpers.py b/instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/helpers.py index 24c32dc..3bb955b 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/helpers.py +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/helpers.py @@ -158,7 +158,6 @@ def _get_span_attributes_from_wrapper(instance, kwargs) -> Attributes: GEN_AI_SYSTEM: "openai", } - # on some azure clients the model was not mandatory if (request_model := kwargs.get("model")) is not None: span_attributes[GEN_AI_REQUEST_MODEL] = request_model diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content[azure_provider_chat_completions].yaml index e1fcb26..754b043 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content[azure_provider_chat_completions].yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content[azure_provider_chat_completions].yaml @@ -80,8 +80,8 @@ interactions: } } ], - "created": 1731468960, - "id": "chatcmpl-ASySeHu4TgKtlulOVp4LU8yTNRvoM", + "created": 1731466221, + "id": "chatcmpl-ASxkTeNjqCBy25d2g18faeBtc66GG", "model": "gpt-4-32k", "object": "chat.completion", "prompt_filter_results": [ @@ -122,33 +122,33 @@ interactions: Content-Type: - application/json Date: - - Wed, 13 Nov 2024 03:36:00 GMT + - Wed, 13 Nov 2024 02:50:21 GMT Set-Cookie: test_set_cookie Strict-Transport-Security: - max-age=31536000; includeSubDomains; preload access-control-allow-origin: - '*' apim-request-id: - - 38407302-010e-4318-8ba2-cd1c61e474c5 + - 53c69374-78ff-4de0-a446-253028228455 azureml-model-session: - - d156-20241010120317 + - d158-20241010133731 openai-organization: test_openai_org_id x-accel-buffering: - 'no' x-content-type-options: - nosniff x-ms-client-request-id: - - 38407302-010e-4318-8ba2-cd1c61e474c5 + - 53c69374-78ff-4de0-a446-253028228455 x-ms-rai-invoked: - 'true' x-ms-region: - Switzerland North x-ratelimit-remaining-requests: - - '79' + - '71' x-ratelimit-remaining-tokens: - - '79968' + - '79644' x-request-id: - - 3910c5ca-854a-481d-b76c-e4140883c952 + - 54470131-0498-4318-a448-5d99d1e57699 status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content[ollama_provider_chat_completions].yaml index b2e071a..2c78822 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content[ollama_provider_chat_completions].yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content[ollama_provider_chat_completions].yaml @@ -49,7 +49,7 @@ interactions: body: string: |- { - "id": "chatcmpl-816", + "id": "chatcmpl-295", "object": "chat.completion", "created": 1731311784, "model": "qwen2.5:0.5b", @@ -59,20 +59,20 @@ interactions: "index": 0, "message": { "role": "assistant", - "content": "Antarctica ocean." + "content": "The Falkland Islands are located in which ocean?" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 46, - "completion_tokens": 6, - "total_tokens": 52 + "completion_tokens": 11, + "total_tokens": 57 } } headers: Content-Length: - - '303' + - '335' Content-Type: - application/json Date: diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content[openai_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content[openai_provider_chat_completions].yaml index 6998876..7745538 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content[openai_provider_chat_completions].yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content[openai_provider_chat_completions].yaml @@ -49,7 +49,7 @@ interactions: body: string: |- { - "id": "chatcmpl-ASfaOHHT6qOYpFc5M7uzSkgfXnnpJ", + "id": "chatcmpl-ASfaOykfLmr5qdUddSbFIDNGReNRJ", "object": "chat.completion", "created": 1731396404, "model": "gpt-4o-mini-2024-07-18", @@ -86,7 +86,7 @@ interactions: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8e14cba439f0ce22-SIN + - 8e14cba7eed66bbd-SIN Connection: - keep-alive Content-Type: @@ -108,7 +108,7 @@ interactions: - '771' openai-organization: test_openai_org_key openai-processing-ms: - - '213' + - '249' openai-version: - '2020-10-01' strict-transport-security: @@ -118,15 +118,15 @@ interactions: x-ratelimit-limit-tokens: - '200000' x-ratelimit-remaining-requests: - - '9984' + - '9983' x-ratelimit-remaining-tokens: - '199966' x-ratelimit-reset-requests: - - 2m17.802s + - 2m25.844s x-ratelimit-reset-tokens: - 10ms x-request-id: - - req_e6b1a7306539cbcad166c1907ae46d4f + - req_3bef9643428bce1d1e43d476d8ef1c43 status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content_span_events[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content_span_events[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..e1fcb26 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content_span_events[azure_provider_chat_completions].yaml @@ -0,0 +1,155 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?" + } + ], + "model": "unused" + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + api-key: + - test_azure_api_key + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '133' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AsyncAzureOpenAI/Python 1.54.3 + x-stainless-arch: + - arm64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.54.3 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2024-08-01-preview + response: + body: + string: |- + { + "choices": [ + { + "content_filter_results": { + "hate": { + "filtered": false, + "severity": "safe" + }, + "self_harm": { + "filtered": false, + "severity": "safe" + }, + "sexual": { + "filtered": false, + "severity": "safe" + }, + "violence": { + "filtered": false, + "severity": "safe" + } + }, + "finish_reason": "stop", + "index": 0, + "logprobs": null, + "message": { + "content": "Atlantic Ocean", + "role": "assistant" + } + } + ], + "created": 1731468960, + "id": "chatcmpl-ASySeHu4TgKtlulOVp4LU8yTNRvoM", + "model": "gpt-4-32k", + "object": "chat.completion", + "prompt_filter_results": [ + { + "prompt_index": 0, + "content_filter_results": { + "hate": { + "filtered": false, + "severity": "safe" + }, + "self_harm": { + "filtered": false, + "severity": "safe" + }, + "sexual": { + "filtered": false, + "severity": "safe" + }, + "violence": { + "filtered": false, + "severity": "safe" + } + } + } + ], + "system_fingerprint": null, + "usage": { + "completion_tokens": 2, + "prompt_tokens": 24, + "total_tokens": 26 + } + } + headers: + Cache-Control: + - no-cache, must-revalidate + Content-Length: + - '805' + Content-Type: + - application/json + Date: + - Wed, 13 Nov 2024 03:36:00 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + access-control-allow-origin: + - '*' + apim-request-id: + - 38407302-010e-4318-8ba2-cd1c61e474c5 + azureml-model-session: + - d156-20241010120317 + openai-organization: test_openai_org_id + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-ms-client-request-id: + - 38407302-010e-4318-8ba2-cd1c61e474c5 + x-ms-rai-invoked: + - 'true' + x-ms-region: + - Switzerland North + x-ratelimit-remaining-requests: + - '79' + x-ratelimit-remaining-tokens: + - '79968' + x-request-id: + - 3910c5ca-854a-481d-b76c-e4140883c952 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content_span_events[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content_span_events[ollama_provider_chat_completions].yaml new file mode 100644 index 0000000..b2e071a --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content_span_events[ollama_provider_chat_completions].yaml @@ -0,0 +1,85 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?" + } + ], + "model": "qwen2.5:0.5b" + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '139' + content-type: + - application/json + host: + - localhost:11434 + user-agent: + - AsyncOpenAI/Python 1.50.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.50.2 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: http://localhost:11434/v1/chat/completions + response: + body: + string: |- + { + "id": "chatcmpl-816", + "object": "chat.completion", + "created": 1731311784, + "model": "qwen2.5:0.5b", + "system_fingerprint": "fp_ollama", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "Antarctica ocean." + }, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 46, + "completion_tokens": 6, + "total_tokens": 52 + } + } + headers: + Content-Length: + - '303' + Content-Type: + - application/json + Date: + - Mon, 11 Nov 2024 07:56:24 GMT + Set-Cookie: test_set_cookie + openai-organization: test_openai_org_key + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content_span_events[openai_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content_span_events[openai_provider_chat_completions].yaml new file mode 100644 index 0000000..6998876 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_message_content_span_events[openai_provider_chat_completions].yaml @@ -0,0 +1,133 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?" + } + ], + "model": "gpt-4o-mini" + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '138' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - AsyncOpenAI/Python 1.54.3 + x-stainless-arch: + - arm64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.54.3 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: |- + { + "id": "chatcmpl-ASfaOHHT6qOYpFc5M7uzSkgfXnnpJ", + "object": "chat.completion", + "created": 1731396404, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "South Atlantic Ocean.", + "refusal": null + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 24, + "completion_tokens": 4, + "total_tokens": 28, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "system_fingerprint": "fp_0ba0d124f1" + } + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8e14cba439f0ce22-SIN + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 12 Nov 2024 07:26:44 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + content-length: + - '771' + openai-organization: test_openai_org_key + openai-processing-ms: + - '213' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9984' + x-ratelimit-remaining-tokens: + - '199966' + x-ratelimit-reset-requests: + - 2m17.802s + x-ratelimit-reset-tokens: + - 10ms + x-request-id: + - req_e6b1a7306539cbcad166c1907ae46d4f + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content[azure_provider_chat_completions].yaml index ead3805..15113eb 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content[azure_provider_chat_completions].yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content[azure_provider_chat_completions].yaml @@ -53,13 +53,13 @@ interactions: string: |+ data: {"choices":[],"created":0,"id":"","model":"","object":"","prompt_filter_results":[{"prompt_index":0,"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}}}]} - data: {"choices":[{"content_filter_results":{},"delta":{"content":"","role":"assistant"},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466223,"id":"chatcmpl-ASxkVWhWg2yeY7IV8yr6Lywa7fke4","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + data: {"choices":[{"content_filter_results":{},"delta":{"content":"","role":"assistant"},"finish_reason":null,"index":0,"logprobs":null}],"created":1731468911,"id":"chatcmpl-ASyRrEoGtgeeLRtFd7mM1CePrJUac","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} - data: {"choices":[{"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}},"delta":{"content":"Atlantic"},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466223,"id":"chatcmpl-ASxkVWhWg2yeY7IV8yr6Lywa7fke4","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + data: {"choices":[{"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}},"delta":{"content":"Atlantic"},"finish_reason":null,"index":0,"logprobs":null}],"created":1731468911,"id":"chatcmpl-ASyRrEoGtgeeLRtFd7mM1CePrJUac","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} - data: {"choices":[{"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}},"delta":{"content":" Ocean"},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466223,"id":"chatcmpl-ASxkVWhWg2yeY7IV8yr6Lywa7fke4","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + data: {"choices":[{"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}},"delta":{"content":" Ocean"},"finish_reason":null,"index":0,"logprobs":null}],"created":1731468911,"id":"chatcmpl-ASyRrEoGtgeeLRtFd7mM1CePrJUac","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} - data: {"choices":[{"content_filter_results":{},"delta":{},"finish_reason":"stop","index":0,"logprobs":null}],"created":1731466223,"id":"chatcmpl-ASxkVWhWg2yeY7IV8yr6Lywa7fke4","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + data: {"choices":[{"content_filter_results":{},"delta":{},"finish_reason":"stop","index":0,"logprobs":null}],"created":1731468911,"id":"chatcmpl-ASyRrEoGtgeeLRtFd7mM1CePrJUac","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} data: [DONE] @@ -69,7 +69,7 @@ interactions: Content-Type: - text/event-stream Date: - - Wed, 13 Nov 2024 02:50:23 GMT + - Wed, 13 Nov 2024 03:35:11 GMT Set-Cookie: test_set_cookie Strict-Transport-Security: - max-age=31536000; includeSubDomains; preload @@ -78,7 +78,7 @@ interactions: access-control-allow-origin: - '*' apim-request-id: - - 32da387e-289d-4876-8d37-adc936ab09da + - 950795c5-f4c5-4a49-8f90-df12358f7c8a azureml-model-session: - d156-20241010120317 openai-organization: test_openai_org_id @@ -87,17 +87,17 @@ interactions: x-content-type-options: - nosniff x-ms-client-request-id: - - 32da387e-289d-4876-8d37-adc936ab09da + - 950795c5-f4c5-4a49-8f90-df12358f7c8a x-ms-rai-invoked: - 'true' x-ms-region: - Switzerland North x-ratelimit-remaining-requests: - - '71' + - '79' x-ratelimit-remaining-tokens: - - '79612' + - '79984' x-request-id: - - 132f6f5c-067a-47e2-bc7d-79aa543876b4 + - 9b878e38-8cfd-434d-8e04-71ba2e5bb8e0 status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content[ollama_provider_chat_completions].yaml index f13de93..600ae73 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content[ollama_provider_chat_completions].yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content[ollama_provider_chat_completions].yaml @@ -49,19 +49,23 @@ interactions: response: body: string: |+ - data: {"id":"chatcmpl-752","object":"chat.completion.chunk","created":1731311784,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"South"},"finish_reason":null}]} + data: {"id":"chatcmpl-465","object":"chat.completion.chunk","created":1731314345,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"The"},"finish_reason":null}]} - data: {"id":"chatcmpl-752","object":"chat.completion.chunk","created":1731311784,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" America"},"finish_reason":null}]} + data: {"id":"chatcmpl-465","object":"chat.completion.chunk","created":1731314345,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" Falk"},"finish_reason":null}]} - data: {"id":"chatcmpl-752","object":"chat.completion.chunk","created":1731311784,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"'s"},"finish_reason":null}]} + data: {"id":"chatcmpl-465","object":"chat.completion.chunk","created":1731314345,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"land"},"finish_reason":null}]} - data: {"id":"chatcmpl-752","object":"chat.completion.chunk","created":1731311784,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" Atlantic"},"finish_reason":null}]} + data: {"id":"chatcmpl-465","object":"chat.completion.chunk","created":1731314345,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" Islands"},"finish_reason":null}]} - data: {"id":"chatcmpl-752","object":"chat.completion.chunk","created":1731311784,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" Ocean"},"finish_reason":null}]} + data: {"id":"chatcmpl-465","object":"chat.completion.chunk","created":1731314345,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" belong"},"finish_reason":null}]} - data: {"id":"chatcmpl-752","object":"chat.completion.chunk","created":1731311784,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null}]} + data: {"id":"chatcmpl-465","object":"chat.completion.chunk","created":1731314345,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null}]} - data: {"id":"chatcmpl-752","object":"chat.completion.chunk","created":1731311784,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} + data: {"id":"chatcmpl-465","object":"chat.completion.chunk","created":1731314345,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" Argentina"},"finish_reason":null}]} + + data: {"id":"chatcmpl-465","object":"chat.completion.chunk","created":1731314345,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null}]} + + data: {"id":"chatcmpl-465","object":"chat.completion.chunk","created":1731314345,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} data: [DONE] @@ -69,7 +73,7 @@ interactions: Content-Type: - text/event-stream Date: - - Mon, 11 Nov 2024 07:56:24 GMT + - Mon, 11 Nov 2024 08:39:05 GMT Set-Cookie: test_set_cookie Transfer-Encoding: - chunked diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content[openai_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content[openai_provider_chat_completions].yaml index 5cc7e03..dd4dce5 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content[openai_provider_chat_completions].yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content[openai_provider_chat_completions].yaml @@ -49,17 +49,17 @@ interactions: response: body: string: |+ - data: {"id":"chatcmpl-ASfaPHhHlSFtYDMa1S0QSWewTPhuS","object":"chat.completion.chunk","created":1731396405,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaQS4L6eLFljyu9h8zZRbp2hf5j","object":"chat.completion.chunk","created":1731396406,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_9b78b61c52","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaPHhHlSFtYDMa1S0QSWewTPhuS","object":"chat.completion.chunk","created":1731396405,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"content":"South"},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaQS4L6eLFljyu9h8zZRbp2hf5j","object":"chat.completion.chunk","created":1731396406,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_9b78b61c52","choices":[{"index":0,"delta":{"content":"South"},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaPHhHlSFtYDMa1S0QSWewTPhuS","object":"chat.completion.chunk","created":1731396405,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"content":" Atlantic"},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaQS4L6eLFljyu9h8zZRbp2hf5j","object":"chat.completion.chunk","created":1731396406,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_9b78b61c52","choices":[{"index":0,"delta":{"content":" Atlantic"},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaPHhHlSFtYDMa1S0QSWewTPhuS","object":"chat.completion.chunk","created":1731396405,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"content":" Ocean"},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaQS4L6eLFljyu9h8zZRbp2hf5j","object":"chat.completion.chunk","created":1731396406,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_9b78b61c52","choices":[{"index":0,"delta":{"content":" Ocean"},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaPHhHlSFtYDMa1S0QSWewTPhuS","object":"chat.completion.chunk","created":1731396405,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaQS4L6eLFljyu9h8zZRbp2hf5j","object":"chat.completion.chunk","created":1731396406,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_9b78b61c52","choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaPHhHlSFtYDMa1S0QSWewTPhuS","object":"chat.completion.chunk","created":1731396405,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} + data: {"id":"chatcmpl-ASfaQS4L6eLFljyu9h8zZRbp2hf5j","object":"chat.completion.chunk","created":1731396406,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_9b78b61c52","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} data: [DONE] @@ -67,13 +67,13 @@ interactions: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8e14cbaf8f6d49b4-SIN + - 8e14cbb39856833c-SIN Connection: - keep-alive Content-Type: - text/event-stream; charset=utf-8 Date: - - Tue, 12 Nov 2024 07:26:46 GMT + - Tue, 12 Nov 2024 07:26:47 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -87,7 +87,7 @@ interactions: - h3=":443"; ma=86400 openai-organization: test_openai_org_key openai-processing-ms: - - '203' + - '543' openai-version: - '2020-10-01' strict-transport-security: @@ -97,15 +97,15 @@ interactions: x-ratelimit-limit-tokens: - '200000' x-ratelimit-remaining-requests: - - '9981' + - '9980' x-ratelimit-remaining-tokens: - '199966' x-ratelimit-reset-requests: - - 2m41.915s + - 2m49.899s x-ratelimit-reset-tokens: - 10ms x-request-id: - - req_cdcc4e2158d7bd20d7769f8ed24a54a1 + - req_85a0e7015e1b6b6b1b7536fdc4c967b4 status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content_span_events[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content_span_events[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..ead3805 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content_span_events[azure_provider_chat_completions].yaml @@ -0,0 +1,104 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?" + } + ], + "model": "unused", + "stream": true + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + api-key: + - test_azure_api_key + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '149' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AsyncAzureOpenAI/Python 1.54.3 + x-stainless-arch: + - arm64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.54.3 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2024-08-01-preview + response: + body: + string: |+ + data: {"choices":[],"created":0,"id":"","model":"","object":"","prompt_filter_results":[{"prompt_index":0,"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}}}]} + + data: {"choices":[{"content_filter_results":{},"delta":{"content":"","role":"assistant"},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466223,"id":"chatcmpl-ASxkVWhWg2yeY7IV8yr6Lywa7fke4","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + + data: {"choices":[{"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}},"delta":{"content":"Atlantic"},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466223,"id":"chatcmpl-ASxkVWhWg2yeY7IV8yr6Lywa7fke4","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + + data: {"choices":[{"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}},"delta":{"content":" Ocean"},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466223,"id":"chatcmpl-ASxkVWhWg2yeY7IV8yr6Lywa7fke4","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + + data: {"choices":[{"content_filter_results":{},"delta":{},"finish_reason":"stop","index":0,"logprobs":null}],"created":1731466223,"id":"chatcmpl-ASxkVWhWg2yeY7IV8yr6Lywa7fke4","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + + data: [DONE] + + headers: + Cache-Control: + - no-cache, must-revalidate + Content-Type: + - text/event-stream + Date: + - Wed, 13 Nov 2024 02:50:23 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + access-control-allow-origin: + - '*' + apim-request-id: + - 32da387e-289d-4876-8d37-adc936ab09da + azureml-model-session: + - d156-20241010120317 + openai-organization: test_openai_org_id + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-ms-client-request-id: + - 32da387e-289d-4876-8d37-adc936ab09da + x-ms-rai-invoked: + - 'true' + x-ms-region: + - Switzerland North + x-ratelimit-remaining-requests: + - '71' + x-ratelimit-remaining-tokens: + - '79612' + x-request-id: + - 132f6f5c-067a-47e2-bc7d-79aa543876b4 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content_span_events[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content_span_events[ollama_provider_chat_completions].yaml new file mode 100644 index 0000000..f13de93 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content_span_events[ollama_provider_chat_completions].yaml @@ -0,0 +1,80 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?" + } + ], + "model": "qwen2.5:0.5b", + "stream": true + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '155' + content-type: + - application/json + host: + - localhost:11434 + user-agent: + - AsyncOpenAI/Python 1.50.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.50.2 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: http://localhost:11434/v1/chat/completions + response: + body: + string: |+ + data: {"id":"chatcmpl-752","object":"chat.completion.chunk","created":1731311784,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"South"},"finish_reason":null}]} + + data: {"id":"chatcmpl-752","object":"chat.completion.chunk","created":1731311784,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" America"},"finish_reason":null}]} + + data: {"id":"chatcmpl-752","object":"chat.completion.chunk","created":1731311784,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"'s"},"finish_reason":null}]} + + data: {"id":"chatcmpl-752","object":"chat.completion.chunk","created":1731311784,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" Atlantic"},"finish_reason":null}]} + + data: {"id":"chatcmpl-752","object":"chat.completion.chunk","created":1731311784,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" Ocean"},"finish_reason":null}]} + + data: {"id":"chatcmpl-752","object":"chat.completion.chunk","created":1731311784,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null}]} + + data: {"id":"chatcmpl-752","object":"chat.completion.chunk","created":1731311784,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + Date: + - Mon, 11 Nov 2024 07:56:24 GMT + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + openai-organization: test_openai_org_key + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content_span_events[openai_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content_span_events[openai_provider_chat_completions].yaml new file mode 100644 index 0000000..5cc7e03 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_message_content_span_events[openai_provider_chat_completions].yaml @@ -0,0 +1,112 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?" + } + ], + "model": "gpt-4o-mini", + "stream": true + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '154' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - AsyncOpenAI/Python 1.54.3 + x-stainless-arch: + - arm64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.54.3 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: |+ + data: {"id":"chatcmpl-ASfaPHhHlSFtYDMa1S0QSWewTPhuS","object":"chat.completion.chunk","created":1731396405,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaPHhHlSFtYDMa1S0QSWewTPhuS","object":"chat.completion.chunk","created":1731396405,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"content":"South"},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaPHhHlSFtYDMa1S0QSWewTPhuS","object":"chat.completion.chunk","created":1731396405,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"content":" Atlantic"},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaPHhHlSFtYDMa1S0QSWewTPhuS","object":"chat.completion.chunk","created":1731396405,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"content":" Ocean"},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaPHhHlSFtYDMa1S0QSWewTPhuS","object":"chat.completion.chunk","created":1731396405,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaPHhHlSFtYDMa1S0QSWewTPhuS","object":"chat.completion.chunk","created":1731396405,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} + + data: [DONE] + + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8e14cbaf8f6d49b4-SIN + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Tue, 12 Nov 2024 07:26:46 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + openai-organization: test_openai_org_key + openai-processing-ms: + - '203' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9981' + x-ratelimit-remaining-tokens: + - '199966' + x-ratelimit-reset-requests: + - 2m41.915s + x-ratelimit-reset-tokens: + - 10ms + x-request-id: + - req_cdcc4e2158d7bd20d7769f8ed24a54a1 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_message_content[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_message_content[azure_provider_chat_completions].yaml index 5044176..cf3c6e2 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_message_content[azure_provider_chat_completions].yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_message_content[azure_provider_chat_completions].yaml @@ -100,15 +100,15 @@ interactions: "arguments": "{\n \"order_id\": \"order_12345\"\n}", "name": "get_delivery_date" }, - "id": "call_Lm5cpl4sJy5b1FfEjsnbbjlL", + "id": "call_U0QYBadhpy4pBO6jYPm09KvZ", "type": "function" } ] } } ], - "created": 1731466225, - "id": "chatcmpl-ASxkX3IDac2dYI6AB8L4iA7SJaNii", + "created": 1731466226, + "id": "chatcmpl-ASxkYrqUQVubUzovieQByym7sxgdm", "model": "gpt-4-32k", "object": "chat.completion", "prompt_filter_results": [ @@ -149,23 +149,23 @@ interactions: Content-Type: - application/json Date: - - Wed, 13 Nov 2024 02:50:25 GMT + - Wed, 13 Nov 2024 02:50:27 GMT Set-Cookie: test_set_cookie Strict-Transport-Security: - max-age=31536000; includeSubDomains; preload access-control-allow-origin: - '*' apim-request-id: - - d0d1d8a8-c031-48c8-b8f5-20fa4a9789ed + - cf22ccd0-88ac-4c8c-9165-cc19ab33cc5b azureml-model-session: - - d160-20241010151341 + - d156-20241010120317 openai-organization: test_openai_org_id x-accel-buffering: - 'no' x-content-type-options: - nosniff x-ms-client-request-id: - - d0d1d8a8-c031-48c8-b8f5-20fa4a9789ed + - cf22ccd0-88ac-4c8c-9165-cc19ab33cc5b x-ms-rai-invoked: - 'true' x-ms-region: @@ -173,9 +173,9 @@ interactions: x-ratelimit-remaining-requests: - '71' x-ratelimit-remaining-tokens: - - '79580' + - '79564' x-request-id: - - 14c4426a-d72d-4c3c-aa90-5026d7d7e314 + - dad29d09-1214-452a-8433-f0a62873e001 status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_message_content[openai_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_message_content[openai_provider_chat_completions].yaml index 914e6e8..70521d3 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_message_content[openai_provider_chat_completions].yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_message_content[openai_provider_chat_completions].yaml @@ -83,9 +83,9 @@ interactions: body: string: |- { - "id": "chatcmpl-ASfaRyXEFFt9GzMooIy1bDXqjYnWV", + "id": "chatcmpl-ASfaSKFvgQzcktnJhUZmtGmdoKwkW", "object": "chat.completion", - "created": 1731396407, + "created": 1731396408, "model": "gpt-4o-mini-2024-07-18", "choices": [ { @@ -95,7 +95,7 @@ interactions: "content": null, "tool_calls": [ { - "id": "call_fW4XFpzxFZ7Rfj5dsDcZTezg", + "id": "call_TZeQV35RVjT4iAuUXs85nmkt", "type": "function", "function": { "name": "get_delivery_date", @@ -130,13 +130,13 @@ interactions: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8e14cbb9deeb49d2-SIN + - 8e14cbc0b9dd81c0-SIN Connection: - keep-alive Content-Type: - application/json Date: - - Tue, 12 Nov 2024 07:26:48 GMT + - Tue, 12 Nov 2024 07:26:49 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -152,7 +152,7 @@ interactions: - '1046' openai-organization: test_openai_org_key openai-processing-ms: - - '711' + - '488' openai-version: - '2020-10-01' strict-transport-security: @@ -162,15 +162,15 @@ interactions: x-ratelimit-limit-tokens: - '200000' x-ratelimit-remaining-requests: - - '9979' + - '9978' x-ratelimit-remaining-tokens: - '199921' x-ratelimit-reset-requests: - - 2m57.53s + - 3m5.077s x-ratelimit-reset-tokens: - 23ms x-request-id: - - req_fb7b2d2cbb3f604371ed39bd6692351b + - req_dbdc2eb2289e3488dda3261f8b1f8996 status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_message_content_span_events[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_message_content_span_events[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..5044176 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_message_content_span_events[azure_provider_chat_completions].yaml @@ -0,0 +1,182 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "system", + "content": "You are a helpful customer support assistant. Use the supplied tools to assist the user." + }, + { + "role": "user", + "content": "Hi, can you tell me the delivery date for my order?" + }, + { + "role": "assistant", + "content": "Hi there! I can help with that. Can you please provide your order ID?" + }, + { + "role": "user", + "content": "i think it is order_12345" + } + ], + "model": "unused", + "tools": [ + { + "type": "function", + "function": { + "name": "get_delivery_date", + "description": "Get the delivery date for a customer's order. Call this whenever you need to know the delivery date, for example when a customer asks 'Where is my package'", + "parameters": { + "type": "object", + "properties": { + "order_id": { + "type": "string", + "description": "The customer's order ID." + } + }, + "required": [ + "order_id" + ], + "additionalProperties": false + } + } + } + ] + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + api-key: + - test_azure_api_key + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '837' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AsyncAzureOpenAI/Python 1.54.3 + x-stainless-arch: + - arm64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.54.3 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2024-08-01-preview + response: + body: + string: |- + { + "choices": [ + { + "content_filter_results": {}, + "finish_reason": "tool_calls", + "index": 0, + "logprobs": null, + "message": { + "content": null, + "role": "assistant", + "tool_calls": [ + { + "function": { + "arguments": "{\n \"order_id\": \"order_12345\"\n}", + "name": "get_delivery_date" + }, + "id": "call_Lm5cpl4sJy5b1FfEjsnbbjlL", + "type": "function" + } + ] + } + } + ], + "created": 1731466225, + "id": "chatcmpl-ASxkX3IDac2dYI6AB8L4iA7SJaNii", + "model": "gpt-4-32k", + "object": "chat.completion", + "prompt_filter_results": [ + { + "prompt_index": 0, + "content_filter_results": { + "hate": { + "filtered": false, + "severity": "safe" + }, + "self_harm": { + "filtered": false, + "severity": "safe" + }, + "sexual": { + "filtered": false, + "severity": "safe" + }, + "violence": { + "filtered": false, + "severity": "safe" + } + } + } + ], + "system_fingerprint": null, + "usage": { + "completion_tokens": 20, + "prompt_tokens": 144, + "total_tokens": 164 + } + } + headers: + Cache-Control: + - no-cache, must-revalidate + Content-Length: + - '780' + Content-Type: + - application/json + Date: + - Wed, 13 Nov 2024 02:50:25 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + access-control-allow-origin: + - '*' + apim-request-id: + - d0d1d8a8-c031-48c8-b8f5-20fa4a9789ed + azureml-model-session: + - d160-20241010151341 + openai-organization: test_openai_org_id + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-ms-client-request-id: + - d0d1d8a8-c031-48c8-b8f5-20fa4a9789ed + x-ms-rai-invoked: + - 'true' + x-ms-region: + - Switzerland North + x-ratelimit-remaining-requests: + - '71' + x-ratelimit-remaining-tokens: + - '79580' + x-request-id: + - 14c4426a-d72d-4c3c-aa90-5026d7d7e314 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_message_content_span_events[openai_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_message_content_span_events[openai_provider_chat_completions].yaml new file mode 100644 index 0000000..914e6e8 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_message_content_span_events[openai_provider_chat_completions].yaml @@ -0,0 +1,177 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "system", + "content": "You are a helpful customer support assistant. Use the supplied tools to assist the user." + }, + { + "role": "user", + "content": "Hi, can you tell me the delivery date for my order?" + }, + { + "role": "assistant", + "content": "Hi there! I can help with that. Can you please provide your order ID?" + }, + { + "role": "user", + "content": "i think it is order_12345" + } + ], + "model": "gpt-4o-mini", + "tools": [ + { + "type": "function", + "function": { + "name": "get_delivery_date", + "description": "Get the delivery date for a customer's order. Call this whenever you need to know the delivery date, for example when a customer asks 'Where is my package'", + "parameters": { + "type": "object", + "properties": { + "order_id": { + "type": "string", + "description": "The customer's order ID." + } + }, + "required": [ + "order_id" + ], + "additionalProperties": false + } + } + } + ] + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '842' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - AsyncOpenAI/Python 1.54.3 + x-stainless-arch: + - arm64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.54.3 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: |- + { + "id": "chatcmpl-ASfaRyXEFFt9GzMooIy1bDXqjYnWV", + "object": "chat.completion", + "created": 1731396407, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_fW4XFpzxFZ7Rfj5dsDcZTezg", + "type": "function", + "function": { + "name": "get_delivery_date", + "arguments": "{\"order_id\":\"order_12345\"}" + } + } + ], + "refusal": null + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 140, + "completion_tokens": 19, + "total_tokens": 159, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "system_fingerprint": "fp_0ba0d124f1" + } + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8e14cbb9deeb49d2-SIN + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 12 Nov 2024 07:26:48 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + content-length: + - '1046' + openai-organization: test_openai_org_key + openai-processing-ms: + - '711' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9979' + x-ratelimit-remaining-tokens: + - '199921' + x-ratelimit-reset-requests: + - 2m57.53s + x-ratelimit-reset-tokens: + - 23ms + x-request-id: + - req_fb7b2d2cbb3f604371ed39bd6692351b + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content[azure_provider_chat_completions].yaml index 62e5895..cb842ef 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content[azure_provider_chat_completions].yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content[azure_provider_chat_completions].yaml @@ -80,8 +80,8 @@ interactions: } } ], - "created": 1731466210, - "id": "chatcmpl-ASxkIgV0VKpWeEuyJHsem9UEl4fAt", + "created": 1731466211, + "id": "chatcmpl-ASxkJuCwyegZk4W2awEhTKyCzstRr", "model": "gpt-4-32k", "object": "chat.completion", "prompt_filter_results": [ @@ -122,14 +122,14 @@ interactions: Content-Type: - application/json Date: - - Wed, 13 Nov 2024 02:50:10 GMT + - Wed, 13 Nov 2024 02:50:11 GMT Set-Cookie: test_set_cookie Strict-Transport-Security: - max-age=31536000; includeSubDomains; preload access-control-allow-origin: - '*' apim-request-id: - - 47b7e79e-0daf-4994-83c4-a9d0217af3b7 + - 2e550e5e-cd45-45db-bec2-e97407157e0b azureml-model-session: - d161-20241010160330 openai-organization: test_openai_org_id @@ -138,17 +138,17 @@ interactions: x-content-type-options: - nosniff x-ms-client-request-id: - - 47b7e79e-0daf-4994-83c4-a9d0217af3b7 + - 2e550e5e-cd45-45db-bec2-e97407157e0b x-ms-rai-invoked: - 'true' x-ms-region: - Switzerland North x-ratelimit-remaining-requests: - - '73' + - '72' x-ratelimit-remaining-tokens: - - '79788' + - '79772' x-request-id: - - 3d6bc529-270c-4ee1-b864-752625329806 + - 5e997357-cafa-48b1-ad07-54ea52e08894 status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content[ollama_provider_chat_completions].yaml index 4f57f6c..c2ace9b 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content[ollama_provider_chat_completions].yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content[ollama_provider_chat_completions].yaml @@ -49,7 +49,7 @@ interactions: body: string: |- { - "id": "chatcmpl-433", + "id": "chatcmpl-913", "object": "chat.completion", "created": 1731311782, "model": "qwen2.5:0.5b", @@ -59,20 +59,20 @@ interactions: "index": 0, "message": { "role": "assistant", - "content": "The Atlantic Ocean." + "content": "Atlantic Ocean" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 46, - "completion_tokens": 5, - "total_tokens": 51 + "completion_tokens": 3, + "total_tokens": 49 } } headers: Content-Length: - - '305' + - '300' Content-Type: - application/json Date: diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content[openai_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content[openai_provider_chat_completions].yaml index b1e1c2a..8449c57 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content[openai_provider_chat_completions].yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content[openai_provider_chat_completions].yaml @@ -49,9 +49,9 @@ interactions: body: string: |- { - "id": "chatcmpl-ASfaC6FMNUKWFqBJmf9rmRluWyRAF", + "id": "chatcmpl-ASfaDugIT60RnKtXL11x7yXKEn7WK", "object": "chat.completion", - "created": 1731396392, + "created": 1731396393, "model": "gpt-4o-mini-2024-07-18", "choices": [ { @@ -80,19 +80,19 @@ interactions: "rejected_prediction_tokens": 0 } }, - "system_fingerprint": "fp_9b78b61c52" + "system_fingerprint": "fp_0ba0d124f1" } headers: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8e14cb5db8012eb6-SIN + - 8e14cb6299a3ce22-SIN Connection: - keep-alive Content-Type: - application/json Date: - - Tue, 12 Nov 2024 07:26:33 GMT + - Tue, 12 Nov 2024 07:26:34 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -108,7 +108,7 @@ interactions: - '771' openai-organization: test_openai_org_key openai-processing-ms: - - '386' + - '504' openai-version: - '2020-10-01' strict-transport-security: @@ -118,15 +118,15 @@ interactions: x-ratelimit-limit-tokens: - '200000' x-ratelimit-remaining-requests: - - '9993' + - '9992' x-ratelimit-remaining-tokens: - '199966' x-ratelimit-reset-requests: - - 54.04s + - 1m1.903s x-ratelimit-reset-tokens: - 10ms x-request-id: - - req_3e642cdb3e05072702a405418b9d3455 + - req_e81f4f9516fa6a28cfe3a0141cfb12fb status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content_span_events[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content_span_events[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..62e5895 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content_span_events[azure_provider_chat_completions].yaml @@ -0,0 +1,155 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?" + } + ], + "model": "unused" + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + api-key: + - test_azure_api_key + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '133' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AzureOpenAI/Python 1.54.3 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.54.3 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2024-08-01-preview + response: + body: + string: |- + { + "choices": [ + { + "content_filter_results": { + "hate": { + "filtered": false, + "severity": "safe" + }, + "self_harm": { + "filtered": false, + "severity": "safe" + }, + "sexual": { + "filtered": false, + "severity": "safe" + }, + "violence": { + "filtered": false, + "severity": "safe" + } + }, + "finish_reason": "stop", + "index": 0, + "logprobs": null, + "message": { + "content": "Atlantic Ocean", + "role": "assistant" + } + } + ], + "created": 1731466210, + "id": "chatcmpl-ASxkIgV0VKpWeEuyJHsem9UEl4fAt", + "model": "gpt-4-32k", + "object": "chat.completion", + "prompt_filter_results": [ + { + "prompt_index": 0, + "content_filter_results": { + "hate": { + "filtered": false, + "severity": "safe" + }, + "self_harm": { + "filtered": false, + "severity": "safe" + }, + "sexual": { + "filtered": false, + "severity": "safe" + }, + "violence": { + "filtered": false, + "severity": "safe" + } + } + } + ], + "system_fingerprint": null, + "usage": { + "completion_tokens": 2, + "prompt_tokens": 24, + "total_tokens": 26 + } + } + headers: + Cache-Control: + - no-cache, must-revalidate + Content-Length: + - '805' + Content-Type: + - application/json + Date: + - Wed, 13 Nov 2024 02:50:10 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + access-control-allow-origin: + - '*' + apim-request-id: + - 47b7e79e-0daf-4994-83c4-a9d0217af3b7 + azureml-model-session: + - d161-20241010160330 + openai-organization: test_openai_org_id + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-ms-client-request-id: + - 47b7e79e-0daf-4994-83c4-a9d0217af3b7 + x-ms-rai-invoked: + - 'true' + x-ms-region: + - Switzerland North + x-ratelimit-remaining-requests: + - '73' + x-ratelimit-remaining-tokens: + - '79788' + x-request-id: + - 3d6bc529-270c-4ee1-b864-752625329806 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content_span_events[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content_span_events[ollama_provider_chat_completions].yaml new file mode 100644 index 0000000..4f57f6c --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content_span_events[ollama_provider_chat_completions].yaml @@ -0,0 +1,85 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?" + } + ], + "model": "qwen2.5:0.5b" + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '139' + content-type: + - application/json + host: + - localhost:11434 + user-agent: + - OpenAI/Python 1.50.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.50.2 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: http://localhost:11434/v1/chat/completions + response: + body: + string: |- + { + "id": "chatcmpl-433", + "object": "chat.completion", + "created": 1731311782, + "model": "qwen2.5:0.5b", + "system_fingerprint": "fp_ollama", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "The Atlantic Ocean." + }, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 46, + "completion_tokens": 5, + "total_tokens": 51 + } + } + headers: + Content-Length: + - '305' + Content-Type: + - application/json + Date: + - Mon, 11 Nov 2024 07:56:22 GMT + Set-Cookie: test_set_cookie + openai-organization: test_openai_org_key + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content_span_events[openai_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content_span_events[openai_provider_chat_completions].yaml new file mode 100644 index 0000000..b1e1c2a --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_message_content_span_events[openai_provider_chat_completions].yaml @@ -0,0 +1,133 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?" + } + ], + "model": "gpt-4o-mini" + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '138' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.54.3 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.54.3 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: |- + { + "id": "chatcmpl-ASfaC6FMNUKWFqBJmf9rmRluWyRAF", + "object": "chat.completion", + "created": 1731396392, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "South Atlantic Ocean.", + "refusal": null + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 24, + "completion_tokens": 4, + "total_tokens": 28, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "system_fingerprint": "fp_9b78b61c52" + } + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8e14cb5db8012eb6-SIN + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 12 Nov 2024 07:26:33 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + content-length: + - '771' + openai-organization: test_openai_org_key + openai-processing-ms: + - '386' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9993' + x-ratelimit-remaining-tokens: + - '199966' + x-ratelimit-reset-requests: + - 54.04s + x-ratelimit-reset-tokens: + - 10ms + x-request-id: + - req_3e642cdb3e05072702a405418b9d3455 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_multiple_choices_with_capture_message_content[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_multiple_choices_with_capture_message_content[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..02c52bf --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_multiple_choices_with_capture_message_content[azure_provider_chat_completions].yaml @@ -0,0 +1,183 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?" + } + ], + "model": "unused", + "n": 2 + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + api-key: + - test_azure_api_key + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '141' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AzureOpenAI/Python 1.54.3 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.54.3 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2024-08-01-preview + response: + body: + string: |- + { + "choices": [ + { + "content_filter_results": { + "hate": { + "filtered": false, + "severity": "safe" + }, + "self_harm": { + "filtered": false, + "severity": "safe" + }, + "sexual": { + "filtered": false, + "severity": "safe" + }, + "violence": { + "filtered": false, + "severity": "safe" + } + }, + "finish_reason": "stop", + "index": 0, + "logprobs": null, + "message": { + "content": "Atlantic Ocean", + "role": "assistant" + } + }, + { + "content_filter_results": { + "hate": { + "filtered": false, + "severity": "safe" + }, + "self_harm": { + "filtered": false, + "severity": "safe" + }, + "sexual": { + "filtered": false, + "severity": "safe" + }, + "violence": { + "filtered": false, + "severity": "safe" + } + }, + "finish_reason": "stop", + "index": 1, + "logprobs": null, + "message": { + "content": "Atlantic Ocean", + "role": "assistant" + } + } + ], + "created": 1731466204, + "id": "chatcmpl-ASxkC12M7RgRDgP5GjnYlUwEWQEDo", + "model": "gpt-4-32k", + "object": "chat.completion", + "prompt_filter_results": [ + { + "prompt_index": 0, + "content_filter_results": { + "hate": { + "filtered": false, + "severity": "safe" + }, + "self_harm": { + "filtered": false, + "severity": "safe" + }, + "sexual": { + "filtered": false, + "severity": "safe" + }, + "violence": { + "filtered": false, + "severity": "safe" + } + } + } + ], + "system_fingerprint": null, + "usage": { + "completion_tokens": 4, + "prompt_tokens": 24, + "total_tokens": 28 + } + } + headers: + Cache-Control: + - no-cache, must-revalidate + Content-Length: + - '1128' + Content-Type: + - application/json + Date: + - Wed, 13 Nov 2024 02:50:03 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + access-control-allow-origin: + - '*' + apim-request-id: + - 30e4b1c2-2a66-474f-9158-8043d27f11a2 + azureml-model-session: + - d156-20241010120317 + openai-organization: test_openai_org_id + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-ms-client-request-id: + - 30e4b1c2-2a66-474f-9158-8043d27f11a2 + x-ms-rai-invoked: + - 'true' + x-ms-region: + - Switzerland North + x-ratelimit-remaining-requests: + - '77' + x-ratelimit-remaining-tokens: + - '79852' + x-request-id: + - 63e3a77f-5291-4257-ba2e-26049d2da567 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_multiple_choices_with_capture_message_content[openai_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_multiple_choices_with_capture_message_content[openai_provider_chat_completions].yaml new file mode 100644 index 0000000..748b79e --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_multiple_choices_with_capture_message_content[openai_provider_chat_completions].yaml @@ -0,0 +1,144 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?" + } + ], + "model": "gpt-4o-mini", + "n": 2 + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '146' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.54.3 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.54.3 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: |- + { + "id": "chatcmpl-ASfa8r4rkn4OQSmqDqjdHf2UtP4Gn", + "object": "chat.completion", + "created": 1731396388, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "South Atlantic Ocean.", + "refusal": null + }, + "logprobs": null, + "finish_reason": "stop" + }, + { + "index": 1, + "message": { + "role": "assistant", + "content": "South Atlantic Ocean.", + "refusal": null + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 24, + "completion_tokens": 8, + "total_tokens": 32, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "system_fingerprint": "fp_0ba0d124f1" + } + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8e14cb3e397c40c8-SIN + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 12 Nov 2024 07:26:28 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + content-length: + - '981' + openai-organization: test_openai_org_key + openai-processing-ms: + - '485' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9997' + x-ratelimit-remaining-tokens: + - '199950' + x-ratelimit-reset-requests: + - 24.512s + x-ratelimit-reset-tokens: + - 15ms + x-request-id: + - req_73c1d28e478e50ab120bd3f3a25eee76 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_parallel_tools_and_capture_message_content[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_parallel_tools_and_capture_message_content[ollama_provider_chat_completions].yaml index ac300a7..1cde55f 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_parallel_tools_and_capture_message_content[ollama_provider_chat_completions].yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_parallel_tools_and_capture_message_content[ollama_provider_chat_completions].yaml @@ -74,89 +74,101 @@ interactions: response: body: string: |+ - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\u003ctool_call\u003e"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\u003ctool_call\u003e"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"{\""},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"{\""},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"name"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"name"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"get"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"get"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_weather"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_weather"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\","},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\","},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"arguments"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"arguments"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" {\""},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" {\""},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"location"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"location"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"New"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"New"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" York"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" York"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" City"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" City"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\"}}\n"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\u003c/tool_call\u003e"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" New"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" York"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\u003ctool_call\u003e"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\"}}\n"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\u003c/tool_call\u003e"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"{\""},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"name"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\u003ctool_call\u003e"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"{\""},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"get"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"name"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_weather"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\","},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"get"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"arguments"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_weather"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\","},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" {\""},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"location"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"arguments"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" {\""},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"London"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"location"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\"}}\n"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\u003c/tool_call\u003e"},"finish_reason":null}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} - data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"London"},"finish_reason":null}]} + + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null}]} + + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311784,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" United"},"finish_reason":null}]} + + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311784,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" Kingdom"},"finish_reason":null}]} + + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311784,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\"}}\n"},"finish_reason":null}]} + + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311784,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\u003c/tool_call\u003e"},"finish_reason":null}]} + + data: {"id":"chatcmpl-563","object":"chat.completion.chunk","created":1731311784,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} data: [DONE] diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_parallel_tools_and_capture_message_content[openai_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_parallel_tools_and_capture_message_content[openai_provider_chat_completions].yaml index a557c38..c51e65a 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_parallel_tools_and_capture_message_content[openai_provider_chat_completions].yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_parallel_tools_and_capture_message_content[openai_provider_chat_completions].yaml @@ -74,35 +74,35 @@ interactions: response: body: string: |+ - data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"role":"assistant","content":null},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaJQVIzX3LUZllbc5hR0NnEzs0b","object":"chat.completion.chunk","created":1731396399,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"role":"assistant","content":null},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"id":"call_awpPik83NVMEmnWIARc49DVf","type":"function","function":{"name":"get_weather","arguments":""}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaJQVIzX3LUZllbc5hR0NnEzs0b","object":"chat.completion.chunk","created":1731396399,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"id":"call_9nzwliy6hCnTQuvkNdULIFkr","type":"function","function":{"name":"get_weather","arguments":""}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\"lo"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaJQVIzX3LUZllbc5hR0NnEzs0b","object":"chat.completion.chunk","created":1731396399,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\"lo"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"catio"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaJQVIzX3LUZllbc5hR0NnEzs0b","object":"chat.completion.chunk","created":1731396399,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"catio"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n\": \"N"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaJQVIzX3LUZllbc5hR0NnEzs0b","object":"chat.completion.chunk","created":1731396399,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n\": \"N"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ew Y"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaJQVIzX3LUZllbc5hR0NnEzs0b","object":"chat.completion.chunk","created":1731396399,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ew Y"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ork C"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaJQVIzX3LUZllbc5hR0NnEzs0b","object":"chat.completion.chunk","created":1731396399,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ork C"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ity\"}"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaJQVIzX3LUZllbc5hR0NnEzs0b","object":"chat.completion.chunk","created":1731396399,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ity\"}"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"id":"call_LPkfKwdcq3Tqg06fTFVIDcV5","type":"function","function":{"name":"get_weather","arguments":""}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaJQVIzX3LUZllbc5hR0NnEzs0b","object":"chat.completion.chunk","created":1731396399,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"id":"call_3WjOCSgcSXK5YPOuP6GMwncg","type":"function","function":{"name":"get_weather","arguments":""}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"{\"lo"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaJQVIzX3LUZllbc5hR0NnEzs0b","object":"chat.completion.chunk","created":1731396399,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"{\"lo"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"catio"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaJQVIzX3LUZllbc5hR0NnEzs0b","object":"chat.completion.chunk","created":1731396399,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"catio"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"n\": \"L"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaJQVIzX3LUZllbc5hR0NnEzs0b","object":"chat.completion.chunk","created":1731396399,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"n\": \"L"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"ondo"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaJQVIzX3LUZllbc5hR0NnEzs0b","object":"chat.completion.chunk","created":1731396399,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"ondo"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"n\"}"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaJQVIzX3LUZllbc5hR0NnEzs0b","object":"chat.completion.chunk","created":1731396399,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"n\"}"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"tool_calls"}]} + data: {"id":"chatcmpl-ASfaJQVIzX3LUZllbc5hR0NnEzs0b","object":"chat.completion.chunk","created":1731396399,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"tool_calls"}]} data: [DONE] @@ -110,13 +110,13 @@ interactions: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8e14cb7bcd51ce22-SIN + - 8e14cb863b3d81e4-SIN Connection: - keep-alive Content-Type: - text/event-stream; charset=utf-8 Date: - - Tue, 12 Nov 2024 07:26:38 GMT + - Tue, 12 Nov 2024 07:26:40 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -130,7 +130,7 @@ interactions: - h3=":443"; ma=86400 openai-organization: test_openai_org_key openai-processing-ms: - - '1268' + - '946' openai-version: - '2020-10-01' strict-transport-security: @@ -140,15 +140,15 @@ interactions: x-ratelimit-limit-tokens: - '200000' x-ratelimit-remaining-requests: - - '9988' + - '9987' x-ratelimit-remaining-tokens: - '199956' x-ratelimit-reset-requests: - - 1m41.081s + - 1m48.017s x-ratelimit-reset-tokens: - 13ms x-request-id: - - req_b2971ad760eb9f1fb8ec7bc289fba757 + - req_e491a8e67eab26b2f434f15dee77d4c7 status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_parallel_tools_and_capture_message_content_span_events[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_parallel_tools_and_capture_message_content_span_events[ollama_provider_chat_completions].yaml new file mode 100644 index 0000000..ac300a7 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_parallel_tools_and_capture_message_content_span_events[ollama_provider_chat_completions].yaml @@ -0,0 +1,175 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "system", + "content": "You are a helpful assistant providing weather updates." + }, + { + "role": "user", + "content": "What is the weather in New York City and London?" + } + ], + "model": "qwen2.5:0.5b", + "stream": true, + "tools": [ + { + "type": "function", + "function": { + "name": "get_weather", + "strict": true, + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string" + } + }, + "required": [ + "location" + ], + "additionalProperties": false + } + } + } + ] + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '450' + content-type: + - application/json + host: + - localhost:11434 + user-agent: + - OpenAI/Python 1.50.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.50.2 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: http://localhost:11434/v1/chat/completions + response: + body: + string: |+ + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\u003ctool_call\u003e"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"{\""},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"name"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"get"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_weather"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\","},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"arguments"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" {\""},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"location"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"New"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" York"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" City"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\"}}\n"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\u003c/tool_call\u003e"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\u003ctool_call\u003e"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"{\""},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"name"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"get"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_weather"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\","},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"arguments"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" {\""},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"location"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"London"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\"}}\n"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\u003c/tool_call\u003e"},"finish_reason":null}]} + + data: {"id":"chatcmpl-918","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + Date: + - Mon, 11 Nov 2024 07:56:23 GMT + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + openai-organization: test_openai_org_key + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_parallel_tools_and_capture_message_content_span_events[openai_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_parallel_tools_and_capture_message_content_span_events[openai_provider_chat_completions].yaml new file mode 100644 index 0000000..a557c38 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_parallel_tools_and_capture_message_content_span_events[openai_provider_chat_completions].yaml @@ -0,0 +1,155 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "system", + "content": "You are a helpful assistant providing weather updates." + }, + { + "role": "user", + "content": "What is the weather in New York City and London?" + } + ], + "model": "gpt-4o-mini", + "stream": true, + "tools": [ + { + "type": "function", + "function": { + "name": "get_weather", + "strict": true, + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string" + } + }, + "required": [ + "location" + ], + "additionalProperties": false + } + } + } + ] + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '449' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.54.3 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.54.3 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: |+ + data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"role":"assistant","content":null},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"id":"call_awpPik83NVMEmnWIARc49DVf","type":"function","function":{"name":"get_weather","arguments":""}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\"lo"}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"catio"}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n\": \"N"}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ew Y"}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ork C"}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ity\"}"}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"id":"call_LPkfKwdcq3Tqg06fTFVIDcV5","type":"function","function":{"name":"get_weather","arguments":""}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"{\"lo"}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"catio"}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"n\": \"L"}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"ondo"}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"n\"}"}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaHUbWaDoK0qGijDZO8PwY9efB7","object":"chat.completion.chunk","created":1731396397,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"tool_calls"}]} + + data: [DONE] + + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8e14cb7bcd51ce22-SIN + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Tue, 12 Nov 2024 07:26:38 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + openai-organization: test_openai_org_key + openai-processing-ms: + - '1268' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9988' + x-ratelimit-remaining-tokens: + - '199956' + x-ratelimit-reset-requests: + - 1m41.081s + x-ratelimit-reset-tokens: + - 13ms + x-request-id: + - req_b2971ad760eb9f1fb8ec7bc289fba757 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content[azure_provider_chat_completions].yaml index 2de43cc..4319728 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content[azure_provider_chat_completions].yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content[azure_provider_chat_completions].yaml @@ -87,35 +87,35 @@ interactions: string: |+ data: {"choices":[],"created":0,"id":"","model":"","object":"","prompt_filter_results":[{"prompt_index":0,"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}}}]} - data: {"choices":[{"content_filter_results":{},"delta":{"content":null,"role":"assistant","tool_calls":[{"function":{"arguments":"","name":"get_delivery_date"},"id":"call_hR2GEOnGJhmLsHHsMgfLuICf","index":0,"type":"function"}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + data: {"choices":[{"content_filter_results":{},"delta":{"content":null,"role":"assistant","tool_calls":[{"function":{"arguments":"","name":"get_delivery_date"},"id":"call_U0QYBadhpy4pBO6jYPm09KvZ","index":0,"type":"function"}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466216,"id":"chatcmpl-ASxkOzfrRK9uiquPJ2AH90npzayEy","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} - data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"{\n"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"{\n"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466216,"id":"chatcmpl-ASxkOzfrRK9uiquPJ2AH90npzayEy","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} - data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":" "},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":" "},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466216,"id":"chatcmpl-ASxkOzfrRK9uiquPJ2AH90npzayEy","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} - data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":" \""},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":" \""},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466216,"id":"chatcmpl-ASxkOzfrRK9uiquPJ2AH90npzayEy","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} - data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"order"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"order"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466216,"id":"chatcmpl-ASxkOzfrRK9uiquPJ2AH90npzayEy","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} - data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"_id"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"_id"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466216,"id":"chatcmpl-ASxkOzfrRK9uiquPJ2AH90npzayEy","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} - data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"\":"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"\":"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466216,"id":"chatcmpl-ASxkOzfrRK9uiquPJ2AH90npzayEy","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} - data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":" \""},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":" \""},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466216,"id":"chatcmpl-ASxkOzfrRK9uiquPJ2AH90npzayEy","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} - data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"order"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"order"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466216,"id":"chatcmpl-ASxkOzfrRK9uiquPJ2AH90npzayEy","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} - data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"_"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"_"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466216,"id":"chatcmpl-ASxkOzfrRK9uiquPJ2AH90npzayEy","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} - data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"123"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"123"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466216,"id":"chatcmpl-ASxkOzfrRK9uiquPJ2AH90npzayEy","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} - data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"45"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"45"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466216,"id":"chatcmpl-ASxkOzfrRK9uiquPJ2AH90npzayEy","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} - data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"\"\n"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"\"\n"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466216,"id":"chatcmpl-ASxkOzfrRK9uiquPJ2AH90npzayEy","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} - data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"}"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"}"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466216,"id":"chatcmpl-ASxkOzfrRK9uiquPJ2AH90npzayEy","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} - data: {"choices":[{"content_filter_results":{},"delta":{},"finish_reason":"tool_calls","index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + data: {"choices":[{"content_filter_results":{},"delta":{},"finish_reason":"tool_calls","index":0,"logprobs":null}],"created":1731466216,"id":"chatcmpl-ASxkOzfrRK9uiquPJ2AH90npzayEy","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} data: [DONE] @@ -125,7 +125,7 @@ interactions: Content-Type: - text/event-stream Date: - - Wed, 13 Nov 2024 02:50:14 GMT + - Wed, 13 Nov 2024 02:50:16 GMT Set-Cookie: test_set_cookie Strict-Transport-Security: - max-age=31536000; includeSubDomains; preload @@ -134,7 +134,7 @@ interactions: access-control-allow-origin: - '*' apim-request-id: - - 0fd69d8a-a962-41e2-afe5-61f4a011d059 + - da236390-adf8-4a46-951f-6d22048b64fa azureml-model-session: - d156-20241010120317 openai-organization: test_openai_org_id @@ -143,7 +143,7 @@ interactions: x-content-type-options: - nosniff x-ms-client-request-id: - - 0fd69d8a-a962-41e2-afe5-61f4a011d059 + - da236390-adf8-4a46-951f-6d22048b64fa x-ms-rai-invoked: - 'true' x-ms-region: @@ -151,9 +151,9 @@ interactions: x-ratelimit-remaining-requests: - '72' x-ratelimit-remaining-tokens: - - '79724' + - '79708' x-request-id: - - 947b357e-4e8f-41f6-a941-1e5390c3e7b0 + - 02e4f6fa-5163-4157-9a96-40b2c353e1c4 status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content[ollama_provider_chat_completions].yaml index 429d402..35fc346 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content[ollama_provider_chat_completions].yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content[ollama_provider_chat_completions].yaml @@ -83,61 +83,61 @@ interactions: response: body: string: |+ - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\u003ctool_call\u003e"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\u003ctool_call\u003e"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"{\""},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"{\""},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"name"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"name"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"get"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"get"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_delivery"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_delivery"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_date"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_date"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\","},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\","},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"arguments"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"arguments"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" {\""},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" {\""},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"order"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"order"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_id"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_id"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"order"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"order"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"2"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"2"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"3"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"3"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"4"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"4"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"5"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"5"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\"}}\n"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\"}}\n"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\u003c/tool_call\u003e"},"finish_reason":null}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\u003c/tool_call\u003e"},"finish_reason":null}]} - data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} + data: {"id":"chatcmpl-749","object":"chat.completion.chunk","created":1731311783,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} data: [DONE] @@ -145,7 +145,7 @@ interactions: Content-Type: - text/event-stream Date: - - Mon, 11 Nov 2024 07:56:22 GMT + - Mon, 11 Nov 2024 07:56:23 GMT Set-Cookie: test_set_cookie Transfer-Encoding: - chunked diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content[openai_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content[openai_provider_chat_completions].yaml index 15be4e5..4b54eb7 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content[openai_provider_chat_completions].yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content[openai_provider_chat_completions].yaml @@ -83,27 +83,27 @@ interactions: response: body: string: |+ - data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_RlWXV8zAJhzxsh6JqMHY0HbV","type":"function","function":{"name":"get_delivery_date","arguments":""}}],"refusal":null},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaGWIziiqvP4PoufIFi3K2p2caY","object":"chat.completion.chunk","created":1731396396,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_oEbEusT5nkkAiGgypUSDwK7k","type":"function","function":{"name":"get_delivery_date","arguments":""}}],"refusal":null},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaGWIziiqvP4PoufIFi3K2p2caY","object":"chat.completion.chunk","created":1731396396,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"order"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaGWIziiqvP4PoufIFi3K2p2caY","object":"chat.completion.chunk","created":1731396396,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"order"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_id"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaGWIziiqvP4PoufIFi3K2p2caY","object":"chat.completion.chunk","created":1731396396,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_id"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaGWIziiqvP4PoufIFi3K2p2caY","object":"chat.completion.chunk","created":1731396396,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"order"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaGWIziiqvP4PoufIFi3K2p2caY","object":"chat.completion.chunk","created":1731396396,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"order"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaGWIziiqvP4PoufIFi3K2p2caY","object":"chat.completion.chunk","created":1731396396,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"123"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaGWIziiqvP4PoufIFi3K2p2caY","object":"chat.completion.chunk","created":1731396396,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"123"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"45"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaGWIziiqvP4PoufIFi3K2p2caY","object":"chat.completion.chunk","created":1731396396,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"45"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-ASfaGWIziiqvP4PoufIFi3K2p2caY","object":"chat.completion.chunk","created":1731396396,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"tool_calls"}]} + data: {"id":"chatcmpl-ASfaGWIziiqvP4PoufIFi3K2p2caY","object":"chat.completion.chunk","created":1731396396,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"tool_calls"}]} data: [DONE] @@ -111,13 +111,13 @@ interactions: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8e14cb707e5f81e4-SIN + - 8e14cb7608622eb6-SIN Connection: - keep-alive Content-Type: - text/event-stream; charset=utf-8 Date: - - Tue, 12 Nov 2024 07:26:36 GMT + - Tue, 12 Nov 2024 07:26:37 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -131,7 +131,7 @@ interactions: - h3=":443"; ma=86400 openai-organization: test_openai_org_key openai-processing-ms: - - '328' + - '371' openai-version: - '2020-10-01' strict-transport-security: @@ -141,15 +141,15 @@ interactions: x-ratelimit-limit-tokens: - '200000' x-ratelimit-remaining-requests: - - '9990' + - '9989' x-ratelimit-remaining-tokens: - '199921' x-ratelimit-reset-requests: - - 1m25.566s + - 1m33.35s x-ratelimit-reset-tokens: - 23ms x-request-id: - - req_a4c989b5de9332354762cf40ddf1c95a + - req_e7a1e495bed22af5cdd9cbe68b48e14b status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content_span_events[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content_span_events[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..2de43cc --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content_span_events[azure_provider_chat_completions].yaml @@ -0,0 +1,160 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "system", + "content": "You are a helpful customer support assistant. Use the supplied tools to assist the user." + }, + { + "role": "user", + "content": "Hi, can you tell me the delivery date for my order?" + }, + { + "role": "assistant", + "content": "Hi there! I can help with that. Can you please provide your order ID?" + }, + { + "role": "user", + "content": "i think it is order_12345" + } + ], + "model": "unused", + "stream": true, + "tools": [ + { + "type": "function", + "function": { + "name": "get_delivery_date", + "description": "Get the delivery date for a customer's order. Call this whenever you need to know the delivery date, for example when a customer asks 'Where is my package'", + "parameters": { + "type": "object", + "properties": { + "order_id": { + "type": "string", + "description": "The customer's order ID." + } + }, + "required": [ + "order_id" + ], + "additionalProperties": false + } + } + } + ] + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + api-key: + - test_azure_api_key + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '853' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AzureOpenAI/Python 1.54.3 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.54.3 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2024-08-01-preview + response: + body: + string: |+ + data: {"choices":[],"created":0,"id":"","model":"","object":"","prompt_filter_results":[{"prompt_index":0,"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}}}]} + + data: {"choices":[{"content_filter_results":{},"delta":{"content":null,"role":"assistant","tool_calls":[{"function":{"arguments":"","name":"get_delivery_date"},"id":"call_hR2GEOnGJhmLsHHsMgfLuICf","index":0,"type":"function"}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"{\n"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":" "},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":" \""},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"order"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"_id"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"\":"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":" \""},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"order"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"_"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"123"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"45"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"\"\n"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + + data: {"choices":[{"content_filter_results":{},"delta":{"tool_calls":[{"function":{"arguments":"}"},"index":0}]},"finish_reason":null,"index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + + data: {"choices":[{"content_filter_results":{},"delta":{},"finish_reason":"tool_calls","index":0,"logprobs":null}],"created":1731466214,"id":"chatcmpl-ASxkMa2HB9hyfwSNjCqVUwX2txxqr","model":"gpt-4-32k","object":"chat.completion.chunk","system_fingerprint":null} + + data: [DONE] + + headers: + Cache-Control: + - no-cache, must-revalidate + Content-Type: + - text/event-stream + Date: + - Wed, 13 Nov 2024 02:50:14 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + access-control-allow-origin: + - '*' + apim-request-id: + - 0fd69d8a-a962-41e2-afe5-61f4a011d059 + azureml-model-session: + - d156-20241010120317 + openai-organization: test_openai_org_id + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-ms-client-request-id: + - 0fd69d8a-a962-41e2-afe5-61f4a011d059 + x-ms-rai-invoked: + - 'true' + x-ms-region: + - Switzerland North + x-ratelimit-remaining-requests: + - '72' + x-ratelimit-remaining-tokens: + - '79724' + x-request-id: + - 947b357e-4e8f-41f6-a941-1e5390c3e7b0 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content_span_events[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content_span_events[ollama_provider_chat_completions].yaml new file mode 100644 index 0000000..429d402 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content_span_events[ollama_provider_chat_completions].yaml @@ -0,0 +1,156 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "system", + "content": "You are a helpful customer support assistant. Use the supplied tools to assist the user." + }, + { + "role": "user", + "content": "Hi, can you tell me the delivery date for my order?" + }, + { + "role": "assistant", + "content": "Hi there! I can help with that. Can you please provide your order ID?" + }, + { + "role": "user", + "content": "i think it is order_12345" + } + ], + "model": "qwen2.5:0.5b", + "stream": true, + "tools": [ + { + "type": "function", + "function": { + "name": "get_delivery_date", + "description": "Get the delivery date for a customer's order. Call this whenever you need to know the delivery date, for example when a customer asks 'Where is my package'", + "parameters": { + "type": "object", + "properties": { + "order_id": { + "type": "string", + "description": "The customer's order ID." + } + }, + "required": [ + "order_id" + ], + "additionalProperties": false + } + } + } + ] + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '859' + content-type: + - application/json + host: + - localhost:11434 + user-agent: + - OpenAI/Python 1.50.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.50.2 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: http://localhost:11434/v1/chat/completions + response: + body: + string: |+ + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\u003ctool_call\u003e"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"{\""},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"name"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"get"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_delivery"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_date"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\","},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"arguments"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" {\""},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"order"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_id"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"order"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"2"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"3"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"4"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"5"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\"}}\n"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\u003c/tool_call\u003e"},"finish_reason":null}]} + + data: {"id":"chatcmpl-268","object":"chat.completion.chunk","created":1731311782,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + Date: + - Mon, 11 Nov 2024 07:56:22 GMT + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + openai-organization: test_openai_org_key + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content_span_events[openai_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content_span_events[openai_provider_chat_completions].yaml new file mode 100644 index 0000000..15be4e5 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_message_content_span_events[openai_provider_chat_completions].yaml @@ -0,0 +1,156 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "system", + "content": "You are a helpful customer support assistant. Use the supplied tools to assist the user." + }, + { + "role": "user", + "content": "Hi, can you tell me the delivery date for my order?" + }, + { + "role": "assistant", + "content": "Hi there! I can help with that. Can you please provide your order ID?" + }, + { + "role": "user", + "content": "i think it is order_12345" + } + ], + "model": "gpt-4o-mini", + "stream": true, + "tools": [ + { + "type": "function", + "function": { + "name": "get_delivery_date", + "description": "Get the delivery date for a customer's order. Call this whenever you need to know the delivery date, for example when a customer asks 'Where is my package'", + "parameters": { + "type": "object", + "properties": { + "order_id": { + "type": "string", + "description": "The customer's order ID." + } + }, + "required": [ + "order_id" + ], + "additionalProperties": false + } + } + } + ] + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '858' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.54.3 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.54.3 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: |+ + data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_RlWXV8zAJhzxsh6JqMHY0HbV","type":"function","function":{"name":"get_delivery_date","arguments":""}}],"refusal":null},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"order"}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_id"}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"order"}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_"}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"123"}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"45"}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"logprobs":null,"finish_reason":null}]} + + data: {"id":"chatcmpl-ASfaFeOMsHtr0F6UH3Q1faiZxSeMX","object":"chat.completion.chunk","created":1731396395,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_0ba0d124f1","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"tool_calls"}]} + + data: [DONE] + + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8e14cb707e5f81e4-SIN + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Tue, 12 Nov 2024 07:26:36 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + openai-organization: test_openai_org_key + openai-processing-ms: + - '328' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9990' + x-ratelimit-remaining-tokens: + - '199921' + x-ratelimit-reset-requests: + - 1m25.566s + x-ratelimit-reset-tokens: + - 23ms + x-request-id: + - req_a4c989b5de9332354762cf40ddf1c95a + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content[azure_provider_chat_completions].yaml index 41384c7..67d1087 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content[azure_provider_chat_completions].yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content[azure_provider_chat_completions].yaml @@ -107,8 +107,8 @@ interactions: } } ], - "created": 1731466206, - "id": "chatcmpl-ASxkERPeCSyiDvA8jyN5dhIpAYryd", + "created": 1731466208, + "id": "chatcmpl-ASxkGiNWw960EEmcHpv6CgIyP6tHy", "model": "gpt-4-32k", "object": "chat.completion", "prompt_filter_results": [ @@ -149,14 +149,14 @@ interactions: Content-Type: - application/json Date: - - Wed, 13 Nov 2024 02:50:07 GMT + - Wed, 13 Nov 2024 02:50:08 GMT Set-Cookie: test_set_cookie Strict-Transport-Security: - max-age=31536000; includeSubDomains; preload access-control-allow-origin: - '*' apim-request-id: - - 9284d670-be85-4101-8dde-1647df437da9 + - f2a2d7bd-955a-41bf-9331-13b30ee4235b azureml-model-session: - d156-20241010120317 openai-organization: test_openai_org_id @@ -165,17 +165,17 @@ interactions: x-content-type-options: - nosniff x-ms-client-request-id: - - 9284d670-be85-4101-8dde-1647df437da9 + - f2a2d7bd-955a-41bf-9331-13b30ee4235b x-ms-rai-invoked: - 'true' x-ms-region: - Switzerland North x-ratelimit-remaining-requests: - - '75' + - '74' x-ratelimit-remaining-tokens: - - '79820' + - '79804' x-request-id: - - c6bbd315-92fa-4d9e-a832-d1cfc9fc0bb2 + - 56967b5f-c563-4d59-af77-891c41dbae2b status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content[ollama_provider_chat_completions].yaml index 853d15e..73e2551 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content[ollama_provider_chat_completions].yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content[ollama_provider_chat_completions].yaml @@ -83,7 +83,7 @@ interactions: body: string: |- { - "id": "chatcmpl-705", + "id": "chatcmpl-695", "object": "chat.completion", "created": 1731311780, "model": "qwen2.5:0.5b", @@ -96,7 +96,7 @@ interactions: "content": "", "tool_calls": [ { - "id": "call_u9zt4jf1", + "id": "call_stzzh47r", "type": "function", "function": { "name": "get_delivery_date", diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content[openai_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content[openai_provider_chat_completions].yaml index c520076..00eafe3 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content[openai_provider_chat_completions].yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content[openai_provider_chat_completions].yaml @@ -83,9 +83,9 @@ interactions: body: string: |- { - "id": "chatcmpl-ASfa9bDXRwPIhzm7t58LNXJLZnBgC", + "id": "chatcmpl-ASfaAdUvnmifbYTNRZYh0TbM7mmTu", "object": "chat.completion", - "created": 1731396389, + "created": 1731396390, "model": "gpt-4o-mini-2024-07-18", "choices": [ { @@ -95,7 +95,7 @@ interactions: "content": null, "tool_calls": [ { - "id": "call_QerODwH75OIstmsLXRkCOy4X", + "id": "call_pWCLNanMRK7W7uEVHK8PzIKU", "type": "function", "function": { "name": "get_delivery_date", @@ -130,13 +130,13 @@ interactions: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8e14cb494bcd401e-SIN + - 8e14cb4f2fa381a1-SIN Connection: - keep-alive Content-Type: - application/json Date: - - Tue, 12 Nov 2024 07:26:30 GMT + - Tue, 12 Nov 2024 07:26:31 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -152,7 +152,7 @@ interactions: - '1046' openai-organization: test_openai_org_key openai-processing-ms: - - '516' + - '480' openai-version: - '2020-10-01' strict-transport-security: @@ -162,15 +162,15 @@ interactions: x-ratelimit-limit-tokens: - '200000' x-ratelimit-remaining-requests: - - '9995' + - '9994' x-ratelimit-remaining-tokens: - '199921' x-ratelimit-reset-requests: - - 40.008s + - 47.726s x-ratelimit-reset-tokens: - 23ms x-request-id: - - req_8c75e0b1c7b908bb414fba6160183ea7 + - req_ccdda6bf020fb93ddd72bcfc2385acc3 status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content_span_events[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content_span_events[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..41384c7 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content_span_events[azure_provider_chat_completions].yaml @@ -0,0 +1,182 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "system", + "content": "You are a helpful customer support assistant. Use the supplied tools to assist the user." + }, + { + "role": "user", + "content": "Hi, can you tell me the delivery date for my order?" + }, + { + "role": "assistant", + "content": "Hi there! I can help with that. Can you please provide your order ID?" + }, + { + "role": "user", + "content": "i think it is order_12345" + } + ], + "model": "unused", + "tools": [ + { + "type": "function", + "function": { + "name": "get_delivery_date", + "description": "Get the delivery date for a customer's order. Call this whenever you need to know the delivery date, for example when a customer asks 'Where is my package'", + "parameters": { + "type": "object", + "properties": { + "order_id": { + "type": "string", + "description": "The customer's order ID." + } + }, + "required": [ + "order_id" + ], + "additionalProperties": false + } + } + } + ] + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + api-key: + - test_azure_api_key + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '837' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AzureOpenAI/Python 1.54.3 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.54.3 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2024-08-01-preview + response: + body: + string: |- + { + "choices": [ + { + "content_filter_results": {}, + "finish_reason": "tool_calls", + "index": 0, + "logprobs": null, + "message": { + "content": null, + "role": "assistant", + "tool_calls": [ + { + "function": { + "arguments": "{\n \"order_id\": \"order_12345\"\n}", + "name": "get_delivery_date" + }, + "id": "call_hR2GEOnGJhmLsHHsMgfLuICf", + "type": "function" + } + ] + } + } + ], + "created": 1731466206, + "id": "chatcmpl-ASxkERPeCSyiDvA8jyN5dhIpAYryd", + "model": "gpt-4-32k", + "object": "chat.completion", + "prompt_filter_results": [ + { + "prompt_index": 0, + "content_filter_results": { + "hate": { + "filtered": false, + "severity": "safe" + }, + "self_harm": { + "filtered": false, + "severity": "safe" + }, + "sexual": { + "filtered": false, + "severity": "safe" + }, + "violence": { + "filtered": false, + "severity": "safe" + } + } + } + ], + "system_fingerprint": null, + "usage": { + "completion_tokens": 20, + "prompt_tokens": 144, + "total_tokens": 164 + } + } + headers: + Cache-Control: + - no-cache, must-revalidate + Content-Length: + - '780' + Content-Type: + - application/json + Date: + - Wed, 13 Nov 2024 02:50:07 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + access-control-allow-origin: + - '*' + apim-request-id: + - 9284d670-be85-4101-8dde-1647df437da9 + azureml-model-session: + - d156-20241010120317 + openai-organization: test_openai_org_id + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-ms-client-request-id: + - 9284d670-be85-4101-8dde-1647df437da9 + x-ms-rai-invoked: + - 'true' + x-ms-region: + - Switzerland North + x-ratelimit-remaining-requests: + - '75' + x-ratelimit-remaining-tokens: + - '79820' + x-request-id: + - c6bbd315-92fa-4d9e-a832-d1cfc9fc0bb2 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content_span_events[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content_span_events[ollama_provider_chat_completions].yaml new file mode 100644 index 0000000..853d15e --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content_span_events[ollama_provider_chat_completions].yaml @@ -0,0 +1,129 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "system", + "content": "You are a helpful customer support assistant. Use the supplied tools to assist the user." + }, + { + "role": "user", + "content": "Hi, can you tell me the delivery date for my order?" + }, + { + "role": "assistant", + "content": "Hi there! I can help with that. Can you please provide your order ID?" + }, + { + "role": "user", + "content": "i think it is order_12345" + } + ], + "model": "qwen2.5:0.5b", + "tools": [ + { + "type": "function", + "function": { + "name": "get_delivery_date", + "description": "Get the delivery date for a customer's order. Call this whenever you need to know the delivery date, for example when a customer asks 'Where is my package'", + "parameters": { + "type": "object", + "properties": { + "order_id": { + "type": "string", + "description": "The customer's order ID." + } + }, + "required": [ + "order_id" + ], + "additionalProperties": false + } + } + } + ] + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '843' + content-type: + - application/json + host: + - localhost:11434 + user-agent: + - OpenAI/Python 1.50.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.50.2 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: http://localhost:11434/v1/chat/completions + response: + body: + string: |- + { + "id": "chatcmpl-705", + "object": "chat.completion", + "created": 1731311780, + "model": "qwen2.5:0.5b", + "system_fingerprint": "fp_ollama", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "", + "tool_calls": [ + { + "id": "call_u9zt4jf1", + "type": "function", + "function": { + "name": "get_delivery_date", + "arguments": "{\"order_id\":\"order_12345\"}" + } + } + ] + }, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 241, + "completion_tokens": 28, + "total_tokens": 269 + } + } + headers: + Content-Length: + - '436' + Content-Type: + - application/json + Date: + - Mon, 11 Nov 2024 07:56:20 GMT + Set-Cookie: test_set_cookie + openai-organization: test_openai_org_key + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content_span_events[openai_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content_span_events[openai_provider_chat_completions].yaml new file mode 100644 index 0000000..c520076 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_message_content_span_events[openai_provider_chat_completions].yaml @@ -0,0 +1,177 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "system", + "content": "You are a helpful customer support assistant. Use the supplied tools to assist the user." + }, + { + "role": "user", + "content": "Hi, can you tell me the delivery date for my order?" + }, + { + "role": "assistant", + "content": "Hi there! I can help with that. Can you please provide your order ID?" + }, + { + "role": "user", + "content": "i think it is order_12345" + } + ], + "model": "gpt-4o-mini", + "tools": [ + { + "type": "function", + "function": { + "name": "get_delivery_date", + "description": "Get the delivery date for a customer's order. Call this whenever you need to know the delivery date, for example when a customer asks 'Where is my package'", + "parameters": { + "type": "object", + "properties": { + "order_id": { + "type": "string", + "description": "The customer's order ID." + } + }, + "required": [ + "order_id" + ], + "additionalProperties": false + } + } + } + ] + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '842' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.54.3 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.54.3 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: |- + { + "id": "chatcmpl-ASfa9bDXRwPIhzm7t58LNXJLZnBgC", + "object": "chat.completion", + "created": 1731396389, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_QerODwH75OIstmsLXRkCOy4X", + "type": "function", + "function": { + "name": "get_delivery_date", + "arguments": "{\"order_id\":\"order_12345\"}" + } + } + ], + "refusal": null + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 140, + "completion_tokens": 19, + "total_tokens": 159, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "system_fingerprint": "fp_0ba0d124f1" + } + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8e14cb494bcd401e-SIN + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 12 Nov 2024 07:26:30 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + content-length: + - '1046' + openai-organization: test_openai_org_key + openai-processing-ms: + - '516' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9995' + x-ratelimit-remaining-tokens: + - '199921' + x-ratelimit-reset-requests: + - 40.008s + x-ratelimit-reset-tokens: + - 23ms + x-request-id: + - req_8c75e0b1c7b908bb414fba6160183ea7 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_followup_and_capture_message_content[openai_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_followup_and_capture_message_content[openai_provider_chat_completions].yaml new file mode 100644 index 0000000..885480b --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_followup_and_capture_message_content[openai_provider_chat_completions].yaml @@ -0,0 +1,342 @@ +interactions: +- request: + body: |- + { + "messages": [ + { + "role": "system", + "content": "You are a helpful assistant providing weather updates." + }, + { + "role": "user", + "content": "What is the weather in New York City and London?" + } + ], + "model": "gpt-4o-mini", + "tools": [ + { + "type": "function", + "function": { + "name": "get_weather", + "strict": true, + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string" + } + }, + "required": [ + "location" + ], + "additionalProperties": false + } + } + } + ] + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '433' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.54.3 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.54.3 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: |- + { + "id": "chatcmpl-ASfaKW9DIuWmmJIEpHKl6zpB87fQk", + "object": "chat.completion", + "created": 1731396400, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_PDht93e7bo48a7PyiyUcmK97", + "type": "function", + "function": { + "name": "get_weather", + "arguments": "{\"location\": \"New York City\"}" + } + }, + { + "id": "call_e5hauJIowS4IYEfeaiReu72o", + "type": "function", + "function": { + "name": "get_weather", + "arguments": "{\"location\": \"London\"}" + } + } + ], + "refusal": null + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 57, + "completion_tokens": 46, + "total_tokens": 103, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "system_fingerprint": "fp_0ba0d124f1" + } + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8e14cb8eaa4849b4-SIN + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 12 Nov 2024 07:26:41 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + content-length: + - '1283' + openai-organization: test_openai_org_key + openai-processing-ms: + - '1171' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9986' + x-ratelimit-remaining-tokens: + - '199956' + x-ratelimit-reset-requests: + - 1m55.337s + x-ratelimit-reset-tokens: + - 13ms + x-request-id: + - req_6c6d22f3f6a68edff6d29a9b9e46486c + status: + code: 200 + message: OK +- request: + body: |- + { + "messages": [ + { + "role": "system", + "content": "You are a helpful assistant providing weather updates." + }, + { + "role": "user", + "content": "What is the weather in New York City and London?" + }, + { + "role": "assistant", + "tool_calls": [ + { + "id": "call_PDht93e7bo48a7PyiyUcmK97", + "function": { + "arguments": "{\"location\": \"New York City\"}", + "name": "get_weather" + }, + "type": "function" + }, + { + "id": "call_e5hauJIowS4IYEfeaiReu72o", + "function": { + "arguments": "{\"location\": \"London\"}", + "name": "get_weather" + }, + "type": "function" + } + ] + }, + { + "role": "tool", + "content": "25 degrees and sunny", + "tool_call_id": "call_PDht93e7bo48a7PyiyUcmK97" + }, + { + "role": "tool", + "content": "15 degrees and raining", + "tool_call_id": "call_e5hauJIowS4IYEfeaiReu72o" + } + ], + "model": "gpt-4o-mini" + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '742' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.54.3 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.54.3 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.6 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: |- + { + "id": "chatcmpl-ASfaMHRVNFyJBKQNN7PYWDC2YfD7T", + "object": "chat.completion", + "created": 1731396402, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "The weather in New York City is 25 degrees and sunny. In London, it is 15 degrees and raining.", + "refusal": null + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 99, + "completion_tokens": 24, + "total_tokens": 123, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "system_fingerprint": "fp_0ba0d124f1" + } + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8e14cb983d8a49b4-SIN + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 12 Nov 2024 07:26:42 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + content-length: + - '846' + openai-organization: test_openai_org_key + openai-processing-ms: + - '699' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9985' + x-ratelimit-remaining-tokens: + - '199943' + x-ratelimit-reset-requests: + - 2m2.445s + x-ratelimit-reset-tokens: + - 17ms + x-request-id: + - req_5e17646545f163ab536bb358437e1461 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_chat_completions.py b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_chat_completions.py index a9b1efb..b7bace7 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_chat_completions.py +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_chat_completions.py @@ -317,7 +317,7 @@ def test_all_the_client_options( ] -test_multiple_choices_capture_message_content_log_events_test_data = [ +test_multiple_choices_capture_message_content_test_data = [ ( "openai_provider_chat_completions", "gpt-4o-mini", @@ -345,9 +345,9 @@ def test_all_the_client_options( @pytest.mark.vcr() @pytest.mark.parametrize( "provider_str,model,response_model,content,response_id,input_tokens,output_tokens,duration", - test_multiple_choices_capture_message_content_log_events_test_data, + test_multiple_choices_capture_message_content_test_data, ) -def test_multiple_choices_with_capture_message_content_log_events( +def test_multiple_choices_with_capture_message_content( provider_str, model, response_model, @@ -367,9 +367,7 @@ def test_multiple_choices_with_capture_message_content_log_events( # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict( - "os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "log"} - ): + with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): OpenAIInstrumentor().instrument() messages = [ @@ -531,7 +529,7 @@ def test_function_calling_with_tools( ) -test_tools_with_capture_message_content_test_data = [ +test_tools_with_capture_message_content_span_events_test_data = [ ( "openai_provider_chat_completions", "gpt-4o-mini", @@ -571,9 +569,9 @@ def test_function_calling_with_tools( @pytest.mark.vcr() @pytest.mark.parametrize( "provider_str,model,response_model,content,response_id,function_call_id,input_tokens,output_tokens,duration", - test_tools_with_capture_message_content_test_data, + test_tools_with_capture_message_content_span_events_test_data, ) -def test_tools_with_capture_message_content( +def test_tools_with_capture_message_content_span_events( provider_str, model, response_model, @@ -592,7 +590,10 @@ def test_tools_with_capture_message_content( # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): + with mock.patch.dict( + "os.environ", + {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "span"}, + ): OpenAIInstrumentor().instrument() tools = [ @@ -680,7 +681,7 @@ def test_tools_with_capture_message_content( ) -test_tools_with_capture_message_content_log_events_test_data = [ +test_tools_with_capture_message_content_test_data = [ ( "openai_provider_chat_completions", "gpt-4o-mini", @@ -720,9 +721,9 @@ def test_tools_with_capture_message_content( @pytest.mark.vcr() @pytest.mark.parametrize( "provider_str,model,response_model,content,response_id,function_call_id,input_tokens,output_tokens,duration", - test_tools_with_capture_message_content_log_events_test_data, + test_tools_with_capture_message_content_test_data, ) -def test_tools_with_capture_message_content_log_events( +def test_tools_with_capture_message_content( provider_str, model, response_model, @@ -742,9 +743,7 @@ def test_tools_with_capture_message_content_log_events( # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict( - "os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "log"} - ): + with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): OpenAIInstrumentor().instrument() tools = [ @@ -856,7 +855,7 @@ def test_tools_with_capture_message_content_log_events( ), ], ) -def test_tools_with_capture_message_content_log_events_integration( +def test_tools_with_capture_message_content_integration( provider_str, model, response_model, @@ -870,9 +869,7 @@ def test_tools_with_capture_message_content_log_events_integration( # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict( - "os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "log"} - ): + with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): OpenAIInstrumentor().instrument() tools = [ @@ -1038,7 +1035,7 @@ def test_connection_error(provider_str, model, duration, trace_exporter, metrics ) -test_basic_with_capture_message_content_test_data = [ +test_basic_with_capture_message_content_span_events_test_data = [ ( "openai_provider_chat_completions", "gpt-4o-mini", @@ -1075,9 +1072,9 @@ def test_connection_error(provider_str, model, duration, trace_exporter, metrics @pytest.mark.vcr() @pytest.mark.parametrize( "provider_str,model,response_model,content,response_id,input_tokens,output_tokens,duration", - test_basic_with_capture_message_content_test_data, + test_basic_with_capture_message_content_span_events_test_data, ) -def test_basic_with_capture_message_content( +def test_basic_with_capture_message_content_span_events( provider_str, model, response_model, @@ -1095,7 +1092,10 @@ def test_basic_with_capture_message_content( # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): + with mock.patch.dict( + "os.environ", + {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "span"}, + ): OpenAIInstrumentor().instrument() messages = [ @@ -1167,7 +1167,7 @@ def test_basic_with_capture_message_content( ) ], ) -def test_basic_with_capture_message_content_integration( +def test_basic_with_capture_message_content_span_events_integration( provider_str, model, response_model, @@ -1179,7 +1179,10 @@ def test_basic_with_capture_message_content_integration( # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): + with mock.patch.dict( + "os.environ", + {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "span"}, + ): OpenAIInstrumentor().instrument() client = provider.get_client() @@ -1242,7 +1245,7 @@ def test_basic_with_capture_message_content_integration( ) -test_basic_with_capture_message_content_log_events_test_data = [ +test_basic_with_capture_message_content_test_data = [ ( "openai_provider_chat_completions", "gpt-4o-mini", @@ -1279,9 +1282,9 @@ def test_basic_with_capture_message_content_integration( @pytest.mark.vcr() @pytest.mark.parametrize( "provider_str,model,response_model,content,response_id,input_tokens,output_tokens,duration", - test_basic_with_capture_message_content_log_events_test_data, + test_basic_with_capture_message_content_test_data, ) -def test_basic_with_capture_message_content_log_events( +def test_basic_with_capture_message_content( provider_str, model, response_model, @@ -1300,9 +1303,7 @@ def test_basic_with_capture_message_content_log_events( # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict( - "os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "log"} - ): + with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): OpenAIInstrumentor().instrument() messages = [ @@ -1553,7 +1554,7 @@ def test_stream_with_include_usage_option( ) ], ) -def test_stream_with_include_usage_option_and_capture_message_content_integration( +def test_stream_with_include_usage_option_and_capture_message_content_span_events_integration( provider_str, model, response_model, @@ -1565,7 +1566,10 @@ def test_stream_with_include_usage_option_and_capture_message_content_integratio # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): + with mock.patch.dict( + "os.environ", + {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "span"}, + ): OpenAIInstrumentor().instrument() client = provider.get_client() @@ -1633,7 +1637,7 @@ def test_stream_with_include_usage_option_and_capture_message_content_integratio ) -test_stream_with_tools_and_capture_message_content_test_data = [ +test_stream_with_tools_and_capture_message_content_span_events_test_data = [ ( "openai_provider_chat_completions", "gpt-4o-mini", @@ -1680,9 +1684,9 @@ def test_stream_with_include_usage_option_and_capture_message_content_integratio @pytest.mark.vcr() @pytest.mark.parametrize( "provider_str,model,response_model,content,completion_content,response_id,finish_reason,duration", - test_stream_with_tools_and_capture_message_content_test_data, + test_stream_with_tools_and_capture_message_content_span_events_test_data, ) -def test_stream_with_tools_and_capture_message_content( +def test_stream_with_tools_and_capture_message_content_span_events( provider_str, model, response_model, @@ -1700,7 +1704,10 @@ def test_stream_with_tools_and_capture_message_content( # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): + with mock.patch.dict( + "os.environ", + {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "span"}, + ): OpenAIInstrumentor().instrument() tools = [ @@ -1778,7 +1785,7 @@ def test_stream_with_tools_and_capture_message_content( ) -test_stream_with_tools_and_capture_message_content_log_events_test_data = [ +test_stream_with_tools_and_capture_message_content_test_data = [ ( "openai_provider_chat_completions", "gpt-4o-mini", @@ -1820,9 +1827,9 @@ def test_stream_with_tools_and_capture_message_content( @pytest.mark.vcr() @pytest.mark.parametrize( "provider_str,model,response_model,content,completion_content,response_id,finish_reason,function_call_id,duration", - test_stream_with_tools_and_capture_message_content_log_events_test_data, + test_stream_with_tools_and_capture_message_content_test_data, ) -def test_stream_with_tools_and_capture_message_content_log_events( +def test_stream_with_tools_and_capture_message_content( provider_str, model, response_model, @@ -1842,9 +1849,7 @@ def test_stream_with_tools_and_capture_message_content_log_events( # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict( - "os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "log"} - ): + with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): OpenAIInstrumentor().instrument() tools = [ @@ -1947,7 +1952,7 @@ def test_stream_with_tools_and_capture_message_content_log_events( # Azure is not tested because only gpt-4o version 2024-08-06 supports structured output: # openai.BadRequestError: Error code: 400 - {'error': {'message': 'Structured output is not allowed.', 'type': 'invalid_request_error', 'param': None, 'code': None}} -test_stream_with_parallel_tools_and_capture_message_content_test_data = [ +test_stream_with_parallel_tools_and_capture_message_content_span_events_test_data = [ ( "openai_provider_chat_completions", "gpt-4o-mini", @@ -1983,9 +1988,9 @@ def test_stream_with_tools_and_capture_message_content_log_events( @pytest.mark.vcr() @pytest.mark.parametrize( "provider_str,model,response_model,content,completion_content,response_id,finish_reason,duration", - test_stream_with_parallel_tools_and_capture_message_content_test_data, + test_stream_with_parallel_tools_and_capture_message_content_span_events_test_data, ) -def test_stream_with_parallel_tools_and_capture_message_content( +def test_stream_with_parallel_tools_and_capture_message_content_span_events( provider_str, model, response_model, @@ -2003,7 +2008,10 @@ def test_stream_with_parallel_tools_and_capture_message_content( # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): + with mock.patch.dict( + "os.environ", + {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "span"}, + ): OpenAIInstrumentor().instrument() tools = [ @@ -2073,7 +2081,7 @@ def test_stream_with_parallel_tools_and_capture_message_content( ) -test_stream_with_parallel_tools_and_capture_message_content_log_events_test_data = [ +test_stream_with_parallel_tools_and_capture_message_content_test_data = [ ( "openai_provider_chat_completions", "gpt-4o-mini", @@ -2111,9 +2119,9 @@ def test_stream_with_parallel_tools_and_capture_message_content( @pytest.mark.vcr() @pytest.mark.parametrize( "provider_str,model,response_model,content,completion_content,response_id,finish_reason,duration", - test_stream_with_parallel_tools_and_capture_message_content_log_events_test_data, + test_stream_with_parallel_tools_and_capture_message_content_test_data, ) -def test_stream_with_parallel_tools_and_capture_message_content_log_events( +def test_stream_with_parallel_tools_and_capture_message_content( provider_str, model, response_model, @@ -2132,9 +2140,7 @@ def test_stream_with_parallel_tools_and_capture_message_content_log_events( # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict( - "os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "log"} - ): + with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): OpenAIInstrumentor().instrument() tools = [ @@ -2222,7 +2228,7 @@ def test_stream_with_parallel_tools_and_capture_message_content_log_events( ) -test_tools_with_followup_and_capture_message_content_log_events_test_data = [ +test_tools_with_followup_and_capture_message_content_test_data = [ ( "openai_provider_chat_completions", "gpt-4o-mini", @@ -2240,9 +2246,9 @@ def test_stream_with_parallel_tools_and_capture_message_content_log_events( @pytest.mark.vcr() @pytest.mark.parametrize( "provider_str,model,response_model,content,completion_content,finish_reason,duration", - test_tools_with_followup_and_capture_message_content_log_events_test_data, + test_tools_with_followup_and_capture_message_content_test_data, ) -def test_tools_with_followup_and_capture_message_content_log_events( +def test_tools_with_followup_and_capture_message_content( provider_str, model, response_model, @@ -2260,9 +2266,7 @@ def test_tools_with_followup_and_capture_message_content_log_events( # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict( - "os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "log"} - ): + with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): OpenAIInstrumentor().instrument() tools = [ @@ -2524,7 +2528,7 @@ async def test_async_basic( ) -test_async_basic_with_capture_message_content_test_data = [ +test_async_basic_with_capture_message_content_span_events_test_data = [ ( "openai_provider_chat_completions", "gpt-4o-mini", @@ -2562,9 +2566,9 @@ async def test_async_basic( @pytest.mark.vcr() @pytest.mark.parametrize( "provider_str,model,response_model,content,response_id,input_tokens,output_tokens,duration", - test_async_basic_with_capture_message_content_test_data, + test_async_basic_with_capture_message_content_span_events_test_data, ) -async def test_async_basic_with_capture_message_content( +async def test_async_basic_with_capture_message_content_span_events( provider_str, model, response_model, @@ -2582,7 +2586,10 @@ async def test_async_basic_with_capture_message_content( # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): + with mock.patch.dict( + "os.environ", + {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "span"}, + ): OpenAIInstrumentor().instrument() messages = [ @@ -2642,7 +2649,7 @@ async def test_async_basic_with_capture_message_content( ) -test_async_basic_with_capture_message_content_log_events_test_data = [ +test_async_basic_with_capture_message_content_test_data = [ ( "openai_provider_chat_completions", "gpt-4o-mini", @@ -2680,9 +2687,9 @@ async def test_async_basic_with_capture_message_content( @pytest.mark.vcr() @pytest.mark.parametrize( "provider_str,model,response_model,content,response_id,input_tokens,output_tokens,duration", - test_async_basic_with_capture_message_content_log_events_test_data, + test_async_basic_with_capture_message_content_test_data, ) -async def test_async_basic_with_capture_message_content_log_events( +async def test_async_basic_with_capture_message_content( provider_str, model, response_model, @@ -2701,9 +2708,7 @@ async def test_async_basic_with_capture_message_content_log_events( # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict( - "os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "log"} - ): + with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): OpenAIInstrumentor().instrument() messages = [ @@ -2776,7 +2781,7 @@ async def test_async_basic_with_capture_message_content_log_events( ), ], ) -async def test_async_basic_with_capture_message_content_log_events_integration( +async def test_async_basic_with_capture_message_content_integration( provider_str, model, response_model, @@ -2790,9 +2795,7 @@ async def test_async_basic_with_capture_message_content_log_events_integration( # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict( - "os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "log"} - ): + with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): OpenAIInstrumentor().instrument() messages = [ @@ -2932,7 +2935,7 @@ async def test_async_stream( ) -test_async_stream_with_capture_message_content_test_data = [ +test_async_stream_with_capture_message_content_span_events_test_data = [ ( "openai_provider_chat_completions", "gpt-4o-mini", @@ -2964,9 +2967,9 @@ async def test_async_stream( @pytest.mark.asyncio @pytest.mark.parametrize( "provider_str,model,response_model,content,response_id,duration", - test_async_stream_with_capture_message_content_test_data, + test_async_stream_with_capture_message_content_span_events_test_data, ) -async def test_async_stream_with_capture_message_content( +async def test_async_stream_with_capture_message_content_span_events( provider_str, model, response_model, @@ -2982,7 +2985,10 @@ async def test_async_stream_with_capture_message_content( # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): + with mock.patch.dict( + "os.environ", + {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "span"}, + ): OpenAIInstrumentor().instrument() messages = [ { @@ -3033,7 +3039,7 @@ async def test_async_stream_with_capture_message_content( ) -test_async_stream_with_capture_message_content_log_events_test_data = [ +test_async_stream_with_capture_message_content_test_data = [ ( "openai_provider_chat_completions", "gpt-4o-mini", @@ -3065,9 +3071,9 @@ async def test_async_stream_with_capture_message_content( @pytest.mark.asyncio @pytest.mark.parametrize( "provider_str,model,response_model,content,response_id,duration", - test_async_stream_with_capture_message_content_log_events_test_data, + test_async_stream_with_capture_message_content_test_data, ) -async def test_async_stream_with_capture_message_content_log_events( +async def test_async_stream_with_capture_message_content( provider_str, model, response_model, @@ -3084,9 +3090,7 @@ async def test_async_stream_with_capture_message_content_log_events( # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict( - "os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "log"} - ): + with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): OpenAIInstrumentor().instrument() messages = [ { @@ -3144,7 +3148,7 @@ async def test_async_stream_with_capture_message_content_log_events( # FIXME: ollama has empty tool_calls -test_async_tools_with_capture_message_content_test_data = [ +test_async_tools_with_capture_message_content_span_events_test_data = [ ( "openai_provider_chat_completions", "gpt-4o-mini", @@ -3172,9 +3176,9 @@ async def test_async_stream_with_capture_message_content_log_events( @pytest.mark.asyncio @pytest.mark.parametrize( "provider_str,model,response_model,response_id,function_call_id,input_tokens,output_tokens,duration", - test_async_tools_with_capture_message_content_test_data, + test_async_tools_with_capture_message_content_span_events_test_data, ) -async def test_async_tools_with_capture_message_content( +async def test_async_tools_with_capture_message_content_span_events( provider_str, model, response_model, @@ -3192,7 +3196,10 @@ async def test_async_tools_with_capture_message_content( # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): + with mock.patch.dict( + "os.environ", + {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "span"}, + ): OpenAIInstrumentor().instrument() tools = [ @@ -3282,7 +3289,7 @@ async def test_async_tools_with_capture_message_content( # FIXME: ollama has empty tool_calls -test_async_tools_with_capture_message_content_log_events_test_data = [ +test_async_tools_with_capture_message_content_test_data = [ ( "openai_provider_chat_completions", "gpt-4o-mini", @@ -3312,9 +3319,9 @@ async def test_async_tools_with_capture_message_content( @pytest.mark.asyncio @pytest.mark.parametrize( "provider_str,model,response_model,response_id,function_call_id,choice_content,input_tokens,output_tokens,duration", - test_async_tools_with_capture_message_content_log_events_test_data, + test_async_tools_with_capture_message_content_test_data, ) -async def test_async_tools_with_capture_message_content_log_events( +async def test_async_tools_with_capture_message_content( provider_str, model, response_model, @@ -3334,9 +3341,7 @@ async def test_async_tools_with_capture_message_content_log_events( # Redo the instrumentation dance to be affected by the environment variable OpenAIInstrumentor().uninstrument() - with mock.patch.dict( - "os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true", "ELASTIC_OTEL_GENAI_EVENTS": "log"} - ): + with mock.patch.dict("os.environ", {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true"}): OpenAIInstrumentor().instrument() tools = [ @@ -3590,14 +3595,14 @@ def test_exported_schema_version( spans = trace_exporter.get_finished_spans() (span,) = spans - assert span.instrumentation_scope.schema_url == "https://opentelemetry.io/schemas/1.27.0" + assert span.instrumentation_scope.schema_url == "https://opentelemetry.io/schemas/1.28.0" metrics_data = metrics_reader.get_metrics_data() resource_metrics = metrics_data.resource_metrics for metrics in resource_metrics: for scope_metrics in metrics.scope_metrics: - assert scope_metrics.schema_url == "https://opentelemetry.io/schemas/1.27.0" + assert scope_metrics.schema_url == "https://opentelemetry.io/schemas/1.28.0" @dataclass diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_embeddings.py b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_embeddings.py index db68bd4..6ac3961 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_embeddings.py +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_embeddings.py @@ -378,7 +378,7 @@ async def test_async_all_the_client_options_integration(provider_str, model, tra test_async_connection_error_test_data = [ ("openai_provider_embeddings", "text-embedding-3-small", 0.2263190783560276), ("azure_provider_embeddings", "ada", 0.8369011571630836), - ("ollama_provider_embeddings", "all-minilm:33m", 0.0030461717396974564), + ("ollama_provider_embeddings", "all-minilm:33m", 1.0055546019999895), ]