Skip to content
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

docs: use async for instead of for for streaming FastAPI resp #570

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

jd-solanki
Copy link
Contributor

@jd-solanki jd-solanki commented Apr 5, 2024

Hi 👋🏻

I tried the docs snippet and found that it should use async for instead of for to avoid TypeError: 'async_generator' object is not iterable


Ellipsis 🚀 This PR description was created by Ellipsis for commit 5f3291d.

Summary:

This PR updates the fastapi.md documentation to use async for instead of for when iterating over an async generator in the generate function within the extract function.

Key points:

  • Updated fastapi.md documentation file
  • Changed for loop to async for in generate function within extract function
  • The change is necessary to avoid TypeError when iterating over users, which is an async generator

Generated with ❤️ by ellipsis.dev

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working documentation Improvements or additions to documentation labels Apr 5, 2024
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me!

  • Reviewed the entire pull request up to 5f3291d
  • Looked at 14 lines of code in 1 files
  • Took 38 seconds to review
More info
  • Skipped 0 files when reviewing.
  • Skipped posting 1 additional comments because they didn't meet confidence threshold of 85%.
1. docs/concepts/fastapi.md:84:
  • Assessed confidence : 0%
  • Comment:
    Good catch! The change from 'for' to 'async for' is correct as the users object is an async generator and needs to be iterated over asynchronously. This change is in line with Python's async programming model and FastAPI's support for async operations.
  • Reasoning:
    The change from 'for' to 'async for' is correct as the users object is an async generator and needs to be iterated over asynchronously. This change is in line with Python's async programming model and FastAPI's support for async operations.

Workflow ID: wflow_QlNqRKc6x8dvfoE8


Not what you expected? You can customize the content of the reviews using rules. Learn more here.

@jd-solanki
Copy link
Contributor Author

As a beginner, Still It's hard for me to get up and running with simple FastAPI & Instructor. Can you please add full runnable example file so we can check?

@jxnl jxnl merged commit b161bbc into instructor-ai:main Apr 5, 2024
@jxnl
Copy link
Collaborator

jxnl commented Apr 5, 2024

can you try this?
https://github.com/instructor-ai/cloud

PrathamSoni pushed a commit to EndexAI/instructor that referenced this pull request Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants