-
Notifications
You must be signed in to change notification settings - Fork 140
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When using Weave with the Anthropic integration, I would expect the outputs of async streaming API calls to be accumulated and passed to Weave when the stream is consumed. I found that when using the stream as a context manager and calling get_final_output, the call finishes but the outputs are not available on the trace. I've included a repro and a screenshot of the trace.
I'm using Weave 0.52.17, Python 3.12.11, Windows 11
Repro:
import weave
from anthropic import AsyncAnthropic
from dotenv import load_dotenv
import asyncio
load_dotenv()
weave.init(project_name="danielpolatajko-mars/test")
async def test_anthropic_streaming():
client = AsyncAnthropic()
async with client.messages.stream(
model="claude-sonnet-4-0",
max_tokens=1024,
messages=[{"role": "user", "content": "Say hello and tell me a short joke!"}]
) as stream:
response = await stream.get_final_message()
print(response.content[0].text)
return response
asyncio.run(test_anthropic_streaming())Weave Project Link
Screenshots
Screenshot of the trace:

Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working