Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning Logs with response_format in opentelemetry-instrumentation-openai-v2 #3052

Open
raptium opened this issue Nov 27, 2024 · 0 comments
Open

Comments

@raptium
Copy link

raptium commented Nov 27, 2024

When using opentelemetry-instrumentation-openai-v2, I receive the following warning when setting the response_format parameter as a dictionary:

WARNING:opentelemetry.attributes:Invalid type dict for attribute 'gen_ai.openai.request.response_format' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types\

The OpenAI Python Client and API Reference indicate that response_format can be a dictionary with a key "type" (values: "text", "json_object", "json_schema"). However, the OpenTelemetry Semantic Conventions specify that this attribute should be a plain string.

The current implementation attempts to log the entire dictionary, causing a type mismatch. The relevant code can be found

GenAIAttributes.GEN_AI_OPENAI_REQUEST_RESPONSE_FORMAT: kwargs.get(
"response_format"
),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant