Skip to content

add streaming examples #38

New issue

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

Merged
merged 3 commits into from
Feb 4, 2025
Merged

add streaming examples #38

merged 3 commits into from
Feb 4, 2025

Conversation

pierrevalade
Copy link
Contributor

@guillaq I'm still getting a lot of lint errors on the file streaming_summary.py

I've added documentation on the README.md as well to try to explain more clearly how to stream response, but please double check my work.

@pierrevalade
Copy link
Contributor Author

Screenshot 2025-02-04 at 18 48 05

the file streaming_summary.py is working 👍

@guillaq
Copy link
Collaborator

guillaq commented Feb 4, 2025

Fixed the doc

The proper way to get streaming is without the async keyword

@workflowai.agent()
def analyze_call_feedback(input: CallFeedbackInput) -> AsyncIterator[CallFeedbackOutput]:
    ...

Added the following note to the readme:

Note: no need to mark the agent as async here ! It is already asynchronous since it returns an AsyncIterator.
The type checkers some times get confused since they consider that an async function that returns an AsyncIterator is
async twice.
For example, a function with the signature async def foo() -> AsyncIterator[int] may be called
async for c in await foo():... in certain cases...

@guillaq guillaq merged commit a8145ab into main Feb 4, 2025
5 checks passed
@guillaq guillaq deleted the documentation-streaming branch February 4, 2025 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants