Skip to content

🐛 Bug Report: Anthropic stream() fails with a TypeError when instrumented #3178

@evalstate

Description

@evalstate

Which component is this bug for?

Anthropic Instrumentation

📜 Description

When using the Async stream() method, it fails with:

RuntimeWarning: coroutine '_awrap' was never awaited
  async with client.messages.stream(

👟 Reproduction steps

https://gist.github.com/evalstate/e6196e15a1e268f806f7740304f592b2

👍 Expected behavior

Return the correct type, instrumented.

👎 Actual Behavior with Screenshots

Returns incompatible type

🤖 Python Version

3.12

📃 Provide any additional context for the Bug.

  • opentelemetry-instrumentation-anthropic: 0.43.1
  • anthropic: 0.59.0
  • Python: 3.12

👀 Have you spent some time to check if this bug has been raised before?

  • I checked and didn't find similar issue

Are you willing to submit PR?

None

Metadata

Metadata

Assignees

No one assigned

    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