Skip to content

Commit 045215c

Browse files
committed
feedback
1 parent b43b014 commit 045215c

File tree

5 files changed

+9
-9
lines changed
  • instrumentation-genai

5 files changed

+9
-9
lines changed

instrumentation-genai/opentelemetry-instrumentation-cohere-v2/src/opentelemetry/instrumentation/cohere_v2/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,4 @@ def _instrument(self, **kwargs):
9090
def _uninstrument(self, **kwargs):
9191
import cohere # pylint: disable=import-outside-toplevel
9292

93-
unwrap(cohere.client_v2.ClientV2, "chat")
93+
unwrap("cohere.client_v2.ClientV2", "chat")

instrumentation-genai/opentelemetry-instrumentation-cohere-v2/src/opentelemetry/instrumentation/cohere_v2/patch.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
)
2121
from opentelemetry.instrumentation.utils import is_instrumentation_enabled
2222
from .utils import (
23-
get_llm_request_attributes,
23+
get_genai_request_attributes,
2424
message_to_event,
2525
set_response_attributes,
2626
set_server_address_and_port,
@@ -36,7 +36,7 @@ def traced_method(wrapped, instance, args, kwargs):
3636
if not is_instrumentation_enabled():
3737
return wrapped(*args, **kwargs)
3838

39-
span_attributes = {**get_llm_request_attributes(kwargs, instance)}
39+
span_attributes = {**get_genai_request_attributes(kwargs, instance)}
4040
set_server_address_and_port(instance, span_attributes)
4141
span_name = get_span_name(span_attributes)
4242

instrumentation-genai/opentelemetry-instrumentation-cohere-v2/src/opentelemetry/instrumentation/cohere_v2/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def set_server_address_and_port(client_instance: cohere.client_v2.V2Client, attr
8282
attributes[ServerAttributes.SERVER_PORT] = port
8383

8484

85-
def get_llm_request_attributes(
85+
def get_genai_request_attributes(
8686
kwargs,
8787
client_instance: cohere.client_v2.V2Client,
8888
operation_name=GenAIAttributes.GenAiOperationNameValues.CHAT.value,
@@ -92,7 +92,7 @@ def get_llm_request_attributes(
9292
GenAIAttributes.GEN_AI_SYSTEM: GenAIAttributes.GenAiSystemValues.COHERE.value,
9393
GenAIAttributes.GEN_AI_REQUEST_MODEL: kwargs.get("model"),
9494
GenAIAttributes.GEN_AI_REQUEST_MAX_TOKENS: kwargs.get("max_tokens"),
95-
GenAIAttributes.GEN_AI_REQUEST_FREQUENCY_PENALTY: kwargs.get(
95+
GenAIAttributes.GEN_AI_REQUEST_STOP_SEQUENCES: kwargs.get(
9696
"stop_sequences"
9797
),
9898
GenAIAttributes.GEN_AI_REQUEST_TEMPERATURE: kwargs.get("temperature"),

instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
from .utils import (
3131
choice_to_event,
32-
get_llm_request_attributes,
32+
get_genai_request_attributes,
3333
is_streaming,
3434
message_to_event,
3535
set_span_attribute,
@@ -42,7 +42,7 @@ def chat_completions_create(
4242
"""Wrap the `create` method of the `ChatCompletion` class to trace it."""
4343

4444
def traced_method(wrapped, instance, args, kwargs):
45-
span_attributes = {**get_llm_request_attributes(kwargs, instance)}
45+
span_attributes = {**get_genai_request_attributes(kwargs, instance)}
4646

4747
span_name = get_span_name(span_attributes)
4848
with tracer.start_as_current_span(
@@ -84,7 +84,7 @@ def async_chat_completions_create(
8484
"""Wrap the `create` method of the `AsyncChatCompletion` class to trace it."""
8585

8686
async def traced_method(wrapped, instance, args, kwargs):
87-
span_attributes = {**get_llm_request_attributes(kwargs, instance)}
87+
span_attributes = {**get_genai_request_attributes(kwargs, instance)}
8888

8989
span_name = f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL]}"
9090
with tracer.start_as_current_span(

instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def non_numerical_value_is_set(value: Optional[Union[bool, str]]):
167167
return bool(value) and value != NOT_GIVEN
168168

169169

170-
def get_llm_request_attributes(
170+
def get_genai_request_attributes(
171171
kwargs,
172172
client_instance,
173173
operation_name=GenAIAttributes.GenAiOperationNameValues.CHAT.value,

0 commit comments

Comments
 (0)