Skip to content

OpenAIException - error - 'StreamWrapper' object has no attribute 'parse' #61

@codefromthecrypt

Description

@codefromthecrypt

Describe the bug: ...

There's a crash when LiteLLM uses OpenAI (found in aider)

litellm.APIError: APIError: OpenAIException - error - 'StreamWrapper' object has no attribute 'parse', Received response - <opentelemetry.instrumentation.openai.wrappers.StreamWrapper object at 0x1776b36b0>, Type of response - <class 
'opentelemetry.instrumentation.openai.wrappers.StreamWrapper'>

To Reproduce

  1. configure aider like this https://github.com/Aider-AI/aider/blob/main/CONTRIBUTING.md#handy-opinionated-setup-commands-for-macos--linux
  2. configure edot like this https://github.com/elastic/elastic-otel-python/tree/main/examples/openai
  3. update to latest openai instrumentation like this: pip install elastic-opentelemetry-instrumentation-openai==0.6.1
  4. run dotenv run -- opentelemetry-instrument aider --model gpt-4o-mini --no-gitignore --no-show-model-warnings -m "how many fingers am I holding up?"
$ dotenv run -- opentelemetry-instrument aider --model gpt-4o-mini --no-gitignore --no-show-model-warnings -m "how many fingers am I holding up?"
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Aider v0.75.3.dev265+gbdefb1d5
Model: gpt-4o-mini with whole edit format
Git repo: .git with 451 files
Repo-map: using 4096 tokens, auto refresh

                    
litellm.APIError: APIError: OpenAIException - error - 'StreamWrapper' object has no attribute 'parse', Received response - <opentelemetry.instrumentation.openai.wrappers.StreamWrapper object at 
0x10de9dd30>, Type of response - <class 'opentelemetry.instrumentation.openai.wrappers.StreamWrapper'>

Environment (please complete the following information)

  • OS: MacOS
  • Python version: 3.12.8
  • Framework and version [e.g. openai 1.63.0]: openai 1.63.0
  • Instrumentation version: elastic-opentelemetry-instrumentation-openai==0.6.1

Additional context

I also tried ollama and same crash. It doesn't crash if you skip opentelemetry-instrument

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions