diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dafd949..615ae3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,8 +38,8 @@ jobs: test: runs-on: ubuntu-latest env: - py38: 3.8 - py39: 3.9 + py38: "3.8" + py39: "3.9" py310: "3.10" py311: "3.11" py312: "3.12" @@ -55,7 +55,11 @@ jobs: with: python-version: ${{ env[matrix.python-version] }} architecture: "x64" - - run: pip install -r dev-requirements.txt + - if: ${{ env[matrix.python-version] == '3.8' || env[matrix.python-version] == '3.9' }} + run: pip install -r dev-requirements-3.9.txt + working-directory: ${{ matrix.working-dir }} + - if: ${{ env[matrix.python-version] != '3.8' && env[matrix.python-version] != '3.9' }} + run: pip install -r dev-requirements.txt working-directory: ${{ matrix.working-dir }} - run: pytest working-directory: ${{ matrix.working-dir }} diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/README.md b/instrumentation/elastic-opentelemetry-instrumentation-openai/README.md index 78dafcb..ce8d9b9 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/README.md +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/README.md @@ -85,14 +85,18 @@ However, unit test recordings should use the authoritative OpenAI platform unles about a specific portability corner case. To refresh a test, delete its cassette file in tests/cassettes and make sure you have the -following environment variables set: +following environment variables set for OpenAI recordings: * `OPENAI_API_KEY` - from https://platform.openai.com/settings/profile?tab=api-keys * It should look like `sk-...` -* `OPENAI_ORG_ID` - from https://platform.openai.com/settings/organization/general - * It should look like `org-...` -* `OPENAI_PROJECT_ID` - from https://platform.openai.com/settings/profile (click Project) - * It should look like `proj_...` + +and the following for Azure recordings, deployment url and api key are available for each deployment +in https://oai.azure.com/resource/deployments: + +* `AZURE_CHAT_COMPLETIONS_DEPLOYMENT_URL` +* `AZURE_CHAT_COMPLETIONS_API_KEY` +* `AZURE_EMBEDDINGS_DEPLOYMENT_URL` +* `AZURE_EMBEDDINGS_API_KEY` If writing a new test, start with the test logic with no assertions. If extending an existing unit test rather than writing a new one, remove the corresponding recorded response from [cassettes](./tests/cassettes/) diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/dev-requirements-3.9.txt b/instrumentation/elastic-opentelemetry-instrumentation-openai/dev-requirements-3.9.txt new file mode 100644 index 0000000..946d813 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/dev-requirements-3.9.txt @@ -0,0 +1,148 @@ +# +# This file is autogenerated by pip-compile with Python 3.8 +# by the following command: +# +# pip-compile --extra=dev --output-file=dev-requirements-3.9.txt --strip-extras pyproject.toml +# +annotated-types==0.7.0 + # via pydantic +anyio==4.5.2 + # via + # httpx + # openai +asgiref==3.8.1 + # via opentelemetry-test-utils +build==1.2.2.post1 + # via pip-tools +certifi==2024.8.30 + # via + # httpcore + # httpx +click==8.1.7 + # via pip-tools +deprecated==1.2.14 + # via + # opentelemetry-api + # opentelemetry-semantic-conventions +distro==1.9.0 + # via openai +exceptiongroup==1.2.2 + # via + # anyio + # pytest +h11==0.14.0 + # via httpcore +httpcore==1.0.6 + # via httpx +httpx==0.27.2 + # via openai +idna==3.10 + # via + # anyio + # httpx + # yarl +importlib-metadata==8.5.0 + # via + # build + # opentelemetry-api +iniconfig==2.0.0 + # via pytest +jiter==0.7.1 + # via openai +multidict==6.1.0 + # via yarl +numpy==1.24.4 + # via elastic-opentelemetry-instrumentation-openai (pyproject.toml) +openai==1.54.4 + # via elastic-opentelemetry-instrumentation-openai (pyproject.toml) +opentelemetry-api==1.28.1 + # via + # elastic-opentelemetry-instrumentation-openai (pyproject.toml) + # opentelemetry-instrumentation + # opentelemetry-sdk + # opentelemetry-semantic-conventions + # opentelemetry-test-utils +opentelemetry-instrumentation==0.49b1 + # via elastic-opentelemetry-instrumentation-openai (pyproject.toml) +opentelemetry-sdk==1.28.1 + # via opentelemetry-test-utils +opentelemetry-semantic-conventions==0.49b1 + # via + # elastic-opentelemetry-instrumentation-openai (pyproject.toml) + # opentelemetry-instrumentation + # opentelemetry-sdk +opentelemetry-test-utils==0.49b1 + # via elastic-opentelemetry-instrumentation-openai (pyproject.toml) +packaging==24.2 + # via + # build + # opentelemetry-instrumentation + # pytest +pip-tools==7.4.1 + # via elastic-opentelemetry-instrumentation-openai (pyproject.toml) +pluggy==1.5.0 + # via pytest +propcache==0.2.0 + # via yarl +pydantic==2.9.2 + # via openai +pydantic-core==2.23.4 + # via pydantic +pyproject-hooks==1.2.0 + # via + # build + # pip-tools +pytest==8.3.3 + # via + # elastic-opentelemetry-instrumentation-openai (pyproject.toml) + # pytest-asyncio + # pytest-vcr +pytest-asyncio==0.24.0 + # via elastic-opentelemetry-instrumentation-openai (pyproject.toml) +pytest-vcr==1.0.2 + # via elastic-opentelemetry-instrumentation-openai (pyproject.toml) +pyyaml==6.0.2 + # via vcrpy +sniffio==1.3.1 + # via + # anyio + # httpx + # openai +tomli==2.1.0 + # via + # build + # pip-tools + # pytest +tqdm==4.67.0 + # via openai +typing-extensions==4.12.2 + # via + # annotated-types + # anyio + # asgiref + # multidict + # openai + # opentelemetry-sdk + # pydantic + # pydantic-core +urllib3==1.26.20 + # via vcrpy +vcrpy==6.0.2 + # via + # elastic-opentelemetry-instrumentation-openai (pyproject.toml) + # pytest-vcr +wheel==0.45.0 + # via pip-tools +wrapt==1.16.0 + # via + # deprecated + # opentelemetry-instrumentation + # vcrpy +yarl==1.15.2 + # via vcrpy +zipp==3.20.2 + # via importlib-metadata + +# The following packages are considered to be unsafe in a requirements file: +# pip +# setuptools diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/dev-requirements.txt b/instrumentation/elastic-opentelemetry-instrumentation-openai/dev-requirements.txt index 3a07d63..964ab18 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/dev-requirements.txt +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/dev-requirements.txt @@ -49,6 +49,8 @@ jiter==0.5.0 # via openai multidict==6.1.0 # via yarl +numpy==2.1.3 + # via elastic-opentelemetry-instrumentation-openai (pyproject.toml) openai==1.50.2 # via elastic-opentelemetry-instrumentation-openai (pyproject.toml) opentelemetry-api==1.27.0 @@ -85,6 +87,13 @@ pyproject-hooks==1.1.0 # build # pip-tools pytest==8.3.3 + # via + # elastic-opentelemetry-instrumentation-openai (pyproject.toml) + # pytest-asyncio + # pytest-vcr +pytest-asyncio==0.24.0 + # via elastic-opentelemetry-instrumentation-openai (pyproject.toml) +pytest-vcr==1.0.2 # via elastic-opentelemetry-instrumentation-openai (pyproject.toml) pyyaml==6.0.2 # via vcrpy @@ -110,7 +119,9 @@ typing-extensions==4.12.2 # pydantic # pydantic-core vcrpy==6.0.1 - # via elastic-opentelemetry-instrumentation-openai (pyproject.toml) + # via + # elastic-opentelemetry-instrumentation-openai (pyproject.toml) + # pytest-vcr wheel==0.44.0 # via pip-tools wrapt==1.16.0 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/pyproject.toml b/instrumentation/elastic-opentelemetry-instrumentation-openai/pyproject.toml index 79c2d83..ae47566 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/pyproject.toml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/pyproject.toml @@ -40,7 +40,7 @@ Homepage = "https://github.com/elastic/elastic-otel-python-instrumentations" "Bug Tracker" = "https://github.com/elastic/elastic-otel-python-instrumentations/issues" [project.optional-dependencies] -dev = ["pytest", "pip-tools", "openai", "opentelemetry-test-utils", "vcrpy"] +dev = ["pytest", "pip-tools", "openai", "numpy", "opentelemetry-test-utils", "vcrpy", "pytest-asyncio", "pytest-vcr"] instruments = [ "openai >= 1.0.0", ] diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/base.py b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/base.py deleted file mode 100644 index f4e46b8..0000000 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/base.py +++ /dev/null @@ -1,207 +0,0 @@ -# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one -# or more contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os -from dataclasses import dataclass - -import openai -from opentelemetry.instrumentation.openai import OpenAIInstrumentor -from opentelemetry.metrics import Histogram -from vcr.unittest import VCRMixin - -# Use the same model for tools as for chat completion -OPENAI_API_KEY = "test_openai_api_key" -OPENAI_ORG_ID = "test_openai_org_key" -OPENAI_PROJECT_ID = "test_openai_project_id" - -LOCAL_MODEL = "qwen2.5:0.5b" - - -@dataclass -class OpenAIEnvironment: - # TODO: add system - operation_name: str = "chat" - model: str = "gpt-4o-mini" - response_model: str = "gpt-4o-mini-2024-07-18" - server_address: str = "api.openai.com" - server_port: int = 443 - - -class OpenaiMixin(VCRMixin): - def _get_vcr_kwargs(self, **kwargs): - """ - This scrubs sensitive data and gunzips bodies when in recording mode. - - Without this, you would leak cookies and auth tokens in the cassettes. - Also, depending on the request, some responses would be binary encoded - while others plain json. This ensures all bodies are human-readable. - """ - return { - "decode_compressed_response": True, - "filter_headers": [ - ("authorization", "Bearer " + OPENAI_API_KEY), - ("openai-organization", OPENAI_ORG_ID), - ("openai-project", OPENAI_PROJECT_ID), - ("cookie", None), - ], - "before_record_response": self.scrub_response_headers, - } - - @staticmethod - def scrub_response_headers(response): - """ - This scrubs sensitive response headers. Note they are case-sensitive! - """ - response["headers"]["openai-organization"] = OPENAI_ORG_ID - response["headers"]["Set-Cookie"] = "test_set_cookie" - return response - - @classmethod - def setup_client(cls): - # Control the arguments - return openai.Client( - api_key=os.getenv("OPENAI_API_KEY", OPENAI_API_KEY), - organization=os.getenv("OPENAI_ORG_ID", OPENAI_ORG_ID), - project=os.getenv("OPENAI_PROJECT_ID", OPENAI_PROJECT_ID), - max_retries=1, - ) - - @classmethod - def setup_environment(cls): - return OpenAIEnvironment() - - @classmethod - def setUpClass(cls): - cls.client = cls.setup_client() - cls.openai_env = cls.setup_environment() - - def setUp(self): - super().setUp() - OpenAIInstrumentor().instrument() - - def tearDown(self): - super().tearDown() - OpenAIInstrumentor().uninstrument() - - def assertOperationDurationMetric(self, metric: Histogram): - self.assertEqual(metric.name, "gen_ai.client.operation.duration") - self.assert_metric_expected( - metric, - [ - self.create_histogram_data_point( - count=1, - sum_data_point=0.006543334107846022, - max_data_point=0.006543334107846022, - min_data_point=0.006543334107846022, - attributes={ - "gen_ai.operation.name": self.openai_env.operation_name, - "gen_ai.request.model": self.openai_env.model, - "gen_ai.response.model": self.openai_env.response_model, - "gen_ai.system": "openai", - "server.address": self.openai_env.server_address, - "server.port": self.openai_env.server_port, - }, - ), - ], - est_value_delta=0.2, - ) - - def assertErrorOperationDurationMetric(self, metric: Histogram, attributes: dict, data_point: float = None): - self.assertEqual(metric.name, "gen_ai.client.operation.duration") - default_attributes = { - "gen_ai.operation.name": self.openai_env.operation_name, - "gen_ai.request.model": self.openai_env.model, - "gen_ai.system": "openai", - "error.type": "APIConnectionError", - "server.address": "localhost", - "server.port": 9999, - } - if data_point is None: - data_point = 0.8643839359283447 - self.assert_metric_expected( - metric, - [ - self.create_histogram_data_point( - count=1, - sum_data_point=data_point, - max_data_point=data_point, - min_data_point=data_point, - attributes={**default_attributes, **attributes}, - ), - ], - est_value_delta=0.5, - ) - - def assertTokenUsageInputMetric(self, metric: Histogram, input_data_point=4): - self.assertEqual(metric.name, "gen_ai.client.token.usage") - self.assert_metric_expected( - metric, - [ - self.create_histogram_data_point( - count=1, - sum_data_point=input_data_point, - max_data_point=input_data_point, - min_data_point=input_data_point, - attributes={ - "gen_ai.operation.name": self.openai_env.operation_name, - "gen_ai.request.model": self.openai_env.model, - "gen_ai.response.model": self.openai_env.response_model, - "gen_ai.system": "openai", - "server.address": self.openai_env.server_address, - "server.port": self.openai_env.server_port, - "gen_ai.token.type": "input", - }, - ), - ], - ) - - def assertTokenUsageMetric(self, metric: Histogram, input_data_point=24, output_data_point=4): - self.assertEqual(metric.name, "gen_ai.client.token.usage") - self.assert_metric_expected( - metric, - [ - self.create_histogram_data_point( - count=1, - sum_data_point=input_data_point, - max_data_point=input_data_point, - min_data_point=input_data_point, - attributes={ - "gen_ai.operation.name": self.openai_env.operation_name, - "gen_ai.request.model": self.openai_env.model, - "gen_ai.response.model": self.openai_env.response_model, - "gen_ai.system": "openai", - "server.address": self.openai_env.server_address, - "server.port": self.openai_env.server_port, - "gen_ai.token.type": "input", - }, - ), - self.create_histogram_data_point( - count=1, - sum_data_point=output_data_point, - max_data_point=output_data_point, - min_data_point=output_data_point, - attributes={ - "gen_ai.operation.name": self.openai_env.operation_name, - "gen_ai.request.model": self.openai_env.model, - "gen_ai.response.model": self.openai_env.response_model, - "gen_ai.system": "openai", - "server.address": self.openai_env.server_address, - "server.port": self.openai_env.server_port, - "gen_ai.token.type": "output", - }, - ), - ], - ) diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_all_the_client_options[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_all_the_client_options[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..9ccdbdc --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_all_the_client_options[azure_provider_chat_completions].yaml @@ -0,0 +1,86 @@ +interactions: +- request: + body: '{"messages": [{"role": "user", "content": "Answer in up to 3 words: Which + ocean contains the falkland islands?"}], "model": "gpt-4o-mini", "frequency_penalty": + 0, "max_tokens": 100, "presence_penalty": 0, "stop": "foo", "temperature": 1, + "top_p": 1}' + 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: + - '249' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AzureOpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2023-03-15-preview + response: + body: + string: '{"choices":[{"finish_reason":"stop","index":0,"message":{"content":"South + Atlantic Ocean.","role":"assistant"}}],"created":1727962531,"id":"chatcmpl-AEGHLLqYkgJxUgLgX8RCLeL85irQR","model":"gpt-4o-mini","object":"chat.completion","system_fingerprint":"fp_878413d04d","usage":{"completion_tokens":4,"prompt_tokens":24,"total_tokens":28}} + + ' + headers: + Content-Length: + - '336' + Content-Type: + - application/json + Date: + - Thu, 03 Oct 2024 13:35:31 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + apim-request-id: + - c017b850-54f6-40dd-9505-d1a9ee9a45b5 + azureml-model-session: + - d009-20240925074800 + openai-organization: test_openai_org_key + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '249' + x-ms-client-request-id: + - c017b850-54f6-40dd-9505-d1a9ee9a45b5 + x-ms-rai-invoked: + - 'true' + x-ms-region: + - East US + x-ratelimit-remaining-requests: + - '909' + x-ratelimit-remaining-tokens: + - '90883' + x-request-id: + - fba991b8-1a4f-4c6e-8a53-8b826a61a78a + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_all_the_client_options[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_all_the_client_options[ollama_provider_chat_completions].yaml new file mode 100644 index 0000000..316fc6a --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_all_the_client_options[ollama_provider_chat_completions].yaml @@ -0,0 +1,60 @@ +interactions: +- request: + body: '{"messages": [{"role": "user", "content": "Answer in up to 3 words: Which + ocean contains the falkland islands?"}], "model": "qwen2.5:0.5b", "frequency_penalty": + 0, "max_completion_tokens": 100, "presence_penalty": 0, "stop": "foo", "temperature": + 1, "top_p": 1}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '261' + content-type: + - application/json + host: + - localhost:11434 + user-agent: + - OpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: http://localhost:11434/v1/chat/completions + response: + body: + string: '{"id":"chatcmpl-398","object":"chat.completion","created":1727962341,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"The + Great British Oceanic Peninsula."},"finish_reason":"stop"}],"usage":{"prompt_tokens":46,"completion_tokens":8,"total_tokens":54}} + + ' + headers: + Content-Length: + - '322' + Content-Type: + - application/json + Date: + - Thu, 03 Oct 2024 13:32:21 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/TestChatCompletions.test_all_the_client_options.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_all_the_client_options[openai_provider_chat_completions].yaml similarity index 66% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_all_the_client_options.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_all_the_client_options[openai_provider_chat_completions].yaml index b7e114d..ac2d32e 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_all_the_client_options.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_all_the_client_options[openai_provider_chat_completions].yaml @@ -20,7 +20,7 @@ interactions: host: - api.openai.com user-agent: - - OpenAI/Python 1.50.2 + - OpenAI/Python 1.50.0 x-stainless-arch: - x64 x-stainless-async: @@ -30,7 +30,7 @@ interactions: x-stainless-os: - Linux x-stainless-package-version: - - 1.50.2 + - 1.50.0 x-stainless-retry-count: - '0' x-stainless-runtime: @@ -41,27 +41,26 @@ interactions: uri: https://api.openai.com/v1/chat/completions response: body: - string: !!binary | - H4sIAAAAAAAAA3SQMU/DMBCF9/wKy3NTpSE0IVslxAZUqoABoch1LompYxv7QoGq/x05aZMysHh4 - 373nd3cICKGipDmhvGHIWyPD1e1TWS8X6/3Lh7q6W6vk+WH3k3zu73ebZUxn3qG378Dx7Jpz3RoJ - KLQaMLfAEHzqIo3TNL1JoqQHrS5BelttMEx02AolwjiKkzBKw0V2cjdacHA0J68BIYQc+tf3VCV8 - 0ZxEs7PSgnOsBpqPQ4RQq6VXKHNOOGQK6WyCXCsE1Vff6A4bskLJFApOHjkwNb+ctVB1jvm+qpPy - pB/Hz6WujdVbd+KjXgklXFNYYE4r/5FDbWhPjwEhb/2S3Z/e1FjdGixQ70D5wDgZ4uh02gmeGWpk - 8sKT/ecpSkAmpLu4Ex3qCVVPAdHYsV+Sum+H0BaVUDVYY8VwtsoUVXa9BbZMs4QGx+AXAAD//wMA - sMwiB0QCAAA= + string: "{\n \"id\": \"chatcmpl-AEGEFRHEOGpX0H3Nx84zgOEbJ8g6Y\",\n \"object\": + \"chat.completion\",\n \"created\": 1727962339,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"South Atlantic Ocean.\",\n \"refusal\": + null\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n + \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 24,\n \"completion_tokens\": + 4,\n \"total_tokens\": 28,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": + 0\n }\n },\n \"system_fingerprint\": \"fp_74ba47b4ac\"\n}\n" headers: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8cbbd9faeab95a0d-MXP + - 8ccd4c2c8867baa3-MXP Connection: - keep-alive - Content-Encoding: - - gzip Content-Type: - application/json Date: - - Tue, 01 Oct 2024 10:43:24 GMT + - Thu, 03 Oct 2024 13:32:19 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -71,9 +70,11 @@ interactions: - nosniff access-control-expose-headers: - X-Request-ID + content-length: + - '643' openai-organization: test_openai_org_key openai-processing-ms: - - '145' + - '172' openai-version: - '2020-10-01' strict-transport-security: @@ -91,7 +92,7 @@ interactions: x-ratelimit-reset-tokens: - 10ms x-request-id: - - req_b2c77a93a9995fac4529c05464b89f7e + - req_52bb30269bd34cf18e783d9b405dac00 status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..41a2891 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic[azure_provider_chat_completions].yaml @@ -0,0 +1,84 @@ +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 + api-key: + - test_azure_api_key + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '138' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AsyncAzureOpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2023-03-15-preview + response: + body: + string: '{"choices":[{"finish_reason":"stop","index":0,"message":{"content":"South + Atlantic Ocean.","role":"assistant"}}],"created":1727964734,"id":"chatcmpl-AEGqs0IFKsicvFYSaiyWFpZVr6OHe","model":"gpt-4o-mini","object":"chat.completion","system_fingerprint":"fp_878413d04d","usage":{"completion_tokens":4,"prompt_tokens":24,"total_tokens":28}} + + ' + headers: + Content-Length: + - '336' + Content-Type: + - application/json + Date: + - Thu, 03 Oct 2024 14:12:13 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + apim-request-id: + - 120798e0-3e81-4492-881e-f03f9a6c6195 + azureml-model-session: + - d010-20240925083720 + openai-organization: test_openai_org_key + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '203' + x-ms-client-request-id: + - 120798e0-3e81-4492-881e-f03f9a6c6195 + x-ms-rai-invoked: + - 'true' + x-ms-region: + - East US + x-ratelimit-remaining-requests: + - '909' + x-ratelimit-remaining-tokens: + - '90343' + x-request-id: + - c668fdd4-14a6-4033-aa51-ac196c8f6133 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local_with_capture_content.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic[ollama_provider_chat_completions].yaml similarity index 72% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local_with_capture_content.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic[ollama_provider_chat_completions].yaml index df12081..4986777 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local_with_capture_content.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic[ollama_provider_chat_completions].yaml @@ -12,23 +12,25 @@ interactions: connection: - keep-alive content-length: - - '150' + - '139' content-type: - application/json host: - localhost:11434 user-agent: - - OpenAI/Python 1.43.1 + - AsyncOpenAI/Python 1.50.0 x-stainless-arch: - x64 x-stainless-async: - - 'false' + - async:asyncio x-stainless-lang: - python x-stainless-os: - Linux x-stainless-package-version: - - 1.43.1 + - 1.50.0 + x-stainless-retry-count: + - '0' x-stainless-runtime: - CPython x-stainless-runtime-version: @@ -37,17 +39,17 @@ interactions: uri: http://localhost:11434/v1/chat/completions response: body: - string: '{"id":"chatcmpl-364","object":"chat.completion","created":1726048337,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"ocean - A: Atlantic, B: Arctic Ocean"},"finish_reason":"stop"}],"usage":{"prompt_tokens":52,"completion_tokens":11,"total_tokens":63}} + string: '{"id":"chatcmpl-425","object":"chat.completion","created":1727964736,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"Atlantic + Ocean"},"finish_reason":"stop"}],"usage":{"prompt_tokens":46,"completion_tokens":3,"total_tokens":49}} ' headers: Content-Length: - - '332' + - '300' Content-Type: - application/json Date: - - Wed, 11 Sep 2024 09:52:17 GMT + - Thu, 03 Oct 2024 14:12:16 GMT Set-Cookie: test_set_cookie openai-organization: test_openai_org_key status: diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_basic.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic[openai_provider_chat_completions].yaml similarity index 72% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_basic.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic[openai_provider_chat_completions].yaml index 550b626..9e51dc3 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_basic.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic[openai_provider_chat_completions].yaml @@ -17,49 +17,48 @@ interactions: - application/json host: - api.openai.com - openai-organization: - - test_openai_org_key - openai-project: - - test_openai_project_id user-agent: - - AsyncOpenAI/Python 1.43.1 + - AsyncOpenAI/Python 1.50.0 x-stainless-arch: - - arm64 + - x64 x-stainless-async: - async:asyncio x-stainless-lang: - python x-stainless-os: - - MacOS + - Linux x-stainless-package-version: - - 1.43.1 + - 1.50.0 + x-stainless-retry-count: + - '0' x-stainless-runtime: - CPython x-stainless-runtime-version: - - 3.12.5 + - 3.10.12 method: POST uri: https://api.openai.com/v1/chat/completions response: body: - string: "{\n \"id\": \"chatcmpl-A9CT0G8qhgAE0LVHYoClD0IG4eyKa\",\n \"object\": - \"chat.completion\",\n \"created\": 1726756238,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + string: "{\n \"id\": \"chatcmpl-AEGqstM7lJ74sLzKJxMyhZZJixowh\",\n \"object\": + \"chat.completion\",\n \"created\": 1727964734,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"South Atlantic Ocean.\",\n \"refusal\": null\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 24,\n \"completion_tokens\": - 4,\n \"total_tokens\": 28,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": - 0\n }\n },\n \"system_fingerprint\": \"fp_1bb46167f9\"\n}\n" + 4,\n \"total_tokens\": 28,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": + 0\n }\n },\n \"system_fingerprint\": \"fp_f85bea6784\"\n}\n" headers: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8c5a465bf852ce77-SIN + - 8ccd86a298050e5e-MXP Connection: - keep-alive Content-Type: - application/json Date: - - Thu, 19 Sep 2024 14:30:39 GMT + - Thu, 03 Oct 2024 14:12:14 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -69,31 +68,29 @@ interactions: - nosniff access-control-expose-headers: - X-Request-ID - alt-svc: - - h3=":443"; ma=86400 content-length: - - '580' + - '643' openai-organization: test_openai_org_key openai-processing-ms: - - '357' + - '125' openai-version: - '2020-10-01' strict-transport-security: - - max-age=15552000; includeSubDomains; preload + - max-age=31536000; includeSubDomains; preload x-ratelimit-limit-requests: - '10000' x-ratelimit-limit-tokens: - '200000' x-ratelimit-remaining-requests: - - '9994' + - '9999' x-ratelimit-remaining-tokens: - '199966' x-ratelimit-reset-requests: - - 45.865s + - 8.64s x-ratelimit-reset-tokens: - 10ms x-request-id: - - req_b5e21857896de9c3351b6e4c5d42e555 + - req_9602b00f6e97ba89d9559b67a68016f2 status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_content[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_content[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..c0e93eb --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_content[azure_provider_chat_completions].yaml @@ -0,0 +1,84 @@ +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 + api-key: + - test_azure_api_key + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '138' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AsyncAzureOpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2023-03-15-preview + response: + body: + string: '{"choices":[{"finish_reason":"stop","index":0,"message":{"content":"South + Atlantic Ocean.","role":"assistant"}}],"created":1727964737,"id":"chatcmpl-AEGqv0J1RJgG477zKEayzIFWtBfoN","model":"gpt-4o-mini","object":"chat.completion","system_fingerprint":"fp_878413d04d","usage":{"completion_tokens":4,"prompt_tokens":24,"total_tokens":28}} + + ' + headers: + Content-Length: + - '336' + Content-Type: + - application/json + Date: + - Thu, 03 Oct 2024 14:12:17 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + apim-request-id: + - 7a43e9ed-16ef-43a6-8f7b-b3cc2de1467a + azureml-model-session: + - d008-20240925065407 + openai-organization: test_openai_org_key + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '214' + x-ms-client-request-id: + - 7a43e9ed-16ef-43a6-8f7b-b3cc2de1467a + x-ms-rai-invoked: + - 'true' + x-ms-region: + - East US + x-ratelimit-remaining-requests: + - '908' + x-ratelimit-remaining-tokens: + - '89686' + x-request-id: + - 500ce7ae-2708-4d07-9d79-b2a91edd6643 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_local.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_content[ollama_provider_chat_completions].yaml similarity index 74% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_local.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_content[ollama_provider_chat_completions].yaml index 3921ba5..ab9aa85 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_local.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_content[ollama_provider_chat_completions].yaml @@ -12,13 +12,13 @@ interactions: connection: - keep-alive content-length: - - '150' + - '139' content-type: - application/json host: - localhost:11434 user-agent: - - AsyncOpenAI/Python 1.43.1 + - AsyncOpenAI/Python 1.50.0 x-stainless-arch: - x64 x-stainless-async: @@ -28,7 +28,9 @@ interactions: x-stainless-os: - Linux x-stainless-package-version: - - 1.43.1 + - 1.50.0 + x-stainless-retry-count: + - '0' x-stainless-runtime: - CPython x-stainless-runtime-version: @@ -37,17 +39,16 @@ interactions: uri: http://localhost:11434/v1/chat/completions response: body: - string: '{"id":"chatcmpl-533","object":"chat.completion","created":1726145246,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"The - South Pole is the answer."},"finish_reason":"stop"}],"usage":{"prompt_tokens":52,"completion_tokens":8,"total_tokens":60}} + string: '{"id":"chatcmpl-280","object":"chat.completion","created":1727964738,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"Antarctica"},"finish_reason":"stop"}],"usage":{"prompt_tokens":46,"completion_tokens":4,"total_tokens":50}} ' headers: Content-Length: - - '326' + - '296' Content-Type: - application/json Date: - - Thu, 12 Sep 2024 12:47:26 GMT + - Thu, 03 Oct 2024 14:12:18 GMT Set-Cookie: test_set_cookie openai-organization: test_openai_org_key status: diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_basic_with_capture_content.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_content[openai_provider_chat_completions].yaml similarity index 72% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_basic_with_capture_content.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_content[openai_provider_chat_completions].yaml index b9e5d9e..831391d 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_basic_with_capture_content.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_basic_with_capture_content[openai_provider_chat_completions].yaml @@ -17,49 +17,48 @@ interactions: - application/json host: - api.openai.com - openai-organization: - - test_openai_org_key - openai-project: - - test_openai_project_id user-agent: - - AsyncOpenAI/Python 1.43.1 + - AsyncOpenAI/Python 1.50.0 x-stainless-arch: - - arm64 + - x64 x-stainless-async: - async:asyncio x-stainless-lang: - python x-stainless-os: - - MacOS + - Linux x-stainless-package-version: - - 1.43.1 + - 1.50.0 + x-stainless-retry-count: + - '0' x-stainless-runtime: - CPython x-stainless-runtime-version: - - 3.12.5 + - 3.10.12 method: POST uri: https://api.openai.com/v1/chat/completions response: body: - string: "{\n \"id\": \"chatcmpl-A9CT2ePKnjnz40F1K7G6YhKMoNLsD\",\n \"object\": - \"chat.completion\",\n \"created\": 1726756240,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + string: "{\n \"id\": \"chatcmpl-AEGquKdflabT1q3yPFXFggu0hn6Cg\",\n \"object\": + \"chat.completion\",\n \"created\": 1727964736,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"South Atlantic Ocean.\",\n \"refusal\": null\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 24,\n \"completion_tokens\": - 4,\n \"total_tokens\": 28,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": - 0\n }\n },\n \"system_fingerprint\": \"fp_1bb46167f9\"\n}\n" + 4,\n \"total_tokens\": 28,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": + 0\n }\n },\n \"system_fingerprint\": \"fp_f85bea6784\"\n}\n" headers: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8c5a466698d1ce33-SIN + - 8ccd86b28aea0e5a-MXP Connection: - keep-alive Content-Type: - application/json Date: - - Thu, 19 Sep 2024 14:30:40 GMT + - Thu, 03 Oct 2024 14:12:17 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -69,31 +68,29 @@ interactions: - nosniff access-control-expose-headers: - X-Request-ID - alt-svc: - - h3=":443"; ma=86400 content-length: - - '580' + - '643' openai-organization: test_openai_org_key openai-processing-ms: - - '200' + - '411' openai-version: - '2020-10-01' strict-transport-security: - - max-age=15552000; includeSubDomains; preload + - max-age=31536000; includeSubDomains; preload x-ratelimit-limit-requests: - '10000' x-ratelimit-limit-tokens: - '200000' x-ratelimit-remaining-requests: - - '9993' + - '9998' x-ratelimit-remaining-tokens: - '199966' x-ratelimit-reset-requests: - - 52.809s + - 14.731s x-ratelimit-reset-tokens: - 10ms x-request-id: - - req_b04c2e5481a583f2f32ee9db27be0f2b + - req_0b79cfb4cff6e27693a5278876194bb4 status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..e5a99c0 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream[azure_provider_chat_completions].yaml @@ -0,0 +1,102 @@ +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 + api-key: + - test_azure_api_key + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '154' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AsyncAzureOpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2023-03-15-preview + response: + body: + string: 'data: {"choices":[{"delta":{"role":"assistant"},"finish_reason":null,"index":0}],"created":1727964739,"id":"chatcmpl-AEGqxYYCkiihSc05nBzHlYVwwUmzl","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"content":"South"},"finish_reason":null,"index":0}],"created":1727964739,"id":"chatcmpl-AEGqxYYCkiihSc05nBzHlYVwwUmzl","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"content":" Atlantic"},"finish_reason":null,"index":0}],"created":1727964739,"id":"chatcmpl-AEGqxYYCkiihSc05nBzHlYVwwUmzl","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"content":" Ocean"},"finish_reason":null,"index":0}],"created":1727964739,"id":"chatcmpl-AEGqxYYCkiihSc05nBzHlYVwwUmzl","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"content":"."},"finish_reason":null,"index":0}],"created":1727964739,"id":"chatcmpl-AEGqxYYCkiihSc05nBzHlYVwwUmzl","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{},"finish_reason":"stop","index":0}],"created":1727964739,"id":"chatcmpl-AEGqxYYCkiihSc05nBzHlYVwwUmzl","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: [DONE] + + + ' + headers: + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 03 Oct 2024 14:12:19 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + apim-request-id: + - 36b04c91-b5c0-46c7-8257-668127c68d4d + azureml-model-session: + - d007-20240926131035 + openai-organization: test_openai_org_key + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '257' + x-ms-client-request-id: + - 36b04c91-b5c0-46c7-8257-668127c68d4d + x-ms-rai-invoked: + - 'true' + x-ms-region: + - East US + x-ratelimit-remaining-requests: + - '907' + x-ratelimit-remaining-tokens: + - '89029' + x-request-id: + - 6a8d5f20-8dfe-4869-9005-a4cf4a9654c8 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream[ollama_provider_chat_completions].yaml new file mode 100644 index 0000000..f9bbd24 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream[ollama_provider_chat_completions].yaml @@ -0,0 +1,99 @@ +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.0 + x-stainless-arch: + - x64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: http://localhost:11434/v1/chat/completions + response: + body: + string: 'data: {"id":"chatcmpl-325","object":"chat.completion.chunk","created":1727964739,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"The"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-325","object":"chat.completion.chunk","created":1727964739,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + Falk"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-325","object":"chat.completion.chunk","created":1727964739,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"land"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-325","object":"chat.completion.chunk","created":1727964739,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + Islands"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-325","object":"chat.completion.chunk","created":1727964739,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + are"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-325","object":"chat.completion.chunk","created":1727964739,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + located"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-325","object":"chat.completion.chunk","created":1727964739,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + on"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-325","object":"chat.completion.chunk","created":1727964739,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + which"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-325","object":"chat.completion.chunk","created":1727964739,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + ocean"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-325","object":"chat.completion.chunk","created":1727964739,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"?"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-325","object":"chat.completion.chunk","created":1727964739,"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: + - Thu, 03 Oct 2024 14:12:19 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/TestChatCompletions.test_stream.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream[openai_provider_chat_completions].yaml similarity index 58% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_stream.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream[openai_provider_chat_completions].yaml index 0639178..bb8fa85 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_stream.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream[openai_provider_chat_completions].yaml @@ -17,48 +17,46 @@ interactions: - application/json host: - api.openai.com - openai-organization: - - test_openai_org_key - openai-project: - - test_openai_project_id user-agent: - - OpenAI/Python 1.43.1 + - AsyncOpenAI/Python 1.50.0 x-stainless-arch: - - arm64 + - x64 x-stainless-async: - - 'false' + - async:asyncio x-stainless-lang: - python x-stainless-os: - - MacOS + - Linux x-stainless-package-version: - - 1.43.1 + - 1.50.0 + x-stainless-retry-count: + - '0' x-stainless-runtime: - CPython x-stainless-runtime-version: - - 3.12.5 + - 3.10.12 method: POST uri: https://api.openai.com/v1/chat/completions response: body: - string: 'data: {"id":"chatcmpl-A6Fj6kEv975Uw3vNCyA2njL0mP4Lg","object":"chat.completion.chunk","created":1726053784,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}]} + string: 'data: {"id":"chatcmpl-AEGqwO8cO97nJK1gMyVlzL9Mfyv7E","object":"chat.completion.chunk","created":1727964738,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_f85bea6784","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A6Fj6kEv975Uw3vNCyA2njL0mP4Lg","object":"chat.completion.chunk","created":1726053784,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"content":"South"},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-AEGqwO8cO97nJK1gMyVlzL9Mfyv7E","object":"chat.completion.chunk","created":1727964738,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_f85bea6784","choices":[{"index":0,"delta":{"content":"South"},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A6Fj6kEv975Uw3vNCyA2njL0mP4Lg","object":"chat.completion.chunk","created":1726053784,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"content":" + data: {"id":"chatcmpl-AEGqwO8cO97nJK1gMyVlzL9Mfyv7E","object":"chat.completion.chunk","created":1727964738,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_f85bea6784","choices":[{"index":0,"delta":{"content":" Atlantic"},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A6Fj6kEv975Uw3vNCyA2njL0mP4Lg","object":"chat.completion.chunk","created":1726053784,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"content":" + data: {"id":"chatcmpl-AEGqwO8cO97nJK1gMyVlzL9Mfyv7E","object":"chat.completion.chunk","created":1727964738,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_f85bea6784","choices":[{"index":0,"delta":{"content":" Ocean"},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A6Fj6kEv975Uw3vNCyA2njL0mP4Lg","object":"chat.completion.chunk","created":1726053784,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-AEGqwO8cO97nJK1gMyVlzL9Mfyv7E","object":"chat.completion.chunk","created":1727964738,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_f85bea6784","choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A6Fj6kEv975Uw3vNCyA2njL0mP4Lg","object":"chat.completion.chunk","created":1726053784,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} + data: {"id":"chatcmpl-AEGqwO8cO97nJK1gMyVlzL9Mfyv7E","object":"chat.completion.chunk","created":1727964738,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_f85bea6784","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} data: [DONE] @@ -69,13 +67,13 @@ interactions: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8c1748957cdf8342-SIN + - 8ccd86bd984e375f-MXP Connection: - keep-alive Content-Type: - text/event-stream; charset=utf-8 Date: - - Wed, 11 Sep 2024 11:23:04 GMT + - Thu, 03 Oct 2024 14:12:18 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -85,29 +83,27 @@ interactions: - nosniff access-control-expose-headers: - X-Request-ID - alt-svc: - - h3=":443"; ma=86400 openai-organization: test_openai_org_key openai-processing-ms: - - '103' + - '129' openai-version: - '2020-10-01' strict-transport-security: - - max-age=15552000; includeSubDomains; preload + - max-age=31536000; includeSubDomains; preload x-ratelimit-limit-requests: - '10000' x-ratelimit-limit-tokens: - '200000' x-ratelimit-remaining-requests: - - '9999' + - '9997' x-ratelimit-remaining-tokens: - '199966' x-ratelimit-reset-requests: - - 8.64s + - 21.613s x-ratelimit-reset-tokens: - 10ms x-request-id: - - req_e189c4d611320e4f236c9a2d16f95beb + - req_75b95a1a6b7e7ab044aff092dc595d3e status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_content[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_content[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..6b89565 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_content[azure_provider_chat_completions].yaml @@ -0,0 +1,102 @@ +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 + api-key: + - test_azure_api_key + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '154' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AsyncAzureOpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2023-03-15-preview + response: + body: + string: 'data: {"choices":[{"delta":{"role":"assistant"},"finish_reason":null,"index":0}],"created":1727964741,"id":"chatcmpl-AEGqzfynQK4iCO7EXRy3kGXYyuxF5","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"content":"South"},"finish_reason":null,"index":0}],"created":1727964741,"id":"chatcmpl-AEGqzfynQK4iCO7EXRy3kGXYyuxF5","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"content":" Atlantic"},"finish_reason":null,"index":0}],"created":1727964741,"id":"chatcmpl-AEGqzfynQK4iCO7EXRy3kGXYyuxF5","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"content":" Ocean"},"finish_reason":null,"index":0}],"created":1727964741,"id":"chatcmpl-AEGqzfynQK4iCO7EXRy3kGXYyuxF5","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"content":"."},"finish_reason":null,"index":0}],"created":1727964741,"id":"chatcmpl-AEGqzfynQK4iCO7EXRy3kGXYyuxF5","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{},"finish_reason":"stop","index":0}],"created":1727964741,"id":"chatcmpl-AEGqzfynQK4iCO7EXRy3kGXYyuxF5","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: [DONE] + + + ' + headers: + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 03 Oct 2024 14:12:21 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + apim-request-id: + - b43f4547-c4fd-4fa5-ac31-8c1c1ac95f13 + azureml-model-session: + - d008-20240925051300 + openai-organization: test_openai_org_key + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '155' + x-ms-client-request-id: + - b43f4547-c4fd-4fa5-ac31-8c1c1ac95f13 + x-ms-rai-invoked: + - 'true' + x-ms-region: + - East US + x-ratelimit-remaining-requests: + - '906' + x-ratelimit-remaining-tokens: + - '88372' + x-request-id: + - e9c64286-f767-46a7-b0b4-cb7876d451a0 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local_stream_error_handling.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_content[ollama_provider_chat_completions].yaml similarity index 50% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local_stream_error_handling.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_content[ollama_provider_chat_completions].yaml index 611c19a..8efb651 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local_stream_error_handling.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_content[ollama_provider_chat_completions].yaml @@ -1,8 +1,8 @@ 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}' + ocean contains the falkland islands?"}], "model": "qwen2.5:0.5b", "stream": + true}' headers: accept: - application/json @@ -13,23 +13,25 @@ interactions: connection: - keep-alive content-length: - - '166' + - '155' content-type: - application/json host: - localhost:11434 user-agent: - - OpenAI/Python 1.43.1 + - AsyncOpenAI/Python 1.50.0 x-stainless-arch: - x64 x-stainless-async: - - 'false' + - async:asyncio x-stainless-lang: - python x-stainless-os: - Linux x-stainless-package-version: - - 1.43.1 + - 1.50.0 + x-stainless-retry-count: + - '0' x-stainless-runtime: - CPython x-stainless-runtime-version: @@ -38,36 +40,40 @@ interactions: uri: http://localhost:11434/v1/chat/completions response: body: - string: 'data: {"id":"chatcmpl-377","object":"chat.completion.chunk","created":1726043716,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"The"},"finish_reason":null}]} + string: 'data: {"id":"chatcmpl-644","object":"chat.completion.chunk","created":1727964741,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"The"},"finish_reason":null}]} - data: {"id":"chatcmpl-377","object":"chat.completion.chunk","created":1726043716,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - Australian"},"finish_reason":null}]} + data: {"id":"chatcmpl-644","object":"chat.completion.chunk","created":1727964741,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + Falk"},"finish_reason":null}]} - data: {"id":"chatcmpl-377","object":"chat.completion.chunk","created":1726043716,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - Ocean"},"finish_reason":null}]} + data: {"id":"chatcmpl-644","object":"chat.completion.chunk","created":1727964741,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"land"},"finish_reason":null}]} - data: {"id":"chatcmpl-377","object":"chat.completion.chunk","created":1726043716,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"ic"},"finish_reason":null}]} + data: {"id":"chatcmpl-644","object":"chat.completion.chunk","created":1727964741,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + Islands"},"finish_reason":null}]} - data: {"id":"chatcmpl-377","object":"chat.completion.chunk","created":1726043716,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - Time"},"finish_reason":null}]} + data: {"id":"chatcmpl-644","object":"chat.completion.chunk","created":1727964741,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + lie"},"finish_reason":null}]} - data: {"id":"chatcmpl-377","object":"chat.completion.chunk","created":1726043716,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - Series"},"finish_reason":null}]} + data: {"id":"chatcmpl-644","object":"chat.completion.chunk","created":1727964741,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + within"},"finish_reason":null}]} - data: {"id":"chatcmpl-377","object":"chat.completion.chunk","created":1726043716,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - System"},"finish_reason":null}]} + data: {"id":"chatcmpl-644","object":"chat.completion.chunk","created":1727964741,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + which"},"finish_reason":null}]} - data: {"id":"chatcmpl-377","object":"chat.completion.chunk","created":1726043716,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null}]} + data: {"id":"chatcmpl-644","object":"chat.completion.chunk","created":1727964741,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + ocean"},"finish_reason":null}]} - data: {"id":"chatcmpl-377","object":"chat.completion.chunk","created":1726043716,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} + data: {"id":"chatcmpl-644","object":"chat.completion.chunk","created":1727964741,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"?"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-644","object":"chat.completion.chunk","created":1727964741,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} data: [DONE] @@ -78,7 +84,7 @@ interactions: Content-Type: - text/event-stream Date: - - Wed, 11 Sep 2024 08:35:16 GMT + - Thu, 03 Oct 2024 14:12:21 GMT Set-Cookie: test_set_cookie Transfer-Encoding: - chunked diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_stream.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_content[openai_provider_chat_completions].yaml similarity index 61% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_stream.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_content[openai_provider_chat_completions].yaml index d171727..3e4c7b4 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_stream.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_stream_with_capture_content[openai_provider_chat_completions].yaml @@ -17,10 +17,8 @@ interactions: - application/json host: - api.openai.com - openai-organization: - - test_openai_org_key user-agent: - - AsyncOpenAI/Python 1.43.1 + - AsyncOpenAI/Python 1.50.0 x-stainless-arch: - x64 x-stainless-async: @@ -30,7 +28,9 @@ interactions: x-stainless-os: - Linux x-stainless-package-version: - - 1.43.1 + - 1.50.0 + x-stainless-retry-count: + - '0' x-stainless-runtime: - CPython x-stainless-runtime-version: @@ -39,24 +39,24 @@ interactions: uri: https://api.openai.com/v1/chat/completions response: body: - string: 'data: {"id":"chatcmpl-A6dGYxfNeE9JSyv3LWSkGTOIXJvqy","object":"chat.completion.chunk","created":1726144270,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}]} + string: 'data: {"id":"chatcmpl-AEGqyZRrj9GUzDNw5te55gt1r7eus","object":"chat.completion.chunk","created":1727964740,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_f85bea6784","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A6dGYxfNeE9JSyv3LWSkGTOIXJvqy","object":"chat.completion.chunk","created":1726144270,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"content":"South"},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-AEGqyZRrj9GUzDNw5te55gt1r7eus","object":"chat.completion.chunk","created":1727964740,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_f85bea6784","choices":[{"index":0,"delta":{"content":"South"},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A6dGYxfNeE9JSyv3LWSkGTOIXJvqy","object":"chat.completion.chunk","created":1726144270,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"content":" + data: {"id":"chatcmpl-AEGqyZRrj9GUzDNw5te55gt1r7eus","object":"chat.completion.chunk","created":1727964740,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_f85bea6784","choices":[{"index":0,"delta":{"content":" Atlantic"},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A6dGYxfNeE9JSyv3LWSkGTOIXJvqy","object":"chat.completion.chunk","created":1726144270,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"content":" + data: {"id":"chatcmpl-AEGqyZRrj9GUzDNw5te55gt1r7eus","object":"chat.completion.chunk","created":1727964740,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_f85bea6784","choices":[{"index":0,"delta":{"content":" Ocean"},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A6dGYxfNeE9JSyv3LWSkGTOIXJvqy","object":"chat.completion.chunk","created":1726144270,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-AEGqyZRrj9GUzDNw5te55gt1r7eus","object":"chat.completion.chunk","created":1727964740,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_f85bea6784","choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A6dGYxfNeE9JSyv3LWSkGTOIXJvqy","object":"chat.completion.chunk","created":1726144270,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} + data: {"id":"chatcmpl-AEGqyZRrj9GUzDNw5te55gt1r7eus","object":"chat.completion.chunk","created":1727964740,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_f85bea6784","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} data: [DONE] @@ -67,13 +67,13 @@ interactions: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8c1fe9bb8dbe0d6e-MXP + - 8ccd86c82a0159e9-MXP Connection: - keep-alive Content-Type: - text/event-stream; charset=utf-8 Date: - - Thu, 12 Sep 2024 12:31:11 GMT + - Thu, 03 Oct 2024 14:12:20 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -83,15 +83,13 @@ interactions: - nosniff access-control-expose-headers: - X-Request-ID - alt-svc: - - h3=":443"; ma=86400 openai-organization: test_openai_org_key openai-processing-ms: - - '148' + - '532' openai-version: - '2020-10-01' strict-transport-security: - - max-age=15552000; includeSubDomains; preload + - max-age=31536000; includeSubDomains; preload x-ratelimit-limit-requests: - '10000' x-ratelimit-limit-tokens: @@ -101,11 +99,11 @@ interactions: x-ratelimit-remaining-tokens: - '199966' x-ratelimit-reset-requests: - - 31.769s + - 28.518s x-ratelimit-reset-tokens: - 10ms x-request-id: - - req_5588d3475b46b89951876ce7867b5d20 + - req_618ce2f84edee62527626249f110d78e status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_content[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_content[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..a88eee0 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_content[azure_provider_chat_completions].yaml @@ -0,0 +1,92 @@ +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 + api-key: + - test_azure_api_key + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '842' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AsyncAzureOpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2023-03-15-preview + response: + body: + string: '{"choices":[{"finish_reason":"tool_calls","index":0,"message":{"content":null,"role":"assistant","tool_calls":[{"function":{"arguments":"{\"order_id\":\"order_12345\"}","name":"get_delivery_date"},"id":"call_46cgdzJzy50oQJwWeUVWIwC3","type":"function"}]}}],"created":1727964743,"id":"chatcmpl-AEGr1X6ieLFOD5hlXZBx2BL2BrSLe","model":"gpt-4o-mini","object":"chat.completion","system_fingerprint":"fp_878413d04d","usage":{"completion_tokens":19,"prompt_tokens":140,"total_tokens":159}} + + ' + headers: + Content-Length: + - '483' + Content-Type: + - application/json + Date: + - Thu, 03 Oct 2024 14:12:23 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + apim-request-id: + - 16057ea8-73e9-4aab-997f-4b19bf7fc0f0 + azureml-model-session: + - d025-20240921204623 + openai-organization: test_openai_org_key + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '215' + x-ms-client-request-id: + - 16057ea8-73e9-4aab-997f-4b19bf7fc0f0 + x-ms-rai-invoked: + - 'true' + x-ms-region: + - East US + x-ratelimit-remaining-requests: + - '905' + x-ratelimit-remaining-tokens: + - '87671' + x-request-id: + - 8609bc6f-4788-4a2e-9c10-d85497a92928 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_tools_with_capture_content.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_content[openai_provider_chat_completions].yaml similarity index 78% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_tools_with_capture_content.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_content[openai_provider_chat_completions].yaml index f842eed..25f8895 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_tools_with_capture_content.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_async_tools_with_capture_content[openai_provider_chat_completions].yaml @@ -26,53 +26,52 @@ interactions: - application/json host: - api.openai.com - openai-organization: - - test_openai_org_key - openai-project: - - test_openai_project_id user-agent: - - AsyncOpenAI/Python 1.43.1 + - AsyncOpenAI/Python 1.50.0 x-stainless-arch: - - arm64 + - x64 x-stainless-async: - async:asyncio x-stainless-lang: - python x-stainless-os: - - MacOS + - Linux x-stainless-package-version: - - 1.43.1 + - 1.50.0 + x-stainless-retry-count: + - '0' x-stainless-runtime: - CPython x-stainless-runtime-version: - - 3.12.5 + - 3.10.12 method: POST uri: https://api.openai.com/v1/chat/completions response: body: - string: "{\n \"id\": \"chatcmpl-A9CT8USSOYj6tJBMsrClMJdppNCf3\",\n \"object\": - \"chat.completion\",\n \"created\": 1726756246,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + string: "{\n \"id\": \"chatcmpl-AEGr0SsAhppNLpPXpTtnmBiGGViQb\",\n \"object\": + \"chat.completion\",\n \"created\": 1727964742,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n - \ \"id\": \"call_GVSapIIRQ6xmhIGepoc0nTyQ\",\n \"type\": + \ \"id\": \"call_vZtzXVh5oO3k1IpFfuRejWHv\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_delivery_date\",\n \ \"arguments\": \"{\\\"order_id\\\":\\\"order_12345\\\"}\"\n \ }\n }\n ],\n \"refusal\": null\n },\n \ \"logprobs\": null,\n \"finish_reason\": \"tool_calls\"\n }\n \ ],\n \"usage\": {\n \"prompt_tokens\": 140,\n \"completion_tokens\": - 19,\n \"total_tokens\": 159,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": - 0\n }\n },\n \"system_fingerprint\": \"fp_e9627b5346\"\n}\n" + 19,\n \"total_tokens\": 159,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": + 0\n }\n },\n \"system_fingerprint\": \"fp_f85bea6784\"\n}\n" headers: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8c5a468c2915ce4f-SIN + - 8ccd86d4bed9839d-MXP Connection: - keep-alive Content-Type: - application/json Date: - - Thu, 19 Sep 2024 14:30:47 GMT + - Thu, 03 Oct 2024 14:12:22 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -82,31 +81,29 @@ interactions: - nosniff access-control-expose-headers: - X-Request-ID - alt-svc: - - h3=":443"; ma=86400 content-length: - - '855' + - '918' openai-organization: test_openai_org_key openai-processing-ms: - - '565' + - '830' openai-version: - '2020-10-01' strict-transport-security: - - max-age=15552000; includeSubDomains; preload + - max-age=31536000; includeSubDomains; preload x-ratelimit-limit-requests: - '10000' x-ratelimit-limit-tokens: - '200000' x-ratelimit-remaining-requests: - - '9992' + - '9995' x-ratelimit-remaining-tokens: - '199921' x-ratelimit-reset-requests: - - 1m4.051s + - 35.224s x-ratelimit-reset-tokens: - 23ms x-request-id: - - req_b360a3435f90b260591649ad9067f57d + - req_f20e0904b378e200a663a40c99bad07b status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..c5cfe13 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic[azure_provider_chat_completions].yaml @@ -0,0 +1,84 @@ +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 + api-key: + - test_azure_api_key + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '138' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AzureOpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2023-03-15-preview + response: + body: + string: '{"choices":[{"finish_reason":"stop","index":0,"message":{"content":"South + Atlantic Ocean","role":"assistant"}}],"created":1727957193,"id":"chatcmpl-AEEtFi8N27MCQoHr62DvUowImjwEc","model":"gpt-4o-mini","object":"chat.completion","system_fingerprint":"fp_878413d04d","usage":{"completion_tokens":3,"prompt_tokens":24,"total_tokens":27}} + + ' + headers: + Content-Length: + - '335' + Content-Type: + - application/json + Date: + - Thu, 03 Oct 2024 12:06:33 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + apim-request-id: + - 71ac28ce-007b-414e-ab35-f326fc57faa5 + azureml-model-session: + - d009-20240925061008 + openai-organization: test_openai_org_key + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '241' + x-ms-client-request-id: + - 71ac28ce-007b-414e-ab35-f326fc57faa5 + x-ms-rai-invoked: + - 'true' + x-ms-region: + - East US + x-ratelimit-remaining-requests: + - '909' + x-ratelimit-remaining-tokens: + - '90343' + x-request-id: + - 2edfbb9b-c853-42c9-97cc-de74fe7e5d1f + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic[ollama_provider_chat_completions].yaml new file mode 100644 index 0000000..34f3ab9 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic[ollama_provider_chat_completions].yaml @@ -0,0 +1,58 @@ +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.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: http://localhost:11434/v1/chat/completions + response: + body: + string: '{"id":"chatcmpl-645","object":"chat.completion","created":1727957194,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"The + Falklands Islands are located in the oceans south of South America."},"finish_reason":"stop"}],"usage":{"prompt_tokens":46,"completion_tokens":15,"total_tokens":61}} + + ' + headers: + Content-Length: + - '358' + Content-Type: + - application/json + Date: + - Thu, 03 Oct 2024 12:06:34 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/TestChatCompletions.test_basic.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic[openai_provider_chat_completions].yaml similarity index 73% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_basic.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic[openai_provider_chat_completions].yaml index b1744dd..9024da4 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_basic.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic[openai_provider_chat_completions].yaml @@ -17,49 +17,48 @@ interactions: - application/json host: - api.openai.com - openai-organization: - - test_openai_org_key - openai-project: - - test_openai_project_id user-agent: - - OpenAI/Python 1.43.1 + - OpenAI/Python 1.50.0 x-stainless-arch: - - arm64 + - x64 x-stainless-async: - 'false' x-stainless-lang: - python x-stainless-os: - - MacOS + - Linux x-stainless-package-version: - - 1.43.1 + - 1.50.0 + x-stainless-retry-count: + - '0' x-stainless-runtime: - CPython x-stainless-runtime-version: - - 3.12.5 + - 3.10.12 method: POST uri: https://api.openai.com/v1/chat/completions response: body: - string: "{\n \"id\": \"chatcmpl-A9CSutUkLCxwZIXuXRXlgEJUCMnlT\",\n \"object\": - \"chat.completion\",\n \"created\": 1726756232,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + string: "{\n \"id\": \"chatcmpl-AEEtEV5mndU1WYBSLgvTpAIKAoYeu\",\n \"object\": + \"chat.completion\",\n \"created\": 1727957192,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"South Atlantic Ocean.\",\n \"refusal\": null\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 24,\n \"completion_tokens\": - 4,\n \"total_tokens\": 28,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": - 0\n }\n },\n \"system_fingerprint\": \"fp_e9627b5346\"\n}\n" + 4,\n \"total_tokens\": 28,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": + 0\n }\n },\n \"system_fingerprint\": \"fp_f85bea6784\"\n}\n" headers: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8c5a46355cffce11-SIN + - 8cccce840dcc4c55-MXP Connection: - keep-alive Content-Type: - application/json Date: - - Thu, 19 Sep 2024 14:30:33 GMT + - Thu, 03 Oct 2024 12:06:32 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -69,17 +68,15 @@ interactions: - nosniff access-control-expose-headers: - X-Request-ID - alt-svc: - - h3=":443"; ma=86400 content-length: - - '580' + - '643' openai-organization: test_openai_org_key openai-processing-ms: - - '169' + - '144' openai-version: - '2020-10-01' strict-transport-security: - - max-age=15552000; includeSubDomains; preload + - max-age=31536000; includeSubDomains; preload x-ratelimit-limit-requests: - '10000' x-ratelimit-limit-tokens: @@ -93,7 +90,7 @@ interactions: x-ratelimit-reset-tokens: - 10ms x-request-id: - - req_bff80607a3cf6acc8cbc327f59c63e96 + - req_d892784a574fbd033045b660e4c1f4b8 status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_content[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_content[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..6965563 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_content[azure_provider_chat_completions].yaml @@ -0,0 +1,84 @@ +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 + api-key: + - test_azure_api_key + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '138' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AzureOpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2023-03-15-preview + response: + body: + string: '{"choices":[{"finish_reason":"stop","index":0,"message":{"content":"Atlantic + Ocean.","role":"assistant"}}],"created":1727961088,"id":"chatcmpl-AEFu4REQubxeCCkrv6wgeJ4VdN6o5","model":"gpt-4o-mini","object":"chat.completion","system_fingerprint":"fp_878413d04d","usage":{"completion_tokens":3,"prompt_tokens":24,"total_tokens":27}} + + ' + headers: + Content-Length: + - '330' + Content-Type: + - application/json + Date: + - Thu, 03 Oct 2024 13:11:28 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + apim-request-id: + - ab1061ae-4e2c-4e4b-8a05-cb6dad53badd + azureml-model-session: + - d006-20240926121537 + openai-organization: test_openai_org_key + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '477' + x-ms-client-request-id: + - ab1061ae-4e2c-4e4b-8a05-cb6dad53badd + x-ms-rai-invoked: + - 'true' + x-ms-region: + - East US + x-ratelimit-remaining-requests: + - '909' + x-ratelimit-remaining-tokens: + - '90343' + x-request-id: + - c7abd511-83f4-417e-9814-fa65b53c144d + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_content[ollama_provider_chat_completions].yaml similarity index 63% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_content[ollama_provider_chat_completions].yaml index 222fe5a..55419b2 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_content[ollama_provider_chat_completions].yaml @@ -8,46 +8,50 @@ interactions: accept-encoding: - gzip, deflate authorization: - - Bearer unused + - Bearer test_openai_api_key connection: - keep-alive content-length: - - '150' + - '139' content-type: - application/json host: - localhost:11434 user-agent: - - OpenAI/Python 1.43.1 + - OpenAI/Python 1.50.0 x-stainless-arch: - - arm64 + - x64 x-stainless-async: - 'false' x-stainless-lang: - python x-stainless-os: - - MacOS + - Linux x-stainless-package-version: - - 1.43.1 + - 1.50.0 + x-stainless-retry-count: + - '0' x-stainless-runtime: - CPython x-stainless-runtime-version: - - 3.12.5 + - 3.10.12 method: POST uri: http://localhost:11434/v1/chat/completions response: body: - string: '{"id":"chatcmpl-753","object":"chat.completion","created":1725605681,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"The - South Atlantic Ocean contains the Falklands Islands."},"finish_reason":"stop"}],"usage":{"prompt_tokens":52,"completion_tokens":11,"total_tokens":63}} + string: '{"id":"chatcmpl-976","object":"chat.completion","created":1727960848,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"The + Atlantic Ocean contains the Falkland Islands."},"finish_reason":"stop"}],"usage":{"prompt_tokens":46,"completion_tokens":10,"total_tokens":56}} ' headers: Content-Length: - - '354' + - '336' Content-Type: - application/json Date: - - Fri, 06 Sep 2024 06:54:41 GMT + - Thu, 03 Oct 2024 13:07:28 GMT + Set-Cookie: test_set_cookie + openai-organization: test_openai_org_key status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_content[openai_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_content[openai_provider_chat_completions].yaml new file mode 100644 index 0000000..28f0fe6 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_basic_with_capture_content[openai_provider_chat_completions].yaml @@ -0,0 +1,97 @@ +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.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: "{\n \"id\": \"chatcmpl-AEFu3fjzje87q8tfrYWpazqelNIfW\",\n \"object\": + \"chat.completion\",\n \"created\": 1727961087,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"South Atlantic Ocean.\",\n \"refusal\": + null\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n + \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 24,\n \"completion_tokens\": + 4,\n \"total_tokens\": 28,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": + 0\n }\n },\n \"system_fingerprint\": \"fp_f85bea6784\"\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8ccd2d980c8a5258-MXP + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 03 Oct 2024 13:11:27 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + content-length: + - '643' + openai-organization: test_openai_org_key + openai-processing-ms: + - '285' + 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: + - '9999' + x-ratelimit-remaining-tokens: + - '199966' + x-ratelimit-reset-requests: + - 8.64s + x-ratelimit-reset-tokens: + - 10ms + x-request-id: + - req_4397ce35e4a59a23e2bcafd3ec37771b + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_function_calling_with_tools[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_function_calling_with_tools[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..8e6339b --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_function_calling_with_tools[azure_provider_chat_completions].yaml @@ -0,0 +1,92 @@ +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 + api-key: + - test_azure_api_key + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '842' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AzureOpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2023-03-15-preview + response: + body: + string: '{"choices":[{"finish_reason":"tool_calls","index":0,"message":{"content":null,"role":"assistant","tool_calls":[{"function":{"arguments":"{\"order_id\":\"order_12345\"}","name":"get_delivery_date"},"id":"call_k7neuKSnenJ2HHuw83I6xMuF","type":"function"}]}}],"created":1727962615,"id":"chatcmpl-AEGIh5ygWzdZJL7BvIVeFLmgDSdT7","model":"gpt-4o-mini","object":"chat.completion","system_fingerprint":"fp_878413d04d","usage":{"completion_tokens":19,"prompt_tokens":140,"total_tokens":159}} + + ' + headers: + Content-Length: + - '483' + Content-Type: + - application/json + Date: + - Thu, 03 Oct 2024 13:36:55 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + apim-request-id: + - f1bc4353-d74e-4ae7-b4ae-3bed4c405009 + azureml-model-session: + - d012-20240925101712 + openai-organization: test_openai_org_key + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '292' + x-ms-client-request-id: + - f1bc4353-d74e-4ae7-b4ae-3bed4c405009 + x-ms-rai-invoked: + - 'true' + x-ms-region: + - East US + x-ratelimit-remaining-requests: + - '909' + x-ratelimit-remaining-tokens: + - '90299' + x-request-id: + - 5a8a5280-4b43-48a7-8b03-f0089eadeb52 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_function_calling_with_tools[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_function_calling_with_tools[ollama_provider_chat_completions].yaml new file mode 100644 index 0000000..c6596bb --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_function_calling_with_tools[ollama_provider_chat_completions].yaml @@ -0,0 +1,66 @@ +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.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: http://localhost:11434/v1/chat/completions + response: + body: + string: '{"id":"chatcmpl-363","object":"chat.completion","created":1727962617,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"","tool_calls":[{"id":"call_53y5aowa","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: + - Thu, 03 Oct 2024 13:36:57 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/TestChatCompletions.test_function_calling_with_tools.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_function_calling_with_tools[openai_provider_chat_completions].yaml similarity index 78% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_function_calling_with_tools.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_function_calling_with_tools[openai_provider_chat_completions].yaml index 211abea..710ec72 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_function_calling_with_tools.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_function_calling_with_tools[openai_provider_chat_completions].yaml @@ -26,53 +26,52 @@ interactions: - application/json host: - api.openai.com - openai-organization: - - test_openai_org_key - openai-project: - - test_openai_project_id user-agent: - - OpenAI/Python 1.43.1 + - OpenAI/Python 1.50.0 x-stainless-arch: - - arm64 + - x64 x-stainless-async: - 'false' x-stainless-lang: - python x-stainless-os: - - MacOS + - Linux x-stainless-package-version: - - 1.43.1 + - 1.50.0 + x-stainless-retry-count: + - '0' x-stainless-runtime: - CPython x-stainless-runtime-version: - - 3.12.5 + - 3.10.12 method: POST uri: https://api.openai.com/v1/chat/completions response: body: - string: "{\n \"id\": \"chatcmpl-A9CSwJdb2481bxsjIiuD8yIBOAfql\",\n \"object\": - \"chat.completion\",\n \"created\": 1726756234,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + string: "{\n \"id\": \"chatcmpl-AEGIgPL1ReEL2yG6M4MrD3Uw960Bu\",\n \"object\": + \"chat.completion\",\n \"created\": 1727962614,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n - \ \"id\": \"call_dOqzuRvPeuy9vHsukAyRp4yy\",\n \"type\": + \ \"id\": \"call_Ry1nbnyK4J1JdY3EUcZO8jrr\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_delivery_date\",\n \ \"arguments\": \"{\\\"order_id\\\":\\\"order_12345\\\"}\"\n \ }\n }\n ],\n \"refusal\": null\n },\n \ \"logprobs\": null,\n \"finish_reason\": \"tool_calls\"\n }\n \ ],\n \"usage\": {\n \"prompt_tokens\": 140,\n \"completion_tokens\": - 19,\n \"total_tokens\": 159,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": - 0\n }\n },\n \"system_fingerprint\": \"fp_1bb46167f9\"\n}\n" + 19,\n \"total_tokens\": 159,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": + 0\n }\n },\n \"system_fingerprint\": \"fp_74ba47b4ac\"\n}\n" headers: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8c5a46416ae2ce11-SIN + - 8ccd52e14cbb59e3-MXP Connection: - keep-alive Content-Type: - application/json Date: - - Thu, 19 Sep 2024 14:30:35 GMT + - Thu, 03 Oct 2024 13:36:54 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -82,31 +81,29 @@ interactions: - nosniff access-control-expose-headers: - X-Request-ID - alt-svc: - - h3=":443"; ma=86400 content-length: - - '855' + - '918' openai-organization: test_openai_org_key openai-processing-ms: - - '851' + - '415' openai-version: - '2020-10-01' strict-transport-security: - - max-age=15552000; includeSubDomains; preload + - max-age=31536000; includeSubDomains; preload x-ratelimit-limit-requests: - '10000' x-ratelimit-limit-tokens: - '200000' x-ratelimit-remaining-requests: - - '9998' + - '9999' x-ratelimit-remaining-tokens: - '199921' x-ratelimit-reset-requests: - - 15.555s + - 8.64s x-ratelimit-reset-tokens: - 23ms x-request-id: - - req_3d6fa273aa9717936dc8cde9b3825092 + - req_cecc12d701909fe4b166ddbd61e500b1 status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..7e39958 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream[azure_provider_chat_completions].yaml @@ -0,0 +1,102 @@ +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 + api-key: + - test_azure_api_key + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '154' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AzureOpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2023-03-15-preview + response: + body: + string: 'data: {"choices":[{"delta":{"role":"assistant"},"finish_reason":null,"index":0}],"created":1727963265,"id":"chatcmpl-AEGTBkVVthwTc3DgRp6RGKJxyY1pE","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"content":"South"},"finish_reason":null,"index":0}],"created":1727963265,"id":"chatcmpl-AEGTBkVVthwTc3DgRp6RGKJxyY1pE","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"content":" Atlantic"},"finish_reason":null,"index":0}],"created":1727963265,"id":"chatcmpl-AEGTBkVVthwTc3DgRp6RGKJxyY1pE","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"content":" Ocean"},"finish_reason":null,"index":0}],"created":1727963265,"id":"chatcmpl-AEGTBkVVthwTc3DgRp6RGKJxyY1pE","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"content":"."},"finish_reason":null,"index":0}],"created":1727963265,"id":"chatcmpl-AEGTBkVVthwTc3DgRp6RGKJxyY1pE","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{},"finish_reason":"stop","index":0}],"created":1727963265,"id":"chatcmpl-AEGTBkVVthwTc3DgRp6RGKJxyY1pE","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: [DONE] + + + ' + headers: + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 03 Oct 2024 13:47:44 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + apim-request-id: + - b9033efa-7880-4d4d-a9cb-48b17c2f85ad + azureml-model-session: + - d014-20240925133946 + openai-organization: test_openai_org_key + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '149' + x-ms-client-request-id: + - b9033efa-7880-4d4d-a9cb-48b17c2f85ad + x-ms-rai-invoked: + - 'true' + x-ms-region: + - East US + x-ratelimit-remaining-requests: + - '909' + x-ratelimit-remaining-tokens: + - '90343' + x-request-id: + - fd5e0272-e578-4eab-b87f-b62c33dabff3 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream[ollama_provider_chat_completions].yaml new file mode 100644 index 0000000..d930e76 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream[ollama_provider_chat_completions].yaml @@ -0,0 +1,356 @@ +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: + - OpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: http://localhost:11434/v1/chat/completions + response: + body: + string: 'data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"The"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + Falk"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"land"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + Islands"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + also"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + known"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + as"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + the"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + Arg"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"entin"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"ian"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + Islands"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + or"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + British"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + South"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + America"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + Land"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + ("},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"BS"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"AL"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"),"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963266,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + is"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + an"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + arch"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"ipel"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"ago"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + of"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + several"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + small"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + islands"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + and"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + pen"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"ins"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"ulas"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + located"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + off"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + the"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + coast"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + of"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + Argentina"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + It"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + contains"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + nine"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + unin"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"hab"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"ited"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + Falk"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"land"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + Islands"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + plus"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + a"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + mix"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + of"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + unin"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"hab"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"itable"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + territory"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + and"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + other"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + small"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + features"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + that"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + are"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + not"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + considered"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + part"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + of"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + the"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + Falk"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"land"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + Islands"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"''"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + current"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + administrative"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + divisions"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null}]} + + + data: {"id":"chatcmpl-415","object":"chat.completion.chunk","created":1727963267,"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: + - Thu, 03 Oct 2024 13:47:46 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/TestAsyncChatCompletions.test_async_stream_with_capture_content.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream[openai_provider_chat_completions].yaml similarity index 61% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_stream_with_capture_content.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream[openai_provider_chat_completions].yaml index d754f8a..510c06d 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_stream_with_capture_content.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream[openai_provider_chat_completions].yaml @@ -17,20 +17,20 @@ interactions: - application/json host: - api.openai.com - openai-organization: - - test_openai_org_key user-agent: - - AsyncOpenAI/Python 1.43.1 + - OpenAI/Python 1.50.0 x-stainless-arch: - x64 x-stainless-async: - - async:asyncio + - 'false' x-stainless-lang: - python x-stainless-os: - Linux x-stainless-package-version: - - 1.43.1 + - 1.50.0 + x-stainless-retry-count: + - '0' x-stainless-runtime: - CPython x-stainless-runtime-version: @@ -39,24 +39,24 @@ interactions: uri: https://api.openai.com/v1/chat/completions response: body: - string: 'data: {"id":"chatcmpl-A6dGarmkMfJOnz2DWzymvkYpWQt00","object":"chat.completion.chunk","created":1726144272,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}]} + string: 'data: {"id":"chatcmpl-AEGTAvX2YSIO9EQwMleHTB91Cgn4G","object":"chat.completion.chunk","created":1727963264,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_74ba47b4ac","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A6dGarmkMfJOnz2DWzymvkYpWQt00","object":"chat.completion.chunk","created":1726144272,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"content":"South"},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-AEGTAvX2YSIO9EQwMleHTB91Cgn4G","object":"chat.completion.chunk","created":1727963264,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_74ba47b4ac","choices":[{"index":0,"delta":{"content":"South"},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A6dGarmkMfJOnz2DWzymvkYpWQt00","object":"chat.completion.chunk","created":1726144272,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"content":" + data: {"id":"chatcmpl-AEGTAvX2YSIO9EQwMleHTB91Cgn4G","object":"chat.completion.chunk","created":1727963264,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_74ba47b4ac","choices":[{"index":0,"delta":{"content":" Atlantic"},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A6dGarmkMfJOnz2DWzymvkYpWQt00","object":"chat.completion.chunk","created":1726144272,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"content":" + data: {"id":"chatcmpl-AEGTAvX2YSIO9EQwMleHTB91Cgn4G","object":"chat.completion.chunk","created":1727963264,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_74ba47b4ac","choices":[{"index":0,"delta":{"content":" Ocean"},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A6dGarmkMfJOnz2DWzymvkYpWQt00","object":"chat.completion.chunk","created":1726144272,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-AEGTAvX2YSIO9EQwMleHTB91Cgn4G","object":"chat.completion.chunk","created":1727963264,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_74ba47b4ac","choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A6dGarmkMfJOnz2DWzymvkYpWQt00","object":"chat.completion.chunk","created":1726144272,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} + data: {"id":"chatcmpl-AEGTAvX2YSIO9EQwMleHTB91Cgn4G","object":"chat.completion.chunk","created":1727963264,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_74ba47b4ac","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} data: [DONE] @@ -67,13 +67,13 @@ interactions: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8c1fe9c3ac02baaf-MXP + - 8ccd62c16ff883b4-MXP Connection: - keep-alive Content-Type: - text/event-stream; charset=utf-8 Date: - - Thu, 12 Sep 2024 12:31:12 GMT + - Thu, 03 Oct 2024 13:47:44 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -87,25 +87,25 @@ interactions: - h3=":443"; ma=86400 openai-organization: test_openai_org_key openai-processing-ms: - - '84' + - '118' openai-version: - '2020-10-01' strict-transport-security: - - max-age=15552000; includeSubDomains; preload + - max-age=31536000; includeSubDomains; preload x-ratelimit-limit-requests: - '10000' x-ratelimit-limit-tokens: - '200000' x-ratelimit-remaining-requests: - - '9995' + - '9999' x-ratelimit-remaining-tokens: - '199966' x-ratelimit-reset-requests: - - 39.095s + - 8.64s x-ratelimit-reset-tokens: - 10ms x-request-id: - - req_830a5f56d0e007d88cb43ed24a217cfd + - req_ffbb4814d7a917d085dbd62f0361fcbb status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_include_usage_option[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_include_usage_option[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..0d8517e --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_include_usage_option[azure_provider_chat_completions].yaml @@ -0,0 +1,106 @@ +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, + "stream_options": {"include_usage": 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: + - '197' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AzureOpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2023-03-15-preview + response: + body: + string: 'data: {"choices":[{"delta":{"role":"assistant"},"finish_reason":null,"index":0}],"created":1727963269,"id":"chatcmpl-AEGTFYMyoBBDm4Qz37Lc8bekb2QOO","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d","usage":null} + + + data: {"choices":[{"delta":{"content":"South"},"finish_reason":null,"index":0}],"created":1727963269,"id":"chatcmpl-AEGTFYMyoBBDm4Qz37Lc8bekb2QOO","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d","usage":null} + + + data: {"choices":[{"delta":{"content":" Atlantic"},"finish_reason":null,"index":0}],"created":1727963269,"id":"chatcmpl-AEGTFYMyoBBDm4Qz37Lc8bekb2QOO","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d","usage":null} + + + data: {"choices":[{"delta":{"content":" Ocean"},"finish_reason":null,"index":0}],"created":1727963269,"id":"chatcmpl-AEGTFYMyoBBDm4Qz37Lc8bekb2QOO","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d","usage":null} + + + data: {"choices":[{"delta":{"content":"."},"finish_reason":null,"index":0}],"created":1727963269,"id":"chatcmpl-AEGTFYMyoBBDm4Qz37Lc8bekb2QOO","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d","usage":null} + + + data: {"choices":[{"delta":{},"finish_reason":"stop","index":0}],"created":1727963269,"id":"chatcmpl-AEGTFYMyoBBDm4Qz37Lc8bekb2QOO","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d","usage":null} + + + data: {"choices":[],"created":1727963269,"id":"chatcmpl-AEGTFYMyoBBDm4Qz37Lc8bekb2QOO","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d","usage":{"completion_tokens":4,"prompt_tokens":24,"total_tokens":28}} + + + data: [DONE] + + + ' + headers: + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 03 Oct 2024 13:47:48 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + apim-request-id: + - 8cbb5f34-a753-48ef-9906-62b070352cd5 + azureml-model-session: + - d007-20240926131035 + openai-organization: test_openai_org_key + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '242' + x-ms-client-request-id: + - 8cbb5f34-a753-48ef-9906-62b070352cd5 + x-ms-rai-invoked: + - 'true' + x-ms-region: + - East US + x-ratelimit-remaining-requests: + - '908' + x-ratelimit-remaining-tokens: + - '89686' + x-request-id: + - 856505ee-135a-477c-bac8-69db30e73778 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_stream_with_include_usage_option.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_include_usage_option[openai_provider_chat_completions].yaml similarity index 58% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_stream_with_include_usage_option.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_include_usage_option[openai_provider_chat_completions].yaml index 4ecba74..6f6b353 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_stream_with_include_usage_option.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_include_usage_option[openai_provider_chat_completions].yaml @@ -18,51 +18,49 @@ interactions: - application/json host: - api.openai.com - openai-organization: - - test_openai_org_key - openai-project: - - test_openai_project_id user-agent: - - OpenAI/Python 1.43.1 + - OpenAI/Python 1.50.0 x-stainless-arch: - - arm64 + - x64 x-stainless-async: - 'false' x-stainless-lang: - python x-stainless-os: - - MacOS + - Linux x-stainless-package-version: - - 1.43.1 + - 1.50.0 + x-stainless-retry-count: + - '0' x-stainless-runtime: - CPython x-stainless-runtime-version: - - 3.12.5 + - 3.10.12 method: POST uri: https://api.openai.com/v1/chat/completions response: body: - string: 'data: {"id":"chatcmpl-A6Fj6QSKWN7eCCTYz5lKYkZMHngDq","object":"chat.completion.chunk","created":1726053784,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null} + string: 'data: {"id":"chatcmpl-AEGTE6nGqR4tbVuy6CPSHnXIF2eqy","object":"chat.completion.chunk","created":1727963268,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_f85bea6784","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null} - data: {"id":"chatcmpl-A6Fj6QSKWN7eCCTYz5lKYkZMHngDq","object":"chat.completion.chunk","created":1726053784,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"content":"South"},"logprobs":null,"finish_reason":null}],"usage":null} + data: {"id":"chatcmpl-AEGTE6nGqR4tbVuy6CPSHnXIF2eqy","object":"chat.completion.chunk","created":1727963268,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_f85bea6784","choices":[{"index":0,"delta":{"content":"South"},"logprobs":null,"finish_reason":null}],"usage":null} - data: {"id":"chatcmpl-A6Fj6QSKWN7eCCTYz5lKYkZMHngDq","object":"chat.completion.chunk","created":1726053784,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"content":" + data: {"id":"chatcmpl-AEGTE6nGqR4tbVuy6CPSHnXIF2eqy","object":"chat.completion.chunk","created":1727963268,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_f85bea6784","choices":[{"index":0,"delta":{"content":" Atlantic"},"logprobs":null,"finish_reason":null}],"usage":null} - data: {"id":"chatcmpl-A6Fj6QSKWN7eCCTYz5lKYkZMHngDq","object":"chat.completion.chunk","created":1726053784,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"content":" + data: {"id":"chatcmpl-AEGTE6nGqR4tbVuy6CPSHnXIF2eqy","object":"chat.completion.chunk","created":1727963268,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_f85bea6784","choices":[{"index":0,"delta":{"content":" Ocean"},"logprobs":null,"finish_reason":null}],"usage":null} - data: {"id":"chatcmpl-A6Fj6QSKWN7eCCTYz5lKYkZMHngDq","object":"chat.completion.chunk","created":1726053784,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}],"usage":null} + data: {"id":"chatcmpl-AEGTE6nGqR4tbVuy6CPSHnXIF2eqy","object":"chat.completion.chunk","created":1727963268,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_f85bea6784","choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}],"usage":null} - data: {"id":"chatcmpl-A6Fj6QSKWN7eCCTYz5lKYkZMHngDq","object":"chat.completion.chunk","created":1726053784,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null} + data: {"id":"chatcmpl-AEGTE6nGqR4tbVuy6CPSHnXIF2eqy","object":"chat.completion.chunk","created":1727963268,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_f85bea6784","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null} - data: {"id":"chatcmpl-A6Fj6QSKWN7eCCTYz5lKYkZMHngDq","object":"chat.completion.chunk","created":1726053784,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[],"usage":{"prompt_tokens":24,"completion_tokens":4,"total_tokens":28}} + data: {"id":"chatcmpl-AEGTE6nGqR4tbVuy6CPSHnXIF2eqy","object":"chat.completion.chunk","created":1727963268,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_f85bea6784","choices":[],"usage":{"prompt_tokens":24,"completion_tokens":4,"total_tokens":28,"prompt_tokens_details":{"cached_tokens":0},"completion_tokens_details":{"reasoning_tokens":0}}} data: [DONE] @@ -73,13 +71,13 @@ interactions: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8c1748992e684067-SIN + - 8ccd62d89b830e63-MXP Connection: - keep-alive Content-Type: - text/event-stream; charset=utf-8 Date: - - Wed, 11 Sep 2024 11:23:04 GMT + - Thu, 03 Oct 2024 13:47:48 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -89,15 +87,13 @@ interactions: - nosniff access-control-expose-headers: - X-Request-ID - alt-svc: - - h3=":443"; ma=86400 openai-organization: test_openai_org_key openai-processing-ms: - - '64' + - '190' openai-version: - '2020-10-01' strict-transport-security: - - max-age=15552000; includeSubDomains; preload + - max-age=31536000; includeSubDomains; preload x-ratelimit-limit-requests: - '10000' x-ratelimit-limit-tokens: @@ -107,11 +103,11 @@ interactions: x-ratelimit-remaining-tokens: - '199966' x-ratelimit-reset-requests: - - 16.69s + - 13.604s x-ratelimit-reset-tokens: - 10ms x-request-id: - - req_9c7e4410d8baab99d48238b991c0ad40 + - req_faa08abf0ed07ca86c252ca3b66a470d status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_content[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_content[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..e7f1c9d --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_content[azure_provider_chat_completions].yaml @@ -0,0 +1,126 @@ +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 + api-key: + - test_azure_api_key + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '858' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AzureOpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2023-03-15-preview + response: + body: + string: 'data: {"choices":[{"delta":{"role":"assistant","tool_calls":[{"function":{"arguments":"","name":"get_delivery_date"},"id":"call_96LHcDPBXtgIxgxbFvuJjTYU","index":0,"type":"function"}]},"finish_reason":null,"index":0}],"created":1727963271,"id":"chatcmpl-AEGTHbbvqBK2BE52I8GByDCM2dypS","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"tool_calls":[{"function":{"arguments":"{\""},"index":0}]},"finish_reason":null,"index":0}],"created":1727963271,"id":"chatcmpl-AEGTHbbvqBK2BE52I8GByDCM2dypS","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"tool_calls":[{"function":{"arguments":"order"},"index":0}]},"finish_reason":null,"index":0}],"created":1727963271,"id":"chatcmpl-AEGTHbbvqBK2BE52I8GByDCM2dypS","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"tool_calls":[{"function":{"arguments":"_id"},"index":0}]},"finish_reason":null,"index":0}],"created":1727963271,"id":"chatcmpl-AEGTHbbvqBK2BE52I8GByDCM2dypS","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"tool_calls":[{"function":{"arguments":"\":\""},"index":0}]},"finish_reason":null,"index":0}],"created":1727963271,"id":"chatcmpl-AEGTHbbvqBK2BE52I8GByDCM2dypS","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"tool_calls":[{"function":{"arguments":"order"},"index":0}]},"finish_reason":null,"index":0}],"created":1727963271,"id":"chatcmpl-AEGTHbbvqBK2BE52I8GByDCM2dypS","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"tool_calls":[{"function":{"arguments":"_"},"index":0}]},"finish_reason":null,"index":0}],"created":1727963271,"id":"chatcmpl-AEGTHbbvqBK2BE52I8GByDCM2dypS","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"tool_calls":[{"function":{"arguments":"123"},"index":0}]},"finish_reason":null,"index":0}],"created":1727963271,"id":"chatcmpl-AEGTHbbvqBK2BE52I8GByDCM2dypS","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"tool_calls":[{"function":{"arguments":"45"},"index":0}]},"finish_reason":null,"index":0}],"created":1727963271,"id":"chatcmpl-AEGTHbbvqBK2BE52I8GByDCM2dypS","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{"tool_calls":[{"function":{"arguments":"\"}"},"index":0}]},"finish_reason":null,"index":0}],"created":1727963271,"id":"chatcmpl-AEGTHbbvqBK2BE52I8GByDCM2dypS","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: {"choices":[{"delta":{},"finish_reason":"tool_calls","index":0}],"created":1727963271,"id":"chatcmpl-AEGTHbbvqBK2BE52I8GByDCM2dypS","model":"gpt-4o-mini","object":"chat.completion.chunk","system_fingerprint":"fp_878413d04d"} + + + data: [DONE] + + + ' + headers: + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 03 Oct 2024 13:47:50 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + apim-request-id: + - 3860d8c9-3fc0-47f9-99c7-81783c2fc7e4 + azureml-model-session: + - d007-20240930124026 + openai-organization: test_openai_org_key + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '197' + x-ms-client-request-id: + - 3860d8c9-3fc0-47f9-99c7-81783c2fc7e4 + x-ms-rai-invoked: + - 'true' + x-ms-region: + - East US + x-ratelimit-remaining-requests: + - '907' + x-ratelimit-remaining-tokens: + - '88985' + x-request-id: + - aa16ff81-57ab-4f83-8ef9-82ae3032f50d + 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_content[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_content[ollama_provider_chat_completions].yaml new file mode 100644 index 0000000..6236f69 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_content[ollama_provider_chat_completions].yaml @@ -0,0 +1,155 @@ +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.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: http://localhost:11434/v1/chat/completions + response: + body: + string: 'data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"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-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"{\""},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"name"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + \""},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"get"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_delivery"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_date"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\","},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + \""},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"arguments"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + {\""},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"order"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_id"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\":"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + \""},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"order"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"_"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"2"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"3"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"4"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"5"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"\"}}\n"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-598","object":"chat.completion.chunk","created":1727963272,"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-598","object":"chat.completion.chunk","created":1727963272,"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: + - Thu, 03 Oct 2024 13:47:52 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/TestChatCompletions.test_stream_with_tools_and_capture_content.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_content[openai_provider_chat_completions].yaml similarity index 61% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_stream_with_tools_and_capture_content.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_content[openai_provider_chat_completions].yaml index edea8a9..23071e7 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_stream_with_tools_and_capture_content.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_stream_with_tools_and_capture_content[openai_provider_chat_completions].yaml @@ -27,7 +27,7 @@ interactions: host: - api.openai.com user-agent: - - OpenAI/Python 1.43.1 + - OpenAI/Python 1.50.0 x-stainless-arch: - x64 x-stainless-async: @@ -37,7 +37,9 @@ interactions: x-stainless-os: - Linux x-stainless-package-version: - - 1.43.1 + - 1.50.0 + x-stainless-retry-count: + - '0' x-stainless-runtime: - CPython x-stainless-runtime-version: @@ -46,37 +48,37 @@ interactions: uri: https://api.openai.com/v1/chat/completions response: body: - string: 'data: {"id":"chatcmpl-A86CT7lmQpCMrARhR2GkBP5JBYLfn","object":"chat.completion.chunk","created":1726493821,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_bfejaMKRxvBgQ06j5qJ1Ue28","type":"function","function":{"name":"get_delivery_date","arguments":""}}],"refusal":null},"logprobs":null,"finish_reason":null}]} + string: 'data: {"id":"chatcmpl-AEGTFZ2zBPeLJlZ1EA10ZEDA12VfO","object":"chat.completion.chunk","created":1727963269,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_74ba47b4ac","choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_Hb0tFTds0zHfckULpnZ4t8XL","type":"function","function":{"name":"get_delivery_date","arguments":""}}],"refusal":null},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A86CT7lmQpCMrARhR2GkBP5JBYLfn","object":"chat.completion.chunk","created":1726493821,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-AEGTFZ2zBPeLJlZ1EA10ZEDA12VfO","object":"chat.completion.chunk","created":1727963269,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_74ba47b4ac","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A86CT7lmQpCMrARhR2GkBP5JBYLfn","object":"chat.completion.chunk","created":1726493821,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"order"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-AEGTFZ2zBPeLJlZ1EA10ZEDA12VfO","object":"chat.completion.chunk","created":1727963269,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_74ba47b4ac","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"order"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A86CT7lmQpCMrARhR2GkBP5JBYLfn","object":"chat.completion.chunk","created":1726493821,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_id"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-AEGTFZ2zBPeLJlZ1EA10ZEDA12VfO","object":"chat.completion.chunk","created":1727963269,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_74ba47b4ac","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_id"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A86CT7lmQpCMrARhR2GkBP5JBYLfn","object":"chat.completion.chunk","created":1726493821,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-AEGTFZ2zBPeLJlZ1EA10ZEDA12VfO","object":"chat.completion.chunk","created":1727963269,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_74ba47b4ac","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A86CT7lmQpCMrARhR2GkBP5JBYLfn","object":"chat.completion.chunk","created":1726493821,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"order"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-AEGTFZ2zBPeLJlZ1EA10ZEDA12VfO","object":"chat.completion.chunk","created":1727963269,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_74ba47b4ac","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"order"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A86CT7lmQpCMrARhR2GkBP5JBYLfn","object":"chat.completion.chunk","created":1726493821,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-AEGTFZ2zBPeLJlZ1EA10ZEDA12VfO","object":"chat.completion.chunk","created":1727963269,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_74ba47b4ac","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A86CT7lmQpCMrARhR2GkBP5JBYLfn","object":"chat.completion.chunk","created":1726493821,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"123"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-AEGTFZ2zBPeLJlZ1EA10ZEDA12VfO","object":"chat.completion.chunk","created":1727963269,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_74ba47b4ac","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"123"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A86CT7lmQpCMrARhR2GkBP5JBYLfn","object":"chat.completion.chunk","created":1726493821,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"45"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-AEGTFZ2zBPeLJlZ1EA10ZEDA12VfO","object":"chat.completion.chunk","created":1727963269,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_74ba47b4ac","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"45"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A86CT7lmQpCMrARhR2GkBP5JBYLfn","object":"chat.completion.chunk","created":1726493821,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"logprobs":null,"finish_reason":null}]} + data: {"id":"chatcmpl-AEGTFZ2zBPeLJlZ1EA10ZEDA12VfO","object":"chat.completion.chunk","created":1727963269,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_74ba47b4ac","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"logprobs":null,"finish_reason":null}]} - data: {"id":"chatcmpl-A86CT7lmQpCMrARhR2GkBP5JBYLfn","object":"chat.completion.chunk","created":1726493821,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_483d39d857","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"tool_calls"}]} + data: {"id":"chatcmpl-AEGTFZ2zBPeLJlZ1EA10ZEDA12VfO","object":"chat.completion.chunk","created":1727963269,"model":"gpt-4o-mini-2024-07-18","system_fingerprint":"fp_74ba47b4ac","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"tool_calls"}]} data: [DONE] @@ -87,13 +89,13 @@ interactions: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8c413fae5ac14c70-MXP + - 8ccd62e2b84583a8-MXP Connection: - keep-alive Content-Type: - text/event-stream; charset=utf-8 Date: - - Mon, 16 Sep 2024 13:37:01 GMT + - Thu, 03 Oct 2024 13:47:50 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -105,25 +107,25 @@ interactions: - X-Request-ID openai-organization: test_openai_org_key openai-processing-ms: - - '253' + - '583' openai-version: - '2020-10-01' strict-transport-security: - - max-age=15552000; includeSubDomains; preload + - max-age=31536000; includeSubDomains; preload x-ratelimit-limit-requests: - '10000' x-ratelimit-limit-tokens: - '200000' x-ratelimit-remaining-requests: - - '9999' + - '9997' x-ratelimit-remaining-tokens: - '199921' x-ratelimit-reset-requests: - - 8.64s + - 20.598s x-ratelimit-reset-tokens: - 23ms x-request-id: - - req_86673f500c2b90f3598223f1f1aab684 + - req_040696455e228f8e53c3316df23e2163 status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_content[azure_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_content[azure_provider_chat_completions].yaml new file mode 100644 index 0000000..3d1b1ab --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_content[azure_provider_chat_completions].yaml @@ -0,0 +1,92 @@ +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 + api-key: + - test_azure_api_key + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '842' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AzureOpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/chat/completions?api-version=2023-03-15-preview + response: + body: + string: '{"choices":[{"finish_reason":"tool_calls","index":0,"message":{"content":null,"role":"assistant","tool_calls":[{"function":{"arguments":"{\"order_id\":\"order_12345\"}","name":"get_delivery_date"},"id":"call_EOPkr9g0pp71Wt6LEteCHWkZ","type":"function"}]}}],"created":1727962826,"id":"chatcmpl-AEGM6niNxWuulOpOMXNelXUZqF443","model":"gpt-4o-mini","object":"chat.completion","system_fingerprint":"fp_878413d04d","usage":{"completion_tokens":19,"prompt_tokens":140,"total_tokens":159}} + + ' + headers: + Content-Length: + - '483' + Content-Type: + - application/json + Date: + - Thu, 03 Oct 2024 13:40:25 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + apim-request-id: + - d0b01be6-ec43-4811-ad49-f676561d8c07 + azureml-model-session: + - d008-20240930131836 + openai-organization: test_openai_org_key + x-accel-buffering: + - 'no' + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '298' + x-ms-client-request-id: + - d0b01be6-ec43-4811-ad49-f676561d8c07 + x-ms-rai-invoked: + - 'true' + x-ms-region: + - East US + x-ratelimit-remaining-requests: + - '909' + x-ratelimit-remaining-tokens: + - '90299' + x-request-id: + - 7af3afc5-e922-467b-8325-d30aee1515e7 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_content[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_content[ollama_provider_chat_completions].yaml new file mode 100644 index 0000000..86a6a1e --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_content[ollama_provider_chat_completions].yaml @@ -0,0 +1,66 @@ +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.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: http://localhost:11434/v1/chat/completions + response: + body: + string: '{"id":"chatcmpl-556","object":"chat.completion","created":1727962827,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"","tool_calls":[{"id":"call_sr2j6oa1","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: + - Thu, 03 Oct 2024 13:40:27 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/TestChatCompletions.test_tools_with_capture_content.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_content[openai_provider_chat_completions].yaml similarity index 78% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_tools_with_capture_content.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_content[openai_provider_chat_completions].yaml index 7a45644..3bb20a1 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_tools_with_capture_content.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_capture_content[openai_provider_chat_completions].yaml @@ -26,53 +26,52 @@ interactions: - application/json host: - api.openai.com - openai-organization: - - test_openai_org_key - openai-project: - - test_openai_project_id user-agent: - - OpenAI/Python 1.43.1 + - OpenAI/Python 1.50.0 x-stainless-arch: - - arm64 + - x64 x-stainless-async: - 'false' x-stainless-lang: - python x-stainless-os: - - MacOS + - Linux x-stainless-package-version: - - 1.43.1 + - 1.50.0 + x-stainless-retry-count: + - '0' x-stainless-runtime: - CPython x-stainless-runtime-version: - - 3.12.5 + - 3.10.12 method: POST uri: https://api.openai.com/v1/chat/completions response: body: - string: "{\n \"id\": \"chatcmpl-A9CSzz613rRslGZpG79Js1deMz98G\",\n \"object\": - \"chat.completion\",\n \"created\": 1726756237,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + string: "{\n \"id\": \"chatcmpl-AEGM5OhimYEMDsRq20IQCBx4vzf2Z\",\n \"object\": + \"chat.completion\",\n \"created\": 1727962825,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n - \ \"id\": \"call_YvfALG4Ylwm9pfSKdAJmEEkB\",\n \"type\": + \ \"id\": \"call_yU31CceO4OliQuZgPdsSPRXT\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_delivery_date\",\n \ \"arguments\": \"{\\\"order_id\\\":\\\"order_12345\\\"}\"\n \ }\n }\n ],\n \"refusal\": null\n },\n \ \"logprobs\": null,\n \"finish_reason\": \"tool_calls\"\n }\n \ ],\n \"usage\": {\n \"prompt_tokens\": 140,\n \"completion_tokens\": - 19,\n \"total_tokens\": 159,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": - 0\n }\n },\n \"system_fingerprint\": \"fp_1bb46167f9\"\n}\n" + 19,\n \"total_tokens\": 159,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": + 0\n }\n },\n \"system_fingerprint\": \"fp_74ba47b4ac\"\n}\n" headers: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8c5a4654bd6ace11-SIN + - 8ccd58064c670f82-MXP Connection: - keep-alive Content-Type: - application/json Date: - - Thu, 19 Sep 2024 14:30:38 GMT + - Thu, 03 Oct 2024 13:40:25 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -82,31 +81,29 @@ interactions: - nosniff access-control-expose-headers: - X-Request-ID - alt-svc: - - h3=":443"; ma=86400 content-length: - - '855' + - '918' openai-organization: test_openai_org_key openai-processing-ms: - - '441' + - '749' openai-version: - '2020-10-01' strict-transport-security: - - max-age=15552000; includeSubDomains; preload + - max-age=31536000; includeSubDomains; preload x-ratelimit-limit-requests: - '10000' x-ratelimit-limit-tokens: - '200000' x-ratelimit-remaining-requests: - - '9995' + - '9999' x-ratelimit-remaining-tokens: - '199921' x-ratelimit-reset-requests: - - 38.378s + - 8.64s x-ratelimit-reset-tokens: - 23ms x-request-id: - - req_72cf71aeaab4ecb44a69db09b087b35e + - req_45f48e5256de5ad05a765aa0f15e9f04 status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_followup_and_capture_content_log_events[ollama_provider_chat_completions].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_followup_and_capture_content_log_events[ollama_provider_chat_completions].yaml new file mode 100644 index 0000000..2138beb --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_chat_completions/test_tools_with_followup_and_capture_content_log_events[ollama_provider_chat_completions].yaml @@ -0,0 +1,66 @@ +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", "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: + - '434' + content-type: + - application/json + host: + - localhost:11434 + user-agent: + - OpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: http://localhost:11434/v1/chat/completions + response: + body: + string: '{"id":"chatcmpl-97","object":"chat.completion","created":1730217202,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"Sure, + I can help you find information about the temperature and weather in New York + City and London. Could you please specify which city(s) you''re interested + in looking up details for? If not provided immediately, I''ll assume we''re + looking at general trends or data across both cities. Please provide some + details so that I can provide accurate information."},"finish_reason":"stop"}],"usage":{"prompt_tokens":150,"completion_tokens":70,"total_tokens":220}} + + ' + headers: + Content-Length: + - '645' + Content-Type: + - application/json + Date: + - Tue, 29 Oct 2024 15:53: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_embeddings/test_all_the_client_options[azure_provider_embeddings].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_all_the_client_options[azure_provider_embeddings].yaml new file mode 100644 index 0000000..2e26245 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_all_the_client_options[azure_provider_embeddings].yaml @@ -0,0 +1,464 @@ +interactions: +- request: + body: '{"input": ["South Atlantic Ocean."], "model": "text-embedding-3-small", + "encoding_format": "float"}' + 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: + - '99' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AzureOpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/embeddings?api-version=2023-05-15 + response: + body: + string: "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": + \"embedding\",\n \"index\": 0,\n \"embedding\": [\n -0.031545125,\n + \ -0.030183462,\n 0.010235145,\n 0.0091061015,\n -0.030864293,\n + \ 0.064815015,\n 0.036061294,\n -0.0018737009,\n -0.004669359,\n + \ -0.021037648,\n 0.0026396345,\n -0.010927321,\n -0.018688783,\n + \ -0.012107427,\n 0.014955565,\n 0.02450988,\n -0.024282936,\n + \ 0.018881686,\n 0.016634947,\n 0.023170915,\n -0.028231751,\n + \ -0.03556202,\n -0.062817916,\n 0.061138533,\n 0.020390859,\n + \ -0.0150123015,\n 0.008255064,\n 0.01822355,\n -0.06377108,\n + \ 0.025962317,\n 0.10521093,\n -0.030705433,\n 0.00090280897,\n + \ 0.065722786,\n 0.039306585,\n 0.06862766,\n -0.020390859,\n + \ -0.01173297,\n -0.05587345,\n 0.008198328,\n 0.029003358,\n + \ -0.055555727,\n 0.0033445773,\n 0.0019148344,\n 0.008447966,\n + \ 0.0053501893,\n -0.06876383,\n -0.031681288,\n 0.035017356,\n + \ 0.01429743,\n -0.03415497,\n 0.028458694,\n -0.032407507,\n + \ -0.043073844,\n 0.043164622,\n -0.025758069,\n -0.013548517,\n + \ 0.00268786,\n 0.06921772,\n -0.00045140448,\n -0.04693188,\n + \ 0.048838206,\n -0.0016070425,\n -0.005143103,\n -0.046069495,\n + \ -0.0024197833,\n 0.014081834,\n 0.061365478,\n -0.056055002,\n + \ -0.01974407,\n -0.04838432,\n 0.02210428,\n 0.024055993,\n + \ -0.036356322,\n -0.05383096,\n -0.014853441,\n -0.01473997,\n + \ -0.036265545,\n -0.0015956953,\n -0.034495387,\n -0.029502634,\n + \ 0.06272714,\n 0.02154827,\n -0.012447841,\n -0.015545619,\n + \ -0.042551875,\n 0.016192406,\n 0.00840825,\n -0.018325673,\n + \ 0.026529675,\n -0.03272523,\n -0.020810703,\n -0.021037648,\n + \ -0.010445067,\n -0.010104652,\n 0.03912503,\n -0.009401128,\n + \ 0.01269748,\n 0.024124077,\n -0.0050012637,\n -0.02419216,\n + \ -0.026121177,\n 0.020799356,\n -0.01397971,\n -0.028299833,\n + \ -0.024850296,\n 0.0017857604,\n 0.010064937,\n 0.012470536,\n + \ -0.011381208,\n -0.009066386,\n 0.029457245,\n -0.0016226448,\n + \ 0.018915728,\n -0.0046636853,\n -0.021060342,\n 0.0029474266,\n + \ -0.06449729,\n 0.056009613,\n 0.0053019635,\n 0.008113224,\n + \ -0.036605958,\n 0.021378063,\n -0.014081834,\n -0.03708254,\n + \ -0.011630846,\n -0.025145322,\n -0.010263512,\n 0.006796953,\n + \ 0.003066572,\n 0.009503252,\n -0.012515925,\n -0.016078936,\n + \ -0.030909682,\n 0.020050444,\n 0.07107865,\n -0.0064395173,\n + \ -0.0216277,\n 0.0012340044,\n 0.01197126,\n 0.022921277,\n + \ 0.02791403,\n 0.0392385,\n 0.0034977642,\n 0.02010718,\n + \ -0.0043289443,\n -0.055691894,\n 0.027142422,\n 0.020118527,\n + \ -0.038444202,\n 0.013287532,\n -0.004947365,\n 0.003880731,\n + \ 0.025780763,\n -0.004728932,\n -0.012901728,\n -0.0036282565,\n + \ 0.005503376,\n 0.011755665,\n -0.0017573924,\n 0.0027587798,\n + \ -0.023012053,\n 0.043073844,\n 0.023760967,\n -0.0168165,\n + \ -0.008493355,\n 0.006632419,\n 0.015625048,\n -0.052015413,\n + \ -0.011454965,\n -0.008221022,\n -0.020674538,\n -0.025621902,\n + \ -0.0049530384,\n -0.010490456,\n -0.03576627,\n 0.009395454,\n + \ -0.031772066,\n -0.018132772,\n 0.016748417,\n -0.021287285,\n + \ 0.0022850358,\n 0.035902437,\n -0.007148715,\n 0.006825321,\n + \ 0.035902437,\n 0.0103883315,\n -0.010479108,\n -0.004192778,\n + \ -0.009463537,\n 0.01914267,\n -0.024918377,\n 0.07067015,\n + \ 0.015761215,\n -0.006944466,\n -0.046477996,\n 0.0140137505,\n + \ 0.04498017,\n -0.008198328,\n 0.03345145,\n 0.028186362,\n + \ -0.0230234,\n -0.033633,\n -0.060185373,\n -0.021809254,\n + \ -0.03315642,\n -0.05378557,\n 0.021196507,\n 0.05514723,\n + \ 0.0005794147,\n 0.016317226,\n -0.018677436,\n 0.02607579,\n + \ 0.019914277,\n -0.026620453,\n -0.0032311056,\n -0.016634947,\n + \ 0.009667786,\n 0.023488635,\n -0.012379759,\n -0.036015905,\n + \ 0.013877585,\n 0.01581795,\n 0.026302733,\n -0.013332921,\n + \ 0.05137997,\n 0.056418113,\n -0.022490084,\n 0.0095826825,\n + \ -0.021797907,\n 0.027051644,\n 0.017440595,\n -0.0065019266,\n + \ -0.034813106,\n -0.05169769,\n -0.040373217,\n -0.0058437907,\n + \ 0.011585457,\n 0.021219201,\n 0.0097926045,\n -0.028935274,\n + \ -0.014342818,\n 0.05097147,\n 0.029820355,\n -0.013401004,\n + \ -0.020254692,\n 0.046409912,\n 0.03905695,\n -0.016203754,\n + \ 0.050154477,\n -0.008192655,\n -0.014932871,\n 0.025894234,\n + \ 0.010802503,\n 0.01059258,\n -0.009486231,\n -0.050835308,\n + \ -0.052968573,\n -0.03985125,\n -0.015851991,\n -0.045592915,\n + \ -0.022932624,\n -0.048202764,\n 0.010081958,\n 0.024714129,\n + \ -0.006167185,\n 0.03315642,\n 0.006184206,\n -0.034132276,\n + \ -0.021536922,\n 0.0032538,\n 0.03760451,\n 0.0063090245,\n + \ 0.00400555,\n 0.028050195,\n 0.035062745,\n 0.02466874,\n + \ 0.019324224,\n 0.011500353,\n -0.004467947,\n 0.027777864,\n + \ -0.05610039,\n -0.0669029,\n 0.012663438,\n -0.012549967,\n + \ -0.015647743,\n 0.008618173,\n -0.027437449,\n 0.038943477,\n + \ 0.03295217,\n 0.08142727,\n 0.024759518,\n -0.020651843,\n + \ -0.015988158,\n -0.02607579,\n 0.0062863305,\n 0.021332674,\n + \ -0.0018268939,\n -0.027891336,\n -0.003662298,\n 0.054194067,\n + \ -0.019959666,\n 0.013627947,\n -0.016510127,\n 0.008379882,\n + \ 0.035312384,\n -0.04634183,\n 0.016078936,\n 0.023897134,\n + \ 0.010978384,\n 0.020458942,\n 0.0009148653,\n 0.03488119,\n + \ -0.017520025,\n 0.036991764,\n -0.011948567,\n -0.054874897,\n + \ -0.0032027378,\n 0.0035771942,\n -0.027142422,\n 0.012062038,\n + \ 0.024282936,\n -0.024963766,\n 0.012039344,\n -0.00036594612,\n + \ -0.046205662,\n -0.025304182,\n -0.02367019,\n 0.024373714,\n + \ -0.015193856,\n 0.001831149,\n 0.0066210716,\n 0.043709286,\n + \ -0.00992877,\n 0.022138322,\n -0.039647,\n -0.03272523,\n + \ 0.028367916,\n -0.035335075,\n 0.06050309,\n -0.009219573,\n + \ -0.01833702,\n 0.02246739,\n 0.02519071,\n -0.010042243,\n + \ -0.009611051,\n -0.01850723,\n 0.01437686,\n 0.07539058,\n + \ -0.015466188,\n 0.008680582,\n 0.0056707463,\n -0.0058097495,\n + \ -0.010172735,\n -0.023715578,\n 0.030523878,\n 0.033088338,\n + \ -0.034767717,\n -0.06871844,\n 0.02130998,\n -0.032589063,\n + \ 0.0036424405,\n -0.031658594,\n 0.0008226696,\n 0.04513903,\n + \ -0.024124077,\n -0.005199839,\n 0.0022126974,\n 0.008232369,\n + \ -0.011585457,\n -0.03576627,\n 0.04797582,\n -0.0520608,\n + \ 0.019154018,\n -0.003594215,\n 0.043391567,\n -0.05174308,\n + \ 0.0015006628,\n -0.03256637,\n -0.0012581171,\n -0.044526283,\n + \ 0.052514687,\n -0.027460143,\n 0.004970059,\n 0.029366467,\n + \ -0.052560076,\n 0.003350251,\n -0.030001909,\n -0.0043629855,\n + \ -0.02607579,\n -0.038466893,\n -0.026824702,\n 0.034745023,\n + \ 0.0026821864,\n -0.0032906784,\n 0.008748665,\n 0.04237032,\n + \ -0.018053342,\n -0.038217258,\n 0.048792817,\n 0.034245748,\n + \ -0.027255895,\n -0.0062749833,\n -0.022807805,\n 0.009174184,\n + \ 0.015114426,\n -0.05718972,\n 0.025667291,\n 0.0055771326,\n + \ -0.014524373,\n -0.0009311769,\n -0.054057904,\n -0.0037644226,\n + \ 0.03383725,\n 0.00013448166,\n 0.040350523,\n -0.015466188,\n + \ 0.051606912,\n 0.004453763,\n 0.025621902,\n -0.005063673,\n + \ 0.055328786,\n -0.007551539,\n -0.004206962,\n 0.011914525,\n + \ 0.0728942,\n 0.03465425,\n -0.030342324,\n 0.0142066525,\n + \ 0.015806602,\n 0.056055002,\n -0.010263512,\n 0.007528845,\n + \ 0.03011538,\n -0.017043443,\n 0.024759518,\n -0.0069955285,\n + \ 0.012844993,\n -0.031091237,\n 0.011284757,\n 0.0037786064,\n + \ 0.020368164,\n 0.00070707034,\n 0.008714624,\n -0.007971385,\n + \ -0.0019502942,\n 0.03277062,\n 0.021378063,\n -0.054693345,\n + \ -0.017894482,\n 0.053694792,\n -0.0049870797,\n -0.0059062,\n + \ 0.012720174,\n 0.028640248,\n -0.019437697,\n -0.008618173,\n + \ 0.027460143,\n 0.012799604,\n 0.045978718,\n 0.008379882,\n + \ -0.01670303,\n -0.054693345,\n 0.011063487,\n 0.02984305,\n + \ 0.028163668,\n 0.0007474946,\n 0.066176675,\n -0.0052196966,\n + \ -0.008720297,\n -0.022092933,\n -0.00923092,\n 0.028889887,\n + \ 0.014762664,\n -0.019710029,\n 0.0036225829,\n -0.0077444413,\n + \ -0.020356817,\n -0.04330079,\n -0.0316359,\n -0.0024552431,\n + \ -0.006479232,\n -0.028640248,\n -0.0139683625,\n -0.018405104,\n + \ -0.029026052,\n -0.0047317683,\n 0.013673336,\n -0.042801514,\n + \ -0.026121177,\n 0.022762416,\n 0.031681288,\n -0.00816996,\n + \ -0.008351515,\n 0.034858495,\n -0.041099437,\n -0.045161724,\n + \ -0.02194542,\n 0.052923184,\n -0.04929209,\n 0.04209799,\n + \ 0.0045927656,\n -0.011778359,\n 0.0057927286,\n 0.07570829,\n + \ -0.044753224,\n -0.016839195,\n -0.053195518,\n -0.025848845,\n + \ 0.015261939,\n -0.0011127315,\n 0.04025975,\n -0.017588109,\n + \ -0.03560741,\n -0.007177083,\n -0.0044310684,\n -0.01209608,\n + \ 0.025576513,\n -0.0015616538,\n -0.0014737133,\n -0.007699053,\n + \ -0.021253243,\n -0.019267488,\n -0.0025701332,\n -0.045933332,\n + \ -0.0011942893,\n -0.028640248,\n -0.0064849057,\n -0.021151118,\n + \ 0.037218705,\n 0.009503252,\n 0.027028952,\n -0.015364064,\n + \ -0.007954364,\n -0.026733924,\n -0.021525575,\n -0.0404413,\n + \ 0.014558415,\n -0.011477659,\n 0.034086887,\n 0.009321697,\n + \ 0.015602354,\n -0.014751317,\n 0.027346672,\n -0.008952915,\n + \ 0.006791279,\n -0.018371062,\n -0.008238043,\n 0.043845452,\n + \ 0.023216303,\n -0.019244794,\n 0.00056523073,\n 0.014002403,\n + \ -0.007449415,\n -0.0027828927,\n -0.035493936,\n 0.008022447,\n + \ -0.01746329,\n -0.013900279,\n 0.013469087,\n 0.029366467,\n + \ -0.016521474,\n -0.022365265,\n -0.009474884,\n 0.008680582,\n + \ 0.057779774,\n 0.016725725,\n -0.018802255,\n -0.0009070641,\n + \ 0.03031963,\n 0.023579413,\n 0.032884087,\n -0.012629396,\n + \ -0.0065700095,\n 0.0066380925,\n 0.023760967,\n 0.033337977,\n + \ -0.017644845,\n -0.014331471,\n 0.014422249,\n -0.022966666,\n + \ -0.022660293,\n -0.015250592,\n 0.044185866,\n -0.006280657,\n + \ 0.01193722,\n -0.02322765,\n -0.0040679593,\n 0.032112483,\n + \ 0.0064395173,\n 0.054647956,\n -0.02807289,\n -0.01369603,\n + \ -0.02330708,\n -0.02118516,\n -0.0085841315,\n 0.04273343,\n + \ -0.008385556,\n 0.012152815,\n 0.042597264,\n 0.018246245,\n + \ -0.024804907,\n -0.017088832,\n -0.004998427,\n -0.03456347,\n + \ 0.0005911165,\n 0.014569762,\n -0.023715578,\n -0.015545619,\n + \ 0.020515677,\n 0.011250716,\n 0.043663897,\n 0.017724274,\n + \ -0.051243804,\n 0.010853565,\n 0.013185408,\n -0.056872,\n + \ 0.03367839,\n 0.006955813,\n -0.01746329,\n -0.007074958,\n + \ 0.024419103,\n 0.029820355,\n 0.007965711,\n -0.020447595,\n + \ -0.0038722206,\n -0.023375163,\n 0.05237852,\n 0.0061898795,\n + \ 0.0022297183,\n -0.018427799,\n 0.028458694,\n 0.019085934,\n + \ 0.007369985,\n -0.0073132487,\n 0.018371062,\n -0.018654741,\n + \ 0.024850296,\n 0.05315013,\n 0.008595479,\n -0.032906782,\n + \ 0.022558168,\n 0.014615151,\n 0.002622614,\n 0.014240694,\n + \ -0.012243593,\n 0.012447841,\n -0.014660539,\n -0.029003358,\n + \ 0.011846442,\n 0.034495387,\n 0.018371062,\n 0.011199653,\n + \ -0.019539822,\n -0.02907144,\n -0.033791862,\n 0.01778101,\n + \ -0.039079644,\n -0.029207608,\n -0.0043232706,\n -0.008742992,\n + \ 0.037944924,\n 0.01893842,\n -0.046273746,\n -0.015466188,\n + \ -0.0057473397,\n -0.008362862,\n -0.001641084,\n 0.027845947,\n + \ -0.04309654,\n 0.039669696,\n -0.009996854,\n 0.042302236,\n + \ 0.0072508394,\n 0.03976047,\n -0.0048140353,\n 0.02582615,\n + \ -0.010989731,\n 0.012947117,\n 0.0005173599,\n -0.03383725,\n + \ 0.02246739,\n -0.006848015,\n 0.029638799,\n -0.011245042,\n + \ -0.0013992474,\n -0.0120733855,\n -0.0112393685,\n -0.009559988,\n + \ 0.04761271,\n -0.027074339,\n 0.045592915,\n 0.022648945,\n + \ 0.017826399,\n 0.014263389,\n 0.018666089,\n -0.020742621,\n + \ -0.0019616415,\n 0.020368164,\n -0.017236346,\n 0.04513903,\n + \ -0.0051799817,\n 0.012050691,\n 0.0074153733,\n -0.0063090245,\n + \ -0.01249323,\n -0.007874934,\n 0.0008531651,\n 0.020402206,\n + \ 0.04348234,\n 0.0166236,\n 0.014842094,\n -0.04761271,\n + \ 0.005049489,\n 0.001504918,\n -0.0091061015,\n -0.010768461,\n + \ 0.020629149,\n -0.042188767,\n -0.0071146735,\n 0.036106683,\n + \ 0.010059264,\n -0.022989359,\n 0.013003853,\n 0.03252098,\n + \ 0.00862952,\n 0.024010604,\n 0.0019375287,\n 0.0011645029,\n + \ -0.005109062,\n -0.016305879,\n 0.018007953,\n 0.00026045294,\n + \ 0.009809625,\n 0.01269748,\n 0.036628652,\n -0.006989855,\n + \ -0.021525575,\n 0.020844745,\n 0.0037956273,\n 0.013060588,\n + \ 0.0014595293,\n 0.020243345,\n 0.01193722,\n 0.025145322,\n + \ -0.0030467142,\n -0.014047792,\n -0.01594277,\n 0.0476581,\n + \ -0.003472233,\n -0.029661493,\n 0.0053672097,\n 0.0160222,\n + \ 0.02367019,\n -0.03199901,\n -0.014660539,\n 0.012765562,\n + \ 0.012243593,\n -0.034472693,\n -0.0029729577,\n -0.005528907,\n + \ 0.018802255,\n 0.040577468,\n 0.017088832,\n 0.02047029,\n + \ -0.00031293358,\n -0.017610803,\n 0.008601152,\n 0.0520608,\n + \ 0.019573862,\n 0.016975362,\n -0.025735375,\n -0.0024694272,\n + \ 0.03320181,\n -0.0038778943,\n 0.0049757324,\n -0.0073586376,\n + \ 0.022864541,\n -0.017156916,\n -0.00672887,\n -0.0014878972,\n + \ -0.030501183,\n 0.008033794,\n -0.002619777,\n 0.0012836482,\n + \ 0.0015432147,\n 0.024033299,\n -0.008209675,\n 0.030818904,\n + \ 0.0045927656,\n 0.00596861,\n -0.0015006628,\n -0.02943455,\n + \ -0.01990293,\n 0.058460604,\n 0.033564918,\n 0.033542223,\n + \ -0.044072397,\n -0.031681288,\n 0.01589738,\n 0.03156782,\n + \ -0.00885079,\n -0.0024935398,\n -0.040350523,\n 0.0028325366,\n + \ 0.051153027,\n -0.0048707714,\n 0.047158826,\n -0.010859239,\n + \ -0.006893404,\n -0.009769911,\n 0.0006854398,\n -0.0324302,\n + \ 0.020685885,\n 0.033088338,\n -0.007840892,\n 0.024577962,\n + \ 0.008289105,\n -0.011676234,\n 0.014354166,\n 0.024759518,\n + \ 0.011869136,\n 0.024441797,\n 0.0018978136,\n 0.052877795,\n + \ 0.0077784825,\n 0.045025557,\n -0.020697232,\n 0.01497826,\n + \ -0.023159567,\n 0.06122931,\n 0.0070976526,\n -0.025304182,\n + \ -0.014399555,\n 0.0142520415,\n -0.038058396,\n -0.02947994,\n + \ -0.026461592,\n -0.024963766,\n 0.029252995,\n 0.05991304,\n + \ 0.0019658967,\n -0.013310227,\n 0.00049856614,\n 0.018858992,\n + \ 0.019494433,\n 0.0128790345,\n -0.0025162343,\n 0.010677684,\n + \ -0.009474884,\n 0.013525822,\n -0.013310227,\n -0.030705433,\n + \ -0.032452896,\n 0.025644597,\n -0.022807805,\n -0.007438068,\n + \ -0.005321821,\n -0.029933825,\n -0.013037895,\n -0.0037360545,\n + \ 0.010195429,\n 0.008533069,\n -0.03340606,\n -0.018416451,\n + \ 0.015341369,\n -0.00877136,\n 0.023602108,\n 0.020924175,\n + \ -0.009304676,\n -0.009395454,\n 0.036174767,\n -0.04466245,\n + \ -0.02330708,\n -0.013673336,\n 0.0073075755,\n 0.021605005,\n + \ 0.02070858,\n -0.0058494643,\n 0.025077239,\n 0.03671943,\n + \ 0.0150123015,\n -0.050290644,\n 0.037309483,\n -0.044526283,\n + \ 0.010660663,\n 0.02194542,\n 0.010473435,\n -0.016544169,\n + \ 0.027868642,\n 0.022853194,\n 0.020731274,\n 0.00026453083,\n + \ -0.0061104493,\n -0.009951465,\n -0.05001831,\n -0.028526777,\n + \ -0.021525575,\n 0.017792357,\n -0.0017971075,\n -0.01633992,\n + \ 0.020606454,\n 0.0019275999,\n -0.04021436,\n 0.005704788,\n + \ 0.028640248,\n 0.011131571,\n 0.0013644968,\n 0.043822758,\n + \ 0.021673089,\n -0.040078193,\n 0.03174937,\n 0.024237547,\n + \ 0.012618049,\n 0.03195362,\n 0.0034552123,\n -0.0024197833,\n + \ -0.016782459,\n 0.0046778694,\n -0.0027488512,\n 0.024850296,\n + \ -0.009032344,\n -0.021820601,\n -0.02582615,\n 0.013843543,\n + \ 0.0017602292,\n -0.011925872,\n 0.0050324686,\n -0.02943455,\n + \ -0.011108876,\n 0.010870585,\n -0.0013602416,\n 0.016453391,\n + \ 0.0040083867,\n 0.00025389285,\n -0.025145322,\n 0.03199901,\n + \ 0.0021517065,\n 0.011159939,\n -0.008924547,\n 0.049655203,\n + \ -0.005608337,\n 0.028027501,\n -0.030501183,\n -0.011466312,\n + \ -0.02314822,\n 0.01345774,\n 0.032929476,\n 0.0070182225,\n + \ -0.03787684,\n 0.026665842,\n 0.028458694,\n 0.036356322,\n + \ -0.0034580491,\n -0.011914525,\n 0.0057416665,\n 0.03184015,\n + \ 0.0054125986,\n 0.0027814743,\n -0.058732934,\n 0.0021744007,\n + \ 0.0035006008,\n 0.016430696,\n -0.005758687,\n 0.0015446331,\n + \ -0.006099102,\n -0.029752271,\n 0.0020481637,\n 0.05374018,\n + \ -0.046750326,\n -0.012118774,\n -0.01826894,\n 0.05142536,\n + \ 0.04761271,\n -0.0036821556,\n 0.028436,\n 0.007812524,\n + \ 0.0041644103,\n -0.03667404,\n -0.017758315,\n -0.0051345928,\n + \ 0.027210506,\n -0.024078688,\n -0.036356322,\n -0.0038353424,\n + \ 0.0059288945,\n -0.00989473,\n 0.02503185,\n 0.023170915,\n + \ -0.027369365,\n 0.0008361443,\n -0.034132276,\n 0.033814557,\n + \ 0.029184913,\n 0.018200856,\n -0.008896179,\n 0.016192406,\n + \ -0.0036878292,\n -0.021366715,\n 0.002981468,\n -0.01550023,\n + \ -0.012345717,\n -0.01233437,\n -0.014059139,\n -0.0073870053,\n + \ 0.022875888,\n -0.017599456,\n 0.006138817,\n 0.014422249,\n + \ -0.019256141,\n -0.035743576,\n 0.036900986,\n 0.024419103,\n + \ 0.025168017,\n 0.024396408,\n -0.054284845,\n 0.023397857,\n + \ -0.003719034,\n -0.0596861,\n 0.022875888,\n 0.053694792,\n + \ 0.006467885,\n 0.0444582,\n -0.009395454,\n -0.031204708,\n + \ 0.004402701,\n 0.0025843172,\n 0.0054636607,\n 0.053649403,\n + \ -0.020368164,\n -0.01081385,\n -0.01589738,\n 0.0009198297,\n + \ 0.017871788,\n 0.010178409,\n 0.028050195,\n -0.010252165,\n + \ -0.0053700465,\n 0.0029077115,\n 0.06354413,\n 0.0134463925,\n + \ -0.0035006008,\n -0.0056991144,\n -0.006360087,\n -0.014354166,\n + \ 0.017917177,\n -0.008464986,\n 0.00038686747,\n -0.017633498,\n + \ -0.011642193,\n 0.0006974962,\n 0.011437944,\n 0.030138075,\n + \ -0.011846442,\n -0.058596767,\n 0.013310227,\n 0.017361164,\n + \ -0.02503185,\n 0.0076309694,\n 0.022149669,\n -0.0023488635,\n + \ 0.012345717,\n -0.00018598716,\n -0.024532575,\n -0.009446517,\n + \ 0.01589738,\n 0.028821804,\n 0.023375163,\n -0.047839653,\n + \ 0.006411149,\n 0.02582615,\n 0.043958925,\n 0.008192655,\n + \ 0.015806602,\n -0.040622856,\n -0.02138941,\n -0.019687334,\n + \ -0.006757238,\n 0.016112976,\n 0.0644519,\n -0.02879911,\n + \ 0.04300576,\n 0.003892078,\n -0.011755665,\n -0.010161388,\n + \ 0.024782212,\n -0.03392803,\n -0.0070636114,\n -0.030614655,\n + \ -0.017156916,\n -0.010479108,\n 0.024646046,\n -0.0037757696,\n + \ 0.04357312,\n 0.0018084546,\n -0.018813603,\n -0.0053813937,\n + \ 0.016044894,\n -0.00035654925,\n -0.00931035,\n 0.017837746,\n + \ -0.004141716,\n -0.006791279,\n 0.031726677,\n -0.019233447,\n + \ 0.008572784,\n -0.0118124,\n 0.040191665,\n 0.0034977642,\n + \ -0.019721376,\n -0.02186599,\n -0.040759023,\n 0.0009155745,\n + \ -0.037763372,\n -0.0022226262,\n -0.027800558,\n -0.02943455,\n + \ -0.003960161,\n -0.027028952,\n 0.02022065,\n 0.018030647,\n + \ -0.025689986,\n -0.003957324,\n 0.00283821,\n -0.01089328,\n + \ -0.004022571,\n 0.0042977394,\n 0.017667538,\n -0.02791403,\n + \ -0.017996605,\n 0.0033842924,\n -0.014808052,\n 0.027573615,\n + \ -0.004561561,\n 0.016010853,\n 0.0071260207,\n -0.007931669,\n + \ -0.016090283,\n -0.031136625,\n 0.043278094,\n 0.039828554,\n + \ 0.03572088,\n 0.018132772,\n 0.005804076,\n 0.018166814,\n + \ 0.029162219,\n 0.028889887,\n 0.09368221,\n 0.013741419,\n + \ -0.031136625,\n -0.020969564,\n 0.030750822,\n -0.008896179,\n + \ -0.02194542,\n 0.025236098,\n 0.014263389,\n 0.015216551,\n + \ 0.013843543,\n 0.005327495,\n 0.019551167,\n 0.001143227,\n + \ -0.00070316973,\n 0.03351953,\n 0.042914983,\n 0.0018155467,\n + \ 0.05069914,\n -0.012277634,\n 0.0032793311,\n -0.025758069,\n + \ -0.029411856,\n 0.035017356,\n 0.012118774,\n 0.020867439,\n + \ 0.0005123955,\n -0.019641945,\n 0.017826399,\n -0.011103203,\n + \ 0.008527395,\n -0.02907144,\n 0.0049076495,\n 0.020141222,\n + \ -0.04865665,\n 0.030841598,\n -0.015375411,\n 0.0006191298,\n + \ -0.025758069,\n 0.03551663,\n 0.0010701796,\n -0.012470536,\n + \ -0.025553819,\n -0.011613825,\n -0.00945219,\n -0.0044707838,\n + \ -0.0003148839,\n -0.003265147,\n -0.015273286,\n 0.002941753,\n + \ -0.012799604,\n 0.045229807,\n -0.0015134284,\n 0.014422249,\n + \ -0.040078193,\n -0.020549718,\n 0.0017956891,\n -0.023375163,\n + \ 0.014944218,\n -0.0236248,\n 0.012470536,\n 0.007171409,\n + \ 0.02655237,\n 0.067992225,\n 0.0021970952,\n -0.023556719,\n + \ -0.023397857,\n -0.008459313,\n -0.011767012,\n -0.015965464,\n + \ -0.0042977394,\n -0.012799604,\n 0.020447595,\n -0.01429743,\n + \ 0.006343066,\n 0.005214023,\n 0.037899535,\n -0.03199901,\n + \ -0.04153063,\n 0.04209799,\n -0.01838241,\n -0.014615151,\n + \ 0.03833073,\n 0.0010886188,\n 0.03111393,\n -0.0444582,\n + \ -0.0042268196,\n -0.0031658595,\n 0.010286206,\n -0.033292588,\n + \ -0.012549967,\n 0.0074550887,\n 0.0060537136,\n 0.007960037,\n + \ 0.01809873,\n 0.014819399,\n 0.00073756586,\n 0.056962777,\n + \ 0.0014339982,\n 0.0388527,\n 0.03127279,\n 0.006167185,\n + \ -0.028027501,\n -0.014161264,\n 0.015488883,\n -0.04498017,\n + \ 0.025009155,\n -0.020129874,\n -0.01105214,\n 0.01698671,\n + \ 0.0011595386,\n 0.027074339,\n -0.0043743327,\n -0.016589558,\n + \ 0.0036169093,\n 0.007835219,\n 0.011364187,\n 0.016124323,\n + \ -0.018575313,\n 0.015556965,\n -0.0023190773,\n -0.027687086,\n + \ 0.04241571,\n -0.02943455,\n 0.0011772686,\n 0.04697727,\n + \ 0.008056488,\n 0.042166073,\n -0.035743576,\n 0.040668245,\n + \ 0.0025616228,\n -0.010649316,\n -0.0032509633,\n 0.00097018277,\n + \ 0.008374209,\n 0.036379017,\n 0.0067458907,\n -0.006116123,\n + \ -0.012016649,\n -0.0021517065,\n -0.003066572,\n 0.005049489,\n + \ -0.021831948,\n -0.033383366,\n 0.018609352,\n -0.049155924,\n + \ 0.022058891,\n -0.005378557,\n -0.003267984,\n -0.020368164,\n + \ -0.016634947,\n 0.005242391,\n -0.02739206,\n 0.023193609,\n + \ 0.016476085,\n -0.015398106,\n -0.014853441,\n -0.007874934,\n + \ 0.008391229,\n 0.02047029,\n 0.027573615,\n 0.011375534,\n + \ -0.032793313,\n -0.024736824,\n 0.0340415,\n -0.0011297523,\n + \ 0.03136357,\n 0.016283184,\n -0.03508544,\n 0.019846195,\n + \ -0.03256637,\n -0.025009155,\n -0.015250592,\n 0.027641699,\n + \ 0.014047792,\n 0.020288734,\n 0.012686132,\n 0.014320124,\n + \ -0.00029999073,\n -0.004059449,\n 0.0024594984,\n 0.0060423664,\n + \ -0.01710018,\n -0.0031034502,\n -0.01249323,\n 0.0021829112,\n + \ 0.026847396,\n -0.004519009,\n -0.016975362,\n 0.012527272,\n + \ 0.014478984,\n 0.03535777,\n 0.035266995,\n -0.013412351,\n + \ -0.016124323,\n 0.013208102,\n 0.03976047,\n -0.0168165,\n + \ -0.0074777827,\n 0.030138075,\n 0.010286206,\n -0.011216674,\n + \ 0.0063771075,\n 0.06771989,\n -0.018756866,\n 0.025463043,\n + \ -0.010728746,\n -0.02727859,\n 0.0078068506,\n 0.040713634,\n + \ 0.012720174,\n -0.010064937,\n -0.0029871417,\n -0.0007567142,\n + \ -0.02991113,\n -0.0063544135,\n -0.007301902,\n 0.0048282193,\n + \ 0.02387444,\n -0.0019261815,\n -0.00009503252,\n -0.024532575,\n + \ 0.019176712,\n -0.006564336,\n 0.0058891797,\n 0.001175141,\n + \ -0.035947826,\n -0.0352443,\n -0.0015999505,\n -0.028776415,\n + \ -0.023420552,\n 0.019846195,\n 0.0005861521,\n -0.01950578,\n + \ 0.047385767,\n 0.0015829297,\n 0.0088224225,\n -0.016487433,\n + \ -0.038421508,\n 0.03195362,\n 0.009015324,\n 0.027528226,\n + \ -0.009662112,\n -0.012652091,\n 0.0128790345,\n 0.029343773,\n + \ -0.015647743,\n 0.00514594,\n 0.048248153,\n 0.019256141,\n + \ 0.005128919,\n 0.01762215,\n 0.008334494,\n -0.033383366,\n + \ 0.018325673,\n 0.024124077,\n -0.018450493,\n 0.016952667,\n + \ -0.014478984,\n 0.018927073,\n 0.027437449,\n 0.0071146735,\n + \ 0.00045034068,\n 0.012765562,\n -0.020697232,\n 0.032543674,\n + \ -0.037581816,\n 0.003321883,\n -0.018132772,\n -0.034813106,\n + \ 0.007665011,\n -0.005923221,\n -0.017474636,\n -0.03755912,\n + \ -0.044390116,\n 0.037854146,\n -0.009735869,\n 0.015398106,\n + \ 0.00207795,\n 0.002314822,\n 0.00598563,\n 0.013571211,\n + \ 0.0012808114,\n -0.03560741,\n -0.01950578,\n 0.0031233076,\n + \ 0.0036112359,\n -0.0046920534,\n 0.0115968045,\n 0.017871788,\n + \ 0.0516523,\n -0.0042636977,\n 0.025258793,\n 0.023102831,\n + \ 0.015795255,\n -0.021491533,\n 0.01029188,\n -0.026575064,\n + \ -0.012776909,\n -0.02650698,\n -0.011494679,\n -0.016044894,\n + \ 0.00020105761,\n -0.0029701209,\n 0.005270759,\n -0.017871788,\n + \ 0.02991113,\n -0.015103078,\n 0.006019672,\n -0.023420552,\n + \ 0.031681288,\n -0.005389904,\n -0.009457864,\n 0.03944275,\n + \ 0.028209057,\n -0.010967037,\n 0.0038778943,\n 0.0027545248,\n + \ 0.0026921153,\n -0.00598563,\n -0.04441281,\n -0.014887483,\n + \ 0.029820355,\n -0.012833646,\n -0.020368164,\n -0.006876383,\n + \ -0.008674909,\n 0.03451808,\n 0.010252165,\n -0.020742621,\n + \ 0.00726786,\n -0.017236346,\n 0.01809873,\n 0.01809873,\n + \ 0.024441797,\n 0.011562763,\n -0.017349819,\n 0.0005187783,\n + \ -0.05991304,\n 0.018291632,\n 0.0072621866,\n -0.012731521,\n + \ 0.016759764,\n -0.03969239,\n 0.0019417839,\n 0.0035431527,\n + \ -0.00062444876,\n 0.0038864047,\n 0.033428755,\n -0.012062038,\n + \ 0.018484535,\n -0.043550424,\n 0.004655175,\n 0.0013793899,\n + \ -0.010620948,\n -0.01730443,\n 0.0025034687,\n 0.019891582,\n + \ -0.01822355,\n -0.03592513,\n 0.01285634,\n -0.01293577,\n + \ 0.006252289,\n -0.010274859,\n -0.009588356,\n -0.018302979,\n + \ -0.017168263,\n 0.029548021,\n -0.036152072,\n 0.00931035,\n + \ -0.0046353177,\n -0.03027424,\n -0.011925872,\n 0.025553819,\n + \ 0.0050041005,\n -0.030864293,\n 0.0013340013,\n 0.030569267,\n + \ -0.01051315,\n 0.038534977,\n -0.045161724,\n 0.008697603,\n + \ 0.0027148097,\n -0.008969936,\n 0.039783165,\n 0.025304182,\n + \ 0.029933825,\n 0.020595107,\n 0.04513903\n ]\n + \ }\n ],\n \"model\": \"text-embedding-3-small\",\n \"usage\": {\n \"prompt_tokens\": + 4,\n \"total_tokens\": 4\n }\n}\n" + headers: + Content-Length: + - '33207' + Content-Type: + - application/json + Date: + - Wed, 02 Oct 2024 14:24:01 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + access-control-allow-origin: + - '*' + apim-request-id: + - f0570ab0-79bb-47e2-af52-2bab1b7a41b0 + azureml-model-session: + - d005-20240531125325 + openai-organization: test_openai_org_key + x-content-type-options: + - nosniff + x-ms-client-request-id: + - f0570ab0-79bb-47e2-af52-2bab1b7a41b0 + x-ms-region: + - East US + x-ratelimit-remaining-requests: + - '1' + x-ratelimit-remaining-tokens: + - '2988' + x-request-id: + - d536759b-6321-43a4-9440-07af18197040 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestLocalEmbeddings.test_all_the_client_options.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_all_the_client_options[ollama_provider_embeddings].yaml similarity index 98% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestLocalEmbeddings.test_all_the_client_options.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_all_the_client_options[ollama_provider_embeddings].yaml index 030d248..f568c04 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestLocalEmbeddings.test_all_the_client_options.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_all_the_client_options[ollama_provider_embeddings].yaml @@ -18,7 +18,7 @@ interactions: host: - localhost:11434 user-agent: - - OpenAI/Python 1.50.2 + - OpenAI/Python 1.50.0 x-stainless-arch: - x64 x-stainless-async: @@ -28,7 +28,7 @@ interactions: x-stainless-os: - Linux x-stainless-package-version: - - 1.50.2 + - 1.50.0 x-stainless-retry-count: - '0' x-stainless-runtime: @@ -46,7 +46,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 12 Nov 2024 14:22:21 GMT + - Wed, 02 Oct 2024 14:24:01 GMT Set-Cookie: test_set_cookie Transfer-Encoding: - chunked diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestOpenAIEmbeddings.test_basic.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_all_the_client_options[openai_provider_embeddings].yaml similarity index 99% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestOpenAIEmbeddings.test_basic.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_all_the_client_options[openai_provider_embeddings].yaml index ace015d..199e675 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestOpenAIEmbeddings.test_basic.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_all_the_client_options[openai_provider_embeddings].yaml @@ -1,6 +1,7 @@ interactions: - request: - body: '{"input": ["South Atlantic Ocean."], "model": "text-embedding-3-small"}' + body: '{"input": ["South Atlantic Ocean."], "model": "text-embedding-3-small", + "encoding_format": "float"}' headers: accept: - application/json @@ -11,13 +12,13 @@ interactions: connection: - keep-alive content-length: - - '71' + - '99' content-type: - application/json host: - api.openai.com user-agent: - - OpenAI/Python 1.50.2 + - OpenAI/Python 1.50.0 x-stainless-arch: - x64 x-stainless-async: @@ -27,7 +28,7 @@ interactions: x-stainless-os: - Linux x-stainless-package-version: - - 1.50.2 + - 1.50.0 x-stainless-retry-count: - '0' x-stainless-runtime: @@ -430,13 +431,13 @@ interactions: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8e174dd6cc77bae7-MXP + - 8cc55a853a16bab5-MXP Connection: - keep-alive Content-Type: - application/json Date: - - Tue, 12 Nov 2024 14:45:08 GMT + - Wed, 02 Oct 2024 14:24:01 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -448,15 +449,13 @@ interactions: - '*' access-control-expose-headers: - X-Request-ID - alt-svc: - - h3=":443"; ma=86400 content-length: - '33244' openai-model: - text-embedding-3-small openai-organization: test_openai_org_key openai-processing-ms: - - '164' + - '18' openai-version: - '2020-10-01' strict-transport-security: @@ -474,7 +473,7 @@ interactions: x-ratelimit-reset-tokens: - 0s x-request-id: - - req_663c545d1a75504a634de5e768246ba1 + - req_dfcdb7ecd2227bb7addc7e38f759ae6d status: code: 200 message: OK diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_async_all_the_client_options[azure_provider_embeddings].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_async_all_the_client_options[azure_provider_embeddings].yaml new file mode 100644 index 0000000..40b05f0 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_async_all_the_client_options[azure_provider_embeddings].yaml @@ -0,0 +1,464 @@ +interactions: +- request: + body: '{"input": ["South Atlantic Ocean."], "model": "text-embedding-3-small", + "encoding_format": "float"}' + 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: + - '99' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AsyncAzureOpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/embeddings?api-version=2023-05-15 + response: + body: + string: "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": + \"embedding\",\n \"index\": 0,\n \"embedding\": [\n -0.031545125,\n + \ -0.030183462,\n 0.010235145,\n 0.0091061015,\n -0.030864293,\n + \ 0.064815015,\n 0.036061294,\n -0.0018737009,\n -0.004669359,\n + \ -0.021037648,\n 0.0026396345,\n -0.010927321,\n -0.018688783,\n + \ -0.012107427,\n 0.014955565,\n 0.02450988,\n -0.024282936,\n + \ 0.018881686,\n 0.016634947,\n 0.023170915,\n -0.028231751,\n + \ -0.03556202,\n -0.062817916,\n 0.061138533,\n 0.020390859,\n + \ -0.0150123015,\n 0.008255064,\n 0.01822355,\n -0.06377108,\n + \ 0.025962317,\n 0.10521093,\n -0.030705433,\n 0.00090280897,\n + \ 0.065722786,\n 0.039306585,\n 0.06862766,\n -0.020390859,\n + \ -0.01173297,\n -0.05587345,\n 0.008198328,\n 0.029003358,\n + \ -0.055555727,\n 0.0033445773,\n 0.0019148344,\n 0.008447966,\n + \ 0.0053501893,\n -0.06876383,\n -0.031681288,\n 0.035017356,\n + \ 0.01429743,\n -0.03415497,\n 0.028458694,\n -0.032407507,\n + \ -0.043073844,\n 0.043164622,\n -0.025758069,\n -0.013548517,\n + \ 0.00268786,\n 0.06921772,\n -0.00045140448,\n -0.04693188,\n + \ 0.048838206,\n -0.0016070425,\n -0.005143103,\n -0.046069495,\n + \ -0.0024197833,\n 0.014081834,\n 0.061365478,\n -0.056055002,\n + \ -0.01974407,\n -0.04838432,\n 0.02210428,\n 0.024055993,\n + \ -0.036356322,\n -0.05383096,\n -0.014853441,\n -0.01473997,\n + \ -0.036265545,\n -0.0015956953,\n -0.034495387,\n -0.029502634,\n + \ 0.06272714,\n 0.02154827,\n -0.012447841,\n -0.015545619,\n + \ -0.042551875,\n 0.016192406,\n 0.00840825,\n -0.018325673,\n + \ 0.026529675,\n -0.03272523,\n -0.020810703,\n -0.021037648,\n + \ -0.010445067,\n -0.010104652,\n 0.03912503,\n -0.009401128,\n + \ 0.01269748,\n 0.024124077,\n -0.0050012637,\n -0.02419216,\n + \ -0.026121177,\n 0.020799356,\n -0.01397971,\n -0.028299833,\n + \ -0.024850296,\n 0.0017857604,\n 0.010064937,\n 0.012470536,\n + \ -0.011381208,\n -0.009066386,\n 0.029457245,\n -0.0016226448,\n + \ 0.018915728,\n -0.0046636853,\n -0.021060342,\n 0.0029474266,\n + \ -0.06449729,\n 0.056009613,\n 0.0053019635,\n 0.008113224,\n + \ -0.036605958,\n 0.021378063,\n -0.014081834,\n -0.03708254,\n + \ -0.011630846,\n -0.025145322,\n -0.010263512,\n 0.006796953,\n + \ 0.003066572,\n 0.009503252,\n -0.012515925,\n -0.016078936,\n + \ -0.030909682,\n 0.020050444,\n 0.07107865,\n -0.0064395173,\n + \ -0.0216277,\n 0.0012340044,\n 0.01197126,\n 0.022921277,\n + \ 0.02791403,\n 0.0392385,\n 0.0034977642,\n 0.02010718,\n + \ -0.0043289443,\n -0.055691894,\n 0.027142422,\n 0.020118527,\n + \ -0.038444202,\n 0.013287532,\n -0.004947365,\n 0.003880731,\n + \ 0.025780763,\n -0.004728932,\n -0.012901728,\n -0.0036282565,\n + \ 0.005503376,\n 0.011755665,\n -0.0017573924,\n 0.0027587798,\n + \ -0.023012053,\n 0.043073844,\n 0.023760967,\n -0.0168165,\n + \ -0.008493355,\n 0.006632419,\n 0.015625048,\n -0.052015413,\n + \ -0.011454965,\n -0.008221022,\n -0.020674538,\n -0.025621902,\n + \ -0.0049530384,\n -0.010490456,\n -0.03576627,\n 0.009395454,\n + \ -0.031772066,\n -0.018132772,\n 0.016748417,\n -0.021287285,\n + \ 0.0022850358,\n 0.035902437,\n -0.007148715,\n 0.006825321,\n + \ 0.035902437,\n 0.0103883315,\n -0.010479108,\n -0.004192778,\n + \ -0.009463537,\n 0.01914267,\n -0.024918377,\n 0.07067015,\n + \ 0.015761215,\n -0.006944466,\n -0.046477996,\n 0.0140137505,\n + \ 0.04498017,\n -0.008198328,\n 0.03345145,\n 0.028186362,\n + \ -0.0230234,\n -0.033633,\n -0.060185373,\n -0.021809254,\n + \ -0.03315642,\n -0.05378557,\n 0.021196507,\n 0.05514723,\n + \ 0.0005794147,\n 0.016317226,\n -0.018677436,\n 0.02607579,\n + \ 0.019914277,\n -0.026620453,\n -0.0032311056,\n -0.016634947,\n + \ 0.009667786,\n 0.023488635,\n -0.012379759,\n -0.036015905,\n + \ 0.013877585,\n 0.01581795,\n 0.026302733,\n -0.013332921,\n + \ 0.05137997,\n 0.056418113,\n -0.022490084,\n 0.0095826825,\n + \ -0.021797907,\n 0.027051644,\n 0.017440595,\n -0.0065019266,\n + \ -0.034813106,\n -0.05169769,\n -0.040373217,\n -0.0058437907,\n + \ 0.011585457,\n 0.021219201,\n 0.0097926045,\n -0.028935274,\n + \ -0.014342818,\n 0.05097147,\n 0.029820355,\n -0.013401004,\n + \ -0.020254692,\n 0.046409912,\n 0.03905695,\n -0.016203754,\n + \ 0.050154477,\n -0.008192655,\n -0.014932871,\n 0.025894234,\n + \ 0.010802503,\n 0.01059258,\n -0.009486231,\n -0.050835308,\n + \ -0.052968573,\n -0.03985125,\n -0.015851991,\n -0.045592915,\n + \ -0.022932624,\n -0.048202764,\n 0.010081958,\n 0.024714129,\n + \ -0.006167185,\n 0.03315642,\n 0.006184206,\n -0.034132276,\n + \ -0.021536922,\n 0.0032538,\n 0.03760451,\n 0.0063090245,\n + \ 0.00400555,\n 0.028050195,\n 0.035062745,\n 0.02466874,\n + \ 0.019324224,\n 0.011500353,\n -0.004467947,\n 0.027777864,\n + \ -0.05610039,\n -0.0669029,\n 0.012663438,\n -0.012549967,\n + \ -0.015647743,\n 0.008618173,\n -0.027437449,\n 0.038943477,\n + \ 0.03295217,\n 0.08142727,\n 0.024759518,\n -0.020651843,\n + \ -0.015988158,\n -0.02607579,\n 0.0062863305,\n 0.021332674,\n + \ -0.0018268939,\n -0.027891336,\n -0.003662298,\n 0.054194067,\n + \ -0.019959666,\n 0.013627947,\n -0.016510127,\n 0.008379882,\n + \ 0.035312384,\n -0.04634183,\n 0.016078936,\n 0.023897134,\n + \ 0.010978384,\n 0.020458942,\n 0.0009148653,\n 0.03488119,\n + \ -0.017520025,\n 0.036991764,\n -0.011948567,\n -0.054874897,\n + \ -0.0032027378,\n 0.0035771942,\n -0.027142422,\n 0.012062038,\n + \ 0.024282936,\n -0.024963766,\n 0.012039344,\n -0.00036594612,\n + \ -0.046205662,\n -0.025304182,\n -0.02367019,\n 0.024373714,\n + \ -0.015193856,\n 0.001831149,\n 0.0066210716,\n 0.043709286,\n + \ -0.00992877,\n 0.022138322,\n -0.039647,\n -0.03272523,\n + \ 0.028367916,\n -0.035335075,\n 0.06050309,\n -0.009219573,\n + \ -0.01833702,\n 0.02246739,\n 0.02519071,\n -0.010042243,\n + \ -0.009611051,\n -0.01850723,\n 0.01437686,\n 0.07539058,\n + \ -0.015466188,\n 0.008680582,\n 0.0056707463,\n -0.0058097495,\n + \ -0.010172735,\n -0.023715578,\n 0.030523878,\n 0.033088338,\n + \ -0.034767717,\n -0.06871844,\n 0.02130998,\n -0.032589063,\n + \ 0.0036424405,\n -0.031658594,\n 0.0008226696,\n 0.04513903,\n + \ -0.024124077,\n -0.005199839,\n 0.0022126974,\n 0.008232369,\n + \ -0.011585457,\n -0.03576627,\n 0.04797582,\n -0.0520608,\n + \ 0.019154018,\n -0.003594215,\n 0.043391567,\n -0.05174308,\n + \ 0.0015006628,\n -0.03256637,\n -0.0012581171,\n -0.044526283,\n + \ 0.052514687,\n -0.027460143,\n 0.004970059,\n 0.029366467,\n + \ -0.052560076,\n 0.003350251,\n -0.030001909,\n -0.0043629855,\n + \ -0.02607579,\n -0.038466893,\n -0.026824702,\n 0.034745023,\n + \ 0.0026821864,\n -0.0032906784,\n 0.008748665,\n 0.04237032,\n + \ -0.018053342,\n -0.038217258,\n 0.048792817,\n 0.034245748,\n + \ -0.027255895,\n -0.0062749833,\n -0.022807805,\n 0.009174184,\n + \ 0.015114426,\n -0.05718972,\n 0.025667291,\n 0.0055771326,\n + \ -0.014524373,\n -0.0009311769,\n -0.054057904,\n -0.0037644226,\n + \ 0.03383725,\n 0.00013448166,\n 0.040350523,\n -0.015466188,\n + \ 0.051606912,\n 0.004453763,\n 0.025621902,\n -0.005063673,\n + \ 0.055328786,\n -0.007551539,\n -0.004206962,\n 0.011914525,\n + \ 0.0728942,\n 0.03465425,\n -0.030342324,\n 0.0142066525,\n + \ 0.015806602,\n 0.056055002,\n -0.010263512,\n 0.007528845,\n + \ 0.03011538,\n -0.017043443,\n 0.024759518,\n -0.0069955285,\n + \ 0.012844993,\n -0.031091237,\n 0.011284757,\n 0.0037786064,\n + \ 0.020368164,\n 0.00070707034,\n 0.008714624,\n -0.007971385,\n + \ -0.0019502942,\n 0.03277062,\n 0.021378063,\n -0.054693345,\n + \ -0.017894482,\n 0.053694792,\n -0.0049870797,\n -0.0059062,\n + \ 0.012720174,\n 0.028640248,\n -0.019437697,\n -0.008618173,\n + \ 0.027460143,\n 0.012799604,\n 0.045978718,\n 0.008379882,\n + \ -0.01670303,\n -0.054693345,\n 0.011063487,\n 0.02984305,\n + \ 0.028163668,\n 0.0007474946,\n 0.066176675,\n -0.0052196966,\n + \ -0.008720297,\n -0.022092933,\n -0.00923092,\n 0.028889887,\n + \ 0.014762664,\n -0.019710029,\n 0.0036225829,\n -0.0077444413,\n + \ -0.020356817,\n -0.04330079,\n -0.0316359,\n -0.0024552431,\n + \ -0.006479232,\n -0.028640248,\n -0.0139683625,\n -0.018405104,\n + \ -0.029026052,\n -0.0047317683,\n 0.013673336,\n -0.042801514,\n + \ -0.026121177,\n 0.022762416,\n 0.031681288,\n -0.00816996,\n + \ -0.008351515,\n 0.034858495,\n -0.041099437,\n -0.045161724,\n + \ -0.02194542,\n 0.052923184,\n -0.04929209,\n 0.04209799,\n + \ 0.0045927656,\n -0.011778359,\n 0.0057927286,\n 0.07570829,\n + \ -0.044753224,\n -0.016839195,\n -0.053195518,\n -0.025848845,\n + \ 0.015261939,\n -0.0011127315,\n 0.04025975,\n -0.017588109,\n + \ -0.03560741,\n -0.007177083,\n -0.0044310684,\n -0.01209608,\n + \ 0.025576513,\n -0.0015616538,\n -0.0014737133,\n -0.007699053,\n + \ -0.021253243,\n -0.019267488,\n -0.0025701332,\n -0.045933332,\n + \ -0.0011942893,\n -0.028640248,\n -0.0064849057,\n -0.021151118,\n + \ 0.037218705,\n 0.009503252,\n 0.027028952,\n -0.015364064,\n + \ -0.007954364,\n -0.026733924,\n -0.021525575,\n -0.0404413,\n + \ 0.014558415,\n -0.011477659,\n 0.034086887,\n 0.009321697,\n + \ 0.015602354,\n -0.014751317,\n 0.027346672,\n -0.008952915,\n + \ 0.006791279,\n -0.018371062,\n -0.008238043,\n 0.043845452,\n + \ 0.023216303,\n -0.019244794,\n 0.00056523073,\n 0.014002403,\n + \ -0.007449415,\n -0.0027828927,\n -0.035493936,\n 0.008022447,\n + \ -0.01746329,\n -0.013900279,\n 0.013469087,\n 0.029366467,\n + \ -0.016521474,\n -0.022365265,\n -0.009474884,\n 0.008680582,\n + \ 0.057779774,\n 0.016725725,\n -0.018802255,\n -0.0009070641,\n + \ 0.03031963,\n 0.023579413,\n 0.032884087,\n -0.012629396,\n + \ -0.0065700095,\n 0.0066380925,\n 0.023760967,\n 0.033337977,\n + \ -0.017644845,\n -0.014331471,\n 0.014422249,\n -0.022966666,\n + \ -0.022660293,\n -0.015250592,\n 0.044185866,\n -0.006280657,\n + \ 0.01193722,\n -0.02322765,\n -0.0040679593,\n 0.032112483,\n + \ 0.0064395173,\n 0.054647956,\n -0.02807289,\n -0.01369603,\n + \ -0.02330708,\n -0.02118516,\n -0.0085841315,\n 0.04273343,\n + \ -0.008385556,\n 0.012152815,\n 0.042597264,\n 0.018246245,\n + \ -0.024804907,\n -0.017088832,\n -0.004998427,\n -0.03456347,\n + \ 0.0005911165,\n 0.014569762,\n -0.023715578,\n -0.015545619,\n + \ 0.020515677,\n 0.011250716,\n 0.043663897,\n 0.017724274,\n + \ -0.051243804,\n 0.010853565,\n 0.013185408,\n -0.056872,\n + \ 0.03367839,\n 0.006955813,\n -0.01746329,\n -0.007074958,\n + \ 0.024419103,\n 0.029820355,\n 0.007965711,\n -0.020447595,\n + \ -0.0038722206,\n -0.023375163,\n 0.05237852,\n 0.0061898795,\n + \ 0.0022297183,\n -0.018427799,\n 0.028458694,\n 0.019085934,\n + \ 0.007369985,\n -0.0073132487,\n 0.018371062,\n -0.018654741,\n + \ 0.024850296,\n 0.05315013,\n 0.008595479,\n -0.032906782,\n + \ 0.022558168,\n 0.014615151,\n 0.002622614,\n 0.014240694,\n + \ -0.012243593,\n 0.012447841,\n -0.014660539,\n -0.029003358,\n + \ 0.011846442,\n 0.034495387,\n 0.018371062,\n 0.011199653,\n + \ -0.019539822,\n -0.02907144,\n -0.033791862,\n 0.01778101,\n + \ -0.039079644,\n -0.029207608,\n -0.0043232706,\n -0.008742992,\n + \ 0.037944924,\n 0.01893842,\n -0.046273746,\n -0.015466188,\n + \ -0.0057473397,\n -0.008362862,\n -0.001641084,\n 0.027845947,\n + \ -0.04309654,\n 0.039669696,\n -0.009996854,\n 0.042302236,\n + \ 0.0072508394,\n 0.03976047,\n -0.0048140353,\n 0.02582615,\n + \ -0.010989731,\n 0.012947117,\n 0.0005173599,\n -0.03383725,\n + \ 0.02246739,\n -0.006848015,\n 0.029638799,\n -0.011245042,\n + \ -0.0013992474,\n -0.0120733855,\n -0.0112393685,\n -0.009559988,\n + \ 0.04761271,\n -0.027074339,\n 0.045592915,\n 0.022648945,\n + \ 0.017826399,\n 0.014263389,\n 0.018666089,\n -0.020742621,\n + \ -0.0019616415,\n 0.020368164,\n -0.017236346,\n 0.04513903,\n + \ -0.0051799817,\n 0.012050691,\n 0.0074153733,\n -0.0063090245,\n + \ -0.01249323,\n -0.007874934,\n 0.0008531651,\n 0.020402206,\n + \ 0.04348234,\n 0.0166236,\n 0.014842094,\n -0.04761271,\n + \ 0.005049489,\n 0.001504918,\n -0.0091061015,\n -0.010768461,\n + \ 0.020629149,\n -0.042188767,\n -0.0071146735,\n 0.036106683,\n + \ 0.010059264,\n -0.022989359,\n 0.013003853,\n 0.03252098,\n + \ 0.00862952,\n 0.024010604,\n 0.0019375287,\n 0.0011645029,\n + \ -0.005109062,\n -0.016305879,\n 0.018007953,\n 0.00026045294,\n + \ 0.009809625,\n 0.01269748,\n 0.036628652,\n -0.006989855,\n + \ -0.021525575,\n 0.020844745,\n 0.0037956273,\n 0.013060588,\n + \ 0.0014595293,\n 0.020243345,\n 0.01193722,\n 0.025145322,\n + \ -0.0030467142,\n -0.014047792,\n -0.01594277,\n 0.0476581,\n + \ -0.003472233,\n -0.029661493,\n 0.0053672097,\n 0.0160222,\n + \ 0.02367019,\n -0.03199901,\n -0.014660539,\n 0.012765562,\n + \ 0.012243593,\n -0.034472693,\n -0.0029729577,\n -0.005528907,\n + \ 0.018802255,\n 0.040577468,\n 0.017088832,\n 0.02047029,\n + \ -0.00031293358,\n -0.017610803,\n 0.008601152,\n 0.0520608,\n + \ 0.019573862,\n 0.016975362,\n -0.025735375,\n -0.0024694272,\n + \ 0.03320181,\n -0.0038778943,\n 0.0049757324,\n -0.0073586376,\n + \ 0.022864541,\n -0.017156916,\n -0.00672887,\n -0.0014878972,\n + \ -0.030501183,\n 0.008033794,\n -0.002619777,\n 0.0012836482,\n + \ 0.0015432147,\n 0.024033299,\n -0.008209675,\n 0.030818904,\n + \ 0.0045927656,\n 0.00596861,\n -0.0015006628,\n -0.02943455,\n + \ -0.01990293,\n 0.058460604,\n 0.033564918,\n 0.033542223,\n + \ -0.044072397,\n -0.031681288,\n 0.01589738,\n 0.03156782,\n + \ -0.00885079,\n -0.0024935398,\n -0.040350523,\n 0.0028325366,\n + \ 0.051153027,\n -0.0048707714,\n 0.047158826,\n -0.010859239,\n + \ -0.006893404,\n -0.009769911,\n 0.0006854398,\n -0.0324302,\n + \ 0.020685885,\n 0.033088338,\n -0.007840892,\n 0.024577962,\n + \ 0.008289105,\n -0.011676234,\n 0.014354166,\n 0.024759518,\n + \ 0.011869136,\n 0.024441797,\n 0.0018978136,\n 0.052877795,\n + \ 0.0077784825,\n 0.045025557,\n -0.020697232,\n 0.01497826,\n + \ -0.023159567,\n 0.06122931,\n 0.0070976526,\n -0.025304182,\n + \ -0.014399555,\n 0.0142520415,\n -0.038058396,\n -0.02947994,\n + \ -0.026461592,\n -0.024963766,\n 0.029252995,\n 0.05991304,\n + \ 0.0019658967,\n -0.013310227,\n 0.00049856614,\n 0.018858992,\n + \ 0.019494433,\n 0.0128790345,\n -0.0025162343,\n 0.010677684,\n + \ -0.009474884,\n 0.013525822,\n -0.013310227,\n -0.030705433,\n + \ -0.032452896,\n 0.025644597,\n -0.022807805,\n -0.007438068,\n + \ -0.005321821,\n -0.029933825,\n -0.013037895,\n -0.0037360545,\n + \ 0.010195429,\n 0.008533069,\n -0.03340606,\n -0.018416451,\n + \ 0.015341369,\n -0.00877136,\n 0.023602108,\n 0.020924175,\n + \ -0.009304676,\n -0.009395454,\n 0.036174767,\n -0.04466245,\n + \ -0.02330708,\n -0.013673336,\n 0.0073075755,\n 0.021605005,\n + \ 0.02070858,\n -0.0058494643,\n 0.025077239,\n 0.03671943,\n + \ 0.0150123015,\n -0.050290644,\n 0.037309483,\n -0.044526283,\n + \ 0.010660663,\n 0.02194542,\n 0.010473435,\n -0.016544169,\n + \ 0.027868642,\n 0.022853194,\n 0.020731274,\n 0.00026453083,\n + \ -0.0061104493,\n -0.009951465,\n -0.05001831,\n -0.028526777,\n + \ -0.021525575,\n 0.017792357,\n -0.0017971075,\n -0.01633992,\n + \ 0.020606454,\n 0.0019275999,\n -0.04021436,\n 0.005704788,\n + \ 0.028640248,\n 0.011131571,\n 0.0013644968,\n 0.043822758,\n + \ 0.021673089,\n -0.040078193,\n 0.03174937,\n 0.024237547,\n + \ 0.012618049,\n 0.03195362,\n 0.0034552123,\n -0.0024197833,\n + \ -0.016782459,\n 0.0046778694,\n -0.0027488512,\n 0.024850296,\n + \ -0.009032344,\n -0.021820601,\n -0.02582615,\n 0.013843543,\n + \ 0.0017602292,\n -0.011925872,\n 0.0050324686,\n -0.02943455,\n + \ -0.011108876,\n 0.010870585,\n -0.0013602416,\n 0.016453391,\n + \ 0.0040083867,\n 0.00025389285,\n -0.025145322,\n 0.03199901,\n + \ 0.0021517065,\n 0.011159939,\n -0.008924547,\n 0.049655203,\n + \ -0.005608337,\n 0.028027501,\n -0.030501183,\n -0.011466312,\n + \ -0.02314822,\n 0.01345774,\n 0.032929476,\n 0.0070182225,\n + \ -0.03787684,\n 0.026665842,\n 0.028458694,\n 0.036356322,\n + \ -0.0034580491,\n -0.011914525,\n 0.0057416665,\n 0.03184015,\n + \ 0.0054125986,\n 0.0027814743,\n -0.058732934,\n 0.0021744007,\n + \ 0.0035006008,\n 0.016430696,\n -0.005758687,\n 0.0015446331,\n + \ -0.006099102,\n -0.029752271,\n 0.0020481637,\n 0.05374018,\n + \ -0.046750326,\n -0.012118774,\n -0.01826894,\n 0.05142536,\n + \ 0.04761271,\n -0.0036821556,\n 0.028436,\n 0.007812524,\n + \ 0.0041644103,\n -0.03667404,\n -0.017758315,\n -0.0051345928,\n + \ 0.027210506,\n -0.024078688,\n -0.036356322,\n -0.0038353424,\n + \ 0.0059288945,\n -0.00989473,\n 0.02503185,\n 0.023170915,\n + \ -0.027369365,\n 0.0008361443,\n -0.034132276,\n 0.033814557,\n + \ 0.029184913,\n 0.018200856,\n -0.008896179,\n 0.016192406,\n + \ -0.0036878292,\n -0.021366715,\n 0.002981468,\n -0.01550023,\n + \ -0.012345717,\n -0.01233437,\n -0.014059139,\n -0.0073870053,\n + \ 0.022875888,\n -0.017599456,\n 0.006138817,\n 0.014422249,\n + \ -0.019256141,\n -0.035743576,\n 0.036900986,\n 0.024419103,\n + \ 0.025168017,\n 0.024396408,\n -0.054284845,\n 0.023397857,\n + \ -0.003719034,\n -0.0596861,\n 0.022875888,\n 0.053694792,\n + \ 0.006467885,\n 0.0444582,\n -0.009395454,\n -0.031204708,\n + \ 0.004402701,\n 0.0025843172,\n 0.0054636607,\n 0.053649403,\n + \ -0.020368164,\n -0.01081385,\n -0.01589738,\n 0.0009198297,\n + \ 0.017871788,\n 0.010178409,\n 0.028050195,\n -0.010252165,\n + \ -0.0053700465,\n 0.0029077115,\n 0.06354413,\n 0.0134463925,\n + \ -0.0035006008,\n -0.0056991144,\n -0.006360087,\n -0.014354166,\n + \ 0.017917177,\n -0.008464986,\n 0.00038686747,\n -0.017633498,\n + \ -0.011642193,\n 0.0006974962,\n 0.011437944,\n 0.030138075,\n + \ -0.011846442,\n -0.058596767,\n 0.013310227,\n 0.017361164,\n + \ -0.02503185,\n 0.0076309694,\n 0.022149669,\n -0.0023488635,\n + \ 0.012345717,\n -0.00018598716,\n -0.024532575,\n -0.009446517,\n + \ 0.01589738,\n 0.028821804,\n 0.023375163,\n -0.047839653,\n + \ 0.006411149,\n 0.02582615,\n 0.043958925,\n 0.008192655,\n + \ 0.015806602,\n -0.040622856,\n -0.02138941,\n -0.019687334,\n + \ -0.006757238,\n 0.016112976,\n 0.0644519,\n -0.02879911,\n + \ 0.04300576,\n 0.003892078,\n -0.011755665,\n -0.010161388,\n + \ 0.024782212,\n -0.03392803,\n -0.0070636114,\n -0.030614655,\n + \ -0.017156916,\n -0.010479108,\n 0.024646046,\n -0.0037757696,\n + \ 0.04357312,\n 0.0018084546,\n -0.018813603,\n -0.0053813937,\n + \ 0.016044894,\n -0.00035654925,\n -0.00931035,\n 0.017837746,\n + \ -0.004141716,\n -0.006791279,\n 0.031726677,\n -0.019233447,\n + \ 0.008572784,\n -0.0118124,\n 0.040191665,\n 0.0034977642,\n + \ -0.019721376,\n -0.02186599,\n -0.040759023,\n 0.0009155745,\n + \ -0.037763372,\n -0.0022226262,\n -0.027800558,\n -0.02943455,\n + \ -0.003960161,\n -0.027028952,\n 0.02022065,\n 0.018030647,\n + \ -0.025689986,\n -0.003957324,\n 0.00283821,\n -0.01089328,\n + \ -0.004022571,\n 0.0042977394,\n 0.017667538,\n -0.02791403,\n + \ -0.017996605,\n 0.0033842924,\n -0.014808052,\n 0.027573615,\n + \ -0.004561561,\n 0.016010853,\n 0.0071260207,\n -0.007931669,\n + \ -0.016090283,\n -0.031136625,\n 0.043278094,\n 0.039828554,\n + \ 0.03572088,\n 0.018132772,\n 0.005804076,\n 0.018166814,\n + \ 0.029162219,\n 0.028889887,\n 0.09368221,\n 0.013741419,\n + \ -0.031136625,\n -0.020969564,\n 0.030750822,\n -0.008896179,\n + \ -0.02194542,\n 0.025236098,\n 0.014263389,\n 0.015216551,\n + \ 0.013843543,\n 0.005327495,\n 0.019551167,\n 0.001143227,\n + \ -0.00070316973,\n 0.03351953,\n 0.042914983,\n 0.0018155467,\n + \ 0.05069914,\n -0.012277634,\n 0.0032793311,\n -0.025758069,\n + \ -0.029411856,\n 0.035017356,\n 0.012118774,\n 0.020867439,\n + \ 0.0005123955,\n -0.019641945,\n 0.017826399,\n -0.011103203,\n + \ 0.008527395,\n -0.02907144,\n 0.0049076495,\n 0.020141222,\n + \ -0.04865665,\n 0.030841598,\n -0.015375411,\n 0.0006191298,\n + \ -0.025758069,\n 0.03551663,\n 0.0010701796,\n -0.012470536,\n + \ -0.025553819,\n -0.011613825,\n -0.00945219,\n -0.0044707838,\n + \ -0.0003148839,\n -0.003265147,\n -0.015273286,\n 0.002941753,\n + \ -0.012799604,\n 0.045229807,\n -0.0015134284,\n 0.014422249,\n + \ -0.040078193,\n -0.020549718,\n 0.0017956891,\n -0.023375163,\n + \ 0.014944218,\n -0.0236248,\n 0.012470536,\n 0.007171409,\n + \ 0.02655237,\n 0.067992225,\n 0.0021970952,\n -0.023556719,\n + \ -0.023397857,\n -0.008459313,\n -0.011767012,\n -0.015965464,\n + \ -0.0042977394,\n -0.012799604,\n 0.020447595,\n -0.01429743,\n + \ 0.006343066,\n 0.005214023,\n 0.037899535,\n -0.03199901,\n + \ -0.04153063,\n 0.04209799,\n -0.01838241,\n -0.014615151,\n + \ 0.03833073,\n 0.0010886188,\n 0.03111393,\n -0.0444582,\n + \ -0.0042268196,\n -0.0031658595,\n 0.010286206,\n -0.033292588,\n + \ -0.012549967,\n 0.0074550887,\n 0.0060537136,\n 0.007960037,\n + \ 0.01809873,\n 0.014819399,\n 0.00073756586,\n 0.056962777,\n + \ 0.0014339982,\n 0.0388527,\n 0.03127279,\n 0.006167185,\n + \ -0.028027501,\n -0.014161264,\n 0.015488883,\n -0.04498017,\n + \ 0.025009155,\n -0.020129874,\n -0.01105214,\n 0.01698671,\n + \ 0.0011595386,\n 0.027074339,\n -0.0043743327,\n -0.016589558,\n + \ 0.0036169093,\n 0.007835219,\n 0.011364187,\n 0.016124323,\n + \ -0.018575313,\n 0.015556965,\n -0.0023190773,\n -0.027687086,\n + \ 0.04241571,\n -0.02943455,\n 0.0011772686,\n 0.04697727,\n + \ 0.008056488,\n 0.042166073,\n -0.035743576,\n 0.040668245,\n + \ 0.0025616228,\n -0.010649316,\n -0.0032509633,\n 0.00097018277,\n + \ 0.008374209,\n 0.036379017,\n 0.0067458907,\n -0.006116123,\n + \ -0.012016649,\n -0.0021517065,\n -0.003066572,\n 0.005049489,\n + \ -0.021831948,\n -0.033383366,\n 0.018609352,\n -0.049155924,\n + \ 0.022058891,\n -0.005378557,\n -0.003267984,\n -0.020368164,\n + \ -0.016634947,\n 0.005242391,\n -0.02739206,\n 0.023193609,\n + \ 0.016476085,\n -0.015398106,\n -0.014853441,\n -0.007874934,\n + \ 0.008391229,\n 0.02047029,\n 0.027573615,\n 0.011375534,\n + \ -0.032793313,\n -0.024736824,\n 0.0340415,\n -0.0011297523,\n + \ 0.03136357,\n 0.016283184,\n -0.03508544,\n 0.019846195,\n + \ -0.03256637,\n -0.025009155,\n -0.015250592,\n 0.027641699,\n + \ 0.014047792,\n 0.020288734,\n 0.012686132,\n 0.014320124,\n + \ -0.00029999073,\n -0.004059449,\n 0.0024594984,\n 0.0060423664,\n + \ -0.01710018,\n -0.0031034502,\n -0.01249323,\n 0.0021829112,\n + \ 0.026847396,\n -0.004519009,\n -0.016975362,\n 0.012527272,\n + \ 0.014478984,\n 0.03535777,\n 0.035266995,\n -0.013412351,\n + \ -0.016124323,\n 0.013208102,\n 0.03976047,\n -0.0168165,\n + \ -0.0074777827,\n 0.030138075,\n 0.010286206,\n -0.011216674,\n + \ 0.0063771075,\n 0.06771989,\n -0.018756866,\n 0.025463043,\n + \ -0.010728746,\n -0.02727859,\n 0.0078068506,\n 0.040713634,\n + \ 0.012720174,\n -0.010064937,\n -0.0029871417,\n -0.0007567142,\n + \ -0.02991113,\n -0.0063544135,\n -0.007301902,\n 0.0048282193,\n + \ 0.02387444,\n -0.0019261815,\n -0.00009503252,\n -0.024532575,\n + \ 0.019176712,\n -0.006564336,\n 0.0058891797,\n 0.001175141,\n + \ -0.035947826,\n -0.0352443,\n -0.0015999505,\n -0.028776415,\n + \ -0.023420552,\n 0.019846195,\n 0.0005861521,\n -0.01950578,\n + \ 0.047385767,\n 0.0015829297,\n 0.0088224225,\n -0.016487433,\n + \ -0.038421508,\n 0.03195362,\n 0.009015324,\n 0.027528226,\n + \ -0.009662112,\n -0.012652091,\n 0.0128790345,\n 0.029343773,\n + \ -0.015647743,\n 0.00514594,\n 0.048248153,\n 0.019256141,\n + \ 0.005128919,\n 0.01762215,\n 0.008334494,\n -0.033383366,\n + \ 0.018325673,\n 0.024124077,\n -0.018450493,\n 0.016952667,\n + \ -0.014478984,\n 0.018927073,\n 0.027437449,\n 0.0071146735,\n + \ 0.00045034068,\n 0.012765562,\n -0.020697232,\n 0.032543674,\n + \ -0.037581816,\n 0.003321883,\n -0.018132772,\n -0.034813106,\n + \ 0.007665011,\n -0.005923221,\n -0.017474636,\n -0.03755912,\n + \ -0.044390116,\n 0.037854146,\n -0.009735869,\n 0.015398106,\n + \ 0.00207795,\n 0.002314822,\n 0.00598563,\n 0.013571211,\n + \ 0.0012808114,\n -0.03560741,\n -0.01950578,\n 0.0031233076,\n + \ 0.0036112359,\n -0.0046920534,\n 0.0115968045,\n 0.017871788,\n + \ 0.0516523,\n -0.0042636977,\n 0.025258793,\n 0.023102831,\n + \ 0.015795255,\n -0.021491533,\n 0.01029188,\n -0.026575064,\n + \ -0.012776909,\n -0.02650698,\n -0.011494679,\n -0.016044894,\n + \ 0.00020105761,\n -0.0029701209,\n 0.005270759,\n -0.017871788,\n + \ 0.02991113,\n -0.015103078,\n 0.006019672,\n -0.023420552,\n + \ 0.031681288,\n -0.005389904,\n -0.009457864,\n 0.03944275,\n + \ 0.028209057,\n -0.010967037,\n 0.0038778943,\n 0.0027545248,\n + \ 0.0026921153,\n -0.00598563,\n -0.04441281,\n -0.014887483,\n + \ 0.029820355,\n -0.012833646,\n -0.020368164,\n -0.006876383,\n + \ -0.008674909,\n 0.03451808,\n 0.010252165,\n -0.020742621,\n + \ 0.00726786,\n -0.017236346,\n 0.01809873,\n 0.01809873,\n + \ 0.024441797,\n 0.011562763,\n -0.017349819,\n 0.0005187783,\n + \ -0.05991304,\n 0.018291632,\n 0.0072621866,\n -0.012731521,\n + \ 0.016759764,\n -0.03969239,\n 0.0019417839,\n 0.0035431527,\n + \ -0.00062444876,\n 0.0038864047,\n 0.033428755,\n -0.012062038,\n + \ 0.018484535,\n -0.043550424,\n 0.004655175,\n 0.0013793899,\n + \ -0.010620948,\n -0.01730443,\n 0.0025034687,\n 0.019891582,\n + \ -0.01822355,\n -0.03592513,\n 0.01285634,\n -0.01293577,\n + \ 0.006252289,\n -0.010274859,\n -0.009588356,\n -0.018302979,\n + \ -0.017168263,\n 0.029548021,\n -0.036152072,\n 0.00931035,\n + \ -0.0046353177,\n -0.03027424,\n -0.011925872,\n 0.025553819,\n + \ 0.0050041005,\n -0.030864293,\n 0.0013340013,\n 0.030569267,\n + \ -0.01051315,\n 0.038534977,\n -0.045161724,\n 0.008697603,\n + \ 0.0027148097,\n -0.008969936,\n 0.039783165,\n 0.025304182,\n + \ 0.029933825,\n 0.020595107,\n 0.04513903\n ]\n + \ }\n ],\n \"model\": \"text-embedding-3-small\",\n \"usage\": {\n \"prompt_tokens\": + 4,\n \"total_tokens\": 4\n }\n}\n" + headers: + Content-Length: + - '33207' + Content-Type: + - application/json + Date: + - Wed, 02 Oct 2024 14:48:21 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + access-control-allow-origin: + - '*' + apim-request-id: + - d7c6be85-be3d-43fe-9c17-22122a62e4c0 + azureml-model-session: + - d005-20240531125325 + openai-organization: test_openai_org_key + x-content-type-options: + - nosniff + x-ms-client-request-id: + - d7c6be85-be3d-43fe-9c17-22122a62e4c0 + x-ms-region: + - East US + x-ratelimit-remaining-requests: + - '2' + x-ratelimit-remaining-tokens: + - '2994' + x-request-id: + - 9036d977-abdc-4ec1-ade8-767e104b00a4 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncLocalEmbeddings.test_all_the_client_options.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_async_all_the_client_options[ollama_provider_embeddings].yaml similarity index 98% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncLocalEmbeddings.test_all_the_client_options.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_async_all_the_client_options[ollama_provider_embeddings].yaml index 0d16f03..48cfbac 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncLocalEmbeddings.test_all_the_client_options.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_async_all_the_client_options[ollama_provider_embeddings].yaml @@ -18,7 +18,7 @@ interactions: host: - localhost:11434 user-agent: - - AsyncOpenAI/Python 1.50.2 + - AsyncOpenAI/Python 1.50.0 x-stainless-arch: - x64 x-stainless-async: @@ -28,7 +28,7 @@ interactions: x-stainless-os: - Linux x-stainless-package-version: - - 1.50.2 + - 1.50.0 x-stainless-retry-count: - '0' x-stainless-runtime: @@ -46,7 +46,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 12 Nov 2024 14:18:04 GMT + - Wed, 02 Oct 2024 14:24:05 GMT Set-Cookie: test_set_cookie Transfer-Encoding: - chunked diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_async_all_the_client_options[openai_provider_embeddings].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_async_all_the_client_options[openai_provider_embeddings].yaml new file mode 100644 index 0000000..283531e --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_async_all_the_client_options[openai_provider_embeddings].yaml @@ -0,0 +1,480 @@ +interactions: +- request: + body: '{"input": ["South Atlantic Ocean."], "model": "text-embedding-3-small", + "encoding_format": "float"}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '99' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - AsyncOpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://api.openai.com/v1/embeddings + response: + body: + string: "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": + \"embedding\",\n \"index\": 0,\n \"embedding\": [\n -0.031546354,\n + \ -0.03013925,\n 0.010269586,\n 0.009123478,\n -0.030865498,\n + \ 0.06481755,\n 0.036040008,\n -0.0019063983,\n -0.004714932,\n + \ -0.020981729,\n 0.002685128,\n -0.010956117,\n -0.018689513,\n + \ -0.012062509,\n 0.015001539,\n 0.024578921,\n -0.024283884,\n + \ 0.018871075,\n 0.0166129,\n 0.023137776,\n -0.028255546,\n + \ -0.0356088,\n -0.06286576,\n 0.06109553,\n 0.020391654,\n + \ -0.014990192,\n 0.008221343,\n 0.018258303,\n -0.063728176,\n + \ 0.02596333,\n 0.105215035,\n -0.030752022,\n 0.00089717034,\n + \ 0.065770745,\n 0.039330814,\n 0.06858495,\n -0.020368958,\n + \ -0.011744776,\n -0.055921018,\n 0.008249712,\n 0.028936403,\n + \ -0.055603284,\n 0.0033787508,\n 0.0019801578,\n 0.0084596425,\n + \ 0.0053532347,\n -0.06876651,\n -0.031682525,\n 0.034996025,\n + \ 0.014297987,\n -0.034179,\n 0.02843711,\n -0.032386076,\n + \ -0.043075524,\n 0.043166306,\n -0.025736379,\n -0.013560393,\n + \ 0.002700731,\n 0.069220416,\n -0.00047553575,\n -0.046979103,\n + \ 0.04884011,\n -0.0016780277,\n -0.0051177717,\n -0.046116684,\n + \ -0.0024269698,\n 0.014105079,\n 0.06136787,\n -0.05605719,\n + \ -0.019767536,\n -0.048386205,\n 0.022037057,\n 0.024125017,\n + \ -0.036380436,\n -0.05383306,\n -0.014842673,\n -0.014740544,\n + \ -0.036289655,\n -0.0015915022,\n -0.034496732,\n -0.029549174,\n + \ 0.06282037,\n 0.02150372,\n -0.012414285,\n -0.0155689195,\n + \ -0.04253084,\n 0.016204387,\n 0.0084256,\n -0.018405823,\n + \ 0.026530711,\n -0.032771897,\n -0.020777473,\n -0.02102712,\n + \ -0.010479517,\n -0.010144763,\n 0.039194643,\n -0.009333408,\n + \ 0.01276606,\n 0.024125017,\n -0.005049686,\n -0.024170408,\n + \ -0.026144892,\n 0.020822862,\n -0.01400295,\n -0.028369023,\n + \ -0.024873959,\n 0.0018397311,\n 0.010071003,\n 0.012459675,\n + \ -0.011410021,\n -0.009095109,\n 0.029435698,\n -0.0016397296,\n + \ 0.018871075,\n -0.004678052,\n -0.021083858,\n 0.0029163356,\n + \ -0.06445442,\n 0.0560118,\n 0.005316355,\n 0.008085172,\n + \ -0.036561996,\n 0.0213562,\n -0.014048341,\n -0.03710668,\n + \ -0.011597257,\n -0.025168998,\n -0.010269586,\n 0.006763175,\n + \ 0.0031092449,\n 0.009514971,\n -0.012527761,\n -0.016079562,\n + \ -0.031001668,\n 0.02007392,\n 0.07108142,\n -0.0064681373,\n + \ -0.021628544,\n 0.0012709323,\n 0.01191499,\n 0.022956213,\n + \ 0.027983205,\n 0.039285425,\n 0.0034610208,\n 0.020142006,\n + \ -0.0043971986,\n -0.055648677,\n 0.027143482,\n 0.020107964,\n + \ -0.0384457,\n 0.013254007,\n -0.004933373,\n 0.0038695347,\n + \ 0.025781767,\n -0.004743301,\n -0.012868189,\n -0.0035886813,\n + \ 0.0054383418,\n 0.011756123,\n -0.0017546241,\n 0.0027517953,\n + \ -0.023012951,\n 0.04309822,\n 0.023807283,\n -0.016794462,\n + \ -0.008522054,\n 0.006649699,\n 0.01561431,\n -0.05201744,\n + \ -0.011500802,\n -0.008221343,\n -0.020675344,\n -0.02553212,\n + \ -0.0049872743,\n -0.010473844,\n -0.035767663,\n 0.009356104,\n + \ -0.031773306,\n -0.01817887,\n 0.016805809,\n -0.021254072,\n + \ 0.0022468267,\n 0.035858445,\n -0.0071376464,\n 0.0068709776,\n + \ 0.035903838,\n 0.010400084,\n -0.010496538,\n -0.0041872677,\n + \ -0.009497949,\n 0.01917746,\n -0.024896655,\n 0.07067291,\n + \ 0.015727786,\n -0.0068936725,\n -0.046411723,\n 0.014036993,\n + \ 0.0450954,\n -0.008153257,\n 0.03340736,\n 0.028255546,\n + \ -0.023035647,\n -0.03365701,\n -0.06018772,\n -0.021764714,\n + \ -0.033157714,\n -0.053787667,\n 0.021231377,\n 0.055194773,\n + \ 0.0005829834,\n 0.01632921,\n -0.018678164,\n 0.026076807,\n + \ 0.019903706,\n -0.026598796,\n -0.0032056996,\n -0.016646942,\n + \ 0.009668163,\n 0.023534942,\n -0.012402937,\n -0.035994615,\n + \ 0.013934864,\n 0.015795872,\n 0.026326453,\n -0.013367483,\n + \ 0.051336583,\n 0.056329533,\n -0.022468267,\n 0.009605751,\n + \ -0.021821452,\n 0.027030006,\n 0.017498013,\n -0.006536223,\n + \ -0.034769073,\n -0.051654316,\n -0.040420186,\n -0.005807139,\n + \ 0.011619952,\n 0.021242725,\n 0.0098327035,\n -0.028868318,\n + \ -0.0143660735,\n 0.051018853,\n 0.029821517,\n -0.01343557,\n + \ -0.02026683,\n 0.046411723,\n 0.039035775,\n -0.016204387,\n + \ 0.050111044,\n -0.008249712,\n -0.014944801,\n 0.025895244,\n + \ 0.010780229,\n 0.01063271,\n -0.009412842,\n -0.0507919,\n + \ -0.05292525,\n -0.039807413,\n -0.015863957,\n -0.045594692,\n + \ -0.022933519,\n -0.048250034,\n 0.010099372,\n 0.024715094,\n + \ -0.006184447,\n 0.033157714,\n 0.0062014684,\n -0.03413361,\n + \ -0.02154911,\n 0.0032312318,\n 0.037651367,\n 0.006309271,\n + \ 0.0039631524,\n 0.028073985,\n 0.035064112,\n 0.024624312,\n + \ 0.019347673,\n 0.0115348445,\n -0.0044936533,\n 0.027778948,\n + \ -0.05610258,\n -0.066905506,\n 0.012686627,\n -0.012561804,\n + \ -0.01561431,\n 0.00859014,\n -0.027461214,\n 0.038944997,\n + \ 0.03293076,\n 0.08147583,\n 0.024805874,\n -0.020629954,\n + \ -0.015988782,\n -0.026076807,\n 0.0063149445,\n 0.021299463,\n + \ -0.0018042699,\n -0.027892424,\n -0.0036737884,\n 0.05424157,\n + \ -0.019926403,\n 0.013605784,\n -0.016578857,\n 0.008380209,\n + \ 0.035336453,\n -0.046252854,\n 0.016068215,\n 0.02387537,\n + \ 0.010973138,\n 0.020425696,\n 0.0009177379,\n 0.03488255,\n + \ -0.017486665,\n 0.037061293,\n -0.011949033,\n -0.05487704,\n + \ -0.0031489616,\n 0.0035688232,\n -0.027166177,\n 0.012028466,\n + \ 0.024306579,\n -0.024896655,\n 0.012028466,\n -0.00041099623,\n + \ -0.046162076,\n -0.025305169,\n -0.023625722,\n 0.02439736,\n + \ -0.015217144,\n 0.0017915039,\n 0.0066043087,\n 0.043733686,\n + \ -0.010002918,\n 0.022139186,\n -0.039625853,\n -0.032771897,\n + \ 0.02843711,\n -0.035336453,\n 0.060596235,\n -0.00925965,\n + \ -0.018280998,\n 0.02244557,\n 0.025214387,\n -0.010002918,\n + \ -0.00963412,\n -0.018485256,\n 0.014400116,\n 0.07543891,\n + \ -0.015500834,\n 0.008658226,\n 0.005662457,\n -0.0058213235,\n + \ -0.0101901535,\n -0.023648418,\n 0.03052507,\n 0.033112325,\n + \ -0.034769073,\n -0.068675734,\n 0.021254072,\n -0.032590333,\n + \ 0.003605703,\n -0.031637136,\n 0.00083263085,\n 0.045140788,\n + \ -0.024125017,\n -0.0051489775,\n 0.00222555,\n 0.008227017,\n + \ -0.01155754,\n -0.03569958,\n 0.047977693,\n -0.05210822,\n + \ 0.01917746,\n -0.0035830077,\n 0.043415952,\n -0.05169971,\n + \ 0.0014737707,\n -0.032590333,\n -0.0012815706,\n -0.04452802,\n + \ 0.052516736,\n -0.02743852,\n 0.0049248626,\n 0.029390307,\n + \ -0.052607518,\n 0.0033276863,\n -0.029934993,\n -0.0043886877,\n + \ -0.026076807,\n -0.038468394,\n -0.026848443,\n 0.034723684,\n + \ 0.002713497,\n -0.0033191757,\n 0.008737659,\n 0.04234928,\n + \ -0.018020004,\n -0.038196053,\n 0.04884011,\n 0.03426978,\n + \ -0.027279653,\n -0.006241185,\n -0.022808695,\n 0.0091461735,\n + \ 0.015092321,\n -0.057237342,\n 0.025645597,\n 0.005600045,\n + \ -0.014558983,\n -0.0009078087,\n -0.054060012,\n -0.003747548,\n + \ 0.033815876,\n 0.00015452252,\n 0.0403521,\n -0.015455443,\n + \ 0.051563535,\n 0.004442589,\n 0.025622902,\n -0.005029828,\n + \ 0.055376332,\n -0.0075404863,\n -0.004241169,\n 0.01196038,\n + \ 0.07289704,\n 0.034723684,\n -0.030343506,\n 0.014229902,\n + \ 0.015818568,\n 0.0560118,\n -0.010252565,\n 0.0075348127,\n + \ 0.03013925,\n -0.01698737,\n 0.024760483,\n -0.0070241704,\n + \ 0.012834146,\n -0.031069754,\n 0.011285197,\n 0.0037815908,\n + \ 0.020334916,\n 0.0007102894,\n 0.008641205,\n -0.008051129,\n + \ -0.0019106537,\n 0.03270381,\n 0.021333506,\n -0.05474087,\n + \ -0.017917875,\n 0.05374228,\n -0.00501848,\n -0.00586104,\n + \ 0.012697975,\n 0.028664062,\n -0.01946115,\n -0.008646878,\n + \ 0.027415823,\n 0.01276606,\n 0.046025902,\n 0.008368862,\n + \ -0.016692333,\n -0.054695476,\n 0.011063919,\n 0.029821517,\n + \ 0.028096681,\n 0.00078511273,\n 0.06604309,\n -0.0051830206,\n + \ -0.008692268,\n -0.02211649,\n -0.009225606,\n 0.028891014,\n + \ 0.014729197,\n -0.019710798,\n 0.003605703,\n -0.0077107004,\n + \ -0.020368958,\n -0.043302476,\n -0.031591743,\n -0.002442573,\n + \ -0.006473811,\n -0.028641365,\n -0.013968907,\n -0.01837178,\n + \ -0.029027184,\n -0.0047291163,\n 0.013685217,\n -0.042825878,\n + \ -0.026167586,\n 0.02272926,\n 0.031727914,\n -0.008147583,\n + \ -0.00835184,\n 0.034859855,\n -0.04105565,\n -0.04518618,\n + \ -0.021923581,\n 0.05292525,\n -0.049248625,\n 0.042122327,\n + \ 0.0045730867,\n -0.011858252,\n 0.005784444,\n 0.07566586,\n + \ -0.04475497,\n -0.016783115,\n -0.053197592,\n -0.025827158,\n + \ 0.015228491,\n -0.0011723499,\n 0.04028401,\n -0.017543403,\n + \ -0.0356088,\n -0.0071830368,\n -0.004431241,\n -0.012073856,\n + \ 0.025577512,\n -0.0015744808,\n -0.0014624231,\n -0.0076993527,\n + \ -0.02126542,\n -0.019256894,\n -0.0025929287,\n -0.045935124,\n + \ -0.0011489454,\n -0.028618671,\n -0.006507854,\n -0.021129249,\n + \ 0.037220158,\n 0.00946958,\n 0.0270527,\n -0.015398705,\n + \ -0.007937653,\n -0.026712272,\n -0.02154911,\n -0.040374793,\n + \ 0.014536288,\n -0.011529171,\n 0.034088217,\n 0.009344757,\n + \ 0.015625658,\n -0.01480863,\n 0.027325043,\n -0.008970285,\n + \ 0.006791544,\n -0.01837178,\n -0.008283755,\n 0.04389255,\n + \ 0.023217209,\n -0.019290935,\n 0.00057695503,\n 0.013968907,\n + \ -0.0074553792,\n -0.0027830012,\n -0.035518017,\n 0.008005738,\n + \ -0.017452624,\n -0.013889474,\n 0.013446917,\n 0.029390307,\n + \ -0.016499424,\n -0.022366138,\n -0.009480927,\n 0.00870929,\n + \ 0.057736635,\n 0.01671503,\n -0.01879164,\n -0.0008397231,\n + \ 0.030343506,\n 0.023557637,\n 0.032817286,\n -0.012595846,\n + \ -0.0065248753,\n 0.0066383514,\n 0.023784589,\n 0.03336197,\n + \ -0.017668227,\n -0.014275293,\n 0.014445507,\n -0.023012951,\n + \ -0.022638481,\n -0.0152965775,\n 0.04418759,\n -0.0062582064,\n + \ 0.01196038,\n -0.023239903,\n -0.004059607,\n 0.03213643,\n + \ 0.006473811,\n 0.054695476,\n -0.028028594,\n -0.013707912,\n + \ -0.02330799,\n -0.02122003,\n -0.008567445,\n 0.04275779,\n + \ -0.008368862,\n 0.012210027,\n 0.042553537,\n 0.018258303,\n + \ -0.024760483,\n -0.0170895,\n -0.004990111,\n -0.034519427,\n + \ 0.000620927,\n 0.014593026,\n -0.023671113,\n -0.01552353,\n + \ 0.020516478,\n 0.0112341335,\n 0.04371099,\n 0.017690923,\n + \ -0.051155023,\n 0.010842641,\n 0.013185922,\n -0.05687422,\n + \ 0.033634312,\n 0.0069617582,\n -0.01746397,\n -0.0070525394,\n + \ 0.02439736,\n 0.029821517,\n 0.007966022,\n -0.020471087,\n + \ -0.0038723717,\n -0.023421466,\n 0.052335173,\n 0.0062014684,\n + \ 0.0022411528,\n -0.01841717,\n 0.028505195,\n 0.019120721,\n + \ 0.0073305555,\n -0.007341903,\n 0.018326389,\n -0.018666817,\n + \ 0.02491935,\n 0.053152204,\n 0.008567445,\n -0.032953456,\n + \ 0.022570394,\n 0.014615721,\n 0.0026822912,\n 0.014263945,\n + \ -0.012255418,\n 0.012448328,\n -0.014615721,\n -0.029027184,\n + \ 0.011824209,\n 0.034496732,\n 0.01841717,\n 0.011188743,\n + \ -0.019551931,\n -0.029072575,\n -0.03374779,\n 0.017759008,\n + \ -0.039081167,\n -0.029186051,\n -0.004374503,\n -0.008771702,\n + \ 0.03792371,\n 0.01893916,\n -0.04623016,\n -0.015478139,\n + \ -0.00577877,\n -0.0084256,\n -0.0016964676,\n 0.027869727,\n + \ -0.043075524,\n 0.039762024,\n -0.010002918,\n 0.042303886,\n + \ 0.007239775,\n 0.03971663,\n -0.0047745067,\n 0.025827158,\n + \ -0.010967464,\n 0.0129362745,\n 0.0005521321,\n -0.033815876,\n + \ 0.022513656,\n -0.006853956,\n 0.02966265,\n -0.0112341335,\n + \ -0.0013886637,\n -0.012051161,\n -0.011228459,\n -0.009514971,\n + \ 0.047614567,\n -0.0270527,\n 0.045549303,\n 0.022627132,\n + \ 0.017815746,\n 0.014275293,\n 0.018723555,\n -0.02074343,\n + \ -0.0019290936,\n 0.02035761,\n -0.017237019,\n 0.045140788,\n + \ -0.0051745097,\n 0.012017118,\n 0.007438358,\n -0.006297923,\n + \ -0.012527761,\n -0.007903609,\n 0.0008163186,\n 0.020403001,\n + \ 0.043461345,\n 0.016635595,\n 0.01480863,\n -0.047614567,\n + \ 0.005049686,\n 0.0015205797,\n -0.0091178045,\n -0.010763207,\n + \ 0.020652648,\n -0.04219041,\n -0.007114951,\n 0.036085397,\n + \ 0.010059656,\n -0.022922171,\n 0.013015708,\n 0.03252225,\n + \ 0.008595814,\n 0.024011541,\n 0.0019560442,\n 0.001138307,\n + \ -0.005114935,\n -0.016363252,\n 0.017951919,\n 0.00025071125,\n + \ 0.009758944,\n 0.012686627,\n 0.03660739,\n -0.0069844536,\n + \ -0.021526415,\n 0.020845558,\n 0.003775917,\n 0.013049751,\n + \ 0.0015035582,\n 0.020289525,\n 0.011937685,\n 0.025146302,\n + \ -0.0030950604,\n -0.014071035,\n -0.015966086,\n 0.047614567,\n + \ -0.0034695314,\n -0.02966265,\n 0.005370256,\n 0.016011477,\n + \ 0.023648418,\n -0.03200026,\n -0.014695154,\n 0.012788756,\n + \ 0.01224407,\n -0.034428645,\n -0.003018464,\n -0.00554047,\n + \ 0.01880299,\n 0.04057905,\n 0.0170895,\n 0.020471087,\n + \ -0.0003187969,\n -0.017645532,\n 0.008567445,\n 0.05210822,\n + \ 0.019563278,\n 0.016976023,\n -0.025690988,\n -0.0024496652,\n + \ 0.033248495,\n -0.003866698,\n 0.004998622,\n -0.007341903,\n + \ 0.022922171,\n -0.017112195,\n -0.006717785,\n -0.0015446934,\n + \ -0.030547764,\n 0.008045455,\n -0.0026198793,\n 0.0012780245,\n + \ 0.0015588779,\n 0.024011541,\n -0.008192974,\n 0.030820107,\n + \ 0.0045759236,\n 0.005929126,\n -0.0015063952,\n -0.029413003,\n + \ -0.019903706,\n 0.058372103,\n 0.033543535,\n 0.033520836,\n + \ -0.044119503,\n -0.031773306,\n 0.015886653,\n 0.031546354,\n + \ -0.008856809,\n -0.0024851265,\n -0.0403521,\n 0.002798604,\n + \ 0.05110963,\n -0.0048709614,\n 0.047160663,\n -0.010808598,\n + \ -0.006910694,\n -0.00975327,\n 0.0006953957,\n -0.032454163,\n + \ 0.020698039,\n 0.033157714,\n -0.007863893,\n 0.024556227,\n + \ 0.00830645,\n -0.011665342,\n 0.0143660735,\n 0.024715094,\n + \ 0.011846904,\n 0.024420055,\n 0.0018922138,\n 0.05287986,\n + \ 0.007750417,\n 0.044981923,\n -0.020709386,\n 0.014978845,\n + \ -0.023103733,\n 0.06118631,\n 0.0070922556,\n -0.025282474,\n + \ -0.014400116,\n 0.014275293,\n -0.038037185,\n -0.029458394,\n + \ -0.02648532,\n -0.024942046,\n 0.029254137,\n 0.059960768,\n + \ 0.0019716471,\n -0.013344789,\n 0.0005070963,\n 0.018871075,\n + \ 0.019438455,\n 0.012845494,\n -0.0024751972,\n 0.010712143,\n + \ -0.0094752535,\n 0.013503655,\n -0.013288051,\n -0.030683935,\n + \ -0.032454163,\n 0.025645597,\n -0.022808695,\n -0.0074213366,\n + \ -0.005310681,\n -0.029912299,\n -0.013049751,\n -0.0037588957,\n + \ 0.0101617845,\n 0.008561771,\n -0.03336197,\n -0.018394474,\n + \ 0.0153533155,\n -0.008749006,\n 0.023625722,\n 0.020936338,\n + \ -0.009293692,\n -0.0094185155,\n 0.03617618,\n -0.044709582,\n + \ -0.02330799,\n -0.013673869,\n 0.0072794915,\n 0.021662585,\n + \ 0.020686692,\n -0.005844019,\n 0.025078217,\n 0.036652777,\n + \ 0.01504693,\n -0.050292604,\n 0.03731094,\n -0.04448263,\n + \ 0.010706469,\n 0.021923581,\n 0.010445475,\n -0.016590204,\n + \ 0.027869727,\n 0.022808695,\n 0.020720735,\n 0.00026383193,\n + \ -0.0060823187,\n -0.009895115,\n -0.050020263,\n -0.02852789,\n + \ -0.021526415,\n 0.017815746,\n -0.0018085252,\n -0.016272472,\n + \ 0.020663997,\n 0.001933349,\n -0.040193234,\n 0.005665294,\n + \ 0.028618671,\n 0.011092288,\n 0.0013404364,\n 0.043847162,\n + \ 0.021673935,\n -0.040034365,\n 0.031727914,\n 0.024215799,\n + \ 0.012641237,\n 0.03193217,\n 0.0034808791,\n -0.002424133,\n + \ -0.016783115,\n 0.0046440093,\n -0.0027957673,\n 0.024873959,\n + \ -0.008981633,\n -0.021821452,\n -0.025804464,\n 0.013844083,\n + \ 0.0017390212,\n -0.0118922945,\n 0.005052523,\n -0.029481089,\n + \ -0.011109309,\n 0.010836967,\n -0.0013943375,\n 0.016499424,\n + \ 0.004034075,\n 0.000265605,\n -0.025146302,\n 0.032022953,\n + \ 0.0021305135,\n 0.011143352,\n -0.008958938,\n 0.049611747,\n + \ -0.0056028822,\n 0.028073985,\n -0.030502373,\n -0.011489455,\n + \ -0.023171818,\n 0.013469612,\n 0.03293076,\n 0.007058213,\n + \ -0.037901014,\n 0.026666882,\n 0.028414413,\n 0.036380436,\n + \ -0.0034638578,\n -0.01191499,\n 0.0057617486,\n 0.031886782,\n + \ 0.005483732,\n 0.0027262631,\n -0.058735225,\n 0.0021773225,\n + \ 0.00345251,\n 0.016408643,\n -0.0057702595,\n 0.0015347642,\n + \ -0.00609934,\n -0.029753432,\n 0.0020383142,\n 0.05374228,\n + \ -0.04675215,\n -0.012096551,\n -0.018292347,\n 0.051336583,\n + \ 0.04770535,\n -0.0036822993,\n 0.028414413,\n 0.007841198,\n + \ 0.004144714,\n -0.036652777,\n -0.017736314,\n -0.005143304,\n + \ 0.027234262,\n -0.024147712,\n -0.03635774,\n -0.0038752086,\n + \ 0.0059177782,\n -0.009917811,\n 0.025010131,\n 0.023171818,\n + \ -0.027370434,\n 0.00081844634,\n -0.034156304,\n 0.03383857,\n + \ 0.029231442,\n 0.01817887,\n -0.008896526,\n 0.016170343,\n + \ -0.0037021574,\n -0.021344854,\n 0.0030411594,\n -0.015455443,\n + \ -0.012357547,\n -0.012346199,\n -0.014082383,\n -0.0073872935,\n + \ 0.022854086,\n -0.017622838,\n 0.0061504045,\n 0.014422812,\n + \ -0.019234197,\n -0.035767663,\n 0.036925122,\n 0.02439736,\n + \ 0.025168998,\n 0.02439736,\n -0.054286964,\n 0.023421466,\n + \ -0.0036936468,\n -0.059733815,\n 0.022842737,\n 0.053651497,\n + \ 0.0064567896,\n 0.04445993,\n -0.009373126,\n -0.031205926,\n + \ 0.0044000354,\n 0.0025986026,\n 0.005432668,\n 0.053606108,\n + \ -0.020289525,\n -0.010831293,\n -0.015875306,\n 0.0008985888,\n + \ 0.01784979,\n 0.010178805,\n 0.0280059,\n -0.010286608,\n + \ -0.0053617456,\n 0.002879456,\n 0.06354661,\n 0.013458265,\n + \ -0.0034893898,\n -0.0057163583,\n -0.006360335,\n -0.014354725,\n + \ 0.01789518,\n -0.008453969,\n 0.0004106416,\n -0.017611489,\n + \ -0.011688038,\n 0.0007156086,\n 0.01143839,\n 0.030116554,\n + \ -0.011869599,\n -0.058644444,\n 0.013310745,\n 0.017384537,\n + \ -0.025055522,\n 0.0076596364,\n 0.022173228,\n -0.002339026,\n + \ 0.012312156,\n -0.00014521394,\n -0.024510836,\n -0.009424189,\n + \ 0.015932044,\n 0.028845623,\n 0.02335338,\n -0.04775074,\n + \ 0.0064624636,\n 0.025804464,\n 0.04396064,\n 0.008221343,\n + \ 0.015818568,\n -0.040669832,\n -0.021412939,\n -0.019676754,\n + \ -0.006763175,\n 0.0161363,\n 0.06440903,\n -0.028800232,\n + \ 0.043030135,\n 0.0038808824,\n -0.011778818,\n -0.010122067,\n + \ 0.024805874,\n -0.033906657,\n -0.0070468653,\n -0.030593155,\n + \ -0.017146237,\n -0.010479517,\n 0.024578921,\n -0.0037617325,\n + \ 0.04357482,\n 0.0017602979,\n -0.018825684,\n -0.005370256,\n + \ 0.016034171,\n -0.0003719888,\n -0.009333408,\n 0.017838443,\n + \ -0.004127693,\n -0.006825587,\n 0.031750612,\n -0.019234197,\n + \ 0.008584467,\n -0.011801514,\n 0.040215928,\n 0.003486553,\n + \ -0.019733492,\n -0.021866843,\n -0.040760614,\n 0.00087234745,\n + \ -0.037787538,\n -0.0021943438,\n -0.027824339,\n -0.029481089,\n + \ -0.003946131,\n -0.027030006,\n 0.020232787,\n 0.018042699,\n + \ -0.025690988,\n -0.0039319466,\n 0.0028482499,\n -0.01087101,\n + \ -0.004039749,\n 0.004323439,\n 0.017634185,\n -0.027892424,\n + \ -0.017997308,\n 0.0033787508,\n -0.014785935,\n 0.027597386,\n + \ -0.004584434,\n 0.016011477,\n 0.0071319724,\n -0.007954674,\n + \ -0.016102258,\n -0.031137839,\n 0.043257087,\n 0.039830107,\n + \ 0.03574497,\n 0.018099437,\n 0.005809976,\n 0.018190218,\n + \ 0.029186051,\n 0.028936403,\n 0.093685865,\n 0.013787345,\n + \ -0.03118323,\n -0.021015773,\n 0.030774716,\n -0.008958938,\n + \ -0.021934928,\n 0.025237083,\n 0.014275293,\n 0.015183101,\n + \ 0.013866778,\n 0.005347561,\n 0.019597322,\n 0.0011333425,\n + \ -0.000682275,\n 0.033498142,\n 0.042871267,\n 0.0018269651,\n + \ 0.05070112,\n -0.012255418,\n 0.003253927,\n -0.025736379,\n + \ -0.029390307,\n 0.034996025,\n 0.012141942,\n 0.020902297,\n + \ 0.0005205716,\n -0.019688101,\n 0.017827094,\n -0.011103636,\n + \ 0.008533402,\n -0.029117966,\n 0.004876635,\n 0.020142006,\n + \ -0.048613157,\n 0.030820107,\n -0.015364663,\n 0.0006216362,\n + \ -0.025781767,\n 0.03554071,\n 0.001087952,\n -0.012471023,\n + \ -0.025577512,\n -0.011653995,\n -0.009458233,\n -0.0045135114,\n + \ -0.00031489617,\n -0.003253927,\n -0.0152965775,\n 0.0029248463,\n + \ -0.012788756,\n 0.04518618,\n -0.0014751892,\n 0.0143660735,\n + \ -0.040034365,\n -0.020550521,\n 0.0018127806,\n -0.02335338,\n + \ 0.0149107585,\n -0.023648418,\n 0.012471023,\n 0.0071546678,\n + \ 0.026553405,\n 0.06799488,\n 0.002178741,\n -0.023557637,\n + \ -0.02339877,\n -0.008470991,\n -0.011767471,\n -0.015954738,\n + \ -0.0043120915,\n -0.012822798,\n 0.020471087,\n -0.014275293,\n + \ 0.006388704,\n 0.0052425954,\n 0.03787832,\n -0.03200026,\n + \ -0.04148686,\n 0.04209963,\n -0.01841717,\n -0.014638416,\n + \ 0.038332224,\n 0.0011141934,\n 0.031160535,\n -0.044414543,\n + \ -0.0042581903,\n -0.0031744938,\n 0.010292281,\n -0.03327119,\n + \ -0.012595846,\n 0.007466727,\n 0.006042602,\n 0.007994391,\n + \ 0.01808809,\n 0.014819978,\n 0.0007375946,\n 0.05705578,\n + \ 0.0014390188,\n 0.03887691,\n 0.031251315,\n 0.0061390568,\n + \ -0.02805129,\n -0.014150469,\n 0.015478139,\n -0.044981923,\n + \ 0.025055522,\n -0.020119311,\n -0.01108094,\n 0.01698737,\n + \ 0.0011879528,\n 0.0270527,\n -0.0043886877,\n -0.016533466,\n + \ 0.0036425826,\n 0.007807155,\n 0.01136463,\n 0.016113605,\n + \ -0.018587384,\n 0.01552353,\n -0.0023503737,\n -0.027710862,\n + \ 0.042371973,\n -0.029390307,\n 0.0012113573,\n 0.046979103,\n + \ 0.008011412,\n 0.042122327,\n -0.035722274,\n 0.040669832,\n + \ 0.002584418,\n -0.010655405,\n -0.0032198841,\n 0.00092412095,\n + \ 0.00835184,\n 0.036380436,\n 0.0067404797,\n -0.0061163614,\n + \ -0.012017118,\n -0.0021432796,\n -0.003083713,\n 0.00505536,\n + \ -0.0218328,\n -0.033339277,\n 0.018632775,\n -0.049157843,\n + \ 0.02202571,\n -0.0053560715,\n -0.0032879699,\n -0.020368958,\n + \ -0.016590204,\n 0.005236922,\n -0.027461214,\n 0.023217209,\n + \ 0.01646538,\n -0.015398705,\n -0.014899411,\n -0.007892262,\n + \ 0.0084029045,\n 0.020471087,\n 0.02757469,\n 0.011353283,\n + \ -0.03279459,\n -0.024715094,\n 0.034042828,\n -0.001119158,\n + \ 0.031342097,\n 0.016295167,\n -0.0351322,\n 0.019881012,\n + \ -0.03256764,\n -0.025032826,\n -0.015251187,\n 0.02757469,\n + \ 0.01400295,\n 0.020289525,\n 0.012652584,\n 0.01428664,\n + \ -0.0003044351,\n -0.0040766285,\n 0.0024269698,\n 0.0060596233,\n + \ -0.017055457,\n -0.0031489616,\n -0.012539108,\n 0.0021886702,\n + \ 0.026848443,\n -0.004502164,\n -0.016953329,\n 0.012539108,\n + \ 0.01447955,\n 0.035336453,\n 0.035222977,\n -0.013424221,\n + \ -0.016147649,\n 0.013185922,\n 0.039762024,\n -0.016862547,\n + \ -0.0075007696,\n 0.030116554,\n 0.010252565,\n -0.01120009,\n + \ 0.0063773566,\n 0.06772253,\n -0.018768946,\n 0.025464036,\n + \ -0.010768881,\n -0.027325043,\n 0.007807155,\n 0.04071522,\n + \ 0.012788756,\n -0.010099372,\n -0.002964563,\n -0.0007148994,\n + \ -0.02995769,\n -0.0064057256,\n -0.007324882,\n 0.0048369183,\n + \ 0.023898065,\n -0.0019078169,\n -0.00008621524,\n -0.024556227,\n + \ 0.019188806,\n -0.0065475707,\n 0.005889409,\n 0.0012283787,\n + \ -0.03597192,\n -0.035291065,\n -0.001612779,\n -0.02870945,\n + \ -0.023421466,\n 0.01989236,\n 0.00059184874,\n -0.019551931,\n + \ 0.047342226,\n 0.001556041,\n 0.0088454615,\n -0.01656751,\n + \ -0.038377613,\n 0.03200026,\n 0.009049718,\n 0.027506605,\n + \ -0.009696532,\n -0.012618542,\n 0.012947622,\n 0.029367613,\n + \ -0.015637005,\n 0.0051659993,\n 0.048250034,\n 0.019234197,\n + \ 0.005140467,\n 0.017634185,\n 0.008334819,\n -0.03340736,\n + \ 0.018315041,\n 0.024193102,\n -0.018428518,\n 0.016941981,\n + \ -0.01447955,\n 0.018927813,\n 0.02748391,\n 0.0070695607,\n + \ 0.00045284053,\n 0.012788756,\n -0.020663997,\n 0.032544944,\n + \ -0.037560586,\n 0.0033021544,\n -0.018156175,\n -0.034814466,\n + \ 0.0076596364,\n -0.0059461473,\n -0.017441275,\n -0.037515197,\n + \ -0.044437237,\n 0.037810232,\n -0.009798661,\n 0.015410054,\n + \ 0.002062428,\n 0.002295054,\n 0.006008559,\n 0.0135944355,\n + \ 0.0013290887,\n -0.035631493,\n -0.019495193,\n 0.003112082,\n + \ 0.0036198874,\n -0.0047234423,\n 0.011597257,\n 0.017883832,\n + \ 0.051608928,\n -0.004306418,\n 0.025237083,\n 0.023103733,\n + \ 0.015773177,\n -0.021492371,\n 0.01030363,\n -0.026530711,\n + \ -0.012754713,\n -0.02648532,\n -0.011517824,\n -0.01604552,\n + \ 0.0001859944,\n -0.0029532153,\n 0.0052794754,\n -0.017861137,\n + \ 0.029889602,\n -0.015069625,\n 0.0060312543,\n -0.023421466,\n + \ 0.031637136,\n -0.00537593,\n -0.009480927,\n 0.03944429,\n + \ 0.028232852,\n -0.010967464,\n 0.0038553502,\n 0.0027844196,\n + \ 0.0027205893,\n -0.0059631686,\n -0.044369154,\n -0.014876716,\n + \ 0.029821517,\n -0.012834146,\n -0.020334916,\n -0.00690502,\n + \ -0.008726312,\n 0.03456482,\n 0.010252565,\n -0.02074343,\n + \ 0.0072908388,\n -0.017191628,\n 0.01808809,\n 0.018110784,\n + \ 0.024442751,\n 0.011563214,\n -0.017361842,\n 0.0005159616,\n + \ -0.059869986,\n 0.01822426,\n 0.0072738174,\n -0.012709322,\n + \ 0.016737724,\n -0.039693937,\n 0.0019106537,\n 0.0035376172,\n + \ -0.00066312595,\n 0.003861024,\n 0.03340736,\n -0.012085204,\n + \ 0.018485256,\n -0.043552123,\n 0.0046553565,\n 0.0013695146,\n + \ -0.010712143,\n -0.017305104,\n 0.0025517936,\n 0.01989236,\n + \ -0.018190218,\n -0.03588114,\n 0.012856841,\n -0.012970317,\n + \ 0.0062298374,\n -0.010263912,\n -0.00958873,\n -0.018280998,\n + \ -0.017248366,\n 0.029503783,\n -0.036153484,\n 0.009310713,\n + \ -0.0045986185,\n -0.030252727,\n -0.011937685,\n 0.025554815,\n + \ 0.005024154,\n -0.030910887,\n 0.0013191595,\n 0.030547764,\n + \ -0.010496538,\n 0.038559176,\n -0.045163486,\n 0.008743333,\n + \ 0.0027489583,\n -0.009010002,\n 0.03973933,\n 0.025259778,\n + \ 0.029934993,\n 0.02059591,\n 0.045140788\n ]\n + \ }\n ],\n \"model\": \"text-embedding-3-small\",\n \"usage\": {\n \"prompt_tokens\": + 4,\n \"total_tokens\": 4\n }\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8cc55a9cfa1e83a0-MXP + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Wed, 02 Oct 2024 14:24:04 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-allow-origin: + - '*' + access-control-expose-headers: + - X-Request-ID + content-length: + - '33244' + openai-model: + - text-embedding-3-small + openai-organization: test_openai_org_key + openai-processing-ms: + - '24' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '3000' + x-ratelimit-limit-tokens: + - '1000000' + x-ratelimit-remaining-requests: + - '2999' + x-ratelimit-remaining-tokens: + - '999994' + x-ratelimit-reset-requests: + - 20ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_54d8614b69ebd4c7500926eebd4d2b08 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_async_basic[azure_provider_embeddings].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_async_basic[azure_provider_embeddings].yaml new file mode 100644 index 0000000..6859961 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_async_basic[azure_provider_embeddings].yaml @@ -0,0 +1,80 @@ +interactions: +- request: + body: '{"input": ["South Atlantic Ocean."], "model": "text-embedding-3-small", + "encoding_format": "base64"}' + 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: + - '100' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AsyncAzureOpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/embeddings?api-version=2023-05-15 + response: + body: + string: "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": + \"embedding\",\n \"index\": 0,\n \"embedding\": \"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\"\n + \ }\n ],\n \"model\": \"text-embedding-3-small\",\n \"usage\": {\n \"prompt_tokens\": + 4,\n \"total_tokens\": 4\n }\n}\n" + headers: + Content-Length: + - '8414' + Content-Type: + - application/json + Date: + - Wed, 02 Oct 2024 14:24:04 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + access-control-allow-origin: + - '*' + apim-request-id: + - ebe2ac5d-75b2-4bbd-a250-dc9fef04f8bc + azureml-model-session: + - d005-20240531125325 + openai-organization: test_openai_org_key + x-content-type-options: + - nosniff + x-ms-client-request-id: + - ebe2ac5d-75b2-4bbd-a250-dc9fef04f8bc + x-ms-region: + - East US + x-ratelimit-remaining-requests: + - '0' + x-ratelimit-remaining-tokens: + - '2982' + x-request-id: + - 237291e0-b4f7-4007-8a1e-39ca31ce9fab + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncLocalEmbeddings.test_basic.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_async_basic[ollama_provider_embeddings].yaml similarity index 97% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncLocalEmbeddings.test_basic.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_async_basic[ollama_provider_embeddings].yaml index 294f97d..55419b0 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncLocalEmbeddings.test_basic.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_async_basic[ollama_provider_embeddings].yaml @@ -1,6 +1,7 @@ interactions: - request: - body: '{"input": ["South Atlantic Ocean."], "model": "all-minilm:33m"}' + body: '{"input": ["South Atlantic Ocean."], "model": "all-minilm:33m", "encoding_format": + "base64"}' headers: accept: - application/json @@ -11,13 +12,13 @@ interactions: connection: - keep-alive content-length: - - '63' + - '92' content-type: - application/json host: - localhost:11434 user-agent: - - AsyncOpenAI/Python 1.50.2 + - AsyncOpenAI/Python 1.50.0 x-stainless-arch: - x64 x-stainless-async: @@ -27,7 +28,7 @@ interactions: x-stainless-os: - Linux x-stainless-package-version: - - 1.50.2 + - 1.50.0 x-stainless-retry-count: - '0' x-stainless-runtime: @@ -45,7 +46,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 12 Nov 2024 14:22:22 GMT + - Wed, 02 Oct 2024 14:24:03 GMT Set-Cookie: test_set_cookie Transfer-Encoding: - chunked diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_async_basic[openai_provider_embeddings].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_async_basic[openai_provider_embeddings].yaml new file mode 100644 index 0000000..9a35c9e --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_async_basic[openai_provider_embeddings].yaml @@ -0,0 +1,96 @@ +interactions: +- request: + body: '{"input": ["South Atlantic Ocean."], "model": "text-embedding-3-small", + "encoding_format": "base64"}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '100' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - AsyncOpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://api.openai.com/v1/embeddings + response: + body: + string: "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": + \"embedding\",\n \"index\": 0,\n \"embedding\": \"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\"\n + \ }\n ],\n \"model\": \"text-embedding-3-small\",\n \"usage\": {\n \"prompt_tokens\": + 4,\n \"total_tokens\": 4\n }\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8cc55a96583ebaab-MXP + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Wed, 02 Oct 2024 14:24:03 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-allow-origin: + - '*' + access-control-expose-headers: + - X-Request-ID + content-length: + - '8414' + openai-model: + - text-embedding-3-small + openai-organization: test_openai_org_key + openai-processing-ms: + - '19' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '3000' + x-ratelimit-limit-tokens: + - '1000000' + x-ratelimit-remaining-requests: + - '2999' + x-ratelimit-remaining-tokens: + - '999994' + x-ratelimit-reset-requests: + - 20ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_785712250143a16a78cf1a8f6138c56d + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_basic[azure_provider_embeddings].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_basic[azure_provider_embeddings].yaml new file mode 100644 index 0000000..25b0b31 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_basic[azure_provider_embeddings].yaml @@ -0,0 +1,80 @@ +interactions: +- request: + body: '{"input": ["South Atlantic Ocean."], "model": "text-embedding-3-small", + "encoding_format": "base64"}' + 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: + - '100' + content-type: + - application/json + host: + - test.openai.azure.com + user-agent: + - AzureOpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://test.openai.azure.com/openai/deployments/test-azure-deployment/embeddings?api-version=2023-05-15 + response: + body: + string: "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": + \"embedding\",\n \"index\": 0,\n \"embedding\": \"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\"\n + \ }\n ],\n \"model\": \"text-embedding-3-small\",\n \"usage\": {\n \"prompt_tokens\": + 4,\n \"total_tokens\": 4\n }\n}\n" + headers: + Content-Length: + - '8414' + Content-Type: + - application/json + Date: + - Wed, 02 Oct 2024 14:23:59 GMT + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + access-control-allow-origin: + - '*' + apim-request-id: + - dcba2e39-3eca-40fd-bbc4-1693d19b254d + azureml-model-session: + - d005-20240531125325 + openai-organization: test_openai_org_key + x-content-type-options: + - nosniff + x-ms-client-request-id: + - dcba2e39-3eca-40fd-bbc4-1693d19b254d + x-ms-region: + - East US + x-ratelimit-remaining-requests: + - '2' + x-ratelimit-remaining-tokens: + - '2994' + x-request-id: + - 995ce329-d04e-4323-b13f-e8e2e701cc0f + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestLocalEmbeddings.test_basic.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_basic[ollama_provider_embeddings].yaml similarity index 97% rename from instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestLocalEmbeddings.test_basic.yaml rename to instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_basic[ollama_provider_embeddings].yaml index 687ca8b..55a8e94 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestLocalEmbeddings.test_basic.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_basic[ollama_provider_embeddings].yaml @@ -1,6 +1,7 @@ interactions: - request: - body: '{"input": ["South Atlantic Ocean."], "model": "all-minilm:33m"}' + body: '{"input": ["South Atlantic Ocean."], "model": "all-minilm:33m", "encoding_format": + "base64"}' headers: accept: - application/json @@ -11,13 +12,13 @@ interactions: connection: - keep-alive content-length: - - '63' + - '92' content-type: - application/json host: - localhost:11434 user-agent: - - OpenAI/Python 1.50.2 + - OpenAI/Python 1.50.0 x-stainless-arch: - x64 x-stainless-async: @@ -27,7 +28,7 @@ interactions: x-stainless-os: - Linux x-stainless-package-version: - - 1.50.2 + - 1.50.0 x-stainless-retry-count: - '0' x-stainless-runtime: @@ -45,7 +46,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 12 Nov 2024 14:18:04 GMT + - Wed, 02 Oct 2024 14:24:00 GMT Set-Cookie: test_set_cookie Transfer-Encoding: - chunked diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_basic[openai_provider_embeddings].yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_basic[openai_provider_embeddings].yaml new file mode 100644 index 0000000..e6c21fa --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/.test_embeddings/test_basic[openai_provider_embeddings].yaml @@ -0,0 +1,96 @@ +interactions: +- request: + body: '{"input": ["South Atlantic Ocean."], "model": "text-embedding-3-small", + "encoding_format": "base64"}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '100' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.50.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.50.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.12 + method: POST + uri: https://api.openai.com/v1/embeddings + response: + body: + string: "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": + \"embedding\",\n \"index\": 0,\n \"embedding\": \"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\"\n + \ }\n ],\n \"model\": \"text-embedding-3-small\",\n \"usage\": {\n \"prompt_tokens\": + 4,\n \"total_tokens\": 4\n }\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8cc55a7d0dfbba86-MXP + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Wed, 02 Oct 2024 14:23:59 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-allow-origin: + - '*' + access-control-expose-headers: + - X-Request-ID + content-length: + - '8414' + openai-model: + - text-embedding-3-small + openai-organization: test_openai_org_key + openai-processing-ms: + - '28' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '3000' + x-ratelimit-limit-tokens: + - '1000000' + x-ratelimit-remaining-requests: + - '2999' + x-ratelimit-remaining-tokens: + - '999994' + x-ratelimit-reset-requests: + - 20ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_7530ceb2d15a30ff7b5ee83900abffcb + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_local_stream_error_handling.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_local_stream_error_handling.yaml deleted file mode 100644 index a142994..0000000 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_local_stream_error_handling.yaml +++ /dev/null @@ -1,70 +0,0 @@ -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: - - '166' - content-type: - - application/json - host: - - localhost:11434 - user-agent: - - AsyncOpenAI/Python 1.43.1 - x-stainless-arch: - - x64 - x-stainless-async: - - async:asyncio - x-stainless-lang: - - python - x-stainless-os: - - Linux - x-stainless-package-version: - - 1.43.1 - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.10.12 - method: POST - uri: http://localhost:11434/v1/chat/completions - response: - body: - string: 'data: {"id":"chatcmpl-242","object":"chat.completion.chunk","created":1726147606,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"T"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-242","object":"chat.completion.chunk","created":1726147606,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"ropical"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-242","object":"chat.completion.chunk","created":1726147606,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - Ocean"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-242","object":"chat.completion.chunk","created":1726147606,"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: - - Thu, 12 Sep 2024 13:26:46 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/TestAsyncOpenAIEmbeddings.test_all_the_client_options.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncOpenAIEmbeddings.test_all_the_client_options.yaml deleted file mode 100644 index 5eb5027..0000000 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncOpenAIEmbeddings.test_all_the_client_options.yaml +++ /dev/null @@ -1,482 +0,0 @@ -interactions: -- request: - body: '{"input": ["South Atlantic Ocean."], "model": "text-embedding-3-small", - "encoding_format": "float"}' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - authorization: - - Bearer test_openai_api_key - connection: - - keep-alive - content-length: - - '99' - content-type: - - application/json - host: - - api.openai.com - user-agent: - - AsyncOpenAI/Python 1.50.2 - x-stainless-arch: - - x64 - x-stainless-async: - - async:asyncio - x-stainless-lang: - - python - x-stainless-os: - - Linux - x-stainless-package-version: - - 1.50.2 - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.10.12 - method: POST - uri: https://api.openai.com/v1/embeddings - response: - body: - string: "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": - \"embedding\",\n \"index\": 0,\n \"embedding\": [\n -0.031541955,\n - \ -0.030180432,\n 0.010239789,\n 0.009082494,\n -0.030861193,\n - \ 0.06476312,\n 0.03601229,\n -0.0018735128,\n -0.004708601,\n - \ -0.021035533,\n 0.002647879,\n -0.01093757,\n -0.01873229,\n - \ -0.012094865,\n 0.014976756,\n 0.024507418,\n -0.02430319,\n - \ 0.01887979,\n 0.016633276,\n 0.02315724,\n -0.028251607,\n - \ -0.035603832,\n -0.06285699,\n 0.06108701,\n 0.020422848,\n - \ -0.014988102,\n 0.00820885,\n 0.018233065,\n -0.06371929,\n - \ 0.025982402,\n 0.105109595,\n -0.030770425,\n 0.0009190282,\n - \ 0.06571619,\n 0.039302636,\n 0.06866615,\n -0.020377465,\n - \ -0.0117771765,\n -0.055867836,\n 0.008186159,\n 0.028977754,\n - \ -0.055550147,\n 0.003386789,\n 0.0019401707,\n 0.0084584635,\n - \ 0.0053524883,\n -0.06875692,\n -0.03172349,\n 0.03501384,\n - \ 0.014318686,\n -0.034151543,\n 0.028478527,\n -0.03238156,\n - \ -0.043137595,\n 0.043137595,\n -0.025778174,\n -0.013535811,\n - \ 0.0026975179,\n 0.06916538,\n -0.0004807879,\n -0.04692717,\n - \ 0.048878685,\n -0.0016650294,\n -0.0051681153,\n -0.04606487,\n - \ -0.0024691792,\n 0.014046381,\n 0.061359316,\n -0.05609476,\n - \ -0.01976478,\n -0.04837946,\n 0.02210206,\n 0.02407627,\n - \ -0.03635267,\n -0.053825554,\n -0.014840604,\n -0.014749835,\n - \ -0.0362619,\n -0.001561497,\n -0.034469232,\n -0.02949967,\n - \ 0.062766224,\n 0.021523414,\n -0.012435245,\n -0.015521365,\n - \ -0.042592987,\n 0.016224818,\n 0.00839606,\n -0.01839191,\n - \ 0.026527012,\n -0.032744635,\n -0.02076323,\n -0.021001495,\n - \ -0.010438344,\n -0.010143348,\n 0.039098408,\n -0.009405856,\n - \ 0.012718896,\n 0.024167039,\n -0.0049752328,\n -0.024167039,\n - \ -0.026141247,\n 0.02081996,\n -0.01402369,\n -0.028319683,\n - \ -0.024779724,\n 0.0017955088,\n 0.01005258,\n 0.012514668,\n - \ -0.011385738,\n -0.009076822,\n 0.029431595,\n -0.0016777938,\n - \ 0.018925173,\n -0.004674563,\n -0.021058226,\n 0.0029471305,\n - \ -0.06449082,\n 0.056003988,\n 0.005292922,\n 0.008084044,\n - \ -0.036602285,\n 0.021296494,\n -0.014012343,\n -0.0371242,\n - \ -0.011595639,\n -0.025165487,\n -0.010239789,\n 0.0068019433,\n - \ 0.0030747734,\n 0.009485278,\n -0.012526014,\n -0.016065974,\n - \ -0.030951962,\n 0.020037083,\n 0.071116894,\n -0.006393486,\n - \ -0.021625528,\n 0.0012544451,\n 0.01193602,\n 0.022941668,\n - \ 0.027865842,\n 0.039302636,\n 0.0034832302,\n 0.020082468,\n - \ -0.004388076,\n -0.055686302,\n 0.027117005,\n 0.020116506,\n - \ -0.03844034,\n 0.01330889,\n -0.0049723964,\n 0.0038831776,\n - \ 0.025778174,\n -0.004722784,\n -0.012900433,\n -0.0036278921,\n - \ 0.0055028233,\n 0.011720446,\n -0.0017316873,\n 0.0027613393,\n - \ -0.023066472,\n 0.04309221,\n 0.023826657,\n -0.016803466,\n - \ -0.00850952,\n 0.0066374256,\n 0.015589441,\n -0.05201019,\n - \ -0.0114765065,\n -0.008197504,\n -0.020638423,\n -0.025573945,\n - \ -0.0049553774,\n -0.010495075,\n -0.03576268,\n 0.009360473,\n - \ -0.031768877,\n -0.018164989,\n 0.01673539,\n -0.021319184,\n - \ 0.0022365856,\n 0.035876136,\n -0.007119632,\n 0.006847327,\n - \ 0.035876136,\n 0.010364596,\n -0.010478056,\n -0.0042292317,\n - \ -0.009473933,\n 0.019152094,\n -0.024938567,\n 0.07070844,\n - \ 0.015782323,\n -0.0069040577,\n -0.04651871,\n 0.014035036,\n - \ 0.04495296,\n -0.008237216,\n 0.033516165,\n 0.028251607,\n - \ -0.022987051,\n -0.033652317,\n -0.060224712,\n -0.021773025,\n - \ -0.03317578,\n -0.05378017,\n 0.021205725,\n 0.055187076,\n - \ 0.0005892843,\n 0.016326932,\n -0.01865287,\n 0.026050478,\n - \ 0.019912278,\n -0.026572395,\n -0.0032109257,\n -0.016655969,\n - \ 0.009689507,\n 0.023486275,\n -0.0124239,\n -0.035989597,\n - \ 0.013921576,\n 0.015827708,\n 0.026300091,\n -0.013320236,\n - \ 0.05137481,\n 0.056412447,\n -0.022487825,\n 0.00963845,\n - \ -0.021795718,\n 0.027003545,\n 0.017438844,\n -0.0065466575,\n - \ -0.03480961,\n -0.0516925,\n -0.040391855,\n -0.005865896,\n - \ 0.011533236,\n 0.021205725,\n 0.009842679,\n -0.028909678,\n - \ -0.014318686,\n 0.050966352,\n 0.02984005,\n -0.01342235,\n - \ -0.020252658,\n 0.046359867,\n 0.039075717,\n -0.016202128,\n - \ 0.05014944,\n -0.008191831,\n -0.014965409,\n 0.025868941,\n - \ 0.010818437,\n 0.010585844,\n -0.009496625,\n -0.05078482,\n - \ -0.052963253,\n -0.039869938,\n -0.015827708,\n -0.045611028,\n - \ -0.02293032,\n -0.04819792,\n 0.010080945,\n 0.024688955,\n - \ -0.00615522,\n 0.033107705,\n 0.0061438736,\n -0.034106158,\n - \ -0.02153476,\n 0.0032931843,\n 0.037623424,\n 0.006308391,\n - \ 0.004042022,\n 0.028070072,\n 0.03503653,\n 0.024666263,\n - \ 0.01933363,\n 0.011533236,\n -0.0044816807,\n 0.027752383,\n - \ -0.05609476,\n -0.06689618,\n 0.012684858,\n -0.012571398,\n - \ -0.01564617,\n 0.008628653,\n -0.027457386,\n 0.038939565,\n - \ 0.032948863,\n 0.08141909,\n 0.024779724,\n -0.020649768,\n - \ -0.015986552,\n -0.02607317,\n 0.006263007,\n 0.021353222,\n - \ -0.0018153643,\n -0.027933918,\n -0.0036392382,\n 0.054143243,\n - \ -0.019934969,\n 0.013558502,\n -0.016531162,\n 0.008390387,\n - \ 0.03533153,\n -0.046337176,\n 0.016043283,\n 0.02387204,\n - \ 0.010999973,\n 0.020456886,\n 0.0009530663,\n 0.034877688,\n - \ -0.017461536,\n 0.036942665,\n -0.011924675,\n -0.054914773,\n - \ -0.0031712146,\n 0.0035910176,\n -0.027162388,\n 0.012015442,\n - \ 0.024325881,\n -0.02496126,\n 0.012026789,\n -0.00039498357,\n - \ -0.04620102,\n -0.025324332,\n -0.023667812,\n 0.024393959,\n - \ -0.01519233,\n 0.0018182008,\n 0.006631753,\n 0.043704897,\n - \ -0.0099334465,\n 0.022181483,\n -0.03964302,\n -0.03269925,\n - \ 0.028387759,\n -0.03533153,\n 0.060497016,\n -0.009252685,\n - \ -0.018312488,\n 0.022499172,\n 0.02518818,\n -0.01005258,\n - \ -0.00963845,\n -0.018539408,\n 0.014386762,\n 0.07547377,\n - \ -0.015498673,\n 0.008719422,\n 0.0056616673,\n -0.005803493,\n - \ -0.010166041,\n -0.023667812,\n 0.030543504,\n 0.033085015,\n - \ -0.03480961,\n -0.06871154,\n 0.02130784,\n -0.032631174,\n - \ 0.0036364016,\n -0.031655416,\n 0.0008474064,\n 0.045157187,\n - \ -0.024167039,\n -0.00514826,\n 0.002182692,\n 0.008180485,\n - \ -0.011584294,\n -0.03576268,\n 0.048016388,\n -0.052100956,\n - \ 0.019140748,\n -0.0036193826,\n 0.0434099,\n -0.051737882,\n - \ 0.0015444779,\n -0.03258579,\n -0.0012615364,\n -0.044499118,\n - \ 0.05246403,\n -0.027412001,\n 0.004946868,\n 0.029363519,\n - \ -0.052554797,\n 0.0033187128,\n -0.029976204,\n -0.0043738936,\n - \ -0.026095862,\n -0.038485724,\n -0.026822008,\n 0.03471884,\n - \ 0.0027570846,\n -0.0033016938,\n 0.008776152,\n 0.042366065,\n - \ -0.018062875,\n -0.03823611,\n 0.048787918,\n 0.034265,\n - \ -0.027321232,\n -0.006280026,\n -0.022805514,\n 0.009139225,\n - \ 0.015090216,\n -0.05722936,\n 0.025664713,\n 0.005565226,\n - \ -0.014545606,\n -0.0008977544,\n -0.054052472,\n -0.0037640445,\n - \ 0.033856545,\n 0.00011532173,\n 0.04032378,\n -0.015498673,\n - \ 0.05155635,\n 0.0044533154,\n 0.025664713,\n -0.0050347997,\n - \ 0.055368613,\n -0.007545108,\n -0.00425476,\n 0.011924675,\n - \ 0.07288688,\n 0.03471884,\n -0.030316584,\n 0.014205226,\n - \ 0.015759632,\n 0.056049373,\n -0.010268155,\n 0.0075678,\n - \ 0.030089663,\n -0.016950965,\n 0.024734339,\n -0.007017518,\n - \ 0.012832357,\n -0.031088114,\n 0.011255259,\n 0.0037526984,\n - \ 0.02036612,\n 0.00072969135,\n 0.008742114,\n -0.007970584,\n - \ -0.0019770453,\n 0.032744635,\n 0.021375915,\n -0.054642465,\n - \ -0.017938068,\n 0.05378017,\n -0.0050177802,\n -0.005894261,\n - \ 0.012730243,\n 0.028682757,\n -0.019469783,\n -0.008634327,\n - \ 0.027457386,\n 0.012775626,\n 0.045974102,\n 0.0084074065,\n - \ -0.01667866,\n -0.05468785,\n 0.011062376,\n 0.02984005,\n - \ 0.028160838,\n 0.00071444514,\n 0.06612465,\n -0.0052078264,\n - \ -0.008674038,\n -0.022068022,\n -0.009201628,\n 0.028841602,\n - \ 0.014806565,\n -0.019696703,\n 0.0036307287,\n -0.0077323173,\n - \ -0.02038881,\n -0.043319132,\n -0.03158734,\n -0.0024422323,\n - \ -0.0064331973,\n -0.028660065,\n -0.014000997,\n -0.018414602,\n - \ -0.029204674,\n -0.0047653313,\n 0.013728693,\n -0.042819906,\n - \ -0.026141247,\n 0.02276013,\n 0.0317008,\n -0.0081067365,\n - \ -0.008350676,\n 0.034854997,\n -0.04107262,\n -0.045134496,\n - \ -0.021954563,\n 0.052872486,\n -0.04928714,\n 0.042116452,\n - \ 0.0045809583,\n -0.0117771765,\n 0.0057581086,\n 0.075746074,\n - \ -0.04477142,\n -0.016848851,\n -0.053190175,\n -0.025800865,\n - \ 0.015237714,\n -0.0011544583,\n 0.04030109,\n -0.017552303,\n - \ -0.035513066,\n -0.0071706893,\n -0.0044306237,\n -0.012128903,\n - \ 0.025596637,\n -0.0015685882,\n -0.00147782,\n -0.0076642414,\n - \ -0.021194378,\n -0.019265555,\n -0.0025826395,\n -0.045883335,\n - \ -0.0012040972,\n -0.028637372,\n -0.0065069464,\n -0.021103611,\n - \ 0.03721497,\n 0.009490952,\n 0.027026236,\n -0.015373867,\n - \ -0.007998949,\n -0.026753932,\n -0.021523414,\n -0.040391855,\n - \ 0.014613682,\n -0.0114935255,\n 0.034083467,\n 0.009332107,\n - \ 0.015623479,\n -0.0147952195,\n 0.027343925,\n -0.00894067,\n - \ 0.0068246354,\n -0.018369218,\n -0.008248562,\n 0.043886434,\n - \ 0.023213971,\n -0.019254208,\n 0.0005871569,\n 0.013978305,\n - \ -0.0074827047,\n -0.002815233,\n -0.035513066,\n 0.007998949,\n - \ -0.017427498,\n -0.013910229,\n 0.013445042,\n 0.02938621,\n - \ -0.016553853,\n -0.02238571,\n -0.009485278,\n 0.00867971,\n - \ 0.057728585,\n 0.016712697,\n -0.018811712,\n -0.00087222585,\n - \ 0.030316584,\n 0.023577044,\n 0.0328354,\n -0.012616782,\n - \ -0.006660118,\n 0.006631753,\n 0.02375858,\n 0.033334628,\n - \ -0.01762038,\n -0.014330032,\n 0.014409455,\n -0.022964358,\n - \ -0.022658017,\n -0.015283098,\n 0.04418143,\n -0.006263007,\n - \ 0.011958713,\n -0.023225317,\n -0.0040902426,\n 0.032109257,\n - \ 0.0064558894,\n 0.054642465,\n -0.028070072,\n -0.013694654,\n - \ -0.023282047,\n -0.021228416,\n -0.008583269,\n 0.04275183,\n - \ -0.008367695,\n 0.012151595,\n 0.042592987,\n 0.018210374,\n - \ -0.024779724,\n -0.017087117,\n -0.00496105,\n -0.034537308,\n - \ 0.0005910571,\n 0.014602337,\n -0.023735888,\n -0.015555403,\n - \ 0.020524964,\n 0.011243912,\n 0.043659512,\n 0.017722495,\n - \ -0.051193275,\n 0.010829783,\n 0.013161391,\n -0.05686629,\n - \ 0.033675008,\n 0.0069664605,\n -0.017472882,\n -0.007057229,\n - \ 0.024439342,\n 0.029794667,\n 0.007987603,\n -0.02044554,\n - \ -0.0039087064,\n -0.023395509,\n 0.05237326,\n 0.0061608925,\n - \ 0.0022692054,\n -0.018425947,\n 0.028478527,\n 0.019061325,\n - \ 0.0073352065,\n -0.0072784764,\n 0.01833518,\n -0.018641522,\n - \ 0.024893183,\n 0.053190175,\n 0.008588943,\n -0.032926172,\n - \ 0.022555903,\n 0.014613682,\n 0.0026563886,\n 0.014273302,\n - \ -0.012276401,\n 0.012446592,\n -0.014659067,\n -0.029000444,\n - \ 0.0118452525,\n 0.034491923,\n 0.018369218,\n 0.011164491,\n - \ -0.01950382,\n -0.029113906,\n -0.03378847,\n 0.017779224,\n - \ -0.039053027,\n -0.029204674,\n -0.004322836,\n -0.008730768,\n - \ 0.037941113,\n 0.018947866,\n -0.0462691,\n -0.015441943,\n - \ -0.0057581086,\n -0.00839606,\n -0.0016636113,\n 0.027865842,\n - \ -0.04309221,\n 0.0396884,\n -0.0100015225,\n 0.04229799,\n - \ 0.0072614574,\n 0.0396884,\n -0.0047908598,\n 0.02584625,\n - \ -0.010965935,\n 0.012957163,\n 0.00052298093,\n -0.033833854,\n - \ 0.022521865,\n -0.0068246354,\n 0.029658515,\n -0.011266605,\n - \ -0.0014097439,\n -0.012094865,\n -0.011260932,\n -0.009547682,\n - \ 0.04760793,\n -0.027094312,\n 0.04554295,\n 0.02264667,\n - \ 0.017835954,\n 0.014284648,\n 0.018686907,\n -0.020717846,\n - \ -0.0019671174,\n 0.020400157,\n -0.017302692,\n 0.045134496,\n - \ -0.0051851342,\n 0.012072173,\n 0.0074259746,\n -0.006263007,\n - \ -0.012469283,\n -0.007913854,\n 0.00085166114,\n 0.020400157,\n - \ 0.04350067,\n 0.016633276,\n 0.014817911,\n -0.04760793,\n - \ 0.005037636,\n 0.001506185,\n -0.009127879,\n -0.010778726,\n - \ 0.020661116,\n -0.042207222,\n -0.0070969397,\n 0.036057673,\n - \ 0.010046907,\n -0.022987051,\n 0.013025239,\n 0.03249502,\n - \ 0.008583269,\n 0.024008194,\n 0.0019486801,\n 0.0011523309,\n - \ -0.005108549,\n -0.016292894,\n 0.017994799,\n 0.0002659225,\n - \ 0.00975191,\n 0.012662166,\n 0.036602285,\n -0.0069551147,\n - \ -0.021478029,\n 0.02084265,\n 0.0037924096,\n 0.013093315,\n - \ 0.0014920025,\n 0.02021862,\n 0.011947366,\n 0.025165487,\n - \ -0.0030520812,\n -0.014035036,\n -0.015941167,\n 0.04760793,\n - \ -0.0034491923,\n -0.029658515,\n 0.005366671,\n 0.01602059,\n - \ 0.023667812,\n -0.03204118,\n -0.014681759,\n 0.012764281,\n - \ 0.012265055,\n -0.034469232,\n -0.002995351,\n -0.0055226786,\n - \ 0.018800367,\n 0.040596087,\n 0.017041733,\n 0.020468233,\n - \ -0.00031006563,\n -0.017643072,\n 0.008617308,\n 0.05205557,\n - \ 0.019560551,\n 0.016973656,\n -0.025710097,\n -0.002479107,\n - \ 0.033221167,\n -0.0038633223,\n 0.004997925,\n -0.0073181875,\n - \ 0.022964358,\n -0.017121155,\n -0.006705502,\n -0.0014877478,\n - \ -0.030520814,\n 0.0080556795,\n -0.0026351148,\n 0.0012643728,\n - \ 0.0015487327,\n 0.024008194,\n -0.008186159,\n 0.0308385,\n - \ 0.004629179,\n 0.0059453184,\n -0.0014948391,\n -0.029454287,\n - \ -0.019855548,\n 0.05845473,\n 0.033561546,\n 0.033561546,\n - \ -0.044067968,\n -0.031678107,\n 0.015839053,\n 0.031564645,\n - \ -0.008832882,\n -0.002501799,\n -0.04032378,\n 0.002849271,\n - \ 0.051102504,\n -0.004875955,\n 0.047154088,\n -0.010846802,\n - \ -0.0068756924,\n -0.009734891,\n 0.00070841756,\n -0.032449637,\n - \ 0.020695154,\n 0.0331304,\n -0.007879816,\n 0.02453011,\n - \ 0.0082826,\n -0.011697754,\n 0.01436407,\n 0.024757031,\n - \ 0.0118112145,\n 0.024439342,\n 0.0019259881,\n 0.05291787,\n - \ 0.0077606826,\n 0.044998344,\n -0.020706499,\n 0.014965409,\n - \ -0.023111857,\n 0.06122316,\n 0.007085594,\n -0.02530164,\n - \ -0.014375417,\n 0.014261956,\n -0.038077265,\n -0.029476978,\n - \ -0.026481627,\n -0.02496126,\n 0.029250057,\n 0.059907023,\n - \ 0.0019770453,\n -0.01330889,\n 0.0004931976,\n 0.018868443,\n - \ 0.019435745,\n 0.012900433,\n -0.0025088901,\n 0.010710649,\n - \ -0.009479606,\n 0.013490426,\n -0.013297544,\n -0.030679658,\n - \ -0.03249502,\n 0.02564202,\n -0.022839552,\n -0.007420302,\n - \ -0.0053524883,\n -0.029930819,\n -0.013047931,\n -0.0037356794,\n - \ 0.010205751,\n 0.008543558,\n -0.033402704,\n -0.018437294,\n - \ 0.015339829,\n -0.008747787,\n 0.023577044,\n 0.02093342,\n - \ -0.009292396,\n -0.009394511,\n 0.036171135,\n -0.04474873,\n - \ -0.023282047,\n -0.013671963,\n 0.007306841,\n 0.02161418,\n - \ 0.020661116,\n -0.005860223,\n 0.025052028,\n 0.036715742,\n - \ 0.01502214,\n -0.050285593,\n 0.03730574,\n -0.04452181,\n - \ 0.010648247,\n 0.02193187,\n 0.010449691,\n -0.01658789,\n - \ 0.027865842,\n 0.022850899,\n 0.020717846,\n 0.00029659225,\n - \ -0.0060871434,\n -0.0099504655,\n -0.05005867,\n -0.02850122,\n - \ -0.021546105,\n 0.01779057,\n -0.0018111096,\n -0.01636097,\n - \ 0.020649768,\n 0.0019103873,\n -0.040255703,\n 0.0057070516,\n - \ 0.028637372,\n 0.011119107,\n 0.0013558503,\n 0.04381836,\n - \ 0.021670911,\n -0.040074166,\n 0.031746183,\n 0.024212422,\n - \ 0.012628128,\n 0.03192772,\n 0.0034633747,\n -0.0023996846,\n - \ -0.016780773,\n 0.004708601,\n -0.0027670125,\n 0.024825107,\n - \ -0.009031437,\n -0.021841101,\n -0.025823558,\n 0.013830807,\n - \ 0.0017331056,\n -0.011924675,\n 0.005043309,\n -0.029476978,\n - \ -0.011136126,\n 0.010846802,\n -0.0013991069,\n 0.016440393,\n - \ 0.003979619,\n 0.00025954036,\n -0.025142796,\n 0.031995796,\n - \ 0.0021458173,\n 0.011164491,\n -0.008946342,\n 0.049650215,\n - \ -0.0056134467,\n 0.028024687,\n -0.030543504,\n -0.0114765065,\n - \ -0.023168588,\n 0.013456388,\n 0.032971554,\n 0.0070288638,\n - \ -0.03789573,\n 0.026663164,\n 0.028455837,\n 0.036329977,\n - \ -0.003480394,\n -0.011924675,\n 0.0057013785,\n 0.031836953,\n - \ 0.00544042,\n 0.0027684306,\n -0.058727037,\n 0.0021642547,\n - \ 0.0034577018,\n 0.016406355,\n -0.0057467627,\n 0.001538805,\n - \ -0.0060644513,\n -0.02981736,\n 0.002081996,\n 0.05378017,\n - \ -0.046791017,\n -0.012117557,\n -0.018289795,\n 0.051420193,\n - \ 0.0476987,\n -0.0036704398,\n 0.028433144,\n 0.007834432,\n - \ 0.0041271173,\n -0.03667036,\n -0.017779224,\n -0.0051510963,\n - \ 0.02718508,\n -0.02409896,\n -0.036307286,\n -0.0038746682,\n - \ 0.0059056072,\n -0.0099221,\n 0.025029335,\n 0.023168588,\n - \ -0.027389308,\n 0.0008197505,\n -0.034151543,\n 0.03381116,\n - \ 0.029181981,\n 0.018164989,\n -0.008849901,\n 0.016179435,\n - \ -0.0036931317,\n -0.021319184,\n 0.0030010242,\n -0.015475981,\n - \ -0.012344478,\n -0.01231044,\n -0.014035036,\n -0.0073522255,\n - \ 0.022850899,\n -0.017586341,\n 0.0061325277,\n 0.0144434925,\n - \ -0.01922017,\n -0.03576268,\n 0.036919974,\n 0.024439342,\n - \ 0.025165487,\n 0.024371266,\n -0.05423401,\n 0.0234182,\n - \ -0.0037073144,\n -0.059725486,\n 0.022862244,\n 0.0536894,\n - \ 0.0064558894,\n 0.044453733,\n -0.00941153,\n -0.03115619,\n - \ 0.004467498,\n 0.0026237688,\n 0.0054546027,\n 0.05359863,\n - \ -0.020298043,\n -0.010852475,\n -0.015873091,\n 0.00089846354,\n - \ 0.017869992,\n 0.010171713,\n 0.028001994,\n -0.0103021925,\n - \ -0.0053780167,\n 0.0028790543,\n 0.063537754,\n 0.01342235,\n - \ -0.0034747208,\n -0.0056730136,\n -0.006387813,\n -0.014352724,\n - \ 0.017892685,\n -0.00845279,\n 0.00039994746,\n -0.017631726,\n - \ -0.011663715,\n 0.0006523965,\n 0.0114254495,\n 0.030112356,\n - \ -0.01187929,\n -0.058636267,\n 0.013331582,\n 0.01735942,\n - \ -0.025052028,\n 0.0076302034,\n 0.022147445,\n -0.0023415363,\n - \ 0.012333131,\n -0.00015875573,\n -0.024507418,\n -0.009422875,\n - \ 0.01590713,\n 0.028773524,\n 0.023372816,\n -0.04783485,\n - \ 0.0064615626,\n 0.025823558,\n 0.04395451,\n 0.008180485,\n - \ 0.015816363,\n -0.040618777,\n -0.021398608,\n -0.019685358,\n - \ -0.0067508863,\n 0.016168088,\n 0.064445436,\n -0.02881891,\n - \ 0.043001443,\n 0.003920052,\n -0.011754484,\n -0.010120656,\n - \ 0.024802415,\n -0.03392462,\n -0.007057229,\n -0.03058889,\n - \ -0.01718923,\n -0.010517767,\n 0.024598187,\n -0.003766881,\n - \ 0.04354605,\n 0.0018252921,\n -0.018834405,\n -0.0053950357,\n - \ 0.016054628,\n -0.00036697305,\n -0.00928105,\n 0.017847301,\n - \ -0.0041611553,\n -0.0068189623,\n 0.031746183,\n -0.019242862,\n - \ 0.008577596,\n -0.011856598,\n 0.04021032,\n 0.0034860668,\n - \ -0.019753434,\n -0.021863794,\n -0.04077762,\n 0.00090484566,\n - \ -0.03778227,\n -0.0022380038,\n -0.027820459,\n -0.029431595,\n - \ -0.003973946,\n -0.027048929,\n 0.02021862,\n 0.018040184,\n - \ -0.025687406,\n -0.003922889,\n 0.002826579,\n -0.010892186,\n - \ -0.003990965,\n 0.004339855,\n 0.017722495,\n -0.027865842,\n - \ -0.017983453,\n 0.003364097,\n -0.014783873,\n 0.027570846,\n - \ -0.00455543,\n 0.016009245,\n 0.007159343,\n -0.007908181,\n - \ -0.01613405,\n -0.031133499,\n 0.043251056,\n 0.039824557,\n - \ 0.035717294,\n 0.01813095,\n 0.00578931,\n 0.018187681,\n - \ 0.029136598,\n 0.028909678,\n 0.0936728,\n 0.0137400385,\n - \ -0.031133499,\n -0.020922074,\n 0.030770425,\n -0.008917977,\n - \ -0.021943217,\n 0.025233565,\n 0.014273302,\n 0.01519233,\n - \ 0.013819461,\n 0.0053354693,\n 0.019571897,\n 0.001141694,\n - \ -0.0006740249,\n 0.03349347,\n 0.042887982,\n 0.0018267103,\n - \ 0.050739434,\n -0.012299093,\n 0.0032648193,\n -0.025755482,\n - \ -0.029454287,\n 0.03501384,\n 0.012106211,\n 0.020876689,\n - \ 0.00048929744,\n -0.019651318,\n 0.017835954,\n -0.0110567035,\n - \ 0.008571924,\n -0.029091213,\n 0.004909993,\n 0.020139199,\n - \ -0.04860638,\n 0.03081581,\n -0.015385212,\n 0.0006424688,\n - \ -0.025800865,\n 0.035535756,\n 0.00108,\n -0.012446592,\n - \ -0.025528561,\n -0.011629677,\n -0.009434221,\n -0.0044760075,\n - \ -0.00033878526,\n -0.0032818383,\n -0.015294445,\n 0.0029471305,\n - \ -0.012798319,\n 0.045225263,\n -0.001506185,\n 0.014454839,\n - \ -0.040028784,\n -0.020547654,\n 0.0017898357,\n -0.023372816,\n - \ 0.014942718,\n -0.02364512,\n 0.012469283,\n 0.00715367,\n - \ 0.026527012,\n 0.068030775,\n 0.0021670912,\n -0.023554353,\n - \ -0.0234182,\n -0.008469809,\n -0.011731792,\n -0.015941167,\n - \ -0.0043143267,\n -0.01282101,\n 0.020456886,\n -0.014273302,\n - \ 0.006319737,\n 0.005187971,\n 0.037941113,\n -0.03206387,\n - \ -0.04150377,\n 0.042139143,\n -0.018380564,\n -0.014602337,\n - \ 0.038304187,\n 0.0011034012,\n 0.03115619,\n -0.04452181,\n - \ -0.0042462507,\n -0.0031825607,\n 0.01029652,\n -0.033289243,\n - \ -0.012560052,\n 0.007471359,\n 0.0060644513,\n 0.007987603,\n - \ 0.018085567,\n 0.014817911,\n 0.00074245565,\n 0.056957055,\n - \ 0.0014820747,\n 0.03889418,\n 0.03126965,\n 0.0061665657,\n - \ -0.028024687,\n -0.014171188,\n 0.015510019,\n -0.044998344,\n - \ 0.025029335,\n -0.020116506,\n -0.011085069,\n 0.01696231,\n - \ 0.0011778594,\n 0.027071621,\n -0.004405095,\n -0.016576545,\n - \ 0.0036250555,\n 0.007817413,\n 0.0113517,\n 0.016145397,\n - \ -0.018630177,\n 0.015555403,\n -0.002289061,\n -0.027684307,\n - \ 0.042366065,\n -0.029408902,\n 0.0011955876,\n 0.047017936,\n - \ 0.0080556795,\n 0.042116452,\n -0.03578537,\n 0.040664162,\n - \ 0.0025897308,\n -0.010642573,\n -0.0032931843,\n 0.0009750492,\n - \ 0.008345003,\n 0.036375362,\n 0.0067508863,\n -0.0061382004,\n - \ -0.012004097,\n -0.0021316349,\n -0.0030038606,\n 0.005066001,\n - \ -0.021852449,\n -0.033380013,\n 0.018607484,\n -0.04915099,\n - \ 0.022068022,\n -0.0053553246,\n -0.0033045304,\n -0.020354772,\n - \ -0.016610583,\n 0.005256047,\n -0.027389308,\n 0.023213971,\n - \ 0.016474431,\n -0.015407905,\n -0.014885987,\n -0.007885489,\n - \ 0.008390387,\n 0.020490926,\n 0.027593538,\n 0.0113517,\n - \ -0.032790016,\n -0.024734339,\n 0.034060773,\n -0.0011296389,\n - \ 0.031383112,\n 0.016292894,\n -0.03514999,\n 0.019866893,\n - \ -0.032563098,\n -0.025052028,\n -0.015294445,\n 0.027593538,\n - \ 0.014046381,\n 0.020320734,\n 0.01265082,\n 0.014284648,\n - \ -0.0002650361,\n -0.004042022,\n 0.0024379776,\n 0.0060587786,\n - \ -0.017075771,\n -0.0031201574,\n -0.012526014,\n 0.0022096387,\n - \ 0.026867392,\n -0.0045128823,\n -0.016973656,\n 0.012548706,\n - \ 0.0144775305,\n 0.035376914,\n 0.035263453,\n -0.013433696,\n - \ -0.016145397,\n 0.013184084,\n 0.039711095,\n -0.016837504,\n - \ -0.007533762,\n 0.03015774,\n 0.010273827,\n -0.01123824,\n - \ 0.006376467,\n 0.06766771,\n -0.018789021,\n 0.025483176,\n - \ -0.010727668,\n -0.027298542,\n 0.0077890474,\n 0.040686853,\n - \ 0.012764281,\n -0.010080945,\n -0.0029896782,\n -0.0007098358,\n - \ -0.029908128,\n -0.006393486,\n -0.0073011685,\n 0.0048220614,\n - \ 0.02387204,\n -0.001903296,\n -0.00010778726,\n -0.024598187,\n - \ 0.019197477,\n -0.0065409844,\n 0.0058885883,\n 0.0012388444,\n - \ -0.035944212,\n -0.035263453,\n -0.0015742612,\n -0.028750833,\n - \ -0.023395509,\n 0.019889586,\n 0.00057510176,\n -0.019481128,\n - \ 0.04742639,\n 0.0015983715,\n 0.0088272095,\n -0.016542507,\n - \ -0.03844034,\n 0.031995796,\n 0.009003072,\n 0.02750277,\n - \ -0.009672488,\n -0.012639474,\n 0.012889087,\n 0.029340826,\n - \ -0.01564617,\n 0.0051794616,\n 0.048243307,\n 0.019254208,\n - \ 0.0051170583,\n 0.017586341,\n 0.008345003,\n -0.03335732,\n - \ 0.018346526,\n 0.024144346,\n -0.018471332,\n 0.016985003,\n - \ -0.014466184,\n 0.01890248,\n 0.027434694,\n 0.007068575,\n - \ 0.0004527774,\n 0.012752934,\n -0.020661116,\n 0.03258579,\n - \ -0.037555348,\n 0.003335732,\n -0.01810826,\n -0.034786917,\n - \ 0.0076642414,\n -0.00596801,\n -0.017461536,\n -0.037555348,\n - \ -0.044431042,\n 0.03780496,\n -0.009746238,\n 0.015385212,\n - \ 0.0020295207,\n 0.002289061,\n 0.0059963753,\n 0.013558502,\n - \ 0.0012835193,\n -0.035649218,\n -0.019537859,\n 0.0031031384,\n - \ 0.0036307287,\n -0.0046944185,\n 0.011589967,\n 0.01790403,\n - \ 0.051647115,\n -0.0042746156,\n 0.025233565,\n 0.02310051,\n - \ 0.015759632,\n -0.021489374,\n 0.010290846,\n -0.026527012,\n - \ -0.012786972,\n -0.026481627,\n -0.011504872,\n -0.016043283,\n - \ 0.0001886277,\n -0.002978332,\n 0.0053042676,\n -0.017869992,\n - \ 0.029885435,\n -0.0151356,\n 0.00602474,\n -0.023440892,\n - \ 0.031678107,\n -0.0053553246,\n -0.009479606,\n 0.039416097,\n - \ 0.028206224,\n -0.01095459,\n 0.0038604857,\n 0.002782613,\n - \ 0.0026804989,\n -0.005985029,\n -0.04440835,\n -0.0148632955,\n - \ 0.02981736,\n -0.012832357,\n -0.02036612,\n -0.0068643466,\n - \ -0.008702403,\n 0.034514613,\n 0.010268155,\n -0.020740537,\n - \ 0.0073125144,\n -0.017211923,\n 0.018085567,\n 0.018119605,\n - \ 0.02441665,\n 0.011572948,\n -0.017348075,\n 0.00049071567,\n - \ -0.059907023,\n 0.018267104,\n 0.007272803,\n -0.012718896,\n - \ 0.016746735,\n -0.03966571,\n 0.0019047143,\n 0.003542797,\n - \ -0.00065629673,\n 0.0038746682,\n 0.033425394,\n -0.01204948,\n - \ 0.01844864,\n -0.04354605,\n 0.004629179,\n 0.0013579776,\n - \ -0.010642573,\n -0.017348075,\n 0.0025216546,\n 0.019912278,\n - \ -0.018244412,\n -0.03592152,\n 0.012809665,\n -0.012945817,\n - \ 0.006240315,\n -0.010273827,\n -0.009587393,\n -0.018301142,\n - \ -0.017200576,\n 0.029567746,\n -0.03610306,\n 0.009371818,\n - \ -0.0046263426,\n -0.030248508,\n -0.01193602,\n 0.025528561,\n - \ 0.0050092707,\n -0.030861193,\n 0.0013402494,\n 0.030520814,\n - \ -0.010455364,\n 0.03853111,\n -0.04517988,\n 0.008719422,\n - \ 0.0026989363,\n -0.008969034,\n 0.03975648,\n 0.02530164,\n - \ 0.029953511,\n 0.02059304,\n 0.045111805\n ]\n - \ }\n ],\n \"model\": \"text-embedding-3-small\",\n \"usage\": {\n \"prompt_tokens\": - 4,\n \"total_tokens\": 4\n }\n}\n" - headers: - CF-Cache-Status: - - DYNAMIC - CF-RAY: - - 8e174ca6898d0d80-MXP - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Tue, 12 Nov 2024 14:44:20 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - access-control-allow-origin: - - '*' - access-control-expose-headers: - - X-Request-ID - alt-svc: - - h3=":443"; ma=86400 - content-length: - - '33236' - openai-model: - - text-embedding-3-small - openai-organization: test_openai_org_key - openai-processing-ms: - - '130' - openai-version: - - '2020-10-01' - strict-transport-security: - - max-age=31536000; includeSubDomains; preload - x-ratelimit-limit-requests: - - '3000' - x-ratelimit-limit-tokens: - - '1000000' - x-ratelimit-remaining-requests: - - '2999' - x-ratelimit-remaining-tokens: - - '999994' - x-ratelimit-reset-requests: - - 20ms - x-ratelimit-reset-tokens: - - 0s - x-request-id: - - req_1361d64d5f74ba6fbd1b5c9f979fb5d5 - status: - code: 200 - message: OK -version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncOpenAIEmbeddings.test_basic.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncOpenAIEmbeddings.test_basic.yaml deleted file mode 100644 index 5bac394..0000000 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncOpenAIEmbeddings.test_basic.yaml +++ /dev/null @@ -1,481 +0,0 @@ -interactions: -- request: - body: '{"input": ["South Atlantic Ocean."], "model": "text-embedding-3-small"}' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - authorization: - - Bearer test_openai_api_key - connection: - - keep-alive - content-length: - - '71' - content-type: - - application/json - host: - - api.openai.com - user-agent: - - AsyncOpenAI/Python 1.50.2 - x-stainless-arch: - - x64 - x-stainless-async: - - async:asyncio - x-stainless-lang: - - python - x-stainless-os: - - Linux - x-stainless-package-version: - - 1.50.2 - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.10.12 - method: POST - uri: https://api.openai.com/v1/embeddings - response: - body: - string: "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": - \"embedding\",\n \"index\": 0,\n \"embedding\": [\n -0.031542376,\n - \ -0.030226218,\n 0.010239925,\n 0.009082615,\n -0.030884296,\n - \ 0.06480937,\n 0.03603546,\n -0.001886302,\n -0.004754049,\n - \ -0.02104716,\n 0.0026351498,\n -0.010915023,\n -0.018721193,\n - \ -0.012060987,\n 0.014942916,\n 0.024462359,\n -0.02425813,\n - \ 0.01888004,\n 0.016588112,\n 0.02312351,\n -0.028274676,\n - \ -0.035581615,\n -0.06285783,\n 0.061133206,\n 0.02036639,\n - \ -0.015010993,\n 0.008208959,\n 0.018176576,\n -0.06372014,\n - \ 0.025937364,\n 0.10520176,\n -0.03072545,\n 0.00089847547,\n - \ 0.065671675,\n 0.03923508,\n 0.06862169,\n -0.020389082,\n - \ -0.011777333,\n -0.05586858,\n 0.008203287,\n 0.02897814,\n - \ -0.05555089,\n 0.003392507,\n 0.001927432,\n 0.008481268,\n - \ 0.005361069,\n -0.06871245,\n -0.031746607,\n 0.03496892,\n - \ 0.014330222,\n -0.03417469,\n 0.028456215,\n -0.032427378,\n - \ -0.043183554,\n 0.043206245,\n -0.025755825,\n -0.013547337,\n - \ 0.0026904624,\n 0.069211684,\n -0.00045810195,\n -0.046973176,\n - \ 0.04883395,\n -0.0016225034,\n -0.005182367,\n -0.04604279,\n - \ -0.0024550292,\n 0.014057915,\n 0.061360132,\n -0.056004733,\n - \ -0.019753696,\n -0.048334718,\n 0.022068316,\n 0.024099281,\n - \ -0.036353152,\n -0.05382627,\n -0.014874839,\n -0.014750032,\n - \ -0.03623969,\n -0.0015913014,\n -0.03446969,\n -0.029500064,\n - \ 0.06272167,\n 0.0215237,\n -0.012435411,\n -0.015532917,\n - \ -0.04248009,\n 0.016122919,\n 0.008441556,\n -0.01834677,\n - \ 0.026550056,\n -0.03274507,\n -0.02080889,\n -0.021001775,\n - \ -0.0104498295,\n -0.010115118,\n 0.039144315,\n -0.009383289,\n - \ 0.012719066,\n 0.024144666,\n -0.004975299,\n -0.024167359,\n - \ -0.026164286,\n 0.020842928,\n -0.014023876,\n -0.028297368,\n - \ -0.024825437,\n 0.0018650279,\n 0.010081079,\n 0.012503488,\n - \ -0.011380216,\n -0.0090145385,\n 0.029431986,\n -0.0016069025,\n - \ 0.018925425,\n -0.0046632793,\n -0.021069853,\n 0.0029783717,\n - \ -0.064491674,\n 0.056004733,\n 0.005292992,\n 0.008129536,\n - \ -0.036534693,\n 0.021319468,\n -0.014080606,\n -0.037102003,\n - \ -0.011595794,\n -0.025120437,\n -0.010268291,\n 0.0067906873,\n - \ 0.0030946701,\n 0.009502424,\n -0.012503488,\n -0.016077533,\n - \ -0.030906988,\n 0.02003735,\n 0.07111784,\n -0.006370879,\n - \ -0.021648508,\n 0.0012317694,\n 0.011970217,\n 0.022930626,\n - \ 0.027888905,\n 0.03923508,\n 0.0035258248,\n 0.02007139,\n - \ -0.0043626055,\n -0.05568704,\n 0.027117366,\n 0.020116774,\n - \ -0.038486235,\n 0.013331759,\n -0.0049469336,\n 0.0038832293,\n - \ 0.025733132,\n -0.004756885,\n -0.012934643,\n -0.0036194308,\n - \ 0.0054943864,\n 0.0117206015,\n -0.0017600758,\n 0.0027542848,\n - \ -0.023032742,\n 0.043070093,\n 0.023781588,\n -0.016780997,\n - \ -0.008475595,\n 0.0066488604,\n 0.015623687,\n -0.05210165,\n - \ -0.011453967,\n -0.008225979,\n -0.020638697,\n -0.025574286,\n - \ -0.004986645,\n -0.010506561,\n -0.035763152,\n 0.009400308,\n - \ -0.03179199,\n -0.018119846,\n 0.016735613,\n -0.02128543,\n - \ 0.0022323604,\n 0.035922,\n -0.007148092,\n 0.006819053,\n - \ 0.035876613,\n 0.010387426,\n -0.010472522,\n -0.004203759,\n - \ -0.00945704,\n 0.019163694,\n -0.024916207,\n 0.07075477,\n - \ 0.01575984,\n -0.0069154953,\n -0.046519328,\n 0.014001183,\n - \ 0.04499894,\n -0.008214633,\n 0.033448532,\n 0.028251983,\n - \ -0.022998702,\n -0.033652764,\n -0.060180128,\n -0.021807354,\n - \ -0.033176225,\n -0.0537355,\n 0.021194661,\n 0.05509704,\n - \ 0.00063893164,\n 0.01632715,\n -0.018653117,\n 0.026050825,\n - \ 0.019901196,\n -0.026550056,\n -0.0032223146,\n -0.016656188,\n - \ 0.00966127,\n 0.023463896,\n -0.012390026,\n -0.035990078,\n - \ 0.013876376,\n 0.015805226,\n 0.02630044,\n -0.013309067,\n - \ 0.051375493,\n 0.056322426,\n -0.022465432,\n 0.009587521,\n - \ -0.0218187,\n 0.027003903,\n 0.017461767,\n -0.0064786677,\n - \ -0.034832764,\n -0.051693186,\n -0.040415086,\n -0.005865974,\n - \ 0.011595794,\n 0.021171968,\n 0.009837137,\n -0.028864676,\n - \ -0.014341569,\n 0.05096703,\n 0.02986314,\n -0.013399836,\n - \ -0.020264274,\n 0.046383176,\n 0.039076235,\n -0.016168304,\n - \ 0.050150108,\n -0.008208959,\n -0.014954262,\n 0.025891978,\n - \ 0.010846946,\n 0.010642715,\n -0.009474059,\n -0.05083088,\n - \ -0.053009342,\n -0.03989316,\n -0.015816571,\n -0.045588944,\n - \ -0.022953318,\n -0.048243947,\n 0.010041367,\n 0.024734668,\n - \ -0.0061553014,\n 0.03313084,\n 0.0061439555,\n -0.034129303,\n - \ -0.021557737,\n 0.003256353,\n 0.037646618,\n 0.0062914556,\n - \ 0.003996691,\n 0.028025059,\n 0.035014305,\n 0.02466659,\n - \ 0.01935658,\n 0.0115390625,\n -0.0045101056,\n 0.027752751,\n - \ -0.056095503,\n -0.06694245,\n 0.012673681,\n -0.012571565,\n - \ -0.015657725,\n 0.008583384,\n -0.027457751,\n 0.03891739,\n - \ 0.032949302,\n 0.081420176,\n 0.024757361,\n -0.020672737,\n - \ -0.015986765,\n -0.026073517,\n 0.0062971287,\n 0.0213762,\n - \ -0.0018309895,\n -0.027911598,\n -0.0036648156,\n 0.054234732,\n - \ -0.019957926,\n 0.013570028,\n -0.016497342,\n 0.008379152,\n - \ 0.03535469,\n -0.04633779,\n 0.016100226,\n 0.023895051,\n - \ 0.011005793,\n 0.020457158,\n 0.0008828745,\n 0.03485546,\n - \ -0.01748446,\n 0.03698854,\n -0.011936179,\n -0.054915503,\n - \ -0.0031655836,\n 0.0035712095,\n -0.027185442,\n 0.012015603,\n - \ 0.024326205,\n -0.025006976,\n 0.012026949,\n -0.00037265103,\n - \ -0.046201635,\n -0.025256593,\n -0.023645435,\n 0.024394283,\n - \ -0.015203878,\n 0.001843754,\n 0.0065921294,\n 0.04370548,\n - \ -0.009893867,\n 0.022181777,\n -0.039620854,\n -0.032722376,\n - \ 0.028456215,\n -0.035400074,\n 0.060633976,\n -0.009258481,\n - \ -0.018369462,\n 0.022454087,\n 0.025211208,\n -0.010013002,\n - \ -0.009644251,\n -0.018528309,\n 0.0143983,\n 0.075384006,\n - \ -0.015498879,\n 0.008702518,\n 0.0056702523,\n -0.005778041,\n - \ -0.010234253,\n -0.02369082,\n 0.030521218,\n 0.033062764,\n - \ -0.03476469,\n -0.06871245,\n 0.021262737,\n -0.032608915,\n - \ 0.0036024116,\n -0.03161045,\n 0.00081763393,\n 0.045157786,\n - \ -0.024144666,\n -0.0052476074,\n 0.0022082499,\n 0.008237326,\n - \ -0.011629832,\n -0.035763152,\n 0.04797164,\n -0.052147035,\n - \ 0.019175041,\n -0.003630777,\n 0.043387786,\n -0.05173857,\n - \ 0.0014920224,\n -0.03256353,\n -0.0012806999,\n -0.0445224,\n - \ 0.052510113,\n -0.027435059,\n 0.004938424,\n 0.0293866,\n - \ -0.052555498,\n 0.0033329397,\n -0.029931217,\n -0.0044136634,\n - \ -0.026028132,\n -0.03850893,\n -0.026845057,\n 0.034719303,\n - \ 0.0027500298,\n -0.0032989013,\n 0.008770595,\n 0.042366628,\n - \ -0.01801773,\n -0.038213927,\n 0.04874318,\n 0.034242764,\n - \ -0.027298905,\n -0.0062914556,\n -0.02282851,\n 0.009218769,\n - \ 0.015124455,\n -0.057230122,\n 0.025665054,\n 0.0055823196,\n - \ -0.014523108,\n -0.0009232952,\n -0.054098576,\n -0.0037839503,\n - \ 0.03381161,\n 0.00015140056,\n 0.04034701,\n -0.015476187,\n - \ 0.051557034,\n 0.004447702,\n 0.025665054,\n -0.0050518857,\n - \ 0.055414733,\n -0.0075622275,\n -0.0042264513,\n 0.011958872,\n - \ 0.072887845,\n 0.034696613,\n -0.03033968,\n 0.0141940685,\n - \ 0.015827918,\n 0.056050118,\n -0.010279637,\n 0.007573574,\n - \ 0.030112756,\n -0.016973883,\n 0.024780052,\n -0.007023284,\n - \ 0.012843873,\n -0.031043142,\n 0.011249735,\n 0.00379246,\n - \ 0.020332351,\n 0.00072331884,\n 0.008702518,\n -0.007976363,\n - \ -0.0019515426,\n 0.03274507,\n 0.02139889,\n -0.05464319,\n - \ -0.017926961,\n 0.0537355,\n -0.005012174,\n -0.005928378,\n - \ 0.012730411,\n 0.028637754,\n -0.01950408,\n -0.00859473,\n - \ 0.027435059,\n 0.012798489,\n 0.046020098,\n 0.008401845,\n - \ -0.016701574,\n -0.054688577,\n 0.011039831,\n 0.029840447,\n - \ 0.02811583,\n 0.0007672853,\n 0.06608014,\n -0.0052220784,\n - \ -0.008679826,\n -0.022091009,\n -0.009224443,\n 0.028841984,\n - \ 0.014795416,\n -0.019708311,\n 0.0036421232,\n -0.0077437665,\n - \ -0.020389082,\n -0.043274324,\n -0.03161045,\n -0.002474885,\n - \ -0.0064616483,\n -0.028683137,\n -0.013978492,\n -0.018369462,\n - \ -0.0290916,\n -0.0047682314,\n 0.013717529,\n -0.0427524,\n - \ -0.026118902,\n 0.022726394,\n 0.031678528,\n -0.0081238635,\n - \ -0.008345114,\n 0.03487815,\n -0.041073166,\n -0.045135096,\n - \ -0.021988893,\n 0.052963957,\n -0.049287796,\n 0.04209432,\n - \ 0.0046235677,\n -0.011777333,\n 0.0057525123,\n 0.07565632,\n - \ -0.04470394,\n -0.016815037,\n -0.053190883,\n -0.0258239,\n - \ 0.015260609,\n -0.0011431274,\n 0.040301625,\n -0.017597921,\n - \ -0.035581615,\n -0.007148092,\n -0.0044420287,\n -0.012129065,\n - \ 0.025551593,\n -0.0015671909,\n -0.0014721666,\n -0.0076870355,\n - \ -0.021274084,\n -0.01926581,\n -0.0025727458,\n -0.045883942,\n - \ -0.0012275146,\n -0.028637754,\n -0.006507033,\n -0.021126583,\n - \ 0.037238155,\n 0.009468385,\n 0.027003903,\n -0.015385417,\n - \ -0.007993382,\n -0.026731595,\n -0.0215237,\n -0.04046047,\n - \ 0.014579839,\n -0.0114880055,\n 0.034083918,\n 0.009332231,\n - \ 0.015600994,\n -0.014750032,\n 0.027321596,\n -0.008969153,\n - \ 0.0067963605,\n -0.018369462,\n -0.008237326,\n 0.04390971,\n - \ 0.023225626,\n -0.019231772,\n 0.00061907584,\n 0.013989837,\n - \ -0.0074941507,\n -0.0028095974,\n -0.035490844,\n 0.00798771,\n - \ -0.017473115,\n -0.013887722,\n 0.0134679135,\n 0.0293866,\n - \ -0.016542727,\n -0.022363316,\n -0.009502424,\n 0.008725211,\n - \ 0.057729352,\n 0.01667888,\n -0.018823309,\n -0.0008658552,\n - \ 0.03033968,\n 0.023531973,\n 0.032835837,\n -0.012628296,\n - \ -0.0065921294,\n 0.0066431873,\n 0.023736205,\n 0.033289686,\n - \ -0.017631961,\n -0.014330222,\n 0.014409646,\n -0.022987356,\n - \ -0.022624278,\n -0.015305994,\n 0.044136632,\n -0.0062801093,\n - \ 0.011958872,\n -0.023259664,\n -0.0040704412,\n 0.032155067,\n - \ 0.006404917,\n 0.05464319,\n -0.028025059,\n -0.013706183,\n - \ -0.023259664,\n -0.021217352,\n -0.008611749,\n 0.0427524,\n - \ -0.008373479,\n 0.012151756,\n 0.042593554,\n 0.018233309,\n - \ -0.024734668,\n -0.017087344,\n -0.004963953,\n -0.03451507,\n - \ 0.0006056022,\n 0.014568493,\n -0.023736205,\n -0.015544264,\n - \ 0.020525236,\n 0.011261081,\n 0.04370548,\n 0.017688692,\n - \ -0.051284723,\n 0.010846946,\n 0.013184259,\n -0.056867044,\n - \ 0.033675455,\n 0.006949534,\n -0.01748446,\n -0.007068669,\n - \ 0.024439666,\n 0.029795064,\n 0.007965017,\n -0.020457158,\n - \ -0.0039456333,\n -0.023350434,\n 0.052373957,\n 0.0061439555,\n - \ 0.002245125,\n -0.018426193,\n 0.028478907,\n 0.019084271,\n - \ 0.0073806886,\n -0.007323958,\n 0.01834677,\n -0.01867581,\n - \ 0.024870822,\n 0.053145498,\n 0.008600403,\n -0.032903917,\n - \ 0.022544855,\n 0.014602531,\n 0.0026507508,\n 0.014250799,\n - \ -0.012287911,\n 0.012435411,\n -0.01463657,\n -0.029023523,\n - \ 0.011890794,\n 0.03449238,\n 0.018392155,\n 0.011198678,\n - \ -0.019583503,\n -0.029136986,\n -0.03378892,\n 0.017802153,\n - \ -0.039053544,\n -0.029227754,\n -0.004373952,\n -0.00874223,\n - \ 0.03796431,\n 0.018982155,\n -0.04622433,\n -0.015476187,\n - \ -0.005741166,\n -0.008396172,\n -0.0016182486,\n 0.02784352,\n - \ -0.043070093,\n 0.039711624,\n -0.010007329,\n 0.04229855,\n - \ 0.0072502075,\n 0.039757006,\n -0.0047852504,\n 0.025801208,\n - \ -0.010966081,\n 0.012980027,\n 0.0005169602,\n -0.033766225,\n - \ 0.022510817,\n -0.0068757837,\n 0.029636217,\n -0.011255409,\n - \ -0.0013884886,\n -0.012038295,\n -0.011261081,\n -0.0095251165,\n - \ 0.04760856,\n -0.027049288,\n 0.045588944,\n 0.022669664,\n - \ 0.0178135,\n 0.014273492,\n 0.01867581,\n -0.020763505,\n - \ -0.0019401964,\n 0.020389082,\n -0.017234845,\n 0.045135096,\n - \ -0.0051766937,\n 0.012060987,\n 0.0074260733,\n -0.006302802,\n - \ -0.012492142,\n -0.007908286,\n 0.0008261436,\n 0.02042312,\n - \ 0.043501247,\n 0.016610805,\n 0.014795416,\n -0.04760856,\n - \ 0.005037703,\n 0.0014891858,\n -0.00914502,\n -0.010756177,\n - \ 0.020672737,\n -0.04220778,\n -0.0071027074,\n 0.036058154,\n - \ 0.010081079,\n -0.022964664,\n 0.012991373,\n 0.032495454,\n - \ 0.008583384,\n 0.024031205,\n 0.0019969274,\n 0.0011495097,\n - \ -0.0051227994,\n -0.016293112,\n 0.017983692,\n 0.0002533389,\n - \ 0.009786079,\n 0.012650988,\n 0.03660277,\n -0.0069722263,\n - \ -0.021512354,\n 0.020797543,\n 0.0037952964,\n 0.013070797,\n - \ 0.0015132965,\n 0.020230236,\n 0.011936179,\n 0.025165822,\n - \ -0.003052122,\n -0.014046568,\n -0.01594138,\n 0.04760856,\n - \ -0.003474767,\n -0.029636217,\n 0.005363906,\n 0.016020803,\n - \ 0.023668127,\n -0.0320643,\n -0.014670608,\n 0.012787143,\n - \ 0.012299256,\n -0.034446996,\n -0.0030294296,\n -0.005517079,\n - \ 0.018766578,\n 0.040573932,\n 0.017087344,\n 0.020468505,\n - \ -0.0003184021,\n -0.017597921,\n 0.008617423,\n 0.05210165,\n - \ 0.019538118,\n 0.016996574,\n -0.02571044,\n -0.0024805581,\n - \ 0.03322161,\n -0.003854864,\n 0.004986645,\n -0.007323958,\n - \ 0.022862548,\n -0.017110037,\n -0.0067282836,\n -0.0014877676,\n - \ -0.030521218,\n 0.008033094,\n -0.0026351498,\n 0.0012778633,\n - \ 0.0015388253,\n 0.024031205,\n -0.008214633,\n 0.03081622,\n - \ 0.004606548,\n 0.0059567434,\n -0.0015232244,\n -0.029454678,\n - \ -0.019810427,\n 0.05845551,\n 0.033584688,\n 0.033584688,\n - \ -0.044068556,\n -0.031723913,\n 0.015839264,\n 0.03158776,\n - \ -0.008855692,\n -0.0024763034,\n -0.040324315,\n 0.0028138522,\n - \ 0.05114857,\n -0.0048930394,\n 0.047154717,\n -0.010869638,\n - \ -0.006892803,\n -0.009780405,\n 0.00071516377,\n -0.03247276,\n - \ 0.02075216,\n 0.033085454,\n -0.007868574,\n 0.024575822,\n - \ 0.00828271,\n -0.011675217,\n 0.0143756075,\n 0.024757361,\n - \ 0.011834064,\n 0.024394283,\n 0.0018933935,\n 0.052963957,\n - \ 0.007755113,\n 0.045044325,\n -0.020706775,\n 0.014954262,\n - \ -0.023134857,\n 0.061223976,\n 0.007085688,\n -0.025301976,\n - \ -0.0143983,\n 0.014250799,\n -0.038100466,\n -0.02947737,\n - \ -0.026481979,\n -0.024916207,\n 0.029227754,\n 0.05990782,\n - \ 0.001979908,\n -0.0133204125,\n 0.00050596864,\n 0.018868694,\n - \ 0.019481387,\n 0.012877912,\n -0.0024961592,\n 0.010699445,\n - \ -0.009479731,\n 0.013513298,\n -0.0133204125,\n -0.030702757,\n - \ -0.032495454,\n 0.025619669,\n -0.022805817,\n -0.0074430928,\n - \ -0.00533554,\n -0.029908525,\n -0.013048105,\n -0.0037300559,\n - \ 0.010205887,\n 0.008543672,\n -0.03335776,\n -0.01846023,\n - \ 0.015328687,\n -0.008770595,\n 0.023577359,\n 0.020933699,\n - \ -0.009269827,\n -0.009388962,\n 0.036171615,\n -0.04470394,\n - \ -0.02330505,\n -0.013660798,\n 0.0073012654,\n 0.021637162,\n - \ 0.02069543,\n -0.0058432817,\n 0.025097746,\n 0.036648154,\n - \ 0.015022339,\n -0.05028626,\n 0.037306234,\n -0.04449971,\n - \ 0.01067108,\n 0.021920815,\n 0.010455503,\n -0.016554074,\n - \ 0.02793429,\n 0.022851203,\n 0.020729467,\n 0.00027656308,\n - \ -0.006070205,\n -0.0099392515,\n -0.050013952,\n -0.028501598,\n - \ -0.0215237,\n 0.017768115,\n -0.0017827682,\n -0.016361188,\n - \ 0.020672737,\n 0.0019061579,\n -0.04025624,\n 0.0056702523,\n - \ 0.028615061,\n 0.011124928,\n 0.0013317576,\n 0.043864325,\n - \ 0.0216712,\n -0.040120084,\n 0.031769298,\n 0.024235437,\n - \ 0.01261695,\n 0.03197353,\n 0.0034237092,\n -0.0023883705,\n - \ -0.016792344,\n 0.0046547693,\n -0.0027698856,\n 0.024825437,\n - \ -0.0090485765,\n -0.021841392,\n -0.025801208,\n 0.013819645,\n - \ 0.0017600758,\n -0.011936179,\n 0.0050660684,\n -0.029454678,\n - \ -0.011107909,\n 0.010801561,\n -0.0013877794,\n 0.016451959,\n - \ 0.003965489,\n 0.00021930035,\n -0.02514313,\n 0.03195084,\n - \ 0.0021841393,\n 0.011193004,\n -0.008986173,\n 0.04969626,\n - \ -0.0056078485,\n 0.028025059,\n -0.030521218,\n -0.0114880055,\n - \ -0.02312351,\n 0.0135019515,\n 0.032926608,\n 0.0070005916,\n - \ -0.037896235,\n 0.02668621,\n 0.028456215,\n 0.03630777,\n - \ -0.0034407284,\n -0.01190214,\n 0.0057298196,\n 0.031837374,\n - \ 0.0054518385,\n 0.0027769771,\n -0.058727816,\n 0.0021557738,\n - \ 0.0034861132,\n 0.016395228,\n -0.0057808775,\n 0.0015274792,\n - \ -0.006075878,\n -0.029749678,\n 0.0020408938,\n 0.05382627,\n - \ -0.046746254,\n -0.012117718,\n -0.018278692,\n 0.05142088,\n - \ 0.047653947,\n -0.0036818348,\n 0.02841083,\n 0.0078061703,\n - \ 0.0041328454,\n -0.03667085,\n -0.01777946,\n -0.005131309,\n - \ 0.027185442,\n -0.024121974,\n -0.036353152,\n -0.0038577004,\n - \ 0.0059340512,\n -0.0098881945,\n 0.025052361,\n 0.023202933,\n - \ -0.027435059,\n 0.0008559273,\n -0.03417469,\n 0.03381161,\n - \ 0.029205061,\n 0.018210616,\n -0.008867038,\n 0.01617965,\n - \ -0.0036704885,\n -0.021319468,\n 0.0030095738,\n -0.01546484,\n - \ -0.012333295,\n -0.012287911,\n -0.014069261,\n -0.007392035,\n - \ 0.022851203,\n -0.017609268,\n 0.006132609,\n 0.014432338,\n - \ -0.019243117,\n -0.035763152,\n 0.03692046,\n 0.024439666,\n - \ 0.025165822,\n 0.024394283,\n -0.054234732,\n 0.02339582,\n - \ -0.0036818348,\n -0.05972628,\n 0.022896588,\n 0.053690113,\n - \ 0.0064786677,\n 0.044454325,\n -0.009377616,\n -0.031179298,\n - \ 0.004419336,\n 0.0025571447,\n 0.005497223,\n 0.053644728,\n - \ -0.02024158,\n -0.0108299265,\n -0.015895994,\n 0.00091549475,\n - \ 0.017847538,\n 0.010200214,\n 0.027956983,\n -0.010273964,\n - \ -0.0054007806,\n 0.0028946938,\n 0.06358398,\n 0.013399836,\n - \ -0.0034634208,\n -0.0056872717,\n -0.006387898,\n -0.014341569,\n - \ 0.017892923,\n -0.008481268,\n 0.0003995982,\n -0.017654654,\n - \ -0.011652525,\n 0.0007045267,\n 0.011436948,\n 0.030112756,\n - \ -0.01190214,\n -0.058591664,\n 0.0133204125,\n 0.017370999,\n - \ -0.025052361,\n 0.0076416507,\n 0.022170432,\n -0.002354332,\n - \ 0.012321949,\n -0.00017497934,\n -0.024507744,\n -0.009400308,\n - \ 0.015895994,\n 0.0287966,\n 0.023350434,\n -0.047790103,\n - \ 0.0064219367,\n 0.025846593,\n 0.0439324,\n 0.00819194,\n - \ 0.01579388,\n -0.040619317,\n -0.0213762,\n -0.019708311,\n - \ -0.0067793415,\n 0.016145611,\n 0.06444629,\n -0.0287966,\n - \ 0.042979322,\n 0.0039286143,\n -0.0117206015,\n -0.01013781,\n - \ 0.024757361,\n -0.03392507,\n -0.0070970342,\n -0.030589296,\n - \ -0.017166767,\n -0.010478196,\n 0.024575822,\n -0.0037328925,\n - \ 0.043546632,\n 0.001818225,\n -0.018800616,\n -0.0053837616,\n - \ 0.01603215,\n -0.00036148215,\n -0.009298192,\n 0.01783619,\n - \ -0.0041612107,\n -0.006819053,\n 0.031701222,\n -0.01926581,\n - \ 0.008549345,\n -0.01184541,\n 0.04023355,\n 0.0035088055,\n - \ -0.019787734,\n -0.021875432,\n -0.04075547,\n 0.0008991846,\n - \ -0.03776008,\n -0.0022153412,\n -0.027820827,\n -0.029454678,\n - \ -0.0039739986,\n -0.027049288,\n 0.02018485,\n 0.018029077,\n - \ -0.025665054,\n -0.003959816,\n 0.0028067608,\n -0.010869638,\n - \ -0.0039626528,\n 0.004322894,\n 0.017711384,\n -0.027911598,\n - \ -0.017972346,\n 0.0033839976,\n -0.01478407,\n 0.027616598,\n - \ -0.00457251,\n 0.01603215,\n 0.0071537653,\n -0.007947997,\n - \ -0.016122919,\n -0.03111122,\n 0.043274324,\n 0.03980239,\n - \ 0.035717767,\n 0.018119846,\n 0.00580357,\n 0.018187923,\n - \ 0.029136986,\n 0.028887369,\n 0.09376481,\n 0.013717529,\n - \ -0.03111122,\n -0.020967737,\n 0.030748142,\n -0.008918095,\n - \ -0.021943508,\n 0.025188515,\n 0.014273492,\n 0.015192532,\n - \ 0.013865029,\n 0.00534405,\n 0.019583503,\n 0.0010807235,\n - \ -0.0006800615,\n 0.033539303,\n 0.042888552,\n 0.0018153884,\n - \ 0.050694723,\n -0.012276565,\n 0.0032393339,\n -0.025733132,\n - \ -0.029454678,\n 0.035014305,\n 0.012117718,\n 0.020865621,\n - \ 0.00050738687,\n -0.01965158,\n 0.01783619,\n -0.011090889,\n - \ 0.008566365,\n -0.0290916,\n 0.004927078,\n 0.020150812,\n - \ -0.048607025,\n 0.030838912,\n -0.015442148,\n 0.00065311434,\n - \ -0.025778517,\n 0.03553623,\n 0.0011062523,\n -0.012458104,\n - \ -0.025551593,\n -0.011618487,\n -0.00945704,\n -0.0044618845,\n - \ -0.0003586456,\n -0.003287555,\n -0.0152833015,\n 0.0029188043,\n - \ -0.012798489,\n 0.045225866,\n -0.001531734,\n 0.014455031,\n - \ -0.040052008,\n -0.020536583,\n 0.0017983692,\n -0.023350434,\n - \ 0.0149202235,\n -0.023645435,\n 0.012458104,\n 0.0071764574,\n - \ 0.026527364,\n 0.067986295,\n 0.0021770478,\n -0.023531973,\n - \ -0.023373127,\n -0.00844723,\n -0.01175464,\n -0.01594138,\n - \ -0.004291692,\n -0.012798489,\n 0.020457158,\n -0.014296184,\n - \ 0.00635386,\n 0.0052022226,\n 0.037918925,\n -0.032018915,\n - \ -0.041481625,\n 0.042139705,\n -0.018426193,\n -0.014568493,\n - \ 0.038282003,\n 0.001119726,\n 0.031133913,\n -0.044477016,\n - \ -0.00425198,\n -0.0031684202,\n 0.010262618,\n -0.033266995,\n - \ -0.012526181,\n 0.007465785,\n 0.0060418397,\n 0.00798771,\n - \ 0.018097153,\n 0.014863493,\n 0.0007055904,\n 0.057003196,\n - \ 0.0014282002,\n 0.038872007,\n 0.03127007,\n 0.006183667,\n - \ -0.028047752,\n -0.014171376,\n 0.015521571,\n -0.044930864,\n - \ 0.025029669,\n -0.02012812,\n -0.011056851,\n 0.016962536,\n - \ 0.0011750385,\n 0.027117366,\n -0.0043852977,\n -0.016554074,\n - \ 0.0036392866,\n 0.007868574,\n 0.01138589,\n 0.016145611,\n - \ -0.018596385,\n 0.01555561,\n -0.0022990194,\n -0.027661981,\n - \ 0.042412013,\n -0.029409293,\n 0.0011743294,\n 0.04701856,\n - \ 0.008067133,\n 0.04211701,\n -0.03574046,\n 0.040664703,\n - \ 0.0025826737,\n -0.010659734,\n -0.0032705357,\n 0.00094386016,\n - \ 0.008384826,\n 0.036375847,\n 0.0067736683,\n -0.006104244,\n - \ -0.012015603,\n -0.002108971,\n -0.0030294296,\n 0.0050462126,\n - \ -0.021875432,\n -0.033380456,\n 0.018573694,\n -0.049151644,\n - \ 0.02205697,\n -0.005366742,\n -0.0033045744,\n -0.020377735,\n - \ -0.016644843,\n 0.005213569,\n -0.027389674,\n 0.023168895,\n - \ 0.016474651,\n -0.015396764,\n -0.0148861855,\n -0.00787992,\n - \ 0.008424537,\n 0.020491198,\n 0.027571213,\n 0.011374543,\n - \ -0.03276776,\n -0.024734668,\n 0.034083918,\n -0.0011402909,\n - \ 0.031338144,\n 0.016281765,\n -0.035127766,\n 0.019844465,\n - \ -0.03254084,\n -0.025029669,\n -0.0152492635,\n 0.027616598,\n - \ 0.014023876,\n 0.020321004,\n 0.012673681,\n 0.014284838,\n - \ -0.00027354926,\n -0.0040052007,\n 0.0024252455,\n 0.006058859,\n - \ -0.01709869,\n -0.0030975065,\n -0.012526181,\n 0.002188394,\n - \ 0.026799671,\n -0.004501596,\n -0.016973883,\n 0.012514834,\n - \ 0.01448907,\n 0.035331998,\n 0.035263922,\n -0.013456567,\n - \ -0.016156957,\n 0.013161566,\n 0.039734315,\n -0.016837727,\n - \ -0.007499824,\n 0.030112756,\n 0.010273964,\n -0.011232716,\n - \ 0.006331167,\n 0.06771399,\n -0.018755233,\n 0.025460823,\n - \ -0.010722138,\n -0.027298905,\n 0.0078118434,\n 0.04073278,\n - \ 0.012719066,\n -0.010081079,\n -0.0029812083,\n -0.0007201277,\n - \ -0.02995391,\n -0.006370879,\n -0.0072785732,\n 0.0047965967,\n - \ 0.023917744,\n -0.0019075761,\n -0.00008407695,\n -0.024530437,\n - \ 0.019186387,\n -0.006569437,\n 0.0058829933,\n 0.0012416973,\n - \ -0.035944693,\n -0.035286613,\n -0.001578537,\n -0.028751215,\n - \ -0.02341851,\n 0.019912543,\n 0.0005673089,\n -0.01950408,\n - \ 0.047427025,\n 0.0016139938,\n 0.0088159805,\n -0.016542727,\n - \ -0.03844085,\n 0.03199622,\n 0.0090145385,\n 0.027503135,\n - \ -0.009689636,\n -0.012662334,\n 0.01291195,\n 0.029341215,\n - \ -0.015635034,\n 0.0051653474,\n 0.048243947,\n 0.019288503,\n - \ 0.0051284726,\n 0.017631961,\n 0.008322421,\n -0.03335776,\n - \ 0.018301385,\n 0.024167359,\n -0.018471578,\n 0.016985228,\n - \ -0.014466377,\n 0.018902732,\n 0.027389674,\n 0.007068669,\n - \ 0.00045774737,\n 0.012741758,\n -0.020672737,\n 0.032586224,\n - \ -0.03757854,\n 0.003293228,\n -0.0181085,\n -0.03476469,\n - \ 0.0076643433,\n -0.005945397,\n -0.01742773,\n -0.037555847,\n - \ -0.04438625,\n 0.03782816,\n -0.009746367,\n 0.01540811,\n - \ 0.0020650043,\n 0.0023188752,\n 0.0059851087,\n 0.013558683,\n - \ 0.0013048105,\n -0.03564969,\n -0.019515427,\n 0.0031287086,\n - \ 0.0036421232,\n -0.0046916446,\n 0.011618487,\n 0.017892923,\n - \ 0.0516478,\n -0.004246307,\n 0.0252339,\n 0.023100818,\n - \ 0.015771188,\n -0.021512354,\n 0.010290983,\n -0.026527364,\n - \ -0.012821181,\n -0.026527364,\n -0.011516371,\n -0.01603215,\n - \ 0.00017666354,\n -0.002995391,\n 0.005281646,\n -0.017881576,\n - \ 0.029885832,\n -0.015124455,\n 0.0060304934,\n -0.02341851,\n - \ 0.031701222,\n -0.005341213,\n -0.009479731,\n 0.039416622,\n - \ 0.028206598,\n -0.0109774275,\n 0.0038179888,\n 0.002771304,\n - \ 0.0026862076,\n -0.005973763,\n -0.04440894,\n -0.014897532,\n - \ 0.029817756,\n -0.012832527,\n -0.02036639,\n -0.0068587647,\n - \ -0.008674153,\n 0.034560457,\n 0.010290983,\n -0.020740813,\n - \ 0.0072785732,\n -0.017212152,\n 0.018097153,\n 0.018119846,\n - \ 0.024394283,\n 0.01160714,\n -0.017359652,\n 0.00053752516,\n - \ -0.059862435,\n 0.01829004,\n 0.007261554,\n -0.012696373,\n - \ 0.016769651,\n -0.039711624,\n 0.0019302685,\n 0.0035541903,\n - \ -0.00066056027,\n 0.003886066,\n 0.033403147,\n -0.012095026,\n - \ 0.018471578,\n -0.043569323,\n 0.0046235677,\n 0.0013891977,\n - \ -0.0105973305,\n -0.017325614,\n 0.0025117602,\n 0.019878503,\n - \ -0.018221961,\n -0.035944693,\n 0.012832527,\n -0.012980027,\n - \ 0.006229052,\n -0.010268291,\n -0.009587521,\n -0.01834677,\n - \ -0.017212152,\n 0.029545447,\n -0.036058154,\n 0.00934925,\n - \ -0.0046122214,\n -0.03024891,\n -0.011924833,\n 0.0255289,\n - \ 0.004983809,\n -0.030906988,\n 0.0013168658,\n 0.030566603,\n - \ -0.010534926,\n 0.03850893,\n -0.04518048,\n 0.008679826,\n - \ 0.0027259192,\n -0.008986173,\n 0.0397797,\n 0.025301976,\n - \ 0.029976603,\n 0.020581966,\n 0.045157786\n ]\n - \ }\n ],\n \"model\": \"text-embedding-3-small\",\n \"usage\": {\n \"prompt_tokens\": - 4,\n \"total_tokens\": 4\n }\n}\n" - headers: - CF-Cache-Status: - - DYNAMIC - CF-RAY: - - 8e1729940afd0e57-MXP - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Tue, 12 Nov 2024 14:20:24 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - access-control-allow-origin: - - '*' - access-control-expose-headers: - - X-Request-ID - alt-svc: - - h3=":443"; ma=86400 - content-length: - - '33253' - openai-model: - - text-embedding-3-small - openai-organization: test_openai_org_key - openai-processing-ms: - - '305' - openai-version: - - '2020-10-01' - strict-transport-security: - - max-age=31536000; includeSubDomains; preload - x-ratelimit-limit-requests: - - '3000' - x-ratelimit-limit-tokens: - - '1000000' - x-ratelimit-remaining-requests: - - '2999' - x-ratelimit-remaining-tokens: - - '999994' - x-ratelimit-reset-requests: - - 20ms - x-ratelimit-reset-tokens: - - 0s - x-request-id: - - req_c61f9b76d074d0a4b0166cff48121fac - status: - code: 200 - message: OK -version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local_stream.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local_stream.yaml deleted file mode 100644 index e5c6c99..0000000 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local_stream.yaml +++ /dev/null @@ -1,69 +0,0 @@ -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: - - '166' - content-type: - - application/json - host: - - localhost:11434 - user-agent: - - OpenAI/Python 1.43.1 - x-stainless-arch: - - x64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - Linux - x-stainless-package-version: - - 1.43.1 - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.10.12 - method: POST - uri: http://localhost:11434/v1/chat/completions - response: - body: - string: 'data: {"id":"chatcmpl-735","object":"chat.completion.chunk","created":1726043659,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"O"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-735","object":"chat.completion.chunk","created":1726043659,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"ce"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-735","object":"chat.completion.chunk","created":1726043659,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"ania"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-735","object":"chat.completion.chunk","created":1726043659,"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: - - Wed, 11 Sep 2024 08:34:19 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/TestChatCompletions.test_local_stream_with_capture_content.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local_stream_with_capture_content.yaml deleted file mode 100644 index b6e33e1..0000000 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local_stream_with_capture_content.yaml +++ /dev/null @@ -1,70 +0,0 @@ -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: - - '166' - content-type: - - application/json - host: - - localhost:11434 - user-agent: - - OpenAI/Python 1.43.1 - x-stainless-arch: - - x64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - Linux - x-stainless-package-version: - - 1.43.1 - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.10.12 - method: POST - uri: http://localhost:11434/v1/chat/completions - response: - body: - string: 'data: {"id":"chatcmpl-829","object":"chat.completion.chunk","created":1726048508,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"Pacific"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-829","object":"chat.completion.chunk","created":1726048508,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - Ocean"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-829","object":"chat.completion.chunk","created":1726048508,"model":"qwen2.5:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null}]} - - - data: {"id":"chatcmpl-829","object":"chat.completion.chunk","created":1726048508,"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: - - Wed, 11 Sep 2024 09:55:08 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/TestOpenAIEmbeddings.test_all_the_client_options.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestOpenAIEmbeddings.test_all_the_client_options.yaml deleted file mode 100644 index f71ea7f..0000000 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestOpenAIEmbeddings.test_all_the_client_options.yaml +++ /dev/null @@ -1,482 +0,0 @@ -interactions: -- request: - body: '{"input": ["South Atlantic Ocean."], "model": "text-embedding-3-small", - "encoding_format": "float"}' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - authorization: - - Bearer test_openai_api_key - connection: - - keep-alive - content-length: - - '99' - content-type: - - application/json - host: - - api.openai.com - user-agent: - - OpenAI/Python 1.50.2 - x-stainless-arch: - - x64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - Linux - x-stainless-package-version: - - 1.50.2 - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.10.12 - method: POST - uri: https://api.openai.com/v1/embeddings - response: - body: - string: "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": - \"embedding\",\n \"index\": 0,\n \"embedding\": [\n -0.031522155,\n - \ -0.030205896,\n 0.010252076,\n 0.009060634,\n -0.030909413,\n - \ 0.064814456,\n 0.036038287,\n -0.0018651743,\n -0.0047203805,\n - \ -0.02101477,\n 0.0026197543,\n -0.010915879,\n -0.018745357,\n - \ -0.012061933,\n 0.014978129,\n 0.02446428,\n -0.024260031,\n - \ 0.018870175,\n 0.016612107,\n 0.023148019,\n -0.0282542,\n - \ -0.0356071,\n -0.062862754,\n 0.061092615,\n 0.020379335,\n - \ -0.015000824,\n 0.008237971,\n 0.01818935,\n -0.063815914,\n - \ 0.025939398,\n 0.10521001,\n -0.030750554,\n 0.0008645047,\n - \ 0.06563144,\n 0.03928355,\n 0.06862707,\n -0.020390682,\n - \ -0.011778257,\n -0.055872962,\n 0.008209604,\n 0.029003106,\n - \ -0.055509858,\n 0.0033161805,\n 0.0019275832,\n 0.00849328,\n - \ 0.005310428,\n -0.06876323,\n -0.031749096,\n 0.034994356,\n - \ 0.014285958,\n -0.034154676,\n 0.02848114,\n -0.032407228,\n - \ -0.043096166,\n 0.04318694,\n -0.025757844,\n -0.013503011,\n - \ 0.0026779082,\n 0.06917173,\n -0.00046345682,\n -0.046931475,\n - \ 0.04883778,\n -0.0016580903,\n -0.005151569,\n -0.046114486,\n - \ -0.0024523851,\n 0.014070365,\n 0.061364945,\n -0.05600913,\n - \ -0.019743899,\n -0.048429288,\n 0.02213813,\n 0.024123866,\n - \ -0.036356006,\n -0.053785104,\n -0.014841965,\n -0.014728494,\n - \ -0.036265228,\n -0.0015814976,\n -0.0344497,\n -0.029502377,\n - \ 0.062726595,\n 0.021548083,\n -0.012413693,\n -0.015579524,\n - \ -0.042506117,\n 0.01618092,\n 0.008442218,\n -0.018393597,\n - \ 0.026529444,\n -0.032793026,\n -0.020753788,\n -0.021026118,\n - \ -0.010399587,\n -0.010115911,\n 0.03912469,\n -0.0093896985,\n - \ 0.012697369,\n 0.024169255,\n -0.0049756896,\n -0.024169255,\n - \ -0.026120951,\n 0.020810522,\n -0.014013629,\n -0.028299587,\n - \ -0.024781996,\n 0.0018325514,\n 0.010059176,\n 0.012481775,\n - \ -0.01139813,\n -0.009049287,\n 0.0294116,\n -0.0016240492,\n - \ 0.018915562,\n -0.0046863393,\n -0.021105547,\n 0.0029303804,\n - \ -0.06449673,\n 0.05600913,\n 0.0053132647,\n 0.008113153,\n - \ -0.036582947,\n 0.021298448,\n -0.014081712,\n -0.037104912,\n - \ -0.011642092,\n -0.025145102,\n -0.010240729,\n 0.0067968937,\n - \ 0.003069382,\n 0.009486149,\n -0.012504469,\n -0.016078796,\n - \ -0.030932108,\n 0.020061616,\n 0.07112342,\n -0.006416767,\n - \ -0.021650206,\n 0.0012552694,\n 0.011948463,\n 0.02290973,\n - \ 0.027913788,\n 0.039238162,\n 0.0034551823,\n 0.020107005,\n - \ -0.004385642,\n -0.05569141,\n 0.027119493,\n 0.020141046,\n - \ -0.03846656,\n 0.013321458,\n -0.0049388115,\n 0.003906228,\n - \ 0.025803233,\n -0.004714707,\n -0.012901616,\n -0.0036140413,\n - \ 0.0055146753,\n 0.011732869,\n -0.0017474485,\n 0.0027559192,\n - \ -0.023057243,\n 0.043118857,\n 0.023783455,\n -0.016805008,\n - \ -0.008504627,\n 0.006632361,\n 0.015647607,\n -0.05201496,\n - \ -0.011460539,\n -0.008215277,\n -0.020617623,\n -0.025576292,\n - \ -0.0049501583,\n -0.010530079,\n -0.035743263,\n 0.0093896985,\n - \ -0.03177179,\n -0.018155308,\n 0.016748272,\n -0.021264406,\n - \ 0.002241046,\n 0.03587943,\n -0.007103265,\n 0.006819588,\n - \ 0.03587943,\n 0.010393915,\n -0.010484691,\n -0.0042125992,\n - \ -0.009463455,\n 0.019165197,\n -0.024895467,\n 0.07071493,\n - \ 0.01574973,\n -0.006944406,\n -0.04652298,\n 0.014002282,\n - \ 0.04500247,\n -0.008181236,\n 0.033451155,\n 0.028231505,\n - \ -0.023000507,\n -0.033655405,\n -0.060184848,\n -0.021831758,\n - \ -0.03320152,\n -0.053739715,\n 0.02120767,\n 0.05514675,\n - \ 0.00061593304,\n 0.016351124,\n -0.018631887,\n 0.026098257,\n - \ 0.019902758,\n -0.026552139,\n -0.0032424247,\n -0.016691538,\n - \ 0.009679049,\n 0.02353382,\n -0.012390998,\n -0.036015593,\n - \ 0.013888812,\n 0.015806466,\n 0.026279809,\n -0.013310111,\n - \ 0.051334135,\n 0.056372233,\n -0.022501236,\n 0.009548558,\n - \ -0.021820411,\n 0.027006023,\n 0.017440444,\n -0.0065075434,\n - \ -0.034812804,\n -0.051651854,\n -0.040372867,\n -0.005860761,\n - \ 0.011596704,\n 0.02120767,\n 0.009854929,\n -0.028889636,\n - \ -0.014342694,\n 0.051061805,\n 0.029865483,\n -0.013412234,\n - \ -0.020254517,\n 0.04636412,\n 0.039033916,\n -0.016158225,\n - \ 0.05015404,\n -0.008237971,\n -0.014955436,\n 0.025825927,\n - \ 0.010842124,\n 0.010615182,\n -0.009452107,\n -0.050834864,\n - \ -0.05305889,\n -0.0398509,\n -0.015851853,\n -0.04559252,\n - \ -0.022932425,\n -0.048247732,\n 0.010070523,\n 0.02469122,\n - \ -0.0061841523,\n 0.03313344,\n 0.006138764,\n -0.034154676,\n - \ -0.021548083,\n 0.0033303646,\n 0.037626877,\n 0.0063259904,\n - \ 0.003982821,\n 0.028004564,\n 0.035085134,\n 0.024668526,\n - \ 0.019335404,\n 0.011545641,\n -0.004456561,\n 0.027777623,\n - \ -0.056054518,\n -0.06690231,\n 0.012708716,\n -0.012572551,\n - \ -0.015647607,\n 0.008646466,\n -0.02743721,\n 0.038920444,\n - \ 0.032929193,\n 0.08147195,\n 0.024827385,\n -0.020663012,\n - \ -0.015999366,\n -0.026052868,\n 0.00630897,\n 0.021343835,\n - \ -0.0018212044,\n -0.027936481,\n -0.0036594295,\n 0.054193597,\n - \ -0.019959493,\n 0.013559747,\n -0.016509984,\n 0.008362789,\n - \ 0.03533477,\n -0.046273343,\n 0.016101489,\n 0.02387423,\n - \ 0.010995309,\n 0.02047011,\n 0.00089854596,\n 0.034880888,\n - \ -0.017485833,\n 0.036991443,\n -0.011948463,\n -0.05491981,\n - \ -0.0031686688,\n 0.00358,\n -0.027142188,\n 0.012016545,\n - \ 0.02430542,\n -0.02496355,\n 0.012016545,\n -0.000414168,\n - \ -0.04620526,\n -0.025281267,\n -0.02364729,\n 0.024373502,\n - \ -0.015216419,\n 0.001863756,\n 0.0066039935,\n 0.043708906,\n - \ -0.0099457055,\n 0.022183519,\n -0.039646655,\n -0.032679558,\n - \ 0.028458446,\n -0.03533477,\n 0.060593344,\n -0.00923084,\n - \ -0.018336862,\n 0.022467194,\n 0.025213186,\n -0.010042155,\n - \ -0.009633661,\n -0.018563803,\n 0.014376735,\n 0.07538992,\n - \ -0.015511442,\n 0.008720222,\n 0.0056565134,\n -0.005798352,\n - \ -0.010206688,\n -0.023669984,\n 0.030500919,\n 0.03308805,\n - \ -0.034767415,\n -0.068717845,\n 0.021275753,\n -0.03258878,\n - \ 0.0036424089,\n -0.031635627,\n 0.0008347187,\n 0.04513864,\n - \ -0.02414656,\n -0.005174263,\n 0.0022027495,\n 0.00820393,\n - \ -0.011619397,\n -0.035743263,\n 0.047975402,\n -0.052151125,\n - \ 0.019176545,\n -0.0036083676,\n 0.043391187,\n -0.051742632,\n - \ 0.0015049049,\n -0.03258878,\n -0.0012808003,\n -0.044525895,\n - \ 0.052468844,\n -0.02743721,\n 0.004916117,\n 0.029366212,\n - \ -0.052559618,\n 0.0033019967,\n -0.029933566,\n -0.004362948,\n - \ -0.026075562,\n -0.03851195,\n -0.026824469,\n 0.03472203,\n - \ 0.0027502456,\n -0.003276466,\n 0.008788304,\n 0.04234726,\n - \ -0.018053185,\n -0.038216926,\n 0.048792392,\n 0.03424545,\n - \ -0.027278353,\n -0.0062862756,\n -0.022807607,\n 0.009094675,\n - \ 0.015125642,\n -0.057189222,\n 0.02562168,\n 0.005585594,\n - \ -0.014580983,\n -0.00088932645,\n -0.05410282,\n -0.0037643898,\n - \ 0.033836957,\n 0.00013368264,\n 0.040350173,\n -0.0154887475,\n - \ 0.051606465,\n 0.0044367034,\n 0.025689762,\n -0.0050239144,\n - \ 0.05537369,\n -0.007574168,\n -0.004240967,\n 0.011948463,\n - \ 0.07289357,\n 0.034699336,\n -0.030364754,\n 0.014172488,\n - \ 0.015806466,\n 0.056054518,\n -0.010280443,\n 0.007540127,\n - \ 0.030137813,\n -0.017009255,\n 0.024759302,\n -0.0069841202,\n - \ 0.0128675755,\n -0.031068273,\n 0.011244944,\n 0.0037842472,\n - \ 0.020333946,\n 0.0007311767,\n 0.008731569,\n -0.007988336,\n - \ -0.0019332567,\n 0.032747637,\n 0.02140057,\n -0.05464748,\n - \ -0.017939715,\n 0.053694326,\n -0.0050239144,\n -0.0059288433,\n - \ 0.012731411,\n 0.028662695,\n -0.019471569,\n -0.008595404,\n - \ 0.02743721,\n 0.012776799,\n 0.046023708,\n 0.008408178,\n - \ -0.016702885,\n -0.05469287,\n 0.011080412,\n 0.029820096,\n - \ 0.028163424,\n 0.0007673455,\n 0.06608532,\n -0.005162916,\n - \ -0.008674834,\n -0.022047354,\n -0.009225166,\n 0.028889636,\n - \ 0.014807924,\n -0.019709857,\n 0.0036736133,\n -0.0077387006,\n - \ -0.020413376,\n -0.043323107,\n -0.03165832,\n -0.0024353645,\n - \ -0.006439461,\n -0.02864,\n -0.013990935,\n -0.018370904,\n - \ -0.029003106,\n -0.0047544213,\n 0.0136959115,\n -0.04280114,\n - \ -0.026120951,\n 0.02271683,\n 0.031681012,\n -0.008113153,\n - \ -0.008351442,\n 0.0348355,\n -0.04109908,\n -0.04516133,\n - \ -0.021945229,\n 0.052968115,\n -0.049246274,\n 0.042097624,\n - \ 0.004604073,\n -0.01180095,\n 0.0057416162,\n 0.07566225,\n - \ -0.044752836,\n -0.01683905,\n -0.053195056,\n -0.025803233,\n - \ 0.015261807,\n -0.0011396712,\n 0.040282093,\n -0.017565262,\n - \ -0.0356071,\n -0.00716,\n -0.0044367034,\n -0.0121300155,\n - \ 0.025530903,\n -0.0015318542,\n -0.0014623534,\n -0.0076989857,\n - \ -0.021241711,\n -0.019244628,\n -0.0025757845,\n -0.04593293,\n - \ -0.0011928605,\n -0.028617306,\n -0.006513217,\n -0.021105547,\n - \ 0.037218384,\n 0.009446434,\n 0.027006023,\n -0.01536393,\n - \ -0.007988336,\n -0.026710998,\n -0.021525389,\n -0.040418256,\n - \ 0.0145696355,\n -0.01149458,\n 0.034041204,\n 0.009332963,\n - \ 0.015613565,\n -0.014762536,\n 0.027346434,\n -0.008941489,\n - \ 0.006808241,\n -0.018427638,\n -0.008243645,\n 0.043845072,\n - \ 0.023227448,\n -0.01923328,\n 0.00057409075,\n 0.013979588,\n - \ -0.0074720443,\n -0.0028041443,\n -0.035493627,\n 0.00801103,\n - \ -0.017485833,\n -0.013900158,\n 0.013434929,\n 0.029366212,\n - \ -0.016532678,\n -0.022376418,\n -0.009469128,\n 0.00868618,\n - \ 0.05777927,\n 0.016691538,\n -0.018813439,\n -0.00089854596,\n - \ 0.030319367,\n 0.023556514,\n 0.032838415,\n -0.012606593,\n - \ -0.0066380347,\n 0.0066664023,\n 0.023738066,\n 0.033292297,\n - \ -0.017633343,\n -0.014331347,\n 0.014388083,\n -0.02295512,\n - \ -0.0226374,\n -0.015250459,\n 0.044140093,\n -0.006274929,\n - \ 0.011971157,\n -0.023284184,\n -0.004079271,\n 0.032180283,\n - \ 0.0064451345,\n 0.05469287,\n -0.028049951,\n -0.013707258,\n - \ -0.023284184,\n -0.021219017,\n -0.008606751,\n 0.042778447,\n - \ -0.008385483,\n 0.0121754045,\n 0.042596895,\n 0.018212045,\n - \ -0.024759302,\n -0.017111378,\n -0.0049586687,\n -0.03456317,\n - \ 0.0005850832,\n 0.014558288,\n -0.023715373,\n -0.015579524,\n - \ 0.020538194,\n 0.011227923,\n 0.043663517,\n 0.017701427,\n - \ -0.05124336,\n 0.01083645,\n 0.013185293,\n -0.056916893,\n - \ 0.033655405,\n 0.006961426,\n -0.017474486,\n -0.0070351823,\n - \ 0.024441585,\n 0.029820096,\n 0.007942948,\n -0.020447416,\n - \ -0.003883534,\n -0.023397654,\n 0.052378066,\n 0.006172805,\n - \ 0.0022467196,\n -0.018404944,\n 0.028458446,\n 0.019097116,\n - \ 0.007358574,\n -0.0073245326,\n 0.018359557,\n -0.01865458,\n - \ 0.024872772,\n 0.053149667,\n 0.008606751,\n -0.032929193,\n - \ 0.02252393,\n 0.0146150235,\n 0.0026509587,\n 0.014217876,\n - \ -0.012243486,\n 0.01242504,\n -0.0146604115,\n -0.029003106,\n - \ 0.011846339,\n 0.034427006,\n 0.018393597,\n 0.011154168,\n - \ -0.019550998,\n -0.029139271,\n -0.033768874,\n 0.017780855,\n - \ -0.039056607,\n -0.029207353,\n -0.004362948,\n -0.008759936,\n - \ 0.03796729,\n 0.018949604,\n -0.046227954,\n -0.015466054,\n - \ -0.005761474,\n -0.008385483,\n -0.0016637639,\n 0.027891094,\n - \ -0.043096166,\n 0.039692044,\n -0.010002441,\n 0.04230187,\n - \ 0.0072394293,\n 0.039737433,\n -0.004774279,\n 0.025825927,\n - \ -0.010966942,\n 0.0129583515,\n 0.0005517512,\n -0.033836957,\n - \ 0.022489889,\n -0.0068763234,\n 0.029661236,\n -0.011244944,\n - \ -0.001394271,\n -0.012050587,\n -0.011216577,\n -0.009548558,\n - \ 0.04756691,\n -0.02705141,\n 0.04554713,\n 0.022694137,\n - \ 0.01780355,\n 0.014308653,\n 0.018688621,\n -0.020719746,\n - \ -0.0018921236,\n 0.020390682,\n -0.017236196,\n 0.04516133,\n - \ -0.0051770997,\n 0.0120846275,\n 0.007426656,\n -0.0063032964,\n - \ -0.012493122,\n -0.007886212,\n 0.00082266243,\n 0.02040203,\n - \ 0.04350466,\n 0.016589414,\n 0.014830618,\n -0.0476123,\n - \ 0.005072139,\n 0.0014893027,\n -0.00911737,\n -0.010751347,\n - \ 0.020674357,\n -0.0421884,\n -0.007108938,\n 0.036083676,\n - \ 0.01008187,\n -0.02298916,\n 0.012992393,\n 0.032498002,\n - \ 0.008595404,\n 0.02403309,\n 0.0019672979,\n 0.0011290333,\n - \ -0.0051061804,\n -0.01629439,\n 0.017951062,\n 0.00023828843,\n - \ 0.009775499,\n 0.012651981,\n 0.03660564,\n -0.0069557526,\n - \ -0.021525389,\n 0.02082187,\n 0.0037927574,\n 0.013071822,\n - \ 0.0015034865,\n 0.020265864,\n 0.011948463,\n 0.025145102,\n - \ -0.0030495245,\n -0.014059017,\n -0.015931284,\n 0.04756691,\n - \ -0.003472203,\n -0.029638542,\n 0.005367163,\n 0.016044755,\n - \ 0.023669984,\n -0.032066815,\n -0.0146604115,\n 0.01281084,\n - \ 0.0122661805,\n -0.03447239,\n -0.003006973,\n -0.0055175116,\n - \ 0.018802091,\n 0.040554423,\n 0.01706599,\n 0.020458763,\n - \ -0.00030442057,\n -0.017599303,\n 0.008595404,\n 0.052105736,\n - \ 0.019550998,\n 0.01698656,\n -0.025689762,\n -0.0024736607,\n - \ 0.03320152,\n -0.0038636767,\n 0.005004057,\n -0.007375594,\n - \ 0.022887036,\n -0.017122725,\n -0.006728811,\n -0.0014935578,\n - \ -0.030546308,\n 0.0080337245,\n -0.0026523771,\n 0.0012857646,\n - \ 0.00155313,\n 0.024010396,\n -0.008181236,\n 0.030841332,\n - \ 0.004635277,\n 0.0059515373,\n -0.0014822108,\n -0.029434295,\n - \ -0.019914104,\n 0.058414705,\n 0.03358732,\n 0.03358732,\n - \ -0.044072013,\n -0.0317264,\n 0.015885895,\n 0.03159024,\n - \ -0.008828019,\n -0.0024793344,\n -0.040350173,\n 0.002792797,\n - \ 0.051152583,\n -0.004873566,\n 0.047158416,\n -0.010870491,\n - \ -0.006904691,\n -0.009752805,\n 0.0007024544,\n -0.032429922,\n - \ 0.020674357,\n 0.03308805,\n -0.007880539,\n 0.024555055,\n - \ 0.008254992,\n -0.011698827,\n 0.014376735,\n 0.024781996,\n - \ 0.011812298,\n 0.02441889,\n 0.0019304199,\n 0.052877337,\n - \ 0.007733027,\n 0.045025166,\n -0.020708399,\n 0.014955436,\n - \ -0.023125324,\n 0.06122878,\n 0.00706355,\n -0.025326656,\n - \ -0.014388083,\n 0.01420653,\n -0.03803537,\n -0.029456988,\n - \ -0.026506752,\n -0.024940856,\n 0.029275436,\n 0.059867132,\n - \ 0.0020297067,\n -0.013332805,\n 0.00047480388,\n 0.018870175,\n - \ 0.019448875,\n 0.012833534,\n -0.002514794,\n 0.010700285,\n - \ -0.00950317,\n 0.013525705,\n -0.013310111,\n -0.030659778,\n - \ -0.032452613,\n 0.025644373,\n -0.022818955,\n -0.0074436767,\n - \ -0.005310428,\n -0.029888177,\n -0.013049128,\n -0.0037643898,\n - \ 0.010206688,\n 0.008521648,\n -0.033383075,\n -0.018427638,\n - \ 0.015329889,\n -0.008771284,\n 0.023579208,\n 0.020958034,\n - \ -0.009236514,\n -0.009401046,\n 0.036174454,\n -0.044684753,\n - \ -0.023306878,\n -0.013639176,\n 0.007301838,\n 0.021650206,\n - \ 0.020685704,\n -0.00584374,\n 0.02507702,\n 0.03669642,\n - \ 0.015034866,\n -0.050290205,\n 0.037286464,\n -0.04454859,\n - \ 0.010649224,\n 0.021956576,\n 0.01045065,\n -0.016555373,\n - \ 0.0278684,\n 0.022852995,\n 0.02074244,\n 0.00029431458,\n - \ -0.0060933754,\n -0.009962725,\n -0.050063264,\n -0.028549224,\n - \ -0.021525389,\n 0.017769508,\n -0.0017885816,\n -0.016339779,\n - \ 0.02062897,\n 0.0018992155,\n -0.040236704,\n 0.0056962282,\n - \ 0.028617306,\n 0.011097432,\n 0.0013616482,\n 0.043867767,\n - \ 0.0216729,\n -0.040100537,\n 0.0317264,\n 0.024237337,\n - \ 0.012651981,\n 0.031930648,\n 0.0034353249,\n -0.002385721,\n - \ -0.016816355,\n 0.004677829,\n -0.0027771948,\n 0.02485008,\n - \ -0.009032266,\n -0.021843106,\n -0.025803233,\n 0.013843423,\n - \ 0.0017389382,\n -0.011914422,\n 0.005072139,\n -0.029479682,\n - \ -0.011108779,\n 0.01083645,\n -0.0013992353,\n 0.016430555,\n - \ 0.003985658,\n 0.00023101922,\n -0.025145102,\n 0.03199873,\n - \ 0.0021516879,\n 0.011165515,\n -0.008969857,\n 0.04965477,\n - \ -0.0055941045,\n 0.028027259,\n -0.030500919,\n -0.011471886,\n - \ -0.023170713,\n 0.013480317,\n 0.032951884,\n 0.0070351823,\n - \ -0.037876513,\n 0.02666561,\n 0.028458446,\n 0.036356006,\n - \ -0.003472203,\n -0.011891727,\n 0.0057189222,\n 0.031885263,\n - \ 0.005455103,\n 0.0027786132,\n -0.058732424,\n 0.002185729,\n - \ 0.0034580189,\n 0.01640786,\n -0.005758637,\n 0.0015502932,\n - \ -0.006059334,\n -0.029774707,\n 0.002033962,\n 0.053785104,\n - \ -0.04674992,\n -0.0121300155,\n -0.018291473,\n 0.051379524,\n - \ 0.047657687,\n -0.0037048177,\n 0.028435752,\n 0.007812456,\n - \ 0.0041473536,\n -0.03665103,\n -0.01775816,\n -0.0051175277,\n - \ 0.02716488,\n -0.024078479,\n -0.036356006,\n -0.0038523297,\n - \ 0.0059118224,\n -0.009934358,\n 0.025054326,\n 0.023193408,\n - \ -0.027369129,\n 0.0008496117,\n -0.034154676,\n 0.033791568,\n - \ 0.02918466,\n 0.01818935,\n -0.008850713,\n 0.01618092,\n - \ -0.003639572,\n -0.021298448,\n 0.0030239937,\n -0.015500095,\n - \ -0.012368305,\n -0.0123115685,\n -0.014070365,\n -0.007392615,\n - \ 0.0228303,\n -0.017633343,\n 0.0061444375,\n 0.014422123,\n - \ -0.019244628,\n -0.035743263,\n 0.03692336,\n 0.024396196,\n - \ 0.025190491,\n 0.024373502,\n -0.054238986,\n 0.023420349,\n - \ -0.0036963075,\n -0.059730966,\n 0.022875689,\n 0.053648937,\n - \ 0.0064621554,\n 0.04445781,\n -0.009367005,\n -0.031136354,\n - \ 0.0044310302,\n 0.0025587638,\n 0.00546645,\n 0.05355816,\n - \ -0.020299904,\n -0.010830777,\n -0.015919937,\n 0.00088861724,\n - \ 0.017860286,\n 0.01017832,\n 0.02798187,\n -0.010280443,\n - \ -0.0053785103,\n 0.0028935024,\n 0.06354358,\n 0.013423582,\n - \ -0.0034636925,\n -0.0056792074,\n -0.006377052,\n -0.014342694,\n - \ 0.017894326,\n -0.008464913,\n 0.00041842312,\n -0.01764469,\n - \ -0.01168748,\n 0.00069252576,\n 0.01141515,\n 0.030115118,\n - \ -0.011903075,\n -0.05859626,\n 0.013310111,\n 0.01737236,\n - \ -0.025054326,\n 0.0076309033,\n 0.022126783,\n -0.0023204754,\n - \ 0.012322916,\n -0.00016967412,\n -0.024509666,\n -0.009406719,\n - \ 0.015874548,\n 0.028776165,\n 0.023352265,\n -0.04783924,\n - \ 0.006450808,\n 0.025825927,\n 0.04395854,\n 0.008192583,\n - \ 0.01582916,\n -0.040622503,\n -0.02140057,\n -0.019687163,\n - \ -0.0067401584,\n 0.016146878,\n 0.06449673,\n -0.02879886,\n - \ 0.04300539,\n 0.003923249,\n -0.011721522,\n -0.010144278,\n - \ 0.024759302,\n -0.033927735,\n -0.0070351823,\n -0.030591695,\n - \ -0.017179461,\n -0.010501712,\n 0.02457775,\n -0.003775737,\n - \ 0.043550048,\n 0.001801347,\n -0.018813439,\n -0.0053756735,\n - \ 0.016056102,\n -0.00034236233,\n -0.0092989225,\n 0.017826244,\n - \ -0.004164374,\n -0.006819588,\n 0.031681012,\n -0.019244628,\n - \ 0.008589731,\n -0.01188038,\n 0.040236704,\n 0.0035034074,\n - \ -0.019766593,\n -0.021899842,\n -0.040781364,\n 0.000909893,\n - \ -0.037785735,\n -0.0022254437,\n -0.02782301,\n -0.029456988,\n - \ -0.0039629634,\n -0.02705141,\n 0.020220475,\n 0.018053185,\n - \ -0.025689762,\n -0.0039601265,\n 0.0028268383,\n -0.010881838,\n - \ -0.0040111886,\n 0.0043175593,\n 0.017678732,\n -0.027936481,\n - \ -0.017985104,\n 0.0034012836,\n -0.01478523,\n 0.027618764,\n - \ -0.0045671947,\n 0.016010713,\n 0.007120285,\n -0.007954295,\n - \ -0.016044755,\n -0.03111366,\n 0.043277718,\n 0.039828207,\n - \ 0.035743263,\n 0.018132614,\n 0.0057784943,\n 0.018200697,\n - \ 0.029207353,\n 0.028889636,\n 0.093681395,\n 0.013718605,\n - \ -0.031181743,\n -0.020923993,\n 0.030773249,\n -0.008913122,\n - \ -0.021888494,\n 0.02523588,\n 0.014274612,\n 0.015193724,\n - \ 0.013843423,\n 0.0053359587,\n 0.019607734,\n 0.0011027931,\n - \ -0.0006783419,\n 0.03351924,\n 0.042891916,\n 0.001801347,\n - \ 0.0506987,\n -0.0123115685,\n 0.0032424247,\n -0.025780538,\n - \ -0.029434295,\n 0.034994356,\n 0.01207328,\n 0.020889953,\n - \ 0.0004964342,\n -0.019664468,\n 0.017837591,\n -0.011069065,\n - \ 0.008567036,\n -0.029116577,\n 0.004910444,\n 0.02016374,\n - \ -0.04861084,\n 0.030864025,\n -0.015386624,\n 0.0006630943,\n - \ -0.025757844,\n 0.03556171,\n 0.0010673336,\n -0.012470428,\n - \ -0.025530903,\n -0.011630745,\n -0.009457781,\n -0.0044367034,\n - \ -0.00034945423,\n -0.0032934865,\n -0.015284501,\n 0.0029530744,\n - \ -0.012822187,\n 0.04520672,\n -0.0015077416,\n 0.014456165,\n - \ -0.040077843,\n -0.020538194,\n 0.0018126941,\n -0.023352265,\n - \ 0.014932741,\n -0.02364729,\n 0.012493122,\n 0.0071656737,\n - \ 0.026552139,\n 0.06799163,\n 0.0021474326,\n -0.023511125,\n - \ -0.023397654,\n -0.008481934,\n -0.01176691,\n -0.015931284,\n - \ -0.004320396,\n -0.01281084,\n 0.020447416,\n -0.014274612,\n - \ 0.0063430113,\n 0.0052026305,\n 0.037944596,\n -0.03204412,\n - \ -0.04148488,\n 0.042120315,\n -0.018404944,\n -0.01459233,\n - \ 0.038285006,\n 0.0011113035,\n 0.031159049,\n -0.044480506,\n - \ -0.0042438037,\n -0.0031715056,\n 0.010286117,\n -0.033292297,\n - \ -0.012561204,\n 0.0074436767,\n 0.006053661,\n 0.007948621,\n - \ 0.01807588,\n 0.014819271,\n 0.0007162837,\n 0.056916893,\n - \ 0.0014417869,\n 0.03885236,\n 0.03127252,\n 0.006172805,\n - \ -0.028027259,\n -0.014172488,\n 0.015511442,\n -0.044979777,\n - \ 0.025031632,\n -0.020107005,\n -0.011091759,\n 0.016963867,\n - \ 0.0011843502,\n 0.027074104,\n -0.0043742945,\n -0.016532678,\n - \ 0.003616878,\n 0.0078691915,\n 0.01139813,\n 0.016124183,\n - \ -0.018609192,\n 0.015534136,\n -0.002319057,\n -0.027686846,\n - \ 0.04241534,\n -0.029434295,\n 0.0011978248,\n 0.04697686,\n - \ 0.008050744,\n 0.042120315,\n -0.03578865,\n 0.04066789,\n - \ 0.0025913867,\n -0.010677591,\n -0.0032566085,\n 0.0009446434,\n - \ 0.00837981,\n 0.036401395,\n 0.006745832,\n -0.006138764,\n - \ -0.012005198,\n -0.002130412,\n -0.0030410143,\n 0.0050607924,\n - \ -0.021854453,\n -0.03336038,\n 0.018609192,\n -0.0491555,\n - \ 0.022058701,\n -0.0053785103,\n -0.0032821395,\n -0.02035664,\n - \ -0.016646149,\n 0.0052423454,\n -0.027391823,\n 0.023193408,\n - \ 0.016498636,\n -0.0153979715,\n -0.014910048,\n -0.007846498,\n - \ 0.00839683,\n 0.020492805,\n 0.02759607,\n 0.011386783,\n - \ -0.032793026,\n -0.02473661,\n 0.034041204,\n -0.0011510182,\n - \ 0.031363297,\n 0.016283043,\n -0.03510783,\n 0.019868717,\n - \ -0.03254339,\n -0.025031632,\n -0.015250459,\n 0.02759607,\n - \ 0.014059017,\n 0.020322599,\n 0.012686023,\n 0.014308653,\n - \ -0.000318959,\n -0.0040338826,\n 0.00244813,\n 0.006053661,\n - \ -0.017100032,\n -0.0031317908,\n -0.012561204,\n 0.0021984945,\n - \ 0.026869858,\n -0.004496276,\n -0.016941173,\n 0.01253851,\n - \ 0.014478859,\n 0.03533477,\n 0.03524399,\n -0.013434929,\n - \ -0.016146878,\n 0.013185293,\n 0.039760128,\n -0.01683905,\n - \ -0.007511759,\n 0.030092424,\n 0.010252076,\n -0.011222251,\n - \ 0.0063657053,\n 0.0677193,\n -0.018802091,\n 0.025462821,\n - \ -0.010728653,\n -0.027278353,\n 0.007795436,\n 0.040735975,\n - \ 0.012742758,\n -0.010070523,\n -0.0029615848,\n -0.00072018424,\n - \ -0.029933566,\n -0.006371379,\n -0.0072904914,\n 0.004822504,\n - \ 0.02387423,\n -0.001863756,\n -0.00007535162,\n -0.024555055,\n - \ 0.019210586,\n -0.0065415846,\n 0.005883455,\n 0.0012254834,\n - \ -0.035947513,\n -0.03524399,\n -0.0015715689,\n -0.028776165,\n - \ -0.023420349,\n 0.019891411,\n 0.0005687718,\n -0.019516958,\n - \ 0.047430746,\n 0.0015985182,\n 0.008822345,\n -0.016544025,\n - \ -0.03846656,\n 0.03199873,\n 0.008992552,\n 0.027527988,\n - \ -0.009701743,\n -0.012640634,\n 0.012935658,\n 0.029343517,\n - \ -0.015647607,\n 0.0051544057,\n 0.048247732,\n 0.019267322,\n - \ 0.005128875,\n 0.01761065,\n 0.008323074,\n -0.03336038,\n - \ 0.01830282,\n 0.024169255,\n -0.01846168,\n 0.01698656,\n - \ -0.014478859,\n 0.01892691,\n 0.027391823,\n 0.0070692236,\n - \ 0.00046026544,\n 0.012742758,\n -0.020663012,\n 0.032566085,\n - \ -0.03758149,\n 0.0033218542,\n -0.018109921,\n -0.034767415,\n - \ 0.007659271,\n -0.0059515373,\n -0.01741775,\n -0.037604183,\n - \ -0.04438973,\n 0.03785382,\n -0.0097357845,\n 0.0153979715,\n - \ 0.0020906972,\n 0.0023091284,\n 0.0060082725,\n 0.013571094,\n - \ 0.0012651981,\n -0.035629794,\n -0.019516958,\n 0.0031261172,\n - \ 0.0036197146,\n -0.004714707,\n 0.011574009,\n 0.017894326,\n - \ 0.051651854,\n -0.004286355,\n 0.025258573,\n 0.023125324,\n - \ 0.015772425,\n -0.021468652,\n 0.010286117,\n -0.026552139,\n - \ -0.01281084,\n -0.026506752,\n -0.01149458,\n -0.016044755,\n - \ 0.0002143532,\n -0.002995626,\n 0.005287734,\n -0.017871631,\n - \ 0.029910872,\n -0.015091601,\n 0.006053661,\n -0.023443043,\n - \ 0.031681012,\n -0.0053870208,\n -0.009497496,\n 0.03944241,\n - \ 0.02820881,\n -0.010978288,\n 0.0038721869,\n 0.00278145,\n - \ 0.0026708161,\n -0.0059685577,\n -0.044412423,\n -0.014853312,\n - \ 0.029820096,\n -0.012822187,\n -0.020367987,\n -0.006864976,\n - \ -0.008652139,\n 0.03456317,\n 0.010269097,\n -0.02074244,\n - \ 0.0073131854,\n -0.01722485,\n 0.018098574,\n 0.018143961,\n - \ 0.024396196,\n 0.011562662,\n -0.017349668,\n 0.00052125595,\n - \ -0.059912518,\n 0.018291473,\n 0.0072848178,\n -0.012720063,\n - \ 0.016782314,\n -0.03971474,\n 0.0019148177,\n 0.0035459588,\n - \ -0.000634372,\n 0.0038636767,\n 0.033428464,\n -0.012050587,\n - \ 0.01846168,\n -0.043572742,\n 0.00461542,\n 0.0013474643,\n - \ -0.010632203,\n -0.01733832,\n 0.002526141,\n 0.019880064,\n - \ -0.018212045,\n -0.035902124,\n 0.012822187,\n -0.012947004,\n - \ 0.0062522343,\n -0.010280443,\n -0.009639334,\n -0.018325515,\n - \ -0.01722485,\n 0.029525071,\n -0.036083676,\n 0.009355658,\n - \ -0.0046097464,\n -0.030251283,\n -0.011925768,\n 0.025530903,\n - \ 0.005004057,\n -0.030864025,\n 0.0013261886,\n 0.030523613,\n - \ -0.010507385,\n 0.038534645,\n -0.04516133,\n 0.008708875,\n - \ 0.0027076942,\n -0.008992552,\n 0.039737433,\n 0.025281267,\n - \ 0.029933566,\n 0.020583581,\n 0.045115944\n ]\n - \ }\n ],\n \"model\": \"text-embedding-3-small\",\n \"usage\": {\n \"prompt_tokens\": - 4,\n \"total_tokens\": 4\n }\n}\n" - headers: - CF-Cache-Status: - - DYNAMIC - CF-RAY: - - 8e172c6d6a5aba8f-MXP - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Tue, 12 Nov 2024 14:22:20 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - access-control-allow-origin: - - '*' - access-control-expose-headers: - - X-Request-ID - alt-svc: - - h3=":443"; ma=86400 - content-length: - - '33236' - openai-model: - - text-embedding-3-small - openai-organization: test_openai_org_key - openai-processing-ms: - - '204' - openai-version: - - '2020-10-01' - strict-transport-security: - - max-age=31536000; includeSubDomains; preload - x-ratelimit-limit-requests: - - '3000' - x-ratelimit-limit-tokens: - - '1000000' - x-ratelimit-remaining-requests: - - '2999' - x-ratelimit-remaining-tokens: - - '999994' - x-ratelimit-reset-requests: - - 20ms - x-ratelimit-reset-tokens: - - 0s - x-request-id: - - req_fc0a46ffb7945933ee5cc6c21c4cd220 - status: - code: 200 - message: OK -version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/conftest.py b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/conftest.py new file mode 100644 index 0000000..ac78e4e --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/conftest.py @@ -0,0 +1,431 @@ +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import re +import os +from urllib.parse import parse_qs, urlparse + +import openai +import pytest +from opentelemetry import metrics, trace +from opentelemetry.instrumentation.openai import OpenAIInstrumentor +from opentelemetry.metrics import Histogram +from opentelemetry.sdk.metrics import MeterProvider +from opentelemetry.sdk.metrics.export import ( + InMemoryMetricReader, +) +from opentelemetry.sdk.trace import TracerProvider +from opentelemetry.sdk.trace.export import SimpleSpanProcessor +from opentelemetry.sdk.trace.export.in_memory_span_exporter import ( + InMemorySpanExporter, +) +from opentelemetry.test.globals_test import reset_metrics_globals + +from .utils import assert_metric_expected, create_histogram_data_point + + +@pytest.fixture(scope="session") +def trace_exporter(): + exporter = InMemorySpanExporter() + processor = SimpleSpanProcessor(exporter) + + provider = TracerProvider() + provider.add_span_processor(processor) + trace.set_tracer_provider(provider) + + return exporter + + +# cannot use a fixture session scoped because we don't have a way to clear it +# TODO: expose api to reset it upstream? +@pytest.fixture +def metrics_reader(): + reset_metrics_globals() + memory_reader = InMemoryMetricReader() + provider = MeterProvider(metric_readers=[memory_reader]) + metrics.set_meter_provider(provider) + + return memory_reader + + +@pytest.fixture(autouse=True) +def clear_exporter(trace_exporter, metrics_reader): + trace_exporter.clear() + + +# TODO: should drop autouse and use it explicitly? +@pytest.fixture(autouse=True) +def instrument(): + instrumentor = OpenAIInstrumentor() + instrumentor.instrument() + + yield instrumentor + + instrumentor.uninstrument() + + +OPENAI_API_KEY = "test_openai_api_key" +OPENAI_ORG_ID = "test_openai_org_key" +OPENAI_PROJECT_ID = "test_openai_project_id" + + +@pytest.fixture +def default_openai_env(monkeypatch): + """ + This fixture prevents OpenAIProvider.from_env() from erring on missing + environment variables. + + When running VCR tests for the first time or after deleting a cassette + recording, set required environment variables, so that real requests don't + fail. Subsequent runs use the recorded data, so don't need them. + """ + if "OPENAI_API_KEY" not in os.environ: + monkeypatch.setenv("OPENAI_API_KEY", OPENAI_API_KEY) + + +AZURE_ENDPOINT = "https://test.openai.azure.com" +AZURE_DEPLOYMENT_NAME = "test-azure-deployment" +AZURE_API_KEY = "test_azure_api_key" +AZURE_CHAT_COMPLETIONS_API_VERSION = "2023-03-15-preview" +AZURE_CHAT_COMPLETIONS_DEPLOYMENT_URL = f"{AZURE_ENDPOINT}/openai/deployments/{AZURE_DEPLOYMENT_NAME}/chat/completions?api-version={AZURE_CHAT_COMPLETIONS_API_VERSION}" +AZURE_EMBEDDINGS_API_VERSION = "2023-05-15" +AZURE_EMBEDDINGS_DEPLOYMENT_URL = ( + f"{AZURE_ENDPOINT}/openai/deployments/{AZURE_DEPLOYMENT_NAME}/embeddings?api-version={AZURE_EMBEDDINGS_API_VERSION}" +) + + +@pytest.fixture +def default_azure_env(monkeypatch): + """ + This fixture prevents AzureProvider.from_env() from erring on missing + environment variables. + + When running VCR tests for the first time or after deleting a cassette + recording, set required environment variables, so that real requests don't + fail. Subsequent runs use the recorded data, so don't need them. + """ + if "AZURE_CHAT_COMPLETIONS_DEPLOYMENT_URL" not in os.environ: + monkeypatch.setenv("AZURE_CHAT_COMPLETIONS_DEPLOYMENT_URL", AZURE_CHAT_COMPLETIONS_DEPLOYMENT_URL) + if "AZURE_CHAT_COMPLETIONS_API_KEY" not in os.environ: + monkeypatch.setenv("AZURE_CHAT_COMPLETIONS_API_KEY", AZURE_API_KEY) + if "AZURE_EMBEDDINGS_DEPLOYMENT_URL" not in os.environ: + monkeypatch.setenv("AZURE_EMBEDDINGS_DEPLOYMENT_URL", AZURE_EMBEDDINGS_DEPLOYMENT_URL) + if "AZURE_EMBEDDINGS_API_KEY" not in os.environ: + monkeypatch.setenv("AZURE_EMBEDDINGS_API_KEY", AZURE_API_KEY) + + +@pytest.fixture(scope="module") +def vcr_config(): + """ + This scrubs sensitive data and gunzips bodies when in recording mode. + + Without this, you would leak cookies and auth tokens in the cassettes. + Also, depending on the request, some responses would be binary encoded + while others plain json. This ensures all bodies are human-readable. + """ + return { + "decode_compressed_response": True, + "filter_headers": [ + ("authorization", "Bearer " + OPENAI_API_KEY), + ("openai-organization", OPENAI_ORG_ID), + ("openai-project", OPENAI_PROJECT_ID), + ("cookie", None), + ], + "before_record_request": scrub_request_url, + "before_record_response": scrub_response_headers, + } + + +def scrub_request_url(request): + """ + This scrubs sensitive request data in provider-specific way. Note that headers + are case-sensitive! + """ + if "openai.azure.com" in request.uri: + request.uri = re.sub(r"https://[^/]+", AZURE_ENDPOINT, request.uri) + request.uri = re.sub(r"/deployments/[^/]+", f"/deployments/{AZURE_DEPLOYMENT_NAME}", request.uri) + request.headers["host"] = AZURE_ENDPOINT.replace("https://", "") + request.headers["api-key"] = AZURE_API_KEY + + return request + + +def scrub_response_headers(response): + """ + This scrubs sensitive response headers. Note they are case-sensitive! + """ + response["headers"]["openai-organization"] = OPENAI_ORG_ID + response["headers"]["Set-Cookie"] = "test_set_cookie" + return response + + +@pytest.fixture(scope="module") +def vcr_cassette_dir(request): + # remove test_ prefix from dir name + return os.path.join("tests", "cassettes", request.module.__name__[5:]) + + +@pytest.fixture +def vcr_cassette_name(request): + """Name of the VCR cassette""" + test_class = request.cls + if test_class: + return "{}.{}".format(test_class.__name__, request.node.name) + + # We have chicken and egg problem when using the output of the call as fixture because llm responses are + # not reproducible and so that name of the cassette would not match the content + # For the convenience of being able to use the test data as parametrized fixture we assume that the first + # element of the test data is the provider and remove everything else from the cassette name + # TODO: we can probably rebuild the name from the request + # request.node.name format: test_basic[ollama_provider_chat_completions-Atlantic Ocean.-24-4-5] + test_name = re.match(r"(\w+\[\w+)", request.node.name) + return f"{test_name.group()}]" + + +class AzureProvider: + def __init__(self, api_key, endpoint, api_version, operation_name): + self.api_key = api_key + self.endpoint = endpoint + self.api_version = api_version + + self.operation_name = operation_name + + self.server_address = "test.openai.azure.com" + self.server_port = 443 + + @classmethod + def from_env(cls, operation_name): + if operation_name == "chat": + deployment_url = os.getenv("AZURE_CHAT_COMPLETIONS_DEPLOYMENT_URL") + api_key = os.getenv("AZURE_CHAT_COMPLETIONS_API_KEY") + elif operation_name == "embeddings": + deployment_url = os.getenv("AZURE_EMBEDDINGS_DEPLOYMENT_URL") + api_key = os.getenv("AZURE_EMBEDDINGS_API_KEY") + else: + raise NotImplementedError() + + parsed_url = urlparse(deployment_url) + endpoint = f"https://{parsed_url.hostname}" + parsed_qs = parse_qs(parsed_url.query) + # query string entries are lists + api_version = parsed_qs["api-version"][0] + return cls( + api_key=api_key, + endpoint=endpoint, + api_version=api_version, + operation_name=operation_name, + ) + + def _get_client_kwargs(self): + return { + "api_key": self.api_key, + "azure_endpoint": self.endpoint, + "api_version": self.api_version, + "max_retries": 1, + } + + def get_client(self): + return openai.AzureOpenAI(**self._get_client_kwargs()) + + def get_async_client(self): + return openai.AsyncAzureOpenAI(**self._get_client_kwargs()) + + +class OpenAIProvider: + def __init__(self, api_key, operation_name): + self.api_key = api_key + + self.operation_name = operation_name + + self.server_address = "api.openai.com" + self.server_port = 443 + + @classmethod + def from_env(cls, operation_name): + api_key = os.getenv("OPENAI_API_KEY", OPENAI_API_KEY) + return cls(api_key=api_key, operation_name=operation_name) + + def _get_client_kwargs(self): + return { + "api_key": self.api_key, + "max_retries": 1, + } + + def get_client(self): + return openai.OpenAI(**self._get_client_kwargs()) + + def get_async_client(self): + return openai.AsyncOpenAI(**self._get_client_kwargs()) + + +class OllamaProvider: + def __init__(self, operation_name): + self.api_key = "unused" + + self.operation_name = operation_name + + self.server_address = "localhost" + self.server_port = 11434 + + @classmethod + def from_env(cls, operation_name): + return cls(operation_name=operation_name) + + def _get_client_kwargs(self): + return { + "base_url": f"http://{self.server_address}:{self.server_port}/v1", + "api_key": self.api_key, + "max_retries": 1, + } + + def get_client(self): + return openai.OpenAI(**self._get_client_kwargs()) + + def get_async_client(self): + return openai.AsyncOpenAI(**self._get_client_kwargs()) + + +@pytest.fixture +def azure_provider_chat_completions(default_azure_env): + return AzureProvider.from_env(operation_name="chat") + + +@pytest.fixture +def openai_provider_chat_completions(default_openai_env): + return OpenAIProvider.from_env(operation_name="chat") + + +@pytest.fixture +def ollama_provider_chat_completions(): + return OllamaProvider.from_env(operation_name="chat") + + +@pytest.fixture +def azure_provider_embeddings(default_azure_env): + return AzureProvider.from_env(operation_name="embeddings") + + +@pytest.fixture +def openai_provider_embeddings(default_openai_env): + return OpenAIProvider.from_env(operation_name="embeddings") + + +@pytest.fixture +def ollama_provider_embeddings(): + return OllamaProvider.from_env(operation_name="embeddings") + + +# data_point = 0.006543334107846022 +def assert_operation_duration_metric(provider, metric: Histogram, attributes: dict, data_point: float): + assert metric.name == "gen_ai.client.operation.duration" + default_attributes = { + "gen_ai.operation.name": provider.operation_name, + "gen_ai.system": "openai", + "server.address": provider.server_address, + "server.port": provider.server_port, + } + assert_metric_expected( + metric, + [ + create_histogram_data_point( + count=1, + sum_data_point=data_point, + max_data_point=data_point, + min_data_point=data_point, + attributes={**default_attributes, **attributes}, + ), + ], + est_value_delta=0.25, + ) + + +def assert_error_operation_duration_metric(provider, metric: Histogram, attributes: dict, data_point: float): + assert metric.name == "gen_ai.client.operation.duration" + default_attributes = { + "gen_ai.operation.name": provider.operation_name, + "gen_ai.system": "openai", + "error.type": "APIConnectionError", + "server.address": "localhost", + "server.port": 9999, + } + assert_metric_expected( + metric, + [ + create_histogram_data_point( + count=1, + sum_data_point=data_point, + max_data_point=data_point, + min_data_point=data_point, + attributes={**default_attributes, **attributes}, + ), + ], + est_value_delta=0.5, + ) + + +def assert_token_usage_input_metric(provider, metric: Histogram, attributes: dict, input_data_point: int): + assert metric.name == "gen_ai.client.token.usage" + default_attributes = { + "gen_ai.operation.name": provider.operation_name, + "gen_ai.system": "openai", + "server.address": provider.server_address, + "server.port": provider.server_port, + "gen_ai.token.type": "input", + } + assert_metric_expected( + metric, + [ + create_histogram_data_point( + count=1, + sum_data_point=input_data_point, + max_data_point=input_data_point, + min_data_point=input_data_point, + attributes={**default_attributes, **attributes}, + ), + ], + ) + + +def assert_token_usage_metric( + provider, metric: Histogram, attributes: dict, input_data_point: int, output_data_point: int +): + assert metric.name == "gen_ai.client.token.usage" + default_attributes = { + "gen_ai.operation.name": provider.operation_name, + "gen_ai.system": "openai", + "server.address": provider.server_address, + "server.port": provider.server_port, + "gen_ai.token.type": "input", + } + assert_metric_expected( + metric, + [ + create_histogram_data_point( + count=1, + sum_data_point=input_data_point, + max_data_point=input_data_point, + min_data_point=input_data_point, + attributes={**default_attributes, **attributes, "gen_ai.token.type": "input"}, + ), + create_histogram_data_point( + count=1, + sum_data_point=output_data_point, + max_data_point=output_data_point, + min_data_point=output_data_point, + attributes={**default_attributes, **attributes, "gen_ai.token.type": "output"}, + ), + ], + ) 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 f79ecae..fea26f1 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_chat_completions.py +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_chat_completions.py @@ -15,12 +15,11 @@ # limitations under the License. import json -import os -from unittest import IsolatedAsyncioTestCase, mock +from unittest import mock import openai +import pytest from opentelemetry.instrumentation.openai import OpenAIInstrumentor -from opentelemetry.test.test_base import TestBase from opentelemetry.trace import SpanKind, StatusCode from opentelemetry.semconv._incubating.attributes.gen_ai_attributes import ( GEN_AI_OPERATION_NAME, @@ -41,1069 +40,1533 @@ from opentelemetry.semconv.attributes.error_attributes import ERROR_TYPE from opentelemetry.semconv.attributes.server_attributes import SERVER_ADDRESS, SERVER_PORT -from .base import ( - LOCAL_MODEL, - OPENAI_API_KEY, - OPENAI_ORG_ID, - OPENAI_PROJECT_ID, - OpenaiMixin, +from .conftest import ( + assert_error_operation_duration_metric, + assert_operation_duration_metric, + assert_token_usage_metric, ) - - -class TestChatCompletions(OpenaiMixin, TestBase): - def test_basic(self): - messages = [ - { - "role": "user", - "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", - } - ] - - chat_completion = self.client.chat.completions.create(model=self.openai_env.model, messages=messages) - - self.assertEqual(chat_completion.choices[0].message.content, "South Atlantic Ocean.") - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_ID: "chatcmpl-A9CSutUkLCxwZIXuXRXlgEJUCMnlT", - GEN_AI_RESPONSE_MODEL: self.openai_env.response_model, - GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), - GEN_AI_USAGE_INPUT_TOKENS: 24, - GEN_AI_USAGE_OUTPUT_TOKENS: 4, - SERVER_ADDRESS: "api.openai.com", - SERVER_PORT: 443, - }, - ) - self.assertEqual(span.events, ()) - - operation_duration_metric, token_usage_metric = self.get_sorted_metrics() - self.assertOperationDurationMetric(operation_duration_metric) - self.assertTokenUsageMetric(token_usage_metric) - - def test_all_the_client_options(self): - messages = [ - { - "role": "user", - "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", - } - ] - - chat_completion = self.client.chat.completions.create( - model=self.openai_env.model, - messages=messages, - frequency_penalty=0, - max_completion_tokens=100, - presence_penalty=0, - temperature=1, - top_p=1, - stop="foo", - ) - - self.assertEqual(chat_completion.choices[0].message.content, "South Atlantic Ocean.") - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_FREQUENCY_PENALTY: 0, - GEN_AI_REQUEST_MAX_TOKENS: 100, - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_REQUEST_PRESENCE_PENALTY: 0, - GEN_AI_REQUEST_STOP_SEQUENCES: ("foo",), - GEN_AI_REQUEST_TEMPERATURE: 1, - GEN_AI_REQUEST_TOP_P: 1, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_ID: "chatcmpl-ADUdg61PwWqn3FPn4VNkz4vwMkS62", - GEN_AI_RESPONSE_MODEL: self.openai_env.response_model, - GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), - GEN_AI_USAGE_INPUT_TOKENS: 24, - GEN_AI_USAGE_OUTPUT_TOKENS: 4, - SERVER_ADDRESS: "api.openai.com", - SERVER_PORT: 443, - }, - ) - self.assertEqual(span.events, ()) - - operation_duration_metric, token_usage_metric = self.get_sorted_metrics() - self.assertOperationDurationMetric(operation_duration_metric) - self.assertTokenUsageMetric(token_usage_metric) - - def test_function_calling_with_tools(self): - 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.", - }, +from .utils import get_sorted_metrics + +providers = ["openai_provider_chat_completions", "ollama_provider_chat_completions", "azure_provider_chat_completions"] + + +# TODO: provide a wrapper to generate parameters names and values for parametrize? +test_basic_test_data = [ + ( + "openai_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "South Atlantic Ocean.", + "chatcmpl-AEEtEV5mndU1WYBSLgvTpAIKAoYeu", + 24, + 4, + 0.006761051714420319, + ), + ( + "azure_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini", + "South Atlantic Ocean", + "chatcmpl-AEEtFi8N27MCQoHr62DvUowImjwEc", + 24, + 3, + 0.002889830619096756, + ), + ( + "ollama_provider_chat_completions", + "qwen2.5:0.5b", + "qwen2.5:0.5b", + "The Falklands Islands are located in the oceans south of South America.", + "chatcmpl-645", + 46, + 15, + 0.002600736916065216, + ), +] + + +@pytest.mark.vcr() +@pytest.mark.parametrize( + "provider_str,model,response_model,content,response_id,input_tokens,output_tokens,duration", test_basic_test_data +) +def test_basic( + provider_str, + model, + response_model, + content, + response_id, + input_tokens, + output_tokens, + duration, + trace_exporter, + metrics_reader, + request, +): + provider = request.getfixturevalue(provider_str) + + client = provider.get_client() + + messages = [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", + } + ] + + chat_completion = client.chat.completions.create(model=model, messages=messages) + + assert chat_completion.choices[0].message.content == content + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"chat {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.UNSET + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: "chat", + GEN_AI_REQUEST_MODEL: model, + GEN_AI_SYSTEM: "openai", + GEN_AI_RESPONSE_ID: response_id, + GEN_AI_RESPONSE_MODEL: response_model, + GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), + GEN_AI_USAGE_INPUT_TOKENS: input_tokens, + GEN_AI_USAGE_OUTPUT_TOKENS: output_tokens, + SERVER_ADDRESS: provider.server_address, + SERVER_PORT: provider.server_port, + } + assert span.events == () + + operation_duration_metric, token_usage_metric = get_sorted_metrics(metrics_reader) + attributes = { + GEN_AI_REQUEST_MODEL: model, + GEN_AI_RESPONSE_MODEL: response_model, + } + assert_operation_duration_metric(provider, operation_duration_metric, attributes=attributes, data_point=duration) + assert_token_usage_metric( + provider, + token_usage_metric, + attributes=attributes, + input_data_point=input_tokens, + output_data_point=output_tokens, + ) + + +test_all_the_client_options_test_data = [ + ( + "openai_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "South Atlantic Ocean.", + "chatcmpl-AEGEFRHEOGpX0H3Nx84zgOEbJ8g6Y", + 24, + 4, + 0.006761051714420319, + ), + ( + "azure_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini", + "South Atlantic Ocean.", + "chatcmpl-AEGHLLqYkgJxUgLgX8RCLeL85irQR", + 24, + 4, + 0.002889830619096756, + ), + ( + "ollama_provider_chat_completions", + "qwen2.5:0.5b", + "qwen2.5:0.5b", + "The Great British Oceanic Peninsula.", + "chatcmpl-398", + 46, + 8, + 0.002600736916065216, + ), +] + + +@pytest.mark.vcr() +@pytest.mark.parametrize( + "provider_str,model,response_model,content,response_id,input_tokens,output_tokens,duration", + test_all_the_client_options_test_data, +) +def test_all_the_client_options( + provider_str, + model, + response_model, + content, + response_id, + input_tokens, + output_tokens, + duration, + trace_exporter, + metrics_reader, + request, +): + provider = request.getfixturevalue(provider_str) + client = provider.get_client() + + messages = [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", + } + ] + + chat_completion = client.chat.completions.create( + model=model, + messages=messages, + frequency_penalty=0, + max_tokens=100, # AzureOpenAI still does not support max_completions_tokens + presence_penalty=0, + temperature=1, + top_p=1, + stop="foo", + ) + + assert chat_completion.choices[0].message.content == content + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"chat {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.UNSET + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: "chat", + GEN_AI_REQUEST_FREQUENCY_PENALTY: 0, + GEN_AI_REQUEST_MAX_TOKENS: 100, + GEN_AI_REQUEST_MODEL: model, + GEN_AI_REQUEST_PRESENCE_PENALTY: 0, + GEN_AI_REQUEST_STOP_SEQUENCES: ("foo",), + GEN_AI_REQUEST_TEMPERATURE: 1, + GEN_AI_REQUEST_TOP_P: 1, + GEN_AI_SYSTEM: "openai", + GEN_AI_RESPONSE_ID: response_id, + GEN_AI_RESPONSE_MODEL: response_model, + GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), + GEN_AI_USAGE_INPUT_TOKENS: input_tokens, + GEN_AI_USAGE_OUTPUT_TOKENS: output_tokens, + SERVER_ADDRESS: provider.server_address, + SERVER_PORT: provider.server_port, + } + assert span.events == () + + operation_duration_metric, token_usage_metric = get_sorted_metrics(metrics_reader) + attributes = { + GEN_AI_REQUEST_MODEL: model, + GEN_AI_RESPONSE_MODEL: response_model, + } + assert_operation_duration_metric(provider, operation_duration_metric, attributes=attributes, data_point=duration) + assert_token_usage_metric( + provider, + token_usage_metric, + attributes=attributes, + input_data_point=input_tokens, + output_data_point=output_tokens, + ) + + +test_function_calling_with_tools_test_data = [ + ( + "openai_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "South Atlantic Ocean.", + "chatcmpl-AEGIgPL1ReEL2yG6M4MrD3Uw960Bu", + 140, + 19, + 0.006761051714420319, + ), + ( + "azure_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini", + "South Atlantic Ocean", + "chatcmpl-AEGIh5ygWzdZJL7BvIVeFLmgDSdT7", + 140, + 19, + 0.002889830619096756, + ), + ( + "ollama_provider_chat_completions", + "qwen2.5:0.5b", + "qwen2.5:0.5b", + "The Falklands Islands are located in the oceans south of South America.", + "chatcmpl-363", + 241, + 28, + 0.002600736916065216, + ), +] + + +@pytest.mark.vcr() +@pytest.mark.parametrize( + "provider_str,model,response_model,content,response_id,input_tokens,output_tokens,duration", + test_function_calling_with_tools_test_data, +) +def test_function_calling_with_tools( + provider_str, + model, + response_model, + content, + response_id, + input_tokens, + output_tokens, + duration, + trace_exporter, + metrics_reader, + request, +): + provider = request.getfixturevalue(provider_str) + client = provider.get_client() + + 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, }, + "required": ["order_id"], + "additionalProperties": False, }, - } - ] - - 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"}, - ] - - response = self.client.chat.completions.create(model=self.openai_env.model, messages=messages, tools=tools) - tool_call = response.choices[0].message.tool_calls[0] - self.assertEqual(tool_call.function.name, "get_delivery_date") - self.assertEqual(json.loads(tool_call.function.arguments), {"order_id": "order_12345"}) - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_ID: "chatcmpl-A9CSwJdb2481bxsjIiuD8yIBOAfql", - GEN_AI_RESPONSE_MODEL: self.openai_env.response_model, - GEN_AI_RESPONSE_FINISH_REASONS: ("tool_calls",), - GEN_AI_USAGE_INPUT_TOKENS: 140, - GEN_AI_USAGE_OUTPUT_TOKENS: 19, - SERVER_ADDRESS: "api.openai.com", - SERVER_PORT: 443, - }, - ) - self.assertEqual(span.events, ()) - - operation_duration_metric, token_usage_metric = self.get_sorted_metrics() - self.assertOperationDurationMetric(operation_duration_metric) - self.assertTokenUsageMetric(token_usage_metric, input_data_point=140, output_data_point=19) - - def test_tools_with_capture_content(self): - # Redo the instrumentation dance to be affected by the environment variable - OpenAIInstrumentor().uninstrument() - with mock.patch.dict("os.environ", {"ELASTIC_OTEL_GENAI_CAPTURE_CONTENT": "true"}): - OpenAIInstrumentor().instrument() - - 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.", - }, + } + ] + + 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"}, + ] + + response = client.chat.completions.create(model=model, messages=messages, tools=tools) + tool_call = response.choices[0].message.tool_calls[0] + assert tool_call.function.name == "get_delivery_date" + # FIXME: add to test data + assert json.loads(tool_call.function.arguments) == {"order_id": "order_12345"} + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"chat {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.UNSET + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: "chat", + GEN_AI_REQUEST_MODEL: model, + GEN_AI_SYSTEM: "openai", + GEN_AI_RESPONSE_ID: response_id, + GEN_AI_RESPONSE_MODEL: response_model, + GEN_AI_RESPONSE_FINISH_REASONS: ("tool_calls",), + GEN_AI_USAGE_INPUT_TOKENS: input_tokens, + GEN_AI_USAGE_OUTPUT_TOKENS: output_tokens, + SERVER_ADDRESS: provider.server_address, + SERVER_PORT: provider.server_port, + } + assert span.events == () + + operation_duration_metric, token_usage_metric = get_sorted_metrics(metrics_reader) + attributes = { + GEN_AI_REQUEST_MODEL: model, + GEN_AI_RESPONSE_MODEL: response_model, + } + assert_operation_duration_metric(provider, operation_duration_metric, attributes=attributes, data_point=duration) + assert_token_usage_metric( + provider, + token_usage_metric, + attributes=attributes, + input_data_point=input_tokens, + output_data_point=output_tokens, + ) + + +test_tools_with_capture_content_test_data = [ + ( + "openai_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "South Atlantic Ocean.", + "chatcmpl-AEGM5OhimYEMDsRq20IQCBx4vzf2Z", + 140, + 19, + 0.006761051714420319, + ), + ( + "azure_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini", + "South Atlantic Ocean", + "chatcmpl-AEGM6niNxWuulOpOMXNelXUZqF443", + 140, + 19, + 0.002889830619096756, + ), + ( + "ollama_provider_chat_completions", + "qwen2.5:0.5b", + "qwen2.5:0.5b", + "The Falklands Islands are located in the oceans south of South America.", + "chatcmpl-556", + 241, + 28, + 0.002600736916065216, + ), +] + + +@pytest.mark.vcr() +@pytest.mark.parametrize( + "provider_str,model,response_model,content,response_id,input_tokens,output_tokens,duration", + test_tools_with_capture_content_test_data, +) +def test_tools_with_capture_content( + provider_str, + model, + response_model, + content, + response_id, + input_tokens, + output_tokens, + duration, + trace_exporter, + metrics_reader, + request, +): + provider = request.getfixturevalue(provider_str) + client = provider.get_client() + + # Redo the instrumentation dance to be affected by the environment variable + OpenAIInstrumentor().uninstrument() + with mock.patch.dict("os.environ", {"ELASTIC_OTEL_GENAI_CAPTURE_CONTENT": "true"}): + OpenAIInstrumentor().instrument() + + 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, }, + "required": ["order_id"], + "additionalProperties": False, }, - } - ] - - 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"}, - ] - - response = self.client.chat.completions.create(model=self.openai_env.model, messages=messages, tools=tools) - tool_call = response.choices[0].message.tool_calls[0] - self.assertEqual(tool_call.function.name, "get_delivery_date") - self.assertEqual(json.loads(tool_call.function.arguments), {"order_id": "order_12345"}) - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_ID: "chatcmpl-A9CSzz613rRslGZpG79Js1deMz98G", - GEN_AI_RESPONSE_MODEL: self.openai_env.response_model, - GEN_AI_RESPONSE_FINISH_REASONS: ("tool_calls",), - GEN_AI_USAGE_INPUT_TOKENS: 140, - GEN_AI_USAGE_OUTPUT_TOKENS: 19, - SERVER_ADDRESS: "api.openai.com", - SERVER_PORT: 443, - }, - ) - - self.assertEqual(len(span.events), 2) - prompt_event, completion_event = span.events - self.assertEqual(prompt_event.name, "gen_ai.content.prompt") - self.assertEqual(dict(prompt_event.attributes), {"gen_ai.prompt": json.dumps(messages)}) - self.assertEqual(completion_event.name, "gen_ai.content.completion") - self.assertEqual( - dict(completion_event.attributes), - {"gen_ai.completion": '[{"role": "assistant", "content": {"order_id": "order_12345"}}]'}, - ) - - def test_connection_error(self): - client = openai.Client(base_url="http://localhost:9999/v5", api_key="unused", max_retries=1) - messages = [ - { - "role": "user", - "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", - } - ] - - self.assertRaises( - Exception, lambda: client.chat.completions.create(model=self.openai_env.model, messages=messages) - ) - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.ERROR) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_SYSTEM: "openai", - ERROR_TYPE: "APIConnectionError", - SERVER_ADDRESS: "localhost", - SERVER_PORT: 9999, - }, - ) - self.assertEqual(span.events, ()) - - (operation_duration_metric,) = self.get_sorted_metrics() - self.assertErrorOperationDurationMetric(operation_duration_metric, {"error.type": "APIConnectionError"}) - - def test_local(self): - client = openai.Client(base_url="http://localhost:11434/v1", api_key="unused", max_retries=1) - - messages = [ - { - "role": "user", - "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", - } - ] - - chat_completion = client.chat.completions.create(model=LOCAL_MODEL, messages=messages) - - self.assertEqual( - chat_completion.choices[0].message.content, "The South Atlantic Ocean contains the Falklands Islands." - ) - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {LOCAL_MODEL}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: LOCAL_MODEL, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_ID: "chatcmpl-753", - GEN_AI_RESPONSE_MODEL: LOCAL_MODEL, - GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), - GEN_AI_USAGE_INPUT_TOKENS: 52, - GEN_AI_USAGE_OUTPUT_TOKENS: 11, - SERVER_ADDRESS: "localhost", - SERVER_PORT: 11434, }, - ) - self.assertEqual(span.events, ()) - - def test_local_with_capture_content(self): - # Redo the instrumentation dance to be affected by the environment variable - OpenAIInstrumentor().uninstrument() - with mock.patch.dict("os.environ", {"ELASTIC_OTEL_GENAI_CAPTURE_CONTENT": "true"}): - OpenAIInstrumentor().instrument() - client = openai.Client(base_url="http://localhost:11434/v1", api_key="unused", max_retries=1) - - messages = [ - { - "role": "user", - "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", - } - ] - - chat_completion = client.chat.completions.create(model=LOCAL_MODEL, messages=messages) - - self.assertEqual(chat_completion.choices[0].message.content, "ocean A: Atlantic, B: Arctic Ocean") - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {LOCAL_MODEL}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: LOCAL_MODEL, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_ID: "chatcmpl-364", - GEN_AI_RESPONSE_MODEL: LOCAL_MODEL, - GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), - GEN_AI_USAGE_INPUT_TOKENS: 52, - GEN_AI_USAGE_OUTPUT_TOKENS: 11, - SERVER_ADDRESS: "localhost", - SERVER_PORT: 11434, - }, - ) - self.assertEqual(len(span.events), 2) - prompt_event, completion_event = span.events - self.assertEqual(prompt_event.name, "gen_ai.content.prompt") - self.assertEqual(dict(prompt_event.attributes), {"gen_ai.prompt": json.dumps(messages)}) - self.assertEqual(completion_event.name, "gen_ai.content.completion") - self.assertEqual( - dict(completion_event.attributes), - {"gen_ai.completion": '[{"role": "assistant", "content": "ocean A: Atlantic, B: Arctic Ocean"}]'}, - ) - - def test_stream(self): - messages = [ - { - "role": "user", - "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", - } - ] - - chat_completion = self.client.chat.completions.create( - model=self.openai_env.model, messages=messages, stream=True - ) - - chunks = [chunk.choices[0].delta.content or "" for chunk in chat_completion if chunk.choices] - self.assertEqual("".join(chunks), "South Atlantic Ocean.") - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_ID: "chatcmpl-A6Fj6kEv975Uw3vNCyA2njL0mP4Lg", - GEN_AI_RESPONSE_MODEL: self.openai_env.response_model, - GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), - SERVER_ADDRESS: "api.openai.com", - SERVER_PORT: 443, - }, - ) - self.assertEqual(span.events, ()) - - (operation_duration_metric,) = self.get_sorted_metrics() - self.assertOperationDurationMetric(operation_duration_metric) - - def test_stream_with_include_usage_option(self): - messages = [ - { - "role": "user", - "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", - } - ] - - chat_completion = self.client.chat.completions.create( - model=self.openai_env.model, messages=messages, stream=True, stream_options={"include_usage": True} - ) - - chunks = [chunk.choices[0].delta.content or "" for chunk in chat_completion if chunk.choices] - self.assertEqual("".join(chunks), "South Atlantic Ocean.") - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_ID: "chatcmpl-A6Fj6QSKWN7eCCTYz5lKYkZMHngDq", - GEN_AI_RESPONSE_MODEL: self.openai_env.response_model, - GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), - GEN_AI_USAGE_INPUT_TOKENS: 24, - GEN_AI_USAGE_OUTPUT_TOKENS: 4, - SERVER_ADDRESS: "api.openai.com", - SERVER_PORT: 443, - }, - ) - self.assertEqual(span.events, ()) - - operation_duration_metric, token_usage_metric = self.get_sorted_metrics() - self.assertOperationDurationMetric(operation_duration_metric) - self.assertTokenUsageMetric(token_usage_metric) - - def test_stream_with_tools_and_capture_content(self): - # Redo the instrumentation dance to be affected by the environment variable - OpenAIInstrumentor().uninstrument() - with mock.patch.dict("os.environ", {"ELASTIC_OTEL_GENAI_CAPTURE_CONTENT": "true"}): - OpenAIInstrumentor().instrument() - - 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.", - }, + } + ] + + 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"}, + ] + + response = client.chat.completions.create(model=model, messages=messages, tools=tools) + tool_call = response.choices[0].message.tool_calls[0] + assert tool_call.function.name == "get_delivery_date" + assert json.loads(tool_call.function.arguments) == {"order_id": "order_12345"} + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"chat {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.UNSET + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: "chat", + GEN_AI_REQUEST_MODEL: model, + GEN_AI_SYSTEM: "openai", + GEN_AI_RESPONSE_ID: response_id, + GEN_AI_RESPONSE_MODEL: response_model, + GEN_AI_RESPONSE_FINISH_REASONS: ("tool_calls",), + GEN_AI_USAGE_INPUT_TOKENS: input_tokens, + GEN_AI_USAGE_OUTPUT_TOKENS: output_tokens, + SERVER_ADDRESS: provider.server_address, + SERVER_PORT: provider.server_port, + } + + assert len(span.events) == 2 + prompt_event, completion_event = span.events + assert prompt_event.name == "gen_ai.content.prompt" + assert dict(prompt_event.attributes) == {"gen_ai.prompt": json.dumps(messages)} + assert completion_event.name == "gen_ai.content.completion" + assert dict(completion_event.attributes) == { + "gen_ai.completion": '[{"role": "assistant", "content": {"order_id": "order_12345"}}]' + } + + operation_duration_metric, token_usage_metric = get_sorted_metrics(metrics_reader) + attributes = { + GEN_AI_REQUEST_MODEL: model, + GEN_AI_RESPONSE_MODEL: response_model, + } + assert_operation_duration_metric(provider, operation_duration_metric, attributes=attributes, data_point=duration) + assert_token_usage_metric( + provider, + token_usage_metric, + attributes=attributes, + input_data_point=input_tokens, + output_data_point=output_tokens, + ) + + +test_connection_error_test_data = [ + ( + "openai_provider_chat_completions", + "gpt-4o-mini", + 0.006761051714420319, + ), + ( + "azure_provider_chat_completions", + "gpt-4o-mini", + 0.002889830619096756, + ), + ( + "ollama_provider_chat_completions", + "qwen2.5:0.5b", + 0.002600736916065216, + ), +] + + +@pytest.mark.vcr() +@pytest.mark.parametrize("provider_str,model,duration", test_connection_error_test_data) +def test_connection_error(provider_str, model, duration, trace_exporter, metrics_reader, request): + provider = request.getfixturevalue(provider_str) + + client = openai.Client(base_url="http://localhost:9999/v5", api_key="unused", max_retries=1) + messages = [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", + } + ] + + with pytest.raises(Exception): + client.chat.completions.create(model=model, messages=messages) + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"chat {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.ERROR + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: "chat", + GEN_AI_REQUEST_MODEL: model, + GEN_AI_SYSTEM: "openai", + ERROR_TYPE: "APIConnectionError", + SERVER_ADDRESS: "localhost", + SERVER_PORT: 9999, + } + assert span.events == () + + (operation_duration_metric,) = get_sorted_metrics(metrics_reader) + attributes = { + GEN_AI_REQUEST_MODEL: model, + ERROR_TYPE: "APIConnectionError", + } + assert_error_operation_duration_metric( + provider, + operation_duration_metric, + attributes=attributes, + data_point=duration, + ) + + +test_basic_with_capture_content_test_data = [ + ( + "openai_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "South Atlantic Ocean.", + "chatcmpl-AEFu3fjzje87q8tfrYWpazqelNIfW", + 24, + 4, + 0.006761051714420319, + ), + ( + "azure_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini", + "Atlantic Ocean.", + "chatcmpl-AEFu4REQubxeCCkrv6wgeJ4VdN6o5", + 24, + 3, + 0.002889830619096756, + ), + ( + "ollama_provider_chat_completions", + "qwen2.5:0.5b", + "qwen2.5:0.5b", + "The Atlantic Ocean contains the Falkland Islands.", + "chatcmpl-976", + 46, + 10, + 0.002600736916065216, + ), +] + + +@pytest.mark.vcr() +@pytest.mark.parametrize( + "provider_str,model,response_model,content,response_id,input_tokens,output_tokens,duration", + test_basic_with_capture_content_test_data, +) +def test_basic_with_capture_content( + provider_str, + model, + response_model, + content, + response_id, + input_tokens, + output_tokens, + duration, + trace_exporter, + metrics_reader, + request, +): + provider = request.getfixturevalue(provider_str) + client = provider.get_client() + + # Redo the instrumentation dance to be affected by the environment variable + OpenAIInstrumentor().uninstrument() + with mock.patch.dict("os.environ", {"ELASTIC_OTEL_GENAI_CAPTURE_CONTENT": "true"}): + OpenAIInstrumentor().instrument() + + messages = [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", + } + ] + + chat_completion = client.chat.completions.create(model=model, messages=messages) + + assert chat_completion.choices[0].message.content == content + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"chat {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.UNSET + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: "chat", + GEN_AI_REQUEST_MODEL: model, + GEN_AI_SYSTEM: "openai", + GEN_AI_RESPONSE_ID: response_id, + GEN_AI_RESPONSE_MODEL: response_model, + GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), + GEN_AI_USAGE_INPUT_TOKENS: input_tokens, + GEN_AI_USAGE_OUTPUT_TOKENS: output_tokens, + SERVER_ADDRESS: provider.server_address, + SERVER_PORT: provider.server_port, + } + + assert len(span.events) == 2 + prompt_event, completion_event = span.events + assert prompt_event.name == "gen_ai.content.prompt" + assert dict(prompt_event.attributes) == {"gen_ai.prompt": json.dumps(messages)} + assert completion_event.name == "gen_ai.content.completion" + assert dict(completion_event.attributes) == { + "gen_ai.completion": '[{"role": "assistant", "content": "' + content + '"}]' + } + + operation_duration_metric, token_usage_metric = get_sorted_metrics(metrics_reader) + attributes = { + GEN_AI_REQUEST_MODEL: model, + GEN_AI_RESPONSE_MODEL: response_model, + } + assert_operation_duration_metric(provider, operation_duration_metric, attributes=attributes, data_point=duration) + assert_token_usage_metric( + provider, + token_usage_metric, + attributes=attributes, + input_data_point=input_tokens, + output_data_point=output_tokens, + ) + + +test_stream_test_data = [ + ( + "openai_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "South Atlantic Ocean.", + "chatcmpl-AEGTAvX2YSIO9EQwMleHTB91Cgn4G", + 0.006761051714420319, + ), + ( + "azure_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini", + "South Atlantic Ocean.", + "chatcmpl-AEGTBkVVthwTc3DgRp6RGKJxyY1pE", + 0.002889830619096756, + ), + ( + "ollama_provider_chat_completions", + "qwen2.5:0.5b", + "qwen2.5:0.5b", + "The Falkland Islands, also known as the Argentinian Islands or British South America Land (BSAL), is an archipelago of several small islands and peninsulas located off the coast of Argentina. It contains nine uninhabited Falkland Islands, plus a mix of uninhabitable territory and other small features that are not considered part of the Falkland Islands' current administrative divisions.", + "chatcmpl-415", + 0.002600736916065216, + ), +] + + +@pytest.mark.vcr() +@pytest.mark.parametrize("provider_str,model,response_model,content,response_id,duration", test_stream_test_data) +def test_stream( + provider_str, model, response_model, content, response_id, duration, trace_exporter, metrics_reader, request +): + provider = request.getfixturevalue(provider_str) + client = provider.get_client() + + messages = [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", + } + ] + + chat_completion = client.chat.completions.create(model=model, messages=messages, stream=True) + + chunks = [chunk.choices[0].delta.content or "" for chunk in chat_completion if chunk.choices] + assert "".join(chunks) == content + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"chat {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.UNSET + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: "chat", + GEN_AI_REQUEST_MODEL: model, + GEN_AI_SYSTEM: "openai", + GEN_AI_RESPONSE_ID: response_id, + GEN_AI_RESPONSE_MODEL: response_model, + GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), + SERVER_ADDRESS: provider.server_address, + SERVER_PORT: provider.server_port, + } + assert span.events == () + + (operation_duration_metric,) = get_sorted_metrics(metrics_reader) + attributes = { + GEN_AI_REQUEST_MODEL: model, + GEN_AI_RESPONSE_MODEL: response_model, + } + assert_operation_duration_metric(provider, operation_duration_metric, attributes=attributes, data_point=duration) + + +# FIXME: add custom ollama +test_stream_with_include_usage_option_test_data = [ + ( + "openai_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "South Atlantic Ocean.", + "chatcmpl-AEGTE6nGqR4tbVuy6CPSHnXIF2eqy", + 24, + 4, + 0.006761051714420319, + ), + ( + "azure_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini", + "South Atlantic Ocean.", + "chatcmpl-AEGTFYMyoBBDm4Qz37Lc8bekb2QOO", + 24, + 4, + 0.002889830619096756, + ), +] + + +@pytest.mark.vcr() +@pytest.mark.parametrize( + "provider_str,model,response_model,content,response_id,input_tokens,output_tokens,duration", + test_stream_with_include_usage_option_test_data, +) +def test_stream_with_include_usage_option( + provider_str, + model, + response_model, + content, + response_id, + input_tokens, + output_tokens, + duration, + trace_exporter, + metrics_reader, + request, +): + provider = request.getfixturevalue(provider_str) + client = provider.get_client() + + messages = [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", + } + ] + + chat_completion = client.chat.completions.create( + model=model, messages=messages, stream=True, stream_options={"include_usage": True} + ) + + chunks = [chunk.choices[0].delta.content or "" for chunk in chat_completion if chunk.choices] + assert "".join(chunks) == content + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"chat {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.UNSET + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: "chat", + GEN_AI_REQUEST_MODEL: model, + GEN_AI_SYSTEM: "openai", + GEN_AI_RESPONSE_ID: response_id, + GEN_AI_RESPONSE_MODEL: response_model, + GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), + GEN_AI_USAGE_INPUT_TOKENS: input_tokens, + GEN_AI_USAGE_OUTPUT_TOKENS: output_tokens, + SERVER_ADDRESS: provider.server_address, + SERVER_PORT: provider.server_port, + } + assert span.events == () + + operation_duration_metric, token_usage_metric = get_sorted_metrics(metrics_reader) + attributes = { + GEN_AI_REQUEST_MODEL: model, + GEN_AI_RESPONSE_MODEL: response_model, + } + assert_operation_duration_metric(provider, operation_duration_metric, attributes=attributes, data_point=duration) + assert_token_usage_metric( + provider, + token_usage_metric, + attributes=attributes, + input_data_point=input_tokens, + output_data_point=output_tokens, + ) + + +test_stream_with_tools_and_capture_content_test_data = [ + ( + "openai_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "", + '{"order_id": "order_12345"}', + "chatcmpl-AEGTFZ2zBPeLJlZ1EA10ZEDA12VfO", + "tool_calls", + 0.006761051714420319, + ), + ( + "azure_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini", + "", + '{"order_id": "order_12345"}', + "chatcmpl-AEGTHbbvqBK2BE52I8GByDCM2dypS", + "tool_calls", + 0.002889830619096756, + ), + ( + "ollama_provider_chat_completions", + "qwen2.5:0.5b", + "qwen2.5:0.5b", + '\n{"name": "get_delivery_date", "arguments": {"order_id": "order_12345"}}\n', + json.dumps( + '\n{"name": "get_delivery_date", "arguments": {"order_id": "order_12345"}}\n' + ), + "chatcmpl-598", + "stop", + 0.002600736916065216, + ), +] + + +@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_content_test_data, +) +def test_stream_with_tools_and_capture_content( + provider_str, + model, + response_model, + content, + completion_content, + response_id, + finish_reason, + duration, + trace_exporter, + metrics_reader, + request, +): + provider = request.getfixturevalue(provider_str) + client = provider.get_client() + + # Redo the instrumentation dance to be affected by the environment variable + OpenAIInstrumentor().uninstrument() + with mock.patch.dict("os.environ", {"ELASTIC_OTEL_GENAI_CAPTURE_CONTENT": "true"}): + OpenAIInstrumentor().instrument() + + 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, }, + "required": ["order_id"], + "additionalProperties": False, }, - } - ] - - 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"}, - ] - - chat_completion = self.client.chat.completions.create( - model=self.openai_env.model, messages=messages, tools=tools, stream=True - ) - - chunks = [chunk.choices[0].delta.content or "" for chunk in chat_completion if chunk.choices] - self.assertEqual("".join(chunks), "") - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_ID: "chatcmpl-A86CT7lmQpCMrARhR2GkBP5JBYLfn", - GEN_AI_RESPONSE_MODEL: self.openai_env.response_model, - GEN_AI_RESPONSE_FINISH_REASONS: ("tool_calls",), - SERVER_ADDRESS: "api.openai.com", - SERVER_PORT: 443, - }, - ) - - self.assertEqual(len(span.events), 2) - prompt_event, completion_event = span.events - self.assertEqual(prompt_event.name, "gen_ai.content.prompt") - self.assertEqual(dict(prompt_event.attributes), {"gen_ai.prompt": json.dumps(messages)}) - self.assertEqual(completion_event.name, "gen_ai.content.completion") - self.assertEqual( - dict(completion_event.attributes), - {"gen_ai.completion": '[{"role": "assistant", "content": {"order_id": "order_12345"}}]'}, - ) - - def test_local_stream(self): - messages = [ - { - "role": "user", - "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", - } - ] - - client = openai.Client(base_url="http://localhost:11434/v1", api_key="unused", max_retries=1) - chat_completion = client.chat.completions.create(model=LOCAL_MODEL, messages=messages, stream=True) - - chunks = [chunk.choices[0].delta.content for chunk in chat_completion if chunk.choices] - self.assertEqual("".join(chunks), "Oceania") - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {LOCAL_MODEL}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: LOCAL_MODEL, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_ID: "chatcmpl-735", - GEN_AI_RESPONSE_MODEL: LOCAL_MODEL, - GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), - SERVER_ADDRESS: "localhost", - SERVER_PORT: 11434, - }, - ) - self.assertEqual(span.events, ()) - - def test_local_stream_with_capture_content(self): - # Redo the instrumentation dance to be affected by the environment variable - OpenAIInstrumentor().uninstrument() - with mock.patch.dict("os.environ", {"ELASTIC_OTEL_GENAI_CAPTURE_CONTENT": "true"}): - OpenAIInstrumentor().instrument() - - messages = [ - { - "role": "user", - "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", - } - ] - - client = openai.Client(base_url="http://localhost:11434/v1", api_key="unused", max_retries=1) - chat_completion = client.chat.completions.create(model=LOCAL_MODEL, messages=messages, stream=True) - - chunks = [chunk.choices[0].delta.content for chunk in chat_completion if chunk.choices] - self.assertEqual("".join(chunks), "Pacific Ocean.") - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {LOCAL_MODEL}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: LOCAL_MODEL, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_ID: "chatcmpl-829", - GEN_AI_RESPONSE_MODEL: LOCAL_MODEL, - GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), - SERVER_ADDRESS: "localhost", - SERVER_PORT: 11434, - }, - ) - - self.assertEqual(len(span.events), 2) - prompt_event, completion_event = span.events - self.assertEqual(prompt_event.name, "gen_ai.content.prompt") - self.assertEqual(dict(prompt_event.attributes), {"gen_ai.prompt": json.dumps(messages)}) - self.assertEqual(completion_event.name, "gen_ai.content.completion") - self.assertEqual( - dict(completion_event.attributes), - {"gen_ai.completion": ('[{"role": "assistant", "content": "Pacific Ocean."}]')}, - ) - - def test_local_stream_error_handling(self): - messages = [ - { - "role": "user", - "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", - } - ] - - client = openai.Client(base_url="http://localhost:11434/v1", api_key="unused", max_retries=1) - with mock.patch.object(openai._streaming.Stream, "__next__", side_effect=ValueError): - chat_completion = client.chat.completions.create(model=LOCAL_MODEL, messages=messages, stream=True) - with self.assertRaises(ValueError): - [chunk.choices[0].delta.content for chunk in chat_completion if chunk.choices] - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {LOCAL_MODEL}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.ERROR) - - self.assertEqual( - dict(span.attributes), - { - ERROR_TYPE: "ValueError", - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: LOCAL_MODEL, - GEN_AI_SYSTEM: "openai", - SERVER_ADDRESS: "localhost", - SERVER_PORT: 11434, - }, - ) - self.assertEqual(span.events, ()) - - -class TestAsyncChatCompletions(OpenaiMixin, TestBase, IsolatedAsyncioTestCase): - @classmethod - def setup_client(cls): - # Control the arguments - return openai.AsyncOpenAI( - api_key=os.getenv("OPENAI_API_KEY", OPENAI_API_KEY), - organization=os.getenv("OPENAI_ORG_ID", OPENAI_ORG_ID), - project=os.getenv("OPENAI_PROJECT_ID", OPENAI_PROJECT_ID), - max_retries=1, - ) - - async def test_async_basic(self): - messages = [ - { - "role": "user", - "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", - } - ] - - chat_completion = await self.client.chat.completions.create(model=self.openai_env.model, messages=messages) - - self.assertEqual(chat_completion.choices[0].message.content, "South Atlantic Ocean.") - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_ID: "chatcmpl-A9CT0G8qhgAE0LVHYoClD0IG4eyKa", - GEN_AI_RESPONSE_MODEL: self.openai_env.response_model, - GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), - GEN_AI_USAGE_INPUT_TOKENS: 24, - GEN_AI_USAGE_OUTPUT_TOKENS: 4, - SERVER_ADDRESS: "api.openai.com", - SERVER_PORT: 443, - }, - ) - self.assertEqual(span.events, ()) - - operation_duration_metric, token_usage_metric = self.get_sorted_metrics() - self.assertOperationDurationMetric(operation_duration_metric) - self.assertTokenUsageMetric(token_usage_metric) - - async def test_async_basic_with_capture_content(self): - # Redo the instrumentation dance to be affected by the environment variable - OpenAIInstrumentor().uninstrument() - with mock.patch.dict("os.environ", {"ELASTIC_OTEL_GENAI_CAPTURE_CONTENT": "true"}): - OpenAIInstrumentor().instrument() - - messages = [ - { - "role": "user", - "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", - } - ] - - chat_completion = await self.client.chat.completions.create(model=self.openai_env.model, messages=messages) - - self.assertEqual(chat_completion.choices[0].message.content, "South Atlantic Ocean.") - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_ID: "chatcmpl-A9CT2ePKnjnz40F1K7G6YhKMoNLsD", - GEN_AI_RESPONSE_MODEL: self.openai_env.response_model, - GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), - GEN_AI_USAGE_INPUT_TOKENS: 24, - GEN_AI_USAGE_OUTPUT_TOKENS: 4, - SERVER_ADDRESS: "api.openai.com", - SERVER_PORT: 443, - }, - ) - self.assertEqual(len(span.events), 2) - prompt_event, completion_event = span.events - self.assertEqual(prompt_event.name, "gen_ai.content.prompt") - self.assertEqual(dict(prompt_event.attributes), {"gen_ai.prompt": json.dumps(messages)}) - self.assertEqual(completion_event.name, "gen_ai.content.completion") - self.assertEqual( - dict(completion_event.attributes), - {"gen_ai.completion": ('[{"role": "assistant", "content": "South Atlantic Ocean."}]')}, - ) - - async def test_async_stream(self): - messages = [ - { - "role": "user", - "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", - } - ] - - chat_completion = await self.client.chat.completions.create( - model=self.openai_env.model, messages=messages, stream=True - ) - - chunks = [chunk.choices[0].delta.content or "" async for chunk in chat_completion if chunk.choices] - self.assertEqual("".join(chunks), "South Atlantic Ocean.") - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_ID: "chatcmpl-A6dGYxfNeE9JSyv3LWSkGTOIXJvqy", - GEN_AI_RESPONSE_MODEL: self.openai_env.response_model, - GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), - SERVER_ADDRESS: "api.openai.com", - SERVER_PORT: 443, - }, - ) - self.assertEqual(span.events, ()) - - (operation_duration_metric,) = self.get_sorted_metrics() - self.assertOperationDurationMetric(operation_duration_metric) - - async def test_async_stream_with_capture_content(self): - # Redo the instrumentation dance to be affected by the environment variable - OpenAIInstrumentor().uninstrument() - with mock.patch.dict("os.environ", {"ELASTIC_OTEL_GENAI_CAPTURE_CONTENT": "true"}): - OpenAIInstrumentor().instrument() - messages = [ - { - "role": "user", - "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", - } - ] - - chat_completion = await self.client.chat.completions.create( - model=self.openai_env.model, messages=messages, stream=True - ) - - chunks = [chunk.choices[0].delta.content or "" async for chunk in chat_completion if chunk.choices] - self.assertEqual("".join(chunks), "South Atlantic Ocean.") - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_ID: "chatcmpl-A6dGarmkMfJOnz2DWzymvkYpWQt00", - GEN_AI_RESPONSE_MODEL: self.openai_env.response_model, - GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), - SERVER_ADDRESS: "api.openai.com", - SERVER_PORT: 443, }, - ) - self.assertEqual(len(span.events), 2) - prompt_event, completion_event = span.events - self.assertEqual(prompt_event.name, "gen_ai.content.prompt") - self.assertEqual(dict(prompt_event.attributes), {"gen_ai.prompt": json.dumps(messages)}) - self.assertEqual(completion_event.name, "gen_ai.content.completion") - self.assertEqual( - dict(completion_event.attributes), - {"gen_ai.completion": ('[{"role": "assistant", "content": "South Atlantic Ocean."}]')}, - ) - - async def test_async_tools_with_capture_content(self): - # Redo the instrumentation dance to be affected by the environment variable - OpenAIInstrumentor().uninstrument() - with mock.patch.dict("os.environ", {"ELASTIC_OTEL_GENAI_CAPTURE_CONTENT": "true"}): - OpenAIInstrumentor().instrument() - - 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.", - }, + } + ] + + 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"}, + ] + + chat_completion = client.chat.completions.create(model=model, messages=messages, tools=tools, stream=True) + + chunks = [chunk.choices[0].delta.content or "" for chunk in chat_completion if chunk.choices] + assert "".join(chunks) == content + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"chat {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.UNSET + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: "chat", + GEN_AI_REQUEST_MODEL: model, + GEN_AI_SYSTEM: "openai", + GEN_AI_RESPONSE_ID: response_id, + GEN_AI_RESPONSE_MODEL: response_model, + GEN_AI_RESPONSE_FINISH_REASONS: (finish_reason,), + SERVER_ADDRESS: provider.server_address, + SERVER_PORT: provider.server_port, + } + + assert len(span.events) == 2 + prompt_event, completion_event = span.events + assert prompt_event.name == "gen_ai.content.prompt" + assert dict(prompt_event.attributes) == {"gen_ai.prompt": json.dumps(messages)} + assert completion_event.name == "gen_ai.content.completion" + assert dict(completion_event.attributes) == { + "gen_ai.completion": '[{"role": "assistant", "content": ' + completion_content + "}]" + } + + (operation_duration_metric,) = get_sorted_metrics(metrics_reader) + attributes = { + GEN_AI_REQUEST_MODEL: model, + GEN_AI_RESPONSE_MODEL: response_model, + } + assert_operation_duration_metric(provider, operation_duration_metric, attributes=attributes, data_point=duration) + + +test_async_basic_test_data = [ + ( + "openai_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "South Atlantic Ocean.", + "chatcmpl-AEGqstM7lJ74sLzKJxMyhZZJixowh", + 24, + 4, + 0.006761051714420319, + ), + ( + "azure_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini", + "South Atlantic Ocean.", + "chatcmpl-AEGqs0IFKsicvFYSaiyWFpZVr6OHe", + 24, + 4, + 0.002889830619096756, + ), + ( + "ollama_provider_chat_completions", + "qwen2.5:0.5b", + "qwen2.5:0.5b", + "Atlantic Ocean", + "chatcmpl-425", + 46, + 3, + 0.002600736916065216, + ), +] + + +@pytest.mark.asyncio +@pytest.mark.vcr() +@pytest.mark.parametrize( + "provider_str,model,response_model,content,response_id,input_tokens,output_tokens,duration", + test_async_basic_test_data, +) +async def test_async_basic( + provider_str, + model, + response_model, + content, + response_id, + input_tokens, + output_tokens, + duration, + trace_exporter, + metrics_reader, + request, +): + provider = request.getfixturevalue(provider_str) + client = provider.get_async_client() + + messages = [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", + } + ] + + chat_completion = await client.chat.completions.create(model=model, messages=messages) + + assert chat_completion.choices[0].message.content == content + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"chat {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.UNSET + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: "chat", + GEN_AI_REQUEST_MODEL: model, + GEN_AI_SYSTEM: "openai", + GEN_AI_RESPONSE_ID: response_id, + GEN_AI_RESPONSE_MODEL: response_model, + GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), + GEN_AI_USAGE_INPUT_TOKENS: input_tokens, + GEN_AI_USAGE_OUTPUT_TOKENS: output_tokens, + SERVER_ADDRESS: provider.server_address, + SERVER_PORT: provider.server_port, + } + assert span.events == () + + operation_duration_metric, token_usage_metric = get_sorted_metrics(metrics_reader) + attributes = { + GEN_AI_REQUEST_MODEL: model, + GEN_AI_RESPONSE_MODEL: response_model, + } + assert_operation_duration_metric(provider, operation_duration_metric, attributes=attributes, data_point=duration) + assert_token_usage_metric( + provider, + token_usage_metric, + attributes=attributes, + input_data_point=input_tokens, + output_data_point=output_tokens, + ) + + +test_async_basic_with_capture_content_test_data = [ + ( + "openai_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "South Atlantic Ocean.", + "chatcmpl-AEGquKdflabT1q3yPFXFggu0hn6Cg", + 24, + 4, + 0.006761051714420319, + ), + ( + "azure_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini", + "South Atlantic Ocean.", + "chatcmpl-AEGqv0J1RJgG477zKEayzIFWtBfoN", + 24, + 4, + 0.002889830619096756, + ), + ( + "ollama_provider_chat_completions", + "qwen2.5:0.5b", + "qwen2.5:0.5b", + "Antarctica", + "chatcmpl-280", + 46, + 4, + 0.002600736916065216, + ), +] + + +@pytest.mark.asyncio +@pytest.mark.vcr() +@pytest.mark.parametrize( + "provider_str,model,response_model,content,response_id,input_tokens,output_tokens,duration", + test_async_basic_with_capture_content_test_data, +) +async def test_async_basic_with_capture_content( + provider_str, + model, + response_model, + content, + response_id, + input_tokens, + output_tokens, + duration, + trace_exporter, + metrics_reader, + request, +): + provider = request.getfixturevalue(provider_str) + client = provider.get_async_client() + + # Redo the instrumentation dance to be affected by the environment variable + OpenAIInstrumentor().uninstrument() + with mock.patch.dict("os.environ", {"ELASTIC_OTEL_GENAI_CAPTURE_CONTENT": "true"}): + OpenAIInstrumentor().instrument() + + messages = [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", + } + ] + + chat_completion = await client.chat.completions.create(model=model, messages=messages) + + assert chat_completion.choices[0].message.content == content + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"chat {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.UNSET + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: "chat", + GEN_AI_REQUEST_MODEL: model, + GEN_AI_SYSTEM: "openai", + GEN_AI_RESPONSE_ID: response_id, + GEN_AI_RESPONSE_MODEL: response_model, + GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), + GEN_AI_USAGE_INPUT_TOKENS: input_tokens, + GEN_AI_USAGE_OUTPUT_TOKENS: output_tokens, + SERVER_ADDRESS: provider.server_address, + SERVER_PORT: provider.server_port, + } + assert len(span.events) == 2 + prompt_event, completion_event = span.events + assert prompt_event.name == "gen_ai.content.prompt" + assert dict(prompt_event.attributes) == {"gen_ai.prompt": json.dumps(messages)} + assert completion_event.name == "gen_ai.content.completion" + assert dict(completion_event.attributes) == { + "gen_ai.completion": ('[{"role": "assistant", "content": "' + content + '"}]') + } + + operation_duration_metric, token_usage_metric = get_sorted_metrics(metrics_reader) + attributes = { + GEN_AI_REQUEST_MODEL: model, + GEN_AI_RESPONSE_MODEL: response_model, + } + assert_operation_duration_metric(provider, operation_duration_metric, attributes=attributes, data_point=duration) + assert_token_usage_metric( + provider, + token_usage_metric, + attributes=attributes, + input_data_point=input_tokens, + output_data_point=output_tokens, + ) + + +test_async_stream_test_data = [ + ( + "openai_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "South Atlantic Ocean.", + "chatcmpl-AEGqwO8cO97nJK1gMyVlzL9Mfyv7E", + 0.006761051714420319, + ), + ( + "azure_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini", + "South Atlantic Ocean.", + "chatcmpl-AEGqxYYCkiihSc05nBzHlYVwwUmzl", + 0.002889830619096756, + ), + ( + "ollama_provider_chat_completions", + "qwen2.5:0.5b", + "qwen2.5:0.5b", + "The Falkland Islands are located on which ocean?", + "chatcmpl-325", + 0.002600736916065216, + ), +] + + +@pytest.mark.vcr() +@pytest.mark.asyncio +@pytest.mark.parametrize("provider_str,model,response_model,content,response_id,duration", test_async_stream_test_data) +async def test_async_stream( + provider_str, model, response_model, content, response_id, duration, trace_exporter, metrics_reader, request +): + provider = request.getfixturevalue(provider_str) + client = provider.get_async_client() + + messages = [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", + } + ] + + chat_completion = await client.chat.completions.create(model=model, messages=messages, stream=True) + + chunks = [chunk.choices[0].delta.content or "" async for chunk in chat_completion if chunk.choices] + assert "".join(chunks) == content + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"chat {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.UNSET + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: "chat", + GEN_AI_REQUEST_MODEL: model, + GEN_AI_SYSTEM: "openai", + GEN_AI_RESPONSE_ID: response_id, + GEN_AI_RESPONSE_MODEL: response_model, + GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), + SERVER_ADDRESS: provider.server_address, + SERVER_PORT: provider.server_port, + } + assert span.events == () + + (operation_duration_metric,) = get_sorted_metrics(metrics_reader) + attributes = { + GEN_AI_REQUEST_MODEL: model, + GEN_AI_RESPONSE_MODEL: response_model, + } + assert_operation_duration_metric(provider, operation_duration_metric, attributes=attributes, data_point=duration) + + +test_async_stream_with_capture_content_test_data = [ + ( + "openai_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "South Atlantic Ocean.", + "chatcmpl-AEGqyZRrj9GUzDNw5te55gt1r7eus", + 0.006761051714420319, + ), + ( + "azure_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini", + "South Atlantic Ocean.", + "chatcmpl-AEGqzfynQK4iCO7EXRy3kGXYyuxF5", + 0.002889830619096756, + ), + ( + "ollama_provider_chat_completions", + "qwen2.5:0.5b", + "qwen2.5:0.5b", + "The Falkland Islands lie within which ocean?", + "chatcmpl-644", + 0.002600736916065216, + ), +] + + +@pytest.mark.vcr() +@pytest.mark.asyncio +@pytest.mark.parametrize( + "provider_str,model,response_model,content,response_id,duration", + test_async_stream_with_capture_content_test_data, +) +async def test_async_stream_with_capture_content( + provider_str, + model, + response_model, + content, + response_id, + duration, + trace_exporter, + metrics_reader, + request, +): + provider = request.getfixturevalue(provider_str) + client = provider.get_async_client() + + # Redo the instrumentation dance to be affected by the environment variable + OpenAIInstrumentor().uninstrument() + with mock.patch.dict("os.environ", {"ELASTIC_OTEL_GENAI_CAPTURE_CONTENT": "true"}): + OpenAIInstrumentor().instrument() + messages = [ + { + "role": "user", + "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", + } + ] + + chat_completion = await client.chat.completions.create(model=model, messages=messages, stream=True) + + chunks = [chunk.choices[0].delta.content or "" async for chunk in chat_completion if chunk.choices] + assert "".join(chunks) == content + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"chat {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.UNSET + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: "chat", + GEN_AI_REQUEST_MODEL: model, + GEN_AI_SYSTEM: "openai", + GEN_AI_RESPONSE_ID: response_id, + GEN_AI_RESPONSE_MODEL: response_model, + GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), + SERVER_ADDRESS: provider.server_address, + SERVER_PORT: provider.server_port, + } + assert len(span.events) == 2 + prompt_event, completion_event = span.events + assert prompt_event.name == "gen_ai.content.prompt" + assert dict(prompt_event.attributes) == {"gen_ai.prompt": json.dumps(messages)} + assert completion_event.name == "gen_ai.content.completion" + assert dict(completion_event.attributes) == { + "gen_ai.completion": ('[{"role": "assistant", "content": "' + content + '"}]') + } + + (operation_duration_metric,) = get_sorted_metrics(metrics_reader) + attributes = { + GEN_AI_REQUEST_MODEL: model, + GEN_AI_RESPONSE_MODEL: response_model, + } + assert_operation_duration_metric(provider, operation_duration_metric, attributes=attributes, data_point=duration) + + +# FIXME: ollama has empty tool_calls +test_async_tools_with_capture_content_test_data = [ + ( + "openai_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "South Atlantic Ocean.", + "chatcmpl-AEGr0SsAhppNLpPXpTtnmBiGGViQb", + 140, + 19, + 0.006761051714420319, + ), + ( + "azure_provider_chat_completions", + "gpt-4o-mini", + "gpt-4o-mini", + "South Atlantic Ocean", + "chatcmpl-AEGr1X6ieLFOD5hlXZBx2BL2BrSLe", + 140, + 19, + 0.002889830619096756, + ), +] + + +@pytest.mark.vcr() +@pytest.mark.asyncio +@pytest.mark.parametrize( + "provider_str,model,response_model,content,response_id,input_tokens,output_tokens,duration", + test_async_tools_with_capture_content_test_data, +) +async def test_async_tools_with_capture_content( + provider_str, + model, + response_model, + content, + response_id, + input_tokens, + output_tokens, + duration, + trace_exporter, + metrics_reader, + request, +): + provider = request.getfixturevalue(provider_str) + client = provider.get_async_client() + + # Redo the instrumentation dance to be affected by the environment variable + OpenAIInstrumentor().uninstrument() + with mock.patch.dict("os.environ", {"ELASTIC_OTEL_GENAI_CAPTURE_CONTENT": "true"}): + OpenAIInstrumentor().instrument() + + 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, }, + "required": ["order_id"], + "additionalProperties": False, }, - } - ] - - 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"}, - ] - - response = await self.client.chat.completions.create( - model=self.openai_env.model, messages=messages, tools=tools - ) - tool_call = response.choices[0].message.tool_calls[0] - self.assertEqual(tool_call.function.name, "get_delivery_date") - self.assertEqual(json.loads(tool_call.function.arguments), {"order_id": "order_12345"}) - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_ID: "chatcmpl-A9CT8USSOYj6tJBMsrClMJdppNCf3", - GEN_AI_RESPONSE_MODEL: self.openai_env.response_model, - GEN_AI_RESPONSE_FINISH_REASONS: ("tool_calls",), - GEN_AI_USAGE_INPUT_TOKENS: 140, - GEN_AI_USAGE_OUTPUT_TOKENS: 19, - SERVER_ADDRESS: "api.openai.com", - SERVER_PORT: 443, - }, - ) - - self.assertEqual(len(span.events), 2) - prompt_event, completion_event = span.events - self.assertEqual(prompt_event.name, "gen_ai.content.prompt") - self.assertEqual(dict(prompt_event.attributes), {"gen_ai.prompt": json.dumps(messages)}) - self.assertEqual(completion_event.name, "gen_ai.content.completion") - self.assertEqual( - dict(completion_event.attributes), - {"gen_ai.completion": '[{"role": "assistant", "content": {"order_id": "order_12345"}}]'}, - ) - - async def test_async_local(self): - client = openai.AsyncOpenAI(base_url="http://localhost:11434/v1", api_key="unused", max_retries=1) - - messages = [ - { - "role": "user", - "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", - } - ] - - chat_completion = await client.chat.completions.create(model=LOCAL_MODEL, messages=messages) - - self.assertEqual(chat_completion.choices[0].message.content, "The South Pole is the answer.") - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {LOCAL_MODEL}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: LOCAL_MODEL, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_ID: "chatcmpl-533", - GEN_AI_RESPONSE_MODEL: LOCAL_MODEL, - GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), - GEN_AI_USAGE_INPUT_TOKENS: 52, - GEN_AI_USAGE_OUTPUT_TOKENS: 8, - SERVER_ADDRESS: "localhost", - SERVER_PORT: 11434, - }, - ) - self.assertEqual(span.events, ()) - - async def test_async_local_stream_error_handling(self): - messages = [ - { - "role": "user", - "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", - } - ] - - client = openai.AsyncOpenAI(base_url="http://localhost:11434/v1", api_key="unused", max_retries=1) - with mock.patch.object(openai._streaming.AsyncStream, "__anext__", side_effect=ValueError): - chat_completion = await client.chat.completions.create(model=LOCAL_MODEL, messages=messages, stream=True) - with self.assertRaises(ValueError): - [chunk.choices[0].delta.content async for chunk in chat_completion if chunk.choices] - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {LOCAL_MODEL}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.ERROR) - - self.assertEqual( - dict(span.attributes), - { - ERROR_TYPE: "ValueError", - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: LOCAL_MODEL, - GEN_AI_SYSTEM: "openai", - SERVER_ADDRESS: "localhost", - SERVER_PORT: 11434, - }, - ) - self.assertEqual(span.events, ()) - - (operation_duration_metric,) = self.get_sorted_metrics() - self.assertErrorOperationDurationMetric( - operation_duration_metric, - {"gen_ai.request.model": LOCAL_MODEL, "error.type": "ValueError", "server.port": 11434}, - data_point=0.0032003200612962246, - ) - - async def test_async_local_connection_error(self): - client = openai.AsyncOpenAI(base_url="http://localhost:9999/v5", api_key="unused", max_retries=1) - messages = [ - { - "role": "user", - "content": "Answer in up to 3 words: Which ocean contains the falkland islands?", - } - ] - - with self.assertRaises(Exception): - await client.chat.completions.create(model=self.openai_env.model, messages=messages) - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"chat {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.ERROR) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_SYSTEM: "openai", - ERROR_TYPE: "APIConnectionError", - SERVER_ADDRESS: "localhost", - SERVER_PORT: 9999, }, - ) - self.assertEqual(span.events, ()) - - (operation_duration_metric,) = self.get_sorted_metrics() - self.assertErrorOperationDurationMetric( - operation_duration_metric, - {"error.type": "APIConnectionError"}, - data_point=0.0072969673201441765, - ) + } + ] + + 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"}, + ] + + response = await client.chat.completions.create(model=model, messages=messages, tools=tools) + tool_call = response.choices[0].message.tool_calls[0] + assert tool_call.function.name == "get_delivery_date" + assert json.loads(tool_call.function.arguments) == {"order_id": "order_12345"} + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"chat {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.UNSET + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: "chat", + GEN_AI_REQUEST_MODEL: model, + GEN_AI_SYSTEM: "openai", + GEN_AI_RESPONSE_ID: response_id, + GEN_AI_RESPONSE_MODEL: response_model, + GEN_AI_RESPONSE_FINISH_REASONS: ("tool_calls",), + GEN_AI_USAGE_INPUT_TOKENS: input_tokens, + GEN_AI_USAGE_OUTPUT_TOKENS: output_tokens, + SERVER_ADDRESS: provider.server_address, + SERVER_PORT: provider.server_port, + } + + assert len(span.events) == 2 + prompt_event, completion_event = span.events + assert prompt_event.name == "gen_ai.content.prompt" + assert dict(prompt_event.attributes) == {"gen_ai.prompt": json.dumps(messages)} + assert completion_event.name == "gen_ai.content.completion" + assert dict(completion_event.attributes) == { + "gen_ai.completion": '[{"role": "assistant", "content": {"order_id": "order_12345"}}]' + } + + operation_duration_metric, token_usage_metric = get_sorted_metrics(metrics_reader) + attributes = { + GEN_AI_REQUEST_MODEL: model, + GEN_AI_RESPONSE_MODEL: response_model, + } + assert_operation_duration_metric(provider, operation_duration_metric, attributes=attributes, data_point=duration) + assert_token_usage_metric( + provider, + token_usage_metric, + attributes=attributes, + input_data_point=input_tokens, + output_data_point=output_tokens, + ) diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_embeddings.py b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_embeddings.py index 7d9a1d7..79e1de6 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_embeddings.py +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_embeddings.py @@ -14,12 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os -from unittest import IsolatedAsyncioTestCase - import openai +import pytest from opentelemetry.instrumentation.openai.helpers import GEN_AI_REQUEST_ENCODING_FORMAT -from opentelemetry.test.test_base import TestBase from opentelemetry.trace import SpanKind, StatusCode from opentelemetry.semconv._incubating.attributes.gen_ai_attributes import ( GEN_AI_OPERATION_NAME, @@ -31,276 +28,301 @@ from opentelemetry.semconv.attributes.error_attributes import ERROR_TYPE from opentelemetry.semconv.attributes.server_attributes import SERVER_ADDRESS, SERVER_PORT -from .base import OPENAI_API_KEY, OpenAIEnvironment, OpenaiMixin - - -class TestOpenAIEmbeddings(OpenaiMixin, TestBase): - @classmethod - def setup_client(cls): - return openai.Client( - api_key=os.getenv("OPENAI_API_KEY", OPENAI_API_KEY), - max_retries=1, - ) - - @classmethod - def setup_environment(cls): - return OpenAIEnvironment( - model="text-embedding-3-small", - response_model="text-embedding-3-small", - operation_name="embeddings", - ) - - def test_basic(self): - text = "South Atlantic Ocean." - - spans = self.get_finished_spans() - response = self.client.embeddings.create(model=self.openai_env.model, input=[text]) - - self.assertTrue(len(response.data), 1) - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"embeddings {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: self.openai_env.operation_name, - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_MODEL: self.openai_env.model, - GEN_AI_USAGE_INPUT_TOKENS: 4, - SERVER_ADDRESS: self.openai_env.server_address, - SERVER_PORT: self.openai_env.server_port, - }, - ) - self.assertEqual(span.events, ()) - - operation_duration_metric, token_usage_metric = self.get_sorted_metrics() - self.assertOperationDurationMetric(operation_duration_metric) - self.assertTokenUsageInputMetric(token_usage_metric) - - def test_all_the_client_options(self): - text = "South Atlantic Ocean." - response = self.client.embeddings.create(model=self.openai_env.model, input=[text], encoding_format="float") - - self.assertTrue(len(response.data), 1) - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"embeddings {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: self.openai_env.operation_name, - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_MODEL: self.openai_env.model, - GEN_AI_REQUEST_ENCODING_FORMAT: "float", - GEN_AI_USAGE_INPUT_TOKENS: 4, - SERVER_ADDRESS: self.openai_env.server_address, - SERVER_PORT: self.openai_env.server_port, - }, - ) - self.assertEqual(span.events, ()) - - operation_duration_metric, token_usage_metric = self.get_sorted_metrics() - self.assertOperationDurationMetric(operation_duration_metric) - self.assertTokenUsageInputMetric(token_usage_metric) - - def test_connection_error(self): - client = openai.Client(base_url="http://localhost:9999/v5", api_key="unused", max_retries=1) - text = "South Atlantic Ocean." - - with self.assertRaises(Exception): - client.embeddings.create(model=self.openai_env.model, input=[text]) - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"embeddings {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.ERROR) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: self.openai_env.operation_name, - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_SYSTEM: "openai", - ERROR_TYPE: "APIConnectionError", - SERVER_ADDRESS: "localhost", - SERVER_PORT: 9999, - }, - ) - self.assertEqual(span.events, ()) - - (operation_duration_metric,) = self.get_sorted_metrics() - self.assertErrorOperationDurationMetric(operation_duration_metric, {"error.type": "APIConnectionError"}) - - -class TestAsyncOpenAIEmbeddings(OpenaiMixin, TestBase, IsolatedAsyncioTestCase): - @classmethod - def setup_client(cls): - return openai.AsyncOpenAI( - api_key=os.getenv("OPENAI_API_KEY", OPENAI_API_KEY), - max_retries=1, - ) - - @classmethod - def setup_environment(cls): - return OpenAIEnvironment( - model="text-embedding-3-small", - response_model="text-embedding-3-small", - operation_name="embeddings", - ) - - async def test_basic(self): - text = "South Atlantic Ocean." - - spans = self.get_finished_spans() - response = await self.client.embeddings.create(model=self.openai_env.model, input=[text]) - - self.assertTrue(len(response.data), 1) - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"embeddings {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: self.openai_env.operation_name, - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_MODEL: self.openai_env.model, - GEN_AI_USAGE_INPUT_TOKENS: 4, - SERVER_ADDRESS: self.openai_env.server_address, - SERVER_PORT: self.openai_env.server_port, - }, - ) - self.assertEqual(span.events, ()) - - operation_duration_metric, token_usage_metric = self.get_sorted_metrics() - self.assertOperationDurationMetric(operation_duration_metric) - self.assertTokenUsageInputMetric(token_usage_metric) - - async def test_all_the_client_options(self): - text = "South Atlantic Ocean." - response = await self.client.embeddings.create( - model=self.openai_env.model, input=[text], encoding_format="float" - ) - - self.assertTrue(len(response.data), 1) - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"embeddings {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.UNSET) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: self.openai_env.operation_name, - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_SYSTEM: "openai", - GEN_AI_RESPONSE_MODEL: self.openai_env.model, - GEN_AI_REQUEST_ENCODING_FORMAT: "float", - GEN_AI_USAGE_INPUT_TOKENS: 4, - SERVER_ADDRESS: self.openai_env.server_address, - SERVER_PORT: self.openai_env.server_port, - }, - ) - self.assertEqual(span.events, ()) - - operation_duration_metric, token_usage_metric = self.get_sorted_metrics() - self.assertOperationDurationMetric(operation_duration_metric) - self.assertTokenUsageInputMetric(token_usage_metric) - - async def test_connection_error(self): - client = openai.Client(base_url="http://localhost:9999/v5", api_key="unused", max_retries=1) - text = "South Atlantic Ocean." - - with self.assertRaises(Exception): - await client.embeddings.create(model=self.openai_env.model, input=[text]) - - spans = self.get_finished_spans() - self.assertEqual(len(spans), 1) - - span = spans[0] - self.assertEqual(span.name, f"embeddings {self.openai_env.model}") - self.assertEqual(span.kind, SpanKind.CLIENT) - self.assertEqual(span.status.status_code, StatusCode.ERROR) - - self.assertEqual( - dict(span.attributes), - { - GEN_AI_OPERATION_NAME: self.openai_env.operation_name, - GEN_AI_REQUEST_MODEL: self.openai_env.model, - GEN_AI_SYSTEM: "openai", - ERROR_TYPE: "APIConnectionError", - SERVER_ADDRESS: "localhost", - SERVER_PORT: 9999, - }, - ) - self.assertEqual(span.events, ()) - - (operation_duration_metric,) = self.get_sorted_metrics() - self.assertErrorOperationDurationMetric(operation_duration_metric, {"error.type": "APIConnectionError"}) - - -class TestLocalEmbeddings(TestOpenAIEmbeddings): - @classmethod - def setup_client(cls): - return openai.Client( - base_url="http://localhost:11434/v1", - api_key="unused", - max_retries=1, - ) - - @classmethod - def setup_environment(cls): - return OpenAIEnvironment( - model="all-minilm:33m", - response_model="all-minilm:33m", - operation_name="embeddings", - server_address="localhost", - server_port=11434, - ) - - -class TestAsyncLocalEmbeddings(TestAsyncOpenAIEmbeddings): - @classmethod - def setup_client(cls): - return openai.AsyncOpenAI( - base_url="http://localhost:11434/v1", - api_key="unused", - max_retries=1, - ) - - @classmethod - def setup_environment(cls): - return OpenAIEnvironment( - model="all-minilm:33m", - response_model="all-minilm:33m", - operation_name="embeddings", - server_address="localhost", - server_port=11434, - ) +from .conftest import ( + assert_error_operation_duration_metric, + assert_operation_duration_metric, + assert_token_usage_input_metric, +) +from .utils import get_sorted_metrics + + +test_basic_test_data = [ + ("openai_provider_embeddings", "text-embedding-3-small", 4, 0.2263190783560276), + ("azure_provider_embeddings", "text-embedding-3-small", 4, 0.0017870571464300156), + ("ollama_provider_embeddings", "all-minilm:33m", 4, 0.0030461717396974564), +] + + +@pytest.mark.vcr() +@pytest.mark.parametrize("provider_str,model,input_tokens,duration", test_basic_test_data) +def test_basic(provider_str, model, input_tokens, duration, trace_exporter, metrics_reader, request): + provider = request.getfixturevalue(provider_str) + client = provider.get_client() + + text = "South Atlantic Ocean." + response = client.embeddings.create(model=model, input=[text]) + + assert len(response.data) == 1 + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"embeddings {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.UNSET + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: provider.operation_name, + GEN_AI_REQUEST_MODEL: model, + GEN_AI_SYSTEM: "openai", + GEN_AI_RESPONSE_MODEL: model, + GEN_AI_USAGE_INPUT_TOKENS: 4, + SERVER_ADDRESS: provider.server_address, + SERVER_PORT: provider.server_port, + } + assert span.events == () + + attributes = { + GEN_AI_REQUEST_MODEL: model, + GEN_AI_RESPONSE_MODEL: model, + } + operation_duration_metric, token_usage_metric = get_sorted_metrics(metrics_reader) + assert_operation_duration_metric(provider, operation_duration_metric, attributes=attributes, data_point=duration) + assert_token_usage_input_metric(provider, token_usage_metric, attributes=attributes, input_data_point=input_tokens) + + +test_all_the_client_options_test_data = [ + ("openai_provider_embeddings", "text-embedding-3-small", 4, 0.2263190783560276), + ("azure_provider_embeddings", "text-embedding-3-small", 4, 0.0017870571464300156), + ("ollama_provider_embeddings", "all-minilm:33m", 4, 0.0030461717396974564), +] + + +@pytest.mark.vcr() +@pytest.mark.parametrize("provider_str,model,input_tokens,duration", test_all_the_client_options_test_data) +def test_all_the_client_options(provider_str, model, input_tokens, duration, trace_exporter, metrics_reader, request): + provider = request.getfixturevalue(provider_str) + client = provider.get_client() + + text = "South Atlantic Ocean." + response = client.embeddings.create(model=model, input=[text], encoding_format="float") + + assert len(response.data) == 1 + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"embeddings {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.UNSET + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: provider.operation_name, + GEN_AI_REQUEST_MODEL: model, + GEN_AI_SYSTEM: "openai", + GEN_AI_RESPONSE_MODEL: model, + GEN_AI_REQUEST_ENCODING_FORMAT: "float", + GEN_AI_USAGE_INPUT_TOKENS: 4, + SERVER_ADDRESS: provider.server_address, + SERVER_PORT: provider.server_port, + } + assert span.events == () + + operation_duration_metric, token_usage_metric = get_sorted_metrics(metrics_reader) + attributes = { + GEN_AI_REQUEST_MODEL: model, + GEN_AI_RESPONSE_MODEL: model, + } + assert_operation_duration_metric( + provider, operation_duration_metric, attributes=attributes, data_point=0.2263190783560276 + ) + assert_token_usage_input_metric(provider, token_usage_metric, attributes=attributes, input_data_point=4) + + +test_connection_error_data = [ + ("openai_provider_embeddings", "text-embedding-3-small", 0.2263190783560276), + ("azure_provider_embeddings", "text-embedding-3-small", 0.0017870571464300156), + ("ollama_provider_embeddings", "all-minilm:33m", 0.0030461717396974564), +] + + +@pytest.mark.vcr() +@pytest.mark.parametrize("provider_str,model,duration", test_connection_error_data) +def test_connection_error(provider_str, model, duration, trace_exporter, metrics_reader, request): + provider = request.getfixturevalue(provider_str) + + client = openai.Client(base_url="http://localhost:9999/v5", api_key="unused", max_retries=1) + text = "South Atlantic Ocean." + + with pytest.raises(Exception): + client.embeddings.create(model=model, input=[text]) + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"embeddings {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.ERROR + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: provider.operation_name, + GEN_AI_REQUEST_MODEL: model, + GEN_AI_SYSTEM: "openai", + ERROR_TYPE: "APIConnectionError", + SERVER_ADDRESS: "localhost", + SERVER_PORT: 9999, + } + assert span.events == () + + (operation_duration_metric,) = get_sorted_metrics(metrics_reader) + attributes = { + GEN_AI_REQUEST_MODEL: model, + ERROR_TYPE: "APIConnectionError", + } + assert_error_operation_duration_metric( + provider, + operation_duration_metric, + attributes=attributes, + data_point=duration, + ) + + +test_async_basic_test_data = [ + ("openai_provider_embeddings", "text-embedding-3-small", 4, 0.2263190783560276), + ("azure_provider_embeddings", "text-embedding-3-small", 4, 0.0017870571464300156), + ("ollama_provider_embeddings", "all-minilm:33m", 4, 0.0030461717396974564), +] + + +@pytest.mark.vcr() +@pytest.mark.asyncio +@pytest.mark.parametrize("provider_str,model,input_tokens,duration", test_async_basic_test_data) +async def test_async_basic(provider_str, model, input_tokens, duration, trace_exporter, metrics_reader, request): + provider = request.getfixturevalue(provider_str) + client = provider.get_async_client() + + text = "South Atlantic Ocean." + response = await client.embeddings.create(model=model, input=[text]) + + assert len(response.data) == 1 + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"embeddings {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.UNSET + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: provider.operation_name, + GEN_AI_REQUEST_MODEL: model, + GEN_AI_SYSTEM: "openai", + GEN_AI_RESPONSE_MODEL: model, + GEN_AI_USAGE_INPUT_TOKENS: input_tokens, + SERVER_ADDRESS: provider.server_address, + SERVER_PORT: provider.server_port, + } + assert span.events == () + + operation_duration_metric, token_usage_metric = get_sorted_metrics(metrics_reader) + attributes = { + GEN_AI_REQUEST_MODEL: model, + GEN_AI_RESPONSE_MODEL: model, + } + assert_operation_duration_metric(provider, operation_duration_metric, attributes=attributes, data_point=duration) + assert_token_usage_input_metric(provider, token_usage_metric, attributes=attributes, input_data_point=input_tokens) + + +test_async_all_the_client_options_test_data = [ + ("openai_provider_embeddings", "text-embedding-3-small", 4, 0.2263190783560276), + ("azure_provider_embeddings", "text-embedding-3-small", 4, 0.0017870571464300156), + ("ollama_provider_embeddings", "all-minilm:33m", 4, 0.0030461717396974564), +] + + +@pytest.mark.vcr() +@pytest.mark.asyncio +@pytest.mark.parametrize("provider_str,model,input_tokens,duration", test_async_all_the_client_options_test_data) +async def test_async_all_the_client_options( + provider_str, model, input_tokens, duration, trace_exporter, metrics_reader, request +): + provider = request.getfixturevalue(provider_str) + client = provider.get_async_client() + + text = "South Atlantic Ocean." + response = await client.embeddings.create(model=model, input=[text], encoding_format="float") + + assert len(response.data) == 1 + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"embeddings {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.UNSET + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: provider.operation_name, + GEN_AI_REQUEST_MODEL: model, + GEN_AI_SYSTEM: "openai", + GEN_AI_RESPONSE_MODEL: model, + GEN_AI_REQUEST_ENCODING_FORMAT: "float", + GEN_AI_USAGE_INPUT_TOKENS: input_tokens, + SERVER_ADDRESS: provider.server_address, + SERVER_PORT: provider.server_port, + } + assert span.events == () + + operation_duration_metric, token_usage_metric = get_sorted_metrics(metrics_reader) + attributes = { + GEN_AI_REQUEST_MODEL: model, + GEN_AI_RESPONSE_MODEL: model, + } + assert_operation_duration_metric(provider, operation_duration_metric, attributes=attributes, data_point=duration) + assert_token_usage_input_metric(provider, token_usage_metric, attributes=attributes, input_data_point=input_tokens) + + +test_async_connection_error_test_data = [ + ("openai_provider_embeddings", "text-embedding-3-small", 0.2263190783560276), + ("azure_provider_embeddings", "text-embedding-3-small", 0.0017870571464300156), + ("ollama_provider_embeddings", "all-minilm:33m", 0.0030461717396974564), +] + + +@pytest.mark.vcr() +@pytest.mark.asyncio +@pytest.mark.parametrize("provider_str,model,duration", test_async_connection_error_test_data) +async def test_async_connection_error(provider_str, model, duration, trace_exporter, metrics_reader, request): + provider = request.getfixturevalue(provider_str) + + client = openai.AsyncOpenAI(base_url="http://localhost:9999/v5", api_key="unused", max_retries=1) + text = "South Atlantic Ocean." + + with pytest.raises(Exception): + await client.embeddings.create(model=model, input=[text]) + + spans = trace_exporter.get_finished_spans() + assert len(spans) == 1 + + span = spans[0] + assert span.name == f"embeddings {model}" + assert span.kind == SpanKind.CLIENT + assert span.status.status_code == StatusCode.ERROR + + assert dict(span.attributes) == { + GEN_AI_OPERATION_NAME: provider.operation_name, + GEN_AI_REQUEST_MODEL: model, + GEN_AI_SYSTEM: "openai", + ERROR_TYPE: "APIConnectionError", + SERVER_ADDRESS: "localhost", + SERVER_PORT: 9999, + } + + assert span.events == () + + (operation_duration_metric,) = get_sorted_metrics(metrics_reader) + attributes = { + GEN_AI_REQUEST_MODEL: model, + ERROR_TYPE: "APIConnectionError", + } + assert_error_operation_duration_metric( + provider, + operation_duration_metric, + attributes=attributes, + data_point=duration, + ) diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_instrumentor.py b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_instrumentor.py index 748ea01..14952f4 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_instrumentor.py +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_instrumentor.py @@ -14,19 +14,42 @@ # See the License for the specific language governing permissions and # limitations under the License. -from unittest import TestCase +from unittest import mock + +import opentelemetry.instrumentation.openai from opentelemetry.instrumentation.openai import OpenAIInstrumentor -class InstrumentorTestCase(TestCase): - def test_capture_content_false_by_default(self): - instrumentor = OpenAIInstrumentor() +def test_capture_content_false_by_default(instrument): + instrument.uninstrument() + assert not instrument.capture_content + + +def test_can_override_capture_content_programmatically(instrument): + instrument.uninstrument() + instrumentor = OpenAIInstrumentor() + instrumentor.instrument(capture_content=True) + assert instrumentor.capture_content + instrumentor.uninstrument() + + +def test_get_tracer_is_called_with_a_string_schema(instrument): + instrument.uninstrument() + instrumentor = OpenAIInstrumentor() + with mock.patch.object(opentelemetry.instrumentation.openai, "get_tracer") as get_tracer_mock: + instrumentor.instrument() + instrumentor.uninstrument() + get_tracer_mock.assert_called_once_with( + "opentelemetry.instrumentation.openai", mock.ANY, None, schema_url="https://opentelemetry.io/schemas/1.27.0" + ) + + +def test_get_meter_is_called_with_a_string_schema(instrument): + instrument.uninstrument() + instrumentor = OpenAIInstrumentor() + with mock.patch.object(opentelemetry.instrumentation.openai, "get_meter") as get_meter_mock: instrumentor.instrument() - self.assertFalse(instrumentor.capture_content) - instrumentor.uninstrument() - - def test_can_override_capture_content_programmatically(self): - instrumentor = OpenAIInstrumentor() - instrumentor.instrument(capture_content=True) - self.assertTrue(instrumentor.capture_content) - instrumentor.uninstrument() + instrumentor.uninstrument() + get_meter_mock.assert_called_once_with( + "opentelemetry.instrumentation.openai", mock.ANY, None, schema_url="https://opentelemetry.io/schemas/1.27.0" + ) diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/utils.py b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/utils.py new file mode 100644 index 0000000..8a98dd8 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/utils.py @@ -0,0 +1,119 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from typing import Optional, Sequence + +from opentelemetry.sdk.metrics._internal.point import Metric +from opentelemetry.sdk.metrics.export import ( + InMemoryMetricReader, + DataPointT, + HistogramDataPoint, + NumberDataPoint, +) + + +def get_sorted_metrics(memory_metrics_reader: InMemoryMetricReader): + metrics_data = memory_metrics_reader.get_metrics_data() + resource_metrics = metrics_data.resource_metrics if metrics_data else [] + + all_metrics = [] + for metrics in resource_metrics: + for scope_metrics in metrics.scope_metrics: + all_metrics.extend(scope_metrics.metrics) + + return sorted_metrics(all_metrics) + + +def sorted_metrics(metrics: Sequence[Metric]): + """ + Sorts metrics by metric name. + """ + return sorted( + metrics, + key=lambda m: m.name, + ) + + +def assert_metric_expected( + metric: Metric, + expected_data_points: Sequence[DataPointT], + est_value_delta: Optional[float] = 0, +): + assert len(expected_data_points) == len(metric.data.data_points) + for expected_data_point in expected_data_points: + assert_data_point_expected(expected_data_point, metric.data.data_points, est_value_delta) + + +def is_data_points_equal( + expected_data_point: DataPointT, + data_point: DataPointT, + est_value_delta: Optional[float] = 0, +): + if type(expected_data_point) != type( # noqa: E721 + data_point + ) or not isinstance(expected_data_point, (HistogramDataPoint, NumberDataPoint)): + return False + + values_diff = None + if isinstance(data_point, NumberDataPoint): + values_diff = abs(expected_data_point.value - data_point.value) + elif isinstance(data_point, HistogramDataPoint): + values_diff = abs(expected_data_point.sum - data_point.sum) + if expected_data_point.count != data_point.count or ( + est_value_delta == 0 + and (expected_data_point.min != data_point.min or expected_data_point.max != data_point.max) + ): + return False + + return values_diff <= est_value_delta and expected_data_point.attributes == dict(data_point.attributes) + + +def assert_data_point_expected( + expected_data_point: DataPointT, + data_points: Sequence[DataPointT], + est_value_delta: Optional[float] = 0, +): + is_data_point_exist = False + for data_point in data_points: + if is_data_points_equal(expected_data_point, data_point, est_value_delta): + is_data_point_exist = True + break + + if not is_data_point_exist: + for data_point in data_points: + print(data_point) + assert is_data_point_exist is True, f"Data point {expected_data_point} does not exist." + + +def create_number_data_point(value, attributes): + return NumberDataPoint( + value=value, + attributes=attributes, + start_time_unix_nano=0, + time_unix_nano=0, + ) + + +def create_histogram_data_point(sum_data_point, count, max_data_point, min_data_point, attributes): + return HistogramDataPoint( + count=count, + sum=sum_data_point, + min=min_data_point, + max=max_data_point, + attributes=attributes, + start_time_unix_nano=0, + time_unix_nano=0, + bucket_counts=[], + explicit_bounds=[], + ) diff --git a/scripts/license_headers_check.sh b/scripts/license_headers_check.sh index e548011..d0a552d 100755 --- a/scripts/license_headers_check.sh +++ b/scripts/license_headers_check.sh @@ -22,7 +22,7 @@ else FILES=$@ fi -LICENSE_HEADER="Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one" +LICENSE_HEADER="Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\|Copyright The OpenTelemetry Authors" MISSING=$(grep --files-without-match "$LICENSE_HEADER" ${FILES})