Skip to content

openai: Invalid type NotGiven for attribute #66

@codefromthecrypt

Description

@codefromthecrypt

Describe the bug: ...

When using openai agents SDK, I get warnings like this:

Invalid type NotGiven for attribute 'gen_ai.request.frequency_penalty' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
Invalid type NotGiven for attribute 'gen_ai.request.max_tokens' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
Invalid type NotGiven for attribute 'gen_ai.request.presence_penalty' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
Invalid type NotGiven for attribute 'gen_ai.request.top_p' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
Invalid type NotGiven for attribute 'gen_ai.openai.request.response_format' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
Invalid type NotGiven for attribute 'gen_ai.request.frequency_penalty' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
Invalid type NotGiven for attribute 'gen_ai.request.max_tokens' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
Invalid type NotGiven for attribute 'gen_ai.request.presence_penalty' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
Invalid type NotGiven for attribute 'gen_ai.request.top_p' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
Invalid type NotGiven for attribute 'gen_ai.openai.request.response_format' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types

To Reproduce

edot-bootstrap --action=install
pip uninstall -y elastic-opentelemetry-instrumentation-openai
pip install 'elastic-opentelemetry-instrumentation-openai @ git+https://github.com/elastic/elastic-otel-python-instrumentations.git@main#subdirectory=instrumentation/elastic-opentelemetry-instrumentation-openai'

then run against openai-agents-python project e.g. elastic/observability-examples#55

Environment (please complete the following information)

  • OS: MacOS
  • Python version: 3.12.9
  • Framework and version: openai 1.66.3
  • Instrumentation version: main

Additional context

requirements.txt:

# TODO: temporary until openai-agents 0.0.5
openai-agents @ git+https://github.com/openai/openai-agents-python.git@main
httpx~=0.28.1

elastic-opentelemetry~=0.8.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions