diff --git a/instrumentation-genai/opentelemetry-instrumentation-cohere-v2/src/opentelemetry/instrumentation/cohere_v2/__init__.py b/instrumentation-genai/opentelemetry-instrumentation-cohere-v2/src/opentelemetry/instrumentation/cohere_v2/__init__.py index 74a60952c4..fedcc04b89 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-cohere-v2/src/opentelemetry/instrumentation/cohere_v2/__init__.py +++ b/instrumentation-genai/opentelemetry-instrumentation-cohere-v2/src/opentelemetry/instrumentation/cohere_v2/__init__.py @@ -90,4 +90,4 @@ def _instrument(self, **kwargs): def _uninstrument(self, **kwargs): import cohere # pylint: disable=import-outside-toplevel - unwrap(cohere.client_v2.ClientV2, "chat") + unwrap("cohere.client_v2.ClientV2", "chat") diff --git a/instrumentation-genai/opentelemetry-instrumentation-cohere-v2/src/opentelemetry/instrumentation/cohere_v2/patch.py b/instrumentation-genai/opentelemetry-instrumentation-cohere-v2/src/opentelemetry/instrumentation/cohere_v2/patch.py index 70f4c22b57..e117899d04 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-cohere-v2/src/opentelemetry/instrumentation/cohere_v2/patch.py +++ b/instrumentation-genai/opentelemetry-instrumentation-cohere-v2/src/opentelemetry/instrumentation/cohere_v2/patch.py @@ -20,7 +20,7 @@ ) from opentelemetry.instrumentation.utils import is_instrumentation_enabled from .utils import ( - get_llm_request_attributes, + get_genai_request_attributes, message_to_event, set_response_attributes, set_server_address_and_port, @@ -36,7 +36,7 @@ def traced_method(wrapped, instance, args, kwargs): if not is_instrumentation_enabled(): return wrapped(*args, **kwargs) - span_attributes = {**get_llm_request_attributes(kwargs, instance)} + span_attributes = {**get_genai_request_attributes(kwargs, instance)} set_server_address_and_port(instance, span_attributes) span_name = get_span_name(span_attributes) diff --git a/instrumentation-genai/opentelemetry-instrumentation-cohere-v2/src/opentelemetry/instrumentation/cohere_v2/utils.py b/instrumentation-genai/opentelemetry-instrumentation-cohere-v2/src/opentelemetry/instrumentation/cohere_v2/utils.py index 4cae63eed4..26e46005d5 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-cohere-v2/src/opentelemetry/instrumentation/cohere_v2/utils.py +++ b/instrumentation-genai/opentelemetry-instrumentation-cohere-v2/src/opentelemetry/instrumentation/cohere_v2/utils.py @@ -82,7 +82,7 @@ def set_server_address_and_port(client_instance: cohere.client_v2.V2Client, attr attributes[ServerAttributes.SERVER_PORT] = port -def get_llm_request_attributes( +def get_genai_request_attributes( kwargs, client_instance: cohere.client_v2.V2Client, operation_name=GenAIAttributes.GenAiOperationNameValues.CHAT.value, @@ -92,7 +92,7 @@ def get_llm_request_attributes( GenAIAttributes.GEN_AI_SYSTEM: GenAIAttributes.GenAiSystemValues.COHERE.value, GenAIAttributes.GEN_AI_REQUEST_MODEL: kwargs.get("model"), GenAIAttributes.GEN_AI_REQUEST_MAX_TOKENS: kwargs.get("max_tokens"), - GenAIAttributes.GEN_AI_REQUEST_FREQUENCY_PENALTY: kwargs.get( + GenAIAttributes.GEN_AI_REQUEST_STOP_SEQUENCES: kwargs.get( "stop_sequences" ), GenAIAttributes.GEN_AI_REQUEST_TEMPERATURE: kwargs.get("temperature"), diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py index 3635e474ed..4f56bc6c8f 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py @@ -29,7 +29,7 @@ from .utils import ( choice_to_event, - get_llm_request_attributes, + get_genai_request_attributes, is_streaming, message_to_event, set_span_attribute, @@ -42,7 +42,7 @@ def chat_completions_create( """Wrap the `create` method of the `ChatCompletion` class to trace it.""" def traced_method(wrapped, instance, args, kwargs): - span_attributes = {**get_llm_request_attributes(kwargs, instance)} + span_attributes = {**get_genai_request_attributes(kwargs, instance)} span_name = get_span_name(span_attributes) with tracer.start_as_current_span( @@ -84,7 +84,7 @@ def async_chat_completions_create( """Wrap the `create` method of the `AsyncChatCompletion` class to trace it.""" async def traced_method(wrapped, instance, args, kwargs): - span_attributes = {**get_llm_request_attributes(kwargs, instance)} + span_attributes = {**get_genai_request_attributes(kwargs, instance)} span_name = f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL]}" with tracer.start_as_current_span( diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py index 2ae6dcdecc..809e1fad6d 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py @@ -167,7 +167,7 @@ def non_numerical_value_is_set(value: Optional[Union[bool, str]]): return bool(value) and value != NOT_GIVEN -def get_llm_request_attributes( +def get_genai_request_attributes( kwargs, client_instance, operation_name=GenAIAttributes.GenAiOperationNameValues.CHAT.value,