We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Path to course in question: https://github.com/anthropics/courses/blob/master/anthropic_api_fundamentals/05_Streaming.ipynb In the Streaming helpers part of the 05.Streaming segment of the api_fundamentals courses when running the last piece of code I am getting the following error: I tried downgrading to an earlier version of anthropic (0.33.0) but the problem persists.
The text was updated successfully, but these errors were encountered:
This content should be updated to use the new Iterator API: anthropics/anthropic-sdk-python#532
Sorry, something went wrong.
I believe this is the current way to do this:
from anthropic import AsyncAnthropic client = AsyncAnthropic() green = '\033[32m' reset = '\033[0m' async def streaming_events_demo(): async with client.messages.stream( max_tokens=1024, messages=[ { "role": "user", "content": "Generate a 5-word poem", } ], model="claude-3-opus-20240229", ) as stream: async for event in stream: if event.type == "text": # This runs only on text delta stream messages print(green + event.text + reset, flush=True) else: # This runs on any stream event print("on_event fired:", event.type) await streaming_events_demo()
fix issue anthropics#28 remove block related to removed `event_handle…
58ab0d3
…r` code
fix issue anthropics#28 add suggested alternate cells
7f840d6
No branches or pull requests
Path to course in question:
https://github.com/anthropics/courses/blob/master/anthropic_api_fundamentals/05_Streaming.ipynb
In the Streaming helpers part of the 05.Streaming segment of the api_fundamentals courses when running the last piece of code I am getting the following error:
I tried downgrading to an earlier version of anthropic (0.33.0) but the problem persists.
The text was updated successfully, but these errors were encountered: