diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/README.md b/instrumentation/elastic-opentelemetry-instrumentation-openai/README.md index 719d194..78dafcb 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/README.md +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/README.md @@ -51,6 +51,11 @@ chat_completion = client.chat.completions.create(model="gpt-4o-mini", messages=m - `ELASTIC_OTEL_GENAI_CAPTURE_CONTENT` (default: `false`): when sets to `true` collect more informations about prompts and responses by enabling content capture +### Elastic specific semantic conventions + +- New `embeddings` value for `gen_ai.operation.name` +- New `gen_ai.request.encoding_format` attribute with openai specific values `[float, base64]` + ## Development We use [pytest](https://docs.pytest.org/en/stable/) to execute tests written with the standard diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/__init__.py b/instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/__init__.py index 05d84d7..819f956 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/__init__.py +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/__init__.py @@ -28,11 +28,13 @@ ELASTIC_OTEL_GENAI_CAPTURE_CONTENT, ) from opentelemetry.instrumentation.openai.helpers import ( + _get_embeddings_span_attributes_from_wrapper, _get_span_attributes_from_wrapper, _message_from_choice, _record_token_usage_metrics, _record_operation_duration_metric, _set_span_attributes_from_response, + _set_embeddings_span_attributes_from_response, ) from opentelemetry.instrumentation.openai.package import _instruments from opentelemetry.instrumentation.openai.version import __version__ @@ -95,6 +97,16 @@ def _patch(self, _module): "AsyncCompletions.create", self._async_chat_completion_wrapper, ) + wrap_function_wrapper( + "openai.resources.embeddings", + "Embeddings.create", + self._embeddings_wrapper, + ) + wrap_function_wrapper( + "openai.resources.embeddings", + "AsyncEmbeddings.create", + self._async_embeddings_wrapper, + ) def _uninstrument(self, **kwargs): # unwrap only supports uninstrementing real module references so we @@ -103,6 +115,8 @@ def _uninstrument(self, **kwargs): unwrap(openai.resources.chat.completions.Completions, "create") unwrap(openai.resources.chat.completions.AsyncCompletions, "create") + unwrap(openai.resources.embeddings.Embeddings, "create") + unwrap(openai.resources.embeddings.AsyncEmbeddings, "create") def _chat_completion_wrapper(self, wrapped, instance, args, kwargs): logger.debug(f"openai.resources.chat.completions.Completions.create kwargs: {kwargs}") @@ -226,3 +240,63 @@ async def _async_chat_completion_wrapper(self, wrapped, instance, args, kwargs): span.end() return result + + def _embeddings_wrapper(self, wrapped, instance, args, kwargs): + span_attributes = _get_embeddings_span_attributes_from_wrapper(instance, kwargs) + + span_name = f"{span_attributes[GEN_AI_OPERATION_NAME]} {span_attributes[GEN_AI_REQUEST_MODEL]}" + with self.tracer.start_as_current_span( + name=span_name, + kind=SpanKind.CLIENT, + attributes=span_attributes, + # this is important to avoid having the span closed before ending the stream + end_on_exit=False, + ) as span: + start_time = default_timer() + try: + result = wrapped(*args, **kwargs) + except Exception as exc: + span.set_status(StatusCode.ERROR, str(exc)) + span.set_attribute(ERROR_TYPE, exc.__class__.__qualname__) + span.end() + _record_operation_duration_metric(self.operation_duration_metric, span, start_time) + raise + + _set_embeddings_span_attributes_from_response(span, result.model, result.usage) + + _record_token_usage_metrics(self.token_usage_metric, span, result.usage) + _record_operation_duration_metric(self.operation_duration_metric, span, start_time) + + span.end() + + return result + + async def _async_embeddings_wrapper(self, wrapped, instance, args, kwargs): + span_attributes = _get_embeddings_span_attributes_from_wrapper(instance, kwargs) + + span_name = f"{span_attributes[GEN_AI_OPERATION_NAME]} {span_attributes[GEN_AI_REQUEST_MODEL]}" + with self.tracer.start_as_current_span( + name=span_name, + kind=SpanKind.CLIENT, + attributes=span_attributes, + # this is important to avoid having the span closed before ending the stream + end_on_exit=False, + ) as span: + start_time = default_timer() + try: + result = await wrapped(*args, **kwargs) + except Exception as exc: + span.set_status(StatusCode.ERROR, str(exc)) + span.set_attribute(ERROR_TYPE, exc.__class__.__qualname__) + span.end() + _record_operation_duration_metric(self.operation_duration_metric, span, start_time) + raise + + _set_embeddings_span_attributes_from_response(span, result.model, result.usage) + + _record_token_usage_metrics(self.token_usage_metric, span, result.usage) + _record_operation_duration_metric(self.operation_duration_metric, span, start_time) + + span.end() + + return result diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/helpers.py b/instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/helpers.py index 90b44e3..918495e 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/helpers.py +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/helpers.py @@ -46,6 +46,8 @@ else: CompletionUsage = None +GEN_AI_REQUEST_ENCODING_FORMAT = "gen_ai.request.encoding_format" + def _set_span_attributes_from_response( span: Span, response_id: str, model: str, choices, usage: CompletionUsage @@ -61,6 +63,11 @@ def _set_span_attributes_from_response( span.set_attribute(GEN_AI_USAGE_OUTPUT_TOKENS, usage.completion_tokens) +def _set_embeddings_span_attributes_from_response(span: Span, model: str, usage: CompletionUsage) -> None: + span.set_attribute(GEN_AI_RESPONSE_MODEL, model) + span.set_attribute(GEN_AI_USAGE_INPUT_TOKENS, usage.prompt_tokens) + + def _decode_function_arguments(arguments: str): try: return json.loads(arguments) @@ -98,6 +105,23 @@ def _message_from_stream_choices(choices): return message +def _attributes_from_client(client): + span_attributes = {} + + if base_url := getattr(client, "_base_url", None): + if host := getattr(base_url, "host", None): + span_attributes[SERVER_ADDRESS] = host + if port := getattr(base_url, "port", None): + span_attributes[SERVER_PORT] = port + elif scheme := getattr(base_url, "scheme", None): + if scheme == "http": + span_attributes[SERVER_PORT] = 80 + elif scheme == "https": + span_attributes[SERVER_PORT] = 443 + + return span_attributes + + def _get_span_attributes_from_wrapper(instance, kwargs): span_attributes = { GEN_AI_OPERATION_NAME: "chat", @@ -106,16 +130,7 @@ def _get_span_attributes_from_wrapper(instance, kwargs): } if client := getattr(instance, "_client", None): - if base_url := getattr(client, "_base_url", None): - if host := getattr(base_url, "host", None): - span_attributes[SERVER_ADDRESS] = host - if port := getattr(base_url, "port", None): - span_attributes[SERVER_PORT] = port - elif scheme := getattr(base_url, "scheme", None): - if scheme == "http": - span_attributes[SERVER_PORT] = 80 - elif scheme == "https": - span_attributes[SERVER_PORT] = 443 + span_attributes.update(_attributes_from_client(client)) if (frequency_penalty := kwargs.get("frequency_penalty")) is not None: span_attributes[GEN_AI_REQUEST_FREQUENCY_PENALTY] = frequency_penalty @@ -135,6 +150,22 @@ def _get_span_attributes_from_wrapper(instance, kwargs): return span_attributes +def _get_embeddings_span_attributes_from_wrapper(instance, kwargs): + span_attributes = { + GEN_AI_OPERATION_NAME: "embeddings", + GEN_AI_REQUEST_MODEL: kwargs["model"], + GEN_AI_SYSTEM: "openai", + } + + if client := getattr(instance, "_client", None): + span_attributes.update(_attributes_from_client(client)) + + if (encoding_format := kwargs.get("encoding_format")) is not None: + span_attributes[GEN_AI_REQUEST_ENCODING_FORMAT] = encoding_format + + return span_attributes + + def _get_attributes_if_set(span: Span, names: Iterable) -> dict: """Returns a dict with any attribute found in the span attributes""" attributes = span.attributes @@ -154,7 +185,9 @@ def _record_token_usage_metrics(metric: Histogram, span: Span, usage: Completion ), ) metric.record(usage.prompt_tokens, {**token_usage_metric_attrs, GEN_AI_TOKEN_TYPE: "input"}) - metric.record(usage.completion_tokens, {**token_usage_metric_attrs, GEN_AI_TOKEN_TYPE: "output"}) + # embeddings responses only have input tokens + if hasattr(usage, "completion_tokens"): + metric.record(usage.completion_tokens, {**token_usage_metric_attrs, GEN_AI_TOKEN_TYPE: "output"}) def _record_operation_duration_metric(metric: Histogram, span: Span, start: float): diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/base.py b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/base.py new file mode 100644 index 0000000..f4e46b8 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/base.py @@ -0,0 +1,207 @@ +# 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/TestAsyncChatCompletions.test_async_local.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_local.yaml index 19d64a2..3921ba5 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_local.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncChatCompletions.test_async_local.yaml @@ -1,7 +1,7 @@ interactions: - request: body: '{"messages": [{"role": "user", "content": "Answer in up to 3 words: Which - ocean contains the falkland islands?"}], "model": "sam4096/qwen2tools:0.5b"}' + ocean contains the falkland islands?"}], "model": "qwen2.5:0.5b"}' headers: accept: - application/json @@ -37,7 +37,7 @@ interactions: uri: http://localhost:11434/v1/chat/completions response: body: - string: '{"id":"chatcmpl-533","object":"chat.completion","created":1726145246,"model":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"The + 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}} ' 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 index 69c9a53..a142994 100644 --- 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 @@ -1,7 +1,7 @@ interactions: - request: body: '{"messages": [{"role": "user", "content": "Answer in up to 3 words: Which - ocean contains the falkland islands?"}], "model": "sam4096/qwen2tools:0.5b", + ocean contains the falkland islands?"}], "model": "qwen2.5:0.5b", "stream": true}' headers: accept: @@ -38,17 +38,17 @@ interactions: uri: http://localhost:11434/v1/chat/completions response: body: - string: 'data: {"id":"chatcmpl-242","object":"chat.completion.chunk","created":1726147606,"model":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"T"},"finish_reason":null}]} + 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":"sam4096/qwen2tools: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":"ropical"},"finish_reason":null}]} - data: {"id":"chatcmpl-242","object":"chat.completion.chunk","created":1726147606,"model":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + 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":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} + 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] 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/TestAsyncLocalEmbeddings.test_all_the_client_options.yaml new file mode 100644 index 0000000..0d16f03 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncLocalEmbeddings.test_all_the_client_options.yaml @@ -0,0 +1,57 @@ +interactions: +- request: + body: '{"input": ["South Atlantic Ocean."], "model": "all-minilm:33m", "encoding_format": + "float"}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '91' + content-type: + - application/json + host: + - localhost:11434 + 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: http://localhost:11434/v1/embeddings + response: + body: + string: '{"object":"list","data":[{"object":"embedding","embedding":[0.020238575,-0.067603655,-0.0055350005,-0.025901468,0.039134417,-0.07973226,-0.0025106478,0.038172755,-0.0220365,0.03762737,0.019464284,0.012076804,0.037383866,-0.029357895,-0.07140336,0.048738256,0.023850564,-0.050092258,0.063617915,0.024232103,0.06786849,0.097488515,-0.03434785,-0.026251148,0.03289966,-0.066301756,-0.029151374,0.090780325,-0.033484105,-0.05349253,0.05199815,0.02674452,-0.018177819,0.023735534,0.03045539,-0.058784653,-0.0006498593,-0.041484576,0.094355054,0.06305357,-0.041899323,-0.038760975,0.017451422,0.055241875,0.014928589,-0.062718496,-0.0055089775,0.069734536,0.03447868,-0.025786871,0.030426526,-0.03787025,-0.09764942,-0.039001897,0.015091974,0.04130729,-0.07442466,-0.026093785,-0.079654776,-0.020952791,0.08062998,0.056691695,-0.05396359,0.0104389535,-0.03391337,0.054115828,-0.02475624,0.0637552,-0.05026828,-0.105304554,-0.025406728,0.018377695,-0.008998563,0.041090712,0.08723917,-0.08823693,-0.03565629,0.0067954925,-0.02416098,0.016172646,0.0014353979,-0.007635756,-0.008469932,0.07858833,0.08338246,-0.029973995,-0.0038711221,-0.11744193,-0.0050501786,-0.015575636,-0.031166617,-0.07616883,-0.05916375,-0.01923404,-0.06493991,0.038902365,-0.05988498,-0.04265531,-0.066932954,0.132832,0.05104717,0.03370988,-0.038690995,-0.006381039,0.070121914,0.09859214,0.0066886847,0.0017949097,0.02325864,-0.05334184,-0.063360564,0.019489558,-0.10830339,-0.077218026,-0.026913162,-0.0027655486,-0.047402453,-0.024734022,-0.018850273,-0.009488749,-0.03612393,-0.00431065,0.012851817,0.07210611,-0.01025445,-0.021802748,0.016996628,-0.04010331,0.07552928,-0.122887164,0.06715445,0.06980343,-0.022516014,0.041706588,-0.021884853,-0.055448882,-0.021441614,0.07537825,-0.035109345,-0.010932432,-0.035653174,-0.00512299,0.03721748,-0.009941104,0.04690756,0.030060058,-0.046139352,-0.030722251,-0.017784324,0.045633737,0.025788452,-0.02757992,0.01345617,-0.073880896,-0.05330018,-0.017612051,-0.04172501,0.049004886,0.057442747,-0.0016323416,-0.012815569,0.057215676,0.035265833,-0.015208088,-0.016590228,0.0075846845,0.0000632459,0.064949244,0.049854696,-0.0017310231,-0.047171354,0.104014836,0.023878893,-0.032303143,-0.058545776,0.0918256,0.04137403,0.035538383,-0.0025768424,-0.012942714,0.016441159,-0.013741499,-0.045992494,0.03494218,0.0214104,-0.015835129,-0.021982314,-0.04719161,0.07148731,0.08773022,0.13266747,-0.03990185,0.07074697,0.092073135,-0.009996082,-0.05665136,-0.0110974545,-0.021186208,0.011514954,-0.056800876,0.04356576,0.031881373,0.042742077,0.071587525,0.092212774,0.016282512,0.08718484,-0.021142948,-0.05312013,0.050425246,-0.009014846,0.037564885,-0.021584045,-0.005614559,-0.024191162,-0.01640164,0.046872575,-0.05962722,-0.10025344,-0.015198743,0.07399379,-0.026101409,-0.052654807,6.7117274e-33,0.008058421,0.00039824526,-0.085726604,-0.000074562646,-0.029765353,-0.06811975,0.06014477,0.09399003,-0.087323494,-0.034551434,-0.07309859,-0.012045084,0.13996105,0.008875395,0.0115905525,-0.0016243597,-0.0026131538,0.05634356,-0.02423776,-0.00815539,0.049586296,-0.07790137,0.08224709,0.073314436,-0.060361113,0.04272933,-0.01517245,-0.00903136,-0.09826167,-0.08857193,-0.021091739,0.09368569,0.009496647,0.063031055,-0.07178574,0.01935741,-0.058569036,-0.052229743,0.003274078,-0.0761883,-0.024532218,-0.04517826,0.025527768,0.062371816,0.03449726,0.028313227,-0.00824433,0.050835248,-0.05379111,0.03261631,-0.0059633707,-0.0069838446,0.07617442,0.038106248,0.035563402,0.02718432,-0.060723282,0.009588595,-0.04425611,0.022720786,0.07028238,-0.03349854,-0.019532245,0.030009037,0.08266604,0.051748272,0.006289073,0.0620938,-0.058303297,0.032228537,-0.02080824,-0.027597072,-0.05708918,-0.011683397,-0.018875588,0.028114296,-0.0059795678,-0.010916794,-0.051868517,0.025415089,-0.13638805,-0.028396102,0.009807943,0.07893343,0.011477604,-0.08126589,0.043204855,-0.07153455,0.0062694172,-0.029702486,0.029131636,-0.017969213,-0.101411335,-0.10118383,0.012476073,-4.5183865e-33,0.014497015,0.032495562,0.0049357894,0.04955029,-0.020423668,-0.0014398395,0.064327,0.02197018,0.113793,-0.014859724,-0.0033947527,0.051327504,0.02366049,-0.05579724,0.008917542,0.021667805,-0.05524281,0.077722095,0.015677655,-0.028756432,0.07348621,0.05950817,0.04026291,-0.025902241,0.009477393,0.06648141,0.0062481337,0.05281992,0.046791505,0.025910243,0.08720314,-0.07901434,-0.111682855,-0.038712163,-0.024854826,-0.029313149,-0.02098991,0.04849633,-0.09546692,-0.030456422,0.004327558,0.10614414,0.06417807,-0.053102467,0.0630565,0.018105814,0.042458892,0.04295112,-0.010424974,-0.05366936,-0.027760327,0.037903257,-0.02330993,0.10888448,0.02122689,-0.052826557,0.064050466,-0.02825889,-0.07498362,0.05557117,-0.049085356,-0.02378308,-0.0825655,0.047098454],"index":0}],"model":"all-minilm:33m","usage":{"prompt_tokens":4,"total_tokens":4}} + + ' + headers: + Content-Type: + - application/json + Date: + - Tue, 12 Nov 2024 14:18:04 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/TestAsyncLocalEmbeddings.test_basic.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncLocalEmbeddings.test_basic.yaml new file mode 100644 index 0000000..294f97d --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncLocalEmbeddings.test_basic.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: '{"input": ["South Atlantic Ocean."], "model": "all-minilm:33m"}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '63' + content-type: + - application/json + host: + - localhost:11434 + 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: http://localhost:11434/v1/embeddings + response: + body: + string: '{"object":"list","data":[{"object":"embedding","embedding":[0.020238575,-0.067603655,-0.0055350005,-0.025901468,0.039134417,-0.07973226,-0.0025106478,0.038172755,-0.0220365,0.03762737,0.019464284,0.012076804,0.037383866,-0.029357895,-0.07140336,0.048738256,0.023850564,-0.050092258,0.063617915,0.024232103,0.06786849,0.097488515,-0.03434785,-0.026251148,0.03289966,-0.066301756,-0.029151374,0.090780325,-0.033484105,-0.05349253,0.05199815,0.02674452,-0.018177819,0.023735534,0.03045539,-0.058784653,-0.0006498593,-0.041484576,0.094355054,0.06305357,-0.041899323,-0.038760975,0.017451422,0.055241875,0.014928589,-0.062718496,-0.0055089775,0.069734536,0.03447868,-0.025786871,0.030426526,-0.03787025,-0.09764942,-0.039001897,0.015091974,0.04130729,-0.07442466,-0.026093785,-0.079654776,-0.020952791,0.08062998,0.056691695,-0.05396359,0.0104389535,-0.03391337,0.054115828,-0.02475624,0.0637552,-0.05026828,-0.105304554,-0.025406728,0.018377695,-0.008998563,0.041090712,0.08723917,-0.08823693,-0.03565629,0.0067954925,-0.02416098,0.016172646,0.0014353979,-0.007635756,-0.008469932,0.07858833,0.08338246,-0.029973995,-0.0038711221,-0.11744193,-0.0050501786,-0.015575636,-0.031166617,-0.07616883,-0.05916375,-0.01923404,-0.06493991,0.038902365,-0.05988498,-0.04265531,-0.066932954,0.132832,0.05104717,0.03370988,-0.038690995,-0.006381039,0.070121914,0.09859214,0.0066886847,0.0017949097,0.02325864,-0.05334184,-0.063360564,0.019489558,-0.10830339,-0.077218026,-0.026913162,-0.0027655486,-0.047402453,-0.024734022,-0.018850273,-0.009488749,-0.03612393,-0.00431065,0.012851817,0.07210611,-0.01025445,-0.021802748,0.016996628,-0.04010331,0.07552928,-0.122887164,0.06715445,0.06980343,-0.022516014,0.041706588,-0.021884853,-0.055448882,-0.021441614,0.07537825,-0.035109345,-0.010932432,-0.035653174,-0.00512299,0.03721748,-0.009941104,0.04690756,0.030060058,-0.046139352,-0.030722251,-0.017784324,0.045633737,0.025788452,-0.02757992,0.01345617,-0.073880896,-0.05330018,-0.017612051,-0.04172501,0.049004886,0.057442747,-0.0016323416,-0.012815569,0.057215676,0.035265833,-0.015208088,-0.016590228,0.0075846845,0.0000632459,0.064949244,0.049854696,-0.0017310231,-0.047171354,0.104014836,0.023878893,-0.032303143,-0.058545776,0.0918256,0.04137403,0.035538383,-0.0025768424,-0.012942714,0.016441159,-0.013741499,-0.045992494,0.03494218,0.0214104,-0.015835129,-0.021982314,-0.04719161,0.07148731,0.08773022,0.13266747,-0.03990185,0.07074697,0.092073135,-0.009996082,-0.05665136,-0.0110974545,-0.021186208,0.011514954,-0.056800876,0.04356576,0.031881373,0.042742077,0.071587525,0.092212774,0.016282512,0.08718484,-0.021142948,-0.05312013,0.050425246,-0.009014846,0.037564885,-0.021584045,-0.005614559,-0.024191162,-0.01640164,0.046872575,-0.05962722,-0.10025344,-0.015198743,0.07399379,-0.026101409,-0.052654807,6.7117274e-33,0.008058421,0.00039824526,-0.085726604,-0.000074562646,-0.029765353,-0.06811975,0.06014477,0.09399003,-0.087323494,-0.034551434,-0.07309859,-0.012045084,0.13996105,0.008875395,0.0115905525,-0.0016243597,-0.0026131538,0.05634356,-0.02423776,-0.00815539,0.049586296,-0.07790137,0.08224709,0.073314436,-0.060361113,0.04272933,-0.01517245,-0.00903136,-0.09826167,-0.08857193,-0.021091739,0.09368569,0.009496647,0.063031055,-0.07178574,0.01935741,-0.058569036,-0.052229743,0.003274078,-0.0761883,-0.024532218,-0.04517826,0.025527768,0.062371816,0.03449726,0.028313227,-0.00824433,0.050835248,-0.05379111,0.03261631,-0.0059633707,-0.0069838446,0.07617442,0.038106248,0.035563402,0.02718432,-0.060723282,0.009588595,-0.04425611,0.022720786,0.07028238,-0.03349854,-0.019532245,0.030009037,0.08266604,0.051748272,0.006289073,0.0620938,-0.058303297,0.032228537,-0.02080824,-0.027597072,-0.05708918,-0.011683397,-0.018875588,0.028114296,-0.0059795678,-0.010916794,-0.051868517,0.025415089,-0.13638805,-0.028396102,0.009807943,0.07893343,0.011477604,-0.08126589,0.043204855,-0.07153455,0.0062694172,-0.029702486,0.029131636,-0.017969213,-0.101411335,-0.10118383,0.012476073,-4.5183865e-33,0.014497015,0.032495562,0.0049357894,0.04955029,-0.020423668,-0.0014398395,0.064327,0.02197018,0.113793,-0.014859724,-0.0033947527,0.051327504,0.02366049,-0.05579724,0.008917542,0.021667805,-0.05524281,0.077722095,0.015677655,-0.028756432,0.07348621,0.05950817,0.04026291,-0.025902241,0.009477393,0.06648141,0.0062481337,0.05281992,0.046791505,0.025910243,0.08720314,-0.07901434,-0.111682855,-0.038712163,-0.024854826,-0.029313149,-0.02098991,0.04849633,-0.09546692,-0.030456422,0.004327558,0.10614414,0.06417807,-0.053102467,0.0630565,0.018105814,0.042458892,0.04295112,-0.010424974,-0.05366936,-0.027760327,0.037903257,-0.02330993,0.10888448,0.02122689,-0.052826557,0.064050466,-0.02825889,-0.07498362,0.05557117,-0.049085356,-0.02378308,-0.0825655,0.047098454],"index":0}],"model":"all-minilm:33m","usage":{"prompt_tokens":4,"total_tokens":4}} + + ' + headers: + Content-Type: + - application/json + Date: + - Tue, 12 Nov 2024 14:22:22 GMT + Set-Cookie: test_set_cookie + Transfer-Encoding: + - chunked + openai-organization: test_openai_org_key + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncOpenAIEmbeddings.test_all_the_client_options.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncOpenAIEmbeddings.test_all_the_client_options.yaml new file mode 100644 index 0000000..5eb5027 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncOpenAIEmbeddings.test_all_the_client_options.yaml @@ -0,0 +1,482 @@ +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 new file mode 100644 index 0000000..5bac394 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestAsyncOpenAIEmbeddings.test_basic.yaml @@ -0,0 +1,481 @@ +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.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local.yaml index 2efe728..222fe5a 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local.yaml @@ -1,7 +1,7 @@ interactions: - request: body: '{"messages": [{"role": "user", "content": "Answer in up to 3 words: Which - ocean contains the falkland islands?"}], "model": "sam4096/qwen2tools:0.5b"}' + ocean contains the falkland islands?"}], "model": "qwen2.5:0.5b"}' headers: accept: - application/json @@ -37,7 +37,7 @@ interactions: uri: http://localhost:11434/v1/chat/completions response: body: - string: '{"id":"chatcmpl-753","object":"chat.completion","created":1725605681,"model":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"The + 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}} ' 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 index aaea579..e5c6c99 100644 --- 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 @@ -1,7 +1,7 @@ interactions: - request: body: '{"messages": [{"role": "user", "content": "Answer in up to 3 words: Which - ocean contains the falkland islands?"}], "model": "sam4096/qwen2tools:0.5b", + ocean contains the falkland islands?"}], "model": "qwen2.5:0.5b", "stream": true}' headers: accept: @@ -38,16 +38,16 @@ interactions: uri: http://localhost:11434/v1/chat/completions response: body: - string: 'data: {"id":"chatcmpl-735","object":"chat.completion.chunk","created":1726043659,"model":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"O"},"finish_reason":null}]} + 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":"sam4096/qwen2tools: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":"ce"},"finish_reason":null}]} - data: {"id":"chatcmpl-735","object":"chat.completion.chunk","created":1726043659,"model":"sam4096/qwen2tools: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":"ania"},"finish_reason":null}]} - data: {"id":"chatcmpl-735","object":"chat.completion.chunk","created":1726043659,"model":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} + 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] 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/TestChatCompletions.test_local_stream_error_handling.yaml index 86b1e9a..611c19a 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local_stream_error_handling.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local_stream_error_handling.yaml @@ -1,7 +1,7 @@ interactions: - request: body: '{"messages": [{"role": "user", "content": "Answer in up to 3 words: Which - ocean contains the falkland islands?"}], "model": "sam4096/qwen2tools:0.5b", + ocean contains the falkland islands?"}], "model": "qwen2.5:0.5b", "stream": true}' headers: accept: @@ -38,36 +38,36 @@ interactions: uri: http://localhost:11434/v1/chat/completions response: body: - string: 'data: {"id":"chatcmpl-377","object":"chat.completion.chunk","created":1726043716,"model":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"The"},"finish_reason":null}]} + 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}]} - data: {"id":"chatcmpl-377","object":"chat.completion.chunk","created":1726043716,"model":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + 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-377","object":"chat.completion.chunk","created":1726043716,"model":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + 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-377","object":"chat.completion.chunk","created":1726043716,"model":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"ic"},"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-377","object":"chat.completion.chunk","created":1726043716,"model":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + 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-377","object":"chat.completion.chunk","created":1726043716,"model":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + 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-377","object":"chat.completion.chunk","created":1726043716,"model":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + 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-377","object":"chat.completion.chunk","created":1726043716,"model":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"."},"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-377","object":"chat.completion.chunk","created":1726043716,"model":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} + 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: [DONE] 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 index c3f9f51..b6e33e1 100644 --- 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 @@ -1,7 +1,7 @@ interactions: - request: body: '{"messages": [{"role": "user", "content": "Answer in up to 3 words: Which - ocean contains the falkland islands?"}], "model": "sam4096/qwen2tools:0.5b", + ocean contains the falkland islands?"}], "model": "qwen2.5:0.5b", "stream": true}' headers: accept: @@ -38,17 +38,17 @@ interactions: uri: http://localhost:11434/v1/chat/completions response: body: - string: 'data: {"id":"chatcmpl-829","object":"chat.completion.chunk","created":1726048508,"model":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"Pacific"},"finish_reason":null}]} + 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":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + 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":"sam4096/qwen2tools: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":null}]} - data: {"id":"chatcmpl-829","object":"chat.completion.chunk","created":1726048508,"model":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} + 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] 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/TestChatCompletions.test_local_with_capture_content.yaml index 65aa069..df12081 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local_with_capture_content.yaml +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestChatCompletions.test_local_with_capture_content.yaml @@ -1,7 +1,7 @@ interactions: - request: body: '{"messages": [{"role": "user", "content": "Answer in up to 3 words: Which - ocean contains the falkland islands?"}], "model": "sam4096/qwen2tools:0.5b"}' + ocean contains the falkland islands?"}], "model": "qwen2.5:0.5b"}' headers: accept: - application/json @@ -37,7 +37,7 @@ interactions: uri: http://localhost:11434/v1/chat/completions response: body: - string: '{"id":"chatcmpl-364","object":"chat.completion","created":1726048337,"model":"sam4096/qwen2tools:0.5b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"ocean + 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}} ' 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/TestLocalEmbeddings.test_all_the_client_options.yaml new file mode 100644 index 0000000..030d248 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestLocalEmbeddings.test_all_the_client_options.yaml @@ -0,0 +1,57 @@ +interactions: +- request: + body: '{"input": ["South Atlantic Ocean."], "model": "all-minilm:33m", "encoding_format": + "float"}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '91' + content-type: + - application/json + host: + - localhost:11434 + 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: http://localhost:11434/v1/embeddings + response: + body: + string: '{"object":"list","data":[{"object":"embedding","embedding":[0.020238575,-0.067603655,-0.0055350005,-0.025901468,0.039134417,-0.07973226,-0.0025106478,0.038172755,-0.0220365,0.03762737,0.019464284,0.012076804,0.037383866,-0.029357895,-0.07140336,0.048738256,0.023850564,-0.050092258,0.063617915,0.024232103,0.06786849,0.097488515,-0.03434785,-0.026251148,0.03289966,-0.066301756,-0.029151374,0.090780325,-0.033484105,-0.05349253,0.05199815,0.02674452,-0.018177819,0.023735534,0.03045539,-0.058784653,-0.0006498593,-0.041484576,0.094355054,0.06305357,-0.041899323,-0.038760975,0.017451422,0.055241875,0.014928589,-0.062718496,-0.0055089775,0.069734536,0.03447868,-0.025786871,0.030426526,-0.03787025,-0.09764942,-0.039001897,0.015091974,0.04130729,-0.07442466,-0.026093785,-0.079654776,-0.020952791,0.08062998,0.056691695,-0.05396359,0.0104389535,-0.03391337,0.054115828,-0.02475624,0.0637552,-0.05026828,-0.105304554,-0.025406728,0.018377695,-0.008998563,0.041090712,0.08723917,-0.08823693,-0.03565629,0.0067954925,-0.02416098,0.016172646,0.0014353979,-0.007635756,-0.008469932,0.07858833,0.08338246,-0.029973995,-0.0038711221,-0.11744193,-0.0050501786,-0.015575636,-0.031166617,-0.07616883,-0.05916375,-0.01923404,-0.06493991,0.038902365,-0.05988498,-0.04265531,-0.066932954,0.132832,0.05104717,0.03370988,-0.038690995,-0.006381039,0.070121914,0.09859214,0.0066886847,0.0017949097,0.02325864,-0.05334184,-0.063360564,0.019489558,-0.10830339,-0.077218026,-0.026913162,-0.0027655486,-0.047402453,-0.024734022,-0.018850273,-0.009488749,-0.03612393,-0.00431065,0.012851817,0.07210611,-0.01025445,-0.021802748,0.016996628,-0.04010331,0.07552928,-0.122887164,0.06715445,0.06980343,-0.022516014,0.041706588,-0.021884853,-0.055448882,-0.021441614,0.07537825,-0.035109345,-0.010932432,-0.035653174,-0.00512299,0.03721748,-0.009941104,0.04690756,0.030060058,-0.046139352,-0.030722251,-0.017784324,0.045633737,0.025788452,-0.02757992,0.01345617,-0.073880896,-0.05330018,-0.017612051,-0.04172501,0.049004886,0.057442747,-0.0016323416,-0.012815569,0.057215676,0.035265833,-0.015208088,-0.016590228,0.0075846845,0.0000632459,0.064949244,0.049854696,-0.0017310231,-0.047171354,0.104014836,0.023878893,-0.032303143,-0.058545776,0.0918256,0.04137403,0.035538383,-0.0025768424,-0.012942714,0.016441159,-0.013741499,-0.045992494,0.03494218,0.0214104,-0.015835129,-0.021982314,-0.04719161,0.07148731,0.08773022,0.13266747,-0.03990185,0.07074697,0.092073135,-0.009996082,-0.05665136,-0.0110974545,-0.021186208,0.011514954,-0.056800876,0.04356576,0.031881373,0.042742077,0.071587525,0.092212774,0.016282512,0.08718484,-0.021142948,-0.05312013,0.050425246,-0.009014846,0.037564885,-0.021584045,-0.005614559,-0.024191162,-0.01640164,0.046872575,-0.05962722,-0.10025344,-0.015198743,0.07399379,-0.026101409,-0.052654807,6.7117274e-33,0.008058421,0.00039824526,-0.085726604,-0.000074562646,-0.029765353,-0.06811975,0.06014477,0.09399003,-0.087323494,-0.034551434,-0.07309859,-0.012045084,0.13996105,0.008875395,0.0115905525,-0.0016243597,-0.0026131538,0.05634356,-0.02423776,-0.00815539,0.049586296,-0.07790137,0.08224709,0.073314436,-0.060361113,0.04272933,-0.01517245,-0.00903136,-0.09826167,-0.08857193,-0.021091739,0.09368569,0.009496647,0.063031055,-0.07178574,0.01935741,-0.058569036,-0.052229743,0.003274078,-0.0761883,-0.024532218,-0.04517826,0.025527768,0.062371816,0.03449726,0.028313227,-0.00824433,0.050835248,-0.05379111,0.03261631,-0.0059633707,-0.0069838446,0.07617442,0.038106248,0.035563402,0.02718432,-0.060723282,0.009588595,-0.04425611,0.022720786,0.07028238,-0.03349854,-0.019532245,0.030009037,0.08266604,0.051748272,0.006289073,0.0620938,-0.058303297,0.032228537,-0.02080824,-0.027597072,-0.05708918,-0.011683397,-0.018875588,0.028114296,-0.0059795678,-0.010916794,-0.051868517,0.025415089,-0.13638805,-0.028396102,0.009807943,0.07893343,0.011477604,-0.08126589,0.043204855,-0.07153455,0.0062694172,-0.029702486,0.029131636,-0.017969213,-0.101411335,-0.10118383,0.012476073,-4.5183865e-33,0.014497015,0.032495562,0.0049357894,0.04955029,-0.020423668,-0.0014398395,0.064327,0.02197018,0.113793,-0.014859724,-0.0033947527,0.051327504,0.02366049,-0.05579724,0.008917542,0.021667805,-0.05524281,0.077722095,0.015677655,-0.028756432,0.07348621,0.05950817,0.04026291,-0.025902241,0.009477393,0.06648141,0.0062481337,0.05281992,0.046791505,0.025910243,0.08720314,-0.07901434,-0.111682855,-0.038712163,-0.024854826,-0.029313149,-0.02098991,0.04849633,-0.09546692,-0.030456422,0.004327558,0.10614414,0.06417807,-0.053102467,0.0630565,0.018105814,0.042458892,0.04295112,-0.010424974,-0.05366936,-0.027760327,0.037903257,-0.02330993,0.10888448,0.02122689,-0.052826557,0.064050466,-0.02825889,-0.07498362,0.05557117,-0.049085356,-0.02378308,-0.0825655,0.047098454],"index":0}],"model":"all-minilm:33m","usage":{"prompt_tokens":4,"total_tokens":4}} + + ' + headers: + Content-Type: + - application/json + Date: + - Tue, 12 Nov 2024 14:22:21 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/TestLocalEmbeddings.test_basic.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestLocalEmbeddings.test_basic.yaml new file mode 100644 index 0000000..687ca8b --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestLocalEmbeddings.test_basic.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: '{"input": ["South Atlantic Ocean."], "model": "all-minilm:33m"}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '63' + content-type: + - application/json + host: + - localhost:11434 + 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: http://localhost:11434/v1/embeddings + response: + body: + string: '{"object":"list","data":[{"object":"embedding","embedding":[0.020238575,-0.067603655,-0.0055350005,-0.025901468,0.039134417,-0.07973226,-0.0025106478,0.038172755,-0.0220365,0.03762737,0.019464284,0.012076804,0.037383866,-0.029357895,-0.07140336,0.048738256,0.023850564,-0.050092258,0.063617915,0.024232103,0.06786849,0.097488515,-0.03434785,-0.026251148,0.03289966,-0.066301756,-0.029151374,0.090780325,-0.033484105,-0.05349253,0.05199815,0.02674452,-0.018177819,0.023735534,0.03045539,-0.058784653,-0.0006498593,-0.041484576,0.094355054,0.06305357,-0.041899323,-0.038760975,0.017451422,0.055241875,0.014928589,-0.062718496,-0.0055089775,0.069734536,0.03447868,-0.025786871,0.030426526,-0.03787025,-0.09764942,-0.039001897,0.015091974,0.04130729,-0.07442466,-0.026093785,-0.079654776,-0.020952791,0.08062998,0.056691695,-0.05396359,0.0104389535,-0.03391337,0.054115828,-0.02475624,0.0637552,-0.05026828,-0.105304554,-0.025406728,0.018377695,-0.008998563,0.041090712,0.08723917,-0.08823693,-0.03565629,0.0067954925,-0.02416098,0.016172646,0.0014353979,-0.007635756,-0.008469932,0.07858833,0.08338246,-0.029973995,-0.0038711221,-0.11744193,-0.0050501786,-0.015575636,-0.031166617,-0.07616883,-0.05916375,-0.01923404,-0.06493991,0.038902365,-0.05988498,-0.04265531,-0.066932954,0.132832,0.05104717,0.03370988,-0.038690995,-0.006381039,0.070121914,0.09859214,0.0066886847,0.0017949097,0.02325864,-0.05334184,-0.063360564,0.019489558,-0.10830339,-0.077218026,-0.026913162,-0.0027655486,-0.047402453,-0.024734022,-0.018850273,-0.009488749,-0.03612393,-0.00431065,0.012851817,0.07210611,-0.01025445,-0.021802748,0.016996628,-0.04010331,0.07552928,-0.122887164,0.06715445,0.06980343,-0.022516014,0.041706588,-0.021884853,-0.055448882,-0.021441614,0.07537825,-0.035109345,-0.010932432,-0.035653174,-0.00512299,0.03721748,-0.009941104,0.04690756,0.030060058,-0.046139352,-0.030722251,-0.017784324,0.045633737,0.025788452,-0.02757992,0.01345617,-0.073880896,-0.05330018,-0.017612051,-0.04172501,0.049004886,0.057442747,-0.0016323416,-0.012815569,0.057215676,0.035265833,-0.015208088,-0.016590228,0.0075846845,0.0000632459,0.064949244,0.049854696,-0.0017310231,-0.047171354,0.104014836,0.023878893,-0.032303143,-0.058545776,0.0918256,0.04137403,0.035538383,-0.0025768424,-0.012942714,0.016441159,-0.013741499,-0.045992494,0.03494218,0.0214104,-0.015835129,-0.021982314,-0.04719161,0.07148731,0.08773022,0.13266747,-0.03990185,0.07074697,0.092073135,-0.009996082,-0.05665136,-0.0110974545,-0.021186208,0.011514954,-0.056800876,0.04356576,0.031881373,0.042742077,0.071587525,0.092212774,0.016282512,0.08718484,-0.021142948,-0.05312013,0.050425246,-0.009014846,0.037564885,-0.021584045,-0.005614559,-0.024191162,-0.01640164,0.046872575,-0.05962722,-0.10025344,-0.015198743,0.07399379,-0.026101409,-0.052654807,6.7117274e-33,0.008058421,0.00039824526,-0.085726604,-0.000074562646,-0.029765353,-0.06811975,0.06014477,0.09399003,-0.087323494,-0.034551434,-0.07309859,-0.012045084,0.13996105,0.008875395,0.0115905525,-0.0016243597,-0.0026131538,0.05634356,-0.02423776,-0.00815539,0.049586296,-0.07790137,0.08224709,0.073314436,-0.060361113,0.04272933,-0.01517245,-0.00903136,-0.09826167,-0.08857193,-0.021091739,0.09368569,0.009496647,0.063031055,-0.07178574,0.01935741,-0.058569036,-0.052229743,0.003274078,-0.0761883,-0.024532218,-0.04517826,0.025527768,0.062371816,0.03449726,0.028313227,-0.00824433,0.050835248,-0.05379111,0.03261631,-0.0059633707,-0.0069838446,0.07617442,0.038106248,0.035563402,0.02718432,-0.060723282,0.009588595,-0.04425611,0.022720786,0.07028238,-0.03349854,-0.019532245,0.030009037,0.08266604,0.051748272,0.006289073,0.0620938,-0.058303297,0.032228537,-0.02080824,-0.027597072,-0.05708918,-0.011683397,-0.018875588,0.028114296,-0.0059795678,-0.010916794,-0.051868517,0.025415089,-0.13638805,-0.028396102,0.009807943,0.07893343,0.011477604,-0.08126589,0.043204855,-0.07153455,0.0062694172,-0.029702486,0.029131636,-0.017969213,-0.101411335,-0.10118383,0.012476073,-4.5183865e-33,0.014497015,0.032495562,0.0049357894,0.04955029,-0.020423668,-0.0014398395,0.064327,0.02197018,0.113793,-0.014859724,-0.0033947527,0.051327504,0.02366049,-0.05579724,0.008917542,0.021667805,-0.05524281,0.077722095,0.015677655,-0.028756432,0.07348621,0.05950817,0.04026291,-0.025902241,0.009477393,0.06648141,0.0062481337,0.05281992,0.046791505,0.025910243,0.08720314,-0.07901434,-0.111682855,-0.038712163,-0.024854826,-0.029313149,-0.02098991,0.04849633,-0.09546692,-0.030456422,0.004327558,0.10614414,0.06417807,-0.053102467,0.0630565,0.018105814,0.042458892,0.04295112,-0.010424974,-0.05366936,-0.027760327,0.037903257,-0.02330993,0.10888448,0.02122689,-0.052826557,0.064050466,-0.02825889,-0.07498362,0.05557117,-0.049085356,-0.02378308,-0.0825655,0.047098454],"index":0}],"model":"all-minilm:33m","usage":{"prompt_tokens":4,"total_tokens":4}} + + ' + headers: + Content-Type: + - application/json + Date: + - Tue, 12 Nov 2024 14:18:04 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 new file mode 100644 index 0000000..f71ea7f --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestOpenAIEmbeddings.test_all_the_client_options.yaml @@ -0,0 +1,482 @@ +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/cassettes/TestOpenAIEmbeddings.test_basic.yaml b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestOpenAIEmbeddings.test_basic.yaml new file mode 100644 index 0000000..ace015d --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/cassettes/TestOpenAIEmbeddings.test_basic.yaml @@ -0,0 +1,481 @@ +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: + - 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.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: + - 8e174dd6cc77bae7-MXP + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 12 Nov 2024 14:45:08 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: + - '33244' + openai-model: + - text-embedding-3-small + openai-organization: test_openai_org_key + openai-processing-ms: + - '164' + 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_663c545d1a75504a634de5e768246ba1 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_chat_completions.py b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_chat_completions.py index b2b2b89..f79ecae 100644 --- a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_chat_completions.py +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_chat_completions.py @@ -21,7 +21,6 @@ import openai from opentelemetry.instrumentation.openai import OpenAIInstrumentor from opentelemetry.test.test_base import TestBase -from opentelemetry.metrics import Histogram from opentelemetry.trace import SpanKind, StatusCode from opentelemetry.semconv._incubating.attributes.gen_ai_attributes import ( GEN_AI_OPERATION_NAME, @@ -41,149 +40,14 @@ ) from opentelemetry.semconv.attributes.error_attributes import ERROR_TYPE from opentelemetry.semconv.attributes.server_attributes import SERVER_ADDRESS, SERVER_PORT -from vcr.unittest import VCRMixin - -# Use the same model for tools as for chat completion -OPENAI_TOOL_MODEL = "gpt-4o-mini" -OPENAI_API_KEY = "test_openai_api_key" -OPENAI_ORG_ID = "test_openai_org_key" -OPENAI_PROJECT_ID = "test_openai_project_id" - -LOCAL_MODEL = "sam4096/qwen2tools:0.5b" - - -class OpenaiMixin(VCRMixin): - def _get_vcr_kwargs(self, **kwargs): - """ - This scrubs sensitive data when in recording mode. - """ - return { - "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 setUpClass(cls): - cls.client = cls.setup_client() - - 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": "chat", - "gen_ai.request.model": OPENAI_TOOL_MODEL, - "gen_ai.response.model": f"{OPENAI_TOOL_MODEL}-2024-07-18", - "gen_ai.system": "openai", - "server.address": "api.openai.com", - "server.port": 443, - }, - ), - ], - est_value_delta=0.1, - ) - - 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": "chat", - "gen_ai.request.model": OPENAI_TOOL_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 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": "chat", - "gen_ai.request.model": OPENAI_TOOL_MODEL, - "gen_ai.response.model": f"{OPENAI_TOOL_MODEL}-2024-07-18", - "gen_ai.system": "openai", - "server.address": "api.openai.com", - "server.port": 443, - "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": "chat", - "gen_ai.request.model": OPENAI_TOOL_MODEL, - "gen_ai.response.model": f"{OPENAI_TOOL_MODEL}-2024-07-18", - "gen_ai.system": "openai", - "server.address": "api.openai.com", - "server.port": 443, - "gen_ai.token.type": "output", - }, - ), - ], - ) +from .base import ( + LOCAL_MODEL, + OPENAI_API_KEY, + OPENAI_ORG_ID, + OPENAI_PROJECT_ID, + OpenaiMixin, +) class TestChatCompletions(OpenaiMixin, TestBase): @@ -195,7 +59,7 @@ def test_basic(self): } ] - chat_completion = self.client.chat.completions.create(model=OPENAI_TOOL_MODEL, messages=messages) + 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.") @@ -203,7 +67,7 @@ def test_basic(self): self.assertEqual(len(spans), 1) span = spans[0] - self.assertEqual(span.name, f"chat {OPENAI_TOOL_MODEL}") + self.assertEqual(span.name, f"chat {self.openai_env.model}") self.assertEqual(span.kind, SpanKind.CLIENT) self.assertEqual(span.status.status_code, StatusCode.UNSET) @@ -211,10 +75,10 @@ def test_basic(self): dict(span.attributes), { GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: OPENAI_TOOL_MODEL, + GEN_AI_REQUEST_MODEL: self.openai_env.model, GEN_AI_SYSTEM: "openai", GEN_AI_RESPONSE_ID: "chatcmpl-A9CSutUkLCxwZIXuXRXlgEJUCMnlT", - GEN_AI_RESPONSE_MODEL: OPENAI_TOOL_MODEL + "-2024-07-18", # Note it is more specific than request! + 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, @@ -237,7 +101,7 @@ def test_all_the_client_options(self): ] chat_completion = self.client.chat.completions.create( - model=OPENAI_TOOL_MODEL, + model=self.openai_env.model, messages=messages, frequency_penalty=0, max_completion_tokens=100, @@ -253,7 +117,7 @@ def test_all_the_client_options(self): self.assertEqual(len(spans), 1) span = spans[0] - self.assertEqual(span.name, f"chat {OPENAI_TOOL_MODEL}") + self.assertEqual(span.name, f"chat {self.openai_env.model}") self.assertEqual(span.kind, SpanKind.CLIENT) self.assertEqual(span.status.status_code, StatusCode.UNSET) @@ -263,14 +127,14 @@ def test_all_the_client_options(self): GEN_AI_OPERATION_NAME: "chat", GEN_AI_REQUEST_FREQUENCY_PENALTY: 0, GEN_AI_REQUEST_MAX_TOKENS: 100, - GEN_AI_REQUEST_MODEL: OPENAI_TOOL_MODEL, + 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: OPENAI_TOOL_MODEL + "-2024-07-18", # Note it is more specific than request!, + 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, @@ -319,7 +183,7 @@ def test_function_calling_with_tools(self): {"role": "user", "content": "i think it is order_12345"}, ] - response = self.client.chat.completions.create(model=OPENAI_TOOL_MODEL, messages=messages, tools=tools) + 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"}) @@ -328,7 +192,7 @@ def test_function_calling_with_tools(self): self.assertEqual(len(spans), 1) span = spans[0] - self.assertEqual(span.name, f"chat {OPENAI_TOOL_MODEL}") + self.assertEqual(span.name, f"chat {self.openai_env.model}") self.assertEqual(span.kind, SpanKind.CLIENT) self.assertEqual(span.status.status_code, StatusCode.UNSET) @@ -336,10 +200,10 @@ def test_function_calling_with_tools(self): dict(span.attributes), { GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: OPENAI_TOOL_MODEL, + GEN_AI_REQUEST_MODEL: self.openai_env.model, GEN_AI_SYSTEM: "openai", GEN_AI_RESPONSE_ID: "chatcmpl-A9CSwJdb2481bxsjIiuD8yIBOAfql", - GEN_AI_RESPONSE_MODEL: OPENAI_TOOL_MODEL + "-2024-07-18", # Note it is more specific than request! + 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, @@ -393,7 +257,7 @@ def test_tools_with_capture_content(self): {"role": "user", "content": "i think it is order_12345"}, ] - response = self.client.chat.completions.create(model=OPENAI_TOOL_MODEL, messages=messages, tools=tools) + 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"}) @@ -402,7 +266,7 @@ def test_tools_with_capture_content(self): self.assertEqual(len(spans), 1) span = spans[0] - self.assertEqual(span.name, f"chat {OPENAI_TOOL_MODEL}") + self.assertEqual(span.name, f"chat {self.openai_env.model}") self.assertEqual(span.kind, SpanKind.CLIENT) self.assertEqual(span.status.status_code, StatusCode.UNSET) @@ -410,10 +274,10 @@ def test_tools_with_capture_content(self): dict(span.attributes), { GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: OPENAI_TOOL_MODEL, + GEN_AI_REQUEST_MODEL: self.openai_env.model, GEN_AI_SYSTEM: "openai", GEN_AI_RESPONSE_ID: "chatcmpl-A9CSzz613rRslGZpG79Js1deMz98G", - GEN_AI_RESPONSE_MODEL: OPENAI_TOOL_MODEL + "-2024-07-18", # Note it is more specific than request! + 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, @@ -441,13 +305,15 @@ def test_connection_error(self): } ] - self.assertRaises(Exception, lambda: client.chat.completions.create(model=OPENAI_TOOL_MODEL, messages=messages)) + 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 {OPENAI_TOOL_MODEL}") + self.assertEqual(span.name, f"chat {self.openai_env.model}") self.assertEqual(span.kind, SpanKind.CLIENT) self.assertEqual(span.status.status_code, StatusCode.ERROR) @@ -455,7 +321,7 @@ def test_connection_error(self): dict(span.attributes), { GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: OPENAI_TOOL_MODEL, + GEN_AI_REQUEST_MODEL: self.openai_env.model, GEN_AI_SYSTEM: "openai", ERROR_TYPE: "APIConnectionError", SERVER_ADDRESS: "localhost", @@ -567,7 +433,9 @@ def test_stream(self): } ] - chat_completion = self.client.chat.completions.create(model=OPENAI_TOOL_MODEL, messages=messages, stream=True) + 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.") @@ -576,7 +444,7 @@ def test_stream(self): self.assertEqual(len(spans), 1) span = spans[0] - self.assertEqual(span.name, f"chat {OPENAI_TOOL_MODEL}") + self.assertEqual(span.name, f"chat {self.openai_env.model}") self.assertEqual(span.kind, SpanKind.CLIENT) self.assertEqual(span.status.status_code, StatusCode.UNSET) @@ -584,10 +452,10 @@ def test_stream(self): dict(span.attributes), { GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: OPENAI_TOOL_MODEL, + GEN_AI_REQUEST_MODEL: self.openai_env.model, GEN_AI_SYSTEM: "openai", GEN_AI_RESPONSE_ID: "chatcmpl-A6Fj6kEv975Uw3vNCyA2njL0mP4Lg", - GEN_AI_RESPONSE_MODEL: f"{OPENAI_TOOL_MODEL}-2024-07-18", + GEN_AI_RESPONSE_MODEL: self.openai_env.response_model, GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), SERVER_ADDRESS: "api.openai.com", SERVER_PORT: 443, @@ -607,7 +475,7 @@ def test_stream_with_include_usage_option(self): ] chat_completion = self.client.chat.completions.create( - model=OPENAI_TOOL_MODEL, messages=messages, stream=True, stream_options={"include_usage": True} + 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] @@ -617,7 +485,7 @@ def test_stream_with_include_usage_option(self): self.assertEqual(len(spans), 1) span = spans[0] - self.assertEqual(span.name, f"chat {OPENAI_TOOL_MODEL}") + self.assertEqual(span.name, f"chat {self.openai_env.model}") self.assertEqual(span.kind, SpanKind.CLIENT) self.assertEqual(span.status.status_code, StatusCode.UNSET) @@ -625,10 +493,10 @@ def test_stream_with_include_usage_option(self): dict(span.attributes), { GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: OPENAI_TOOL_MODEL, + GEN_AI_REQUEST_MODEL: self.openai_env.model, GEN_AI_SYSTEM: "openai", GEN_AI_RESPONSE_ID: "chatcmpl-A6Fj6QSKWN7eCCTYz5lKYkZMHngDq", - GEN_AI_RESPONSE_MODEL: f"{OPENAI_TOOL_MODEL}-2024-07-18", + 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, @@ -683,7 +551,7 @@ def test_stream_with_tools_and_capture_content(self): ] chat_completion = self.client.chat.completions.create( - model=OPENAI_TOOL_MODEL, messages=messages, tools=tools, stream=True + 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] @@ -693,7 +561,7 @@ def test_stream_with_tools_and_capture_content(self): self.assertEqual(len(spans), 1) span = spans[0] - self.assertEqual(span.name, f"chat {OPENAI_TOOL_MODEL}") + self.assertEqual(span.name, f"chat {self.openai_env.model}") self.assertEqual(span.kind, SpanKind.CLIENT) self.assertEqual(span.status.status_code, StatusCode.UNSET) @@ -701,10 +569,10 @@ def test_stream_with_tools_and_capture_content(self): dict(span.attributes), { GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: OPENAI_TOOL_MODEL, + GEN_AI_REQUEST_MODEL: self.openai_env.model, GEN_AI_SYSTEM: "openai", GEN_AI_RESPONSE_ID: "chatcmpl-A86CT7lmQpCMrARhR2GkBP5JBYLfn", - GEN_AI_RESPONSE_MODEL: f"{OPENAI_TOOL_MODEL}-2024-07-18", + GEN_AI_RESPONSE_MODEL: self.openai_env.response_model, GEN_AI_RESPONSE_FINISH_REASONS: ("tool_calls",), SERVER_ADDRESS: "api.openai.com", SERVER_PORT: 443, @@ -864,7 +732,7 @@ async def test_async_basic(self): } ] - chat_completion = await self.client.chat.completions.create(model=OPENAI_TOOL_MODEL, messages=messages) + 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.") @@ -872,7 +740,7 @@ async def test_async_basic(self): self.assertEqual(len(spans), 1) span = spans[0] - self.assertEqual(span.name, f"chat {OPENAI_TOOL_MODEL}") + self.assertEqual(span.name, f"chat {self.openai_env.model}") self.assertEqual(span.kind, SpanKind.CLIENT) self.assertEqual(span.status.status_code, StatusCode.UNSET) @@ -880,10 +748,10 @@ async def test_async_basic(self): dict(span.attributes), { GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: OPENAI_TOOL_MODEL, + GEN_AI_REQUEST_MODEL: self.openai_env.model, GEN_AI_SYSTEM: "openai", GEN_AI_RESPONSE_ID: "chatcmpl-A9CT0G8qhgAE0LVHYoClD0IG4eyKa", - GEN_AI_RESPONSE_MODEL: OPENAI_TOOL_MODEL + "-2024-07-18", # Note it is more specific than request! + 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, @@ -910,7 +778,7 @@ async def test_async_basic_with_capture_content(self): } ] - chat_completion = await self.client.chat.completions.create(model=OPENAI_TOOL_MODEL, messages=messages) + 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.") @@ -918,7 +786,7 @@ async def test_async_basic_with_capture_content(self): self.assertEqual(len(spans), 1) span = spans[0] - self.assertEqual(span.name, f"chat {OPENAI_TOOL_MODEL}") + self.assertEqual(span.name, f"chat {self.openai_env.model}") self.assertEqual(span.kind, SpanKind.CLIENT) self.assertEqual(span.status.status_code, StatusCode.UNSET) @@ -926,10 +794,10 @@ async def test_async_basic_with_capture_content(self): dict(span.attributes), { GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: OPENAI_TOOL_MODEL, + GEN_AI_REQUEST_MODEL: self.openai_env.model, GEN_AI_SYSTEM: "openai", GEN_AI_RESPONSE_ID: "chatcmpl-A9CT2ePKnjnz40F1K7G6YhKMoNLsD", - GEN_AI_RESPONSE_MODEL: OPENAI_TOOL_MODEL + "-2024-07-18", # Note it is more specific than request! + 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, @@ -956,7 +824,7 @@ async def test_async_stream(self): ] chat_completion = await self.client.chat.completions.create( - model=OPENAI_TOOL_MODEL, messages=messages, stream=True + 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] @@ -966,7 +834,7 @@ async def test_async_stream(self): self.assertEqual(len(spans), 1) span = spans[0] - self.assertEqual(span.name, f"chat {OPENAI_TOOL_MODEL}") + self.assertEqual(span.name, f"chat {self.openai_env.model}") self.assertEqual(span.kind, SpanKind.CLIENT) self.assertEqual(span.status.status_code, StatusCode.UNSET) @@ -974,10 +842,10 @@ async def test_async_stream(self): dict(span.attributes), { GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: OPENAI_TOOL_MODEL, + GEN_AI_REQUEST_MODEL: self.openai_env.model, GEN_AI_SYSTEM: "openai", GEN_AI_RESPONSE_ID: "chatcmpl-A6dGYxfNeE9JSyv3LWSkGTOIXJvqy", - GEN_AI_RESPONSE_MODEL: f"{OPENAI_TOOL_MODEL}-2024-07-18", + GEN_AI_RESPONSE_MODEL: self.openai_env.response_model, GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), SERVER_ADDRESS: "api.openai.com", SERVER_PORT: 443, @@ -1001,7 +869,7 @@ async def test_async_stream_with_capture_content(self): ] chat_completion = await self.client.chat.completions.create( - model=OPENAI_TOOL_MODEL, messages=messages, stream=True + 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] @@ -1011,7 +879,7 @@ async def test_async_stream_with_capture_content(self): self.assertEqual(len(spans), 1) span = spans[0] - self.assertEqual(span.name, f"chat {OPENAI_TOOL_MODEL}") + self.assertEqual(span.name, f"chat {self.openai_env.model}") self.assertEqual(span.kind, SpanKind.CLIENT) self.assertEqual(span.status.status_code, StatusCode.UNSET) @@ -1019,10 +887,10 @@ async def test_async_stream_with_capture_content(self): dict(span.attributes), { GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: OPENAI_TOOL_MODEL, + GEN_AI_REQUEST_MODEL: self.openai_env.model, GEN_AI_SYSTEM: "openai", GEN_AI_RESPONSE_ID: "chatcmpl-A6dGarmkMfJOnz2DWzymvkYpWQt00", - GEN_AI_RESPONSE_MODEL: f"{OPENAI_TOOL_MODEL}-2024-07-18", + GEN_AI_RESPONSE_MODEL: self.openai_env.response_model, GEN_AI_RESPONSE_FINISH_REASONS: ("stop",), SERVER_ADDRESS: "api.openai.com", SERVER_PORT: 443, @@ -1078,7 +946,9 @@ async def test_async_tools_with_capture_content(self): {"role": "user", "content": "i think it is order_12345"}, ] - response = await self.client.chat.completions.create(model=OPENAI_TOOL_MODEL, messages=messages, tools=tools) + 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"}) @@ -1087,7 +957,7 @@ async def test_async_tools_with_capture_content(self): self.assertEqual(len(spans), 1) span = spans[0] - self.assertEqual(span.name, f"chat {OPENAI_TOOL_MODEL}") + self.assertEqual(span.name, f"chat {self.openai_env.model}") self.assertEqual(span.kind, SpanKind.CLIENT) self.assertEqual(span.status.status_code, StatusCode.UNSET) @@ -1095,10 +965,10 @@ async def test_async_tools_with_capture_content(self): dict(span.attributes), { GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: OPENAI_TOOL_MODEL, + GEN_AI_REQUEST_MODEL: self.openai_env.model, GEN_AI_SYSTEM: "openai", GEN_AI_RESPONSE_ID: "chatcmpl-A9CT8USSOYj6tJBMsrClMJdppNCf3", - GEN_AI_RESPONSE_MODEL: OPENAI_TOOL_MODEL + "-2024-07-18", # Note it is more specific than request! + 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, @@ -1208,13 +1078,13 @@ async def test_async_local_connection_error(self): ] with self.assertRaises(Exception): - await client.chat.completions.create(model=OPENAI_TOOL_MODEL, messages=messages) + 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 {OPENAI_TOOL_MODEL}") + self.assertEqual(span.name, f"chat {self.openai_env.model}") self.assertEqual(span.kind, SpanKind.CLIENT) self.assertEqual(span.status.status_code, StatusCode.ERROR) @@ -1222,7 +1092,7 @@ async def test_async_local_connection_error(self): dict(span.attributes), { GEN_AI_OPERATION_NAME: "chat", - GEN_AI_REQUEST_MODEL: OPENAI_TOOL_MODEL, + GEN_AI_REQUEST_MODEL: self.openai_env.model, GEN_AI_SYSTEM: "openai", ERROR_TYPE: "APIConnectionError", SERVER_ADDRESS: "localhost", diff --git a/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_embeddings.py b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_embeddings.py new file mode 100644 index 0000000..7d9a1d7 --- /dev/null +++ b/instrumentation/elastic-opentelemetry-instrumentation-openai/tests/test_embeddings.py @@ -0,0 +1,306 @@ +# 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 unittest import IsolatedAsyncioTestCase + +import openai +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, + GEN_AI_REQUEST_MODEL, + GEN_AI_SYSTEM, + GEN_AI_RESPONSE_MODEL, + GEN_AI_USAGE_INPUT_TOKENS, +) +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, + )