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

Use Python asyncio gRPC #722

Merged
merged 1 commit into from
Nov 16, 2023
Merged

Use Python asyncio gRPC #722

merged 1 commit into from
Nov 16, 2023

Conversation

cbornet
Copy link
Member

@cbornet cbornet commented Nov 16, 2023

This has several advantages:

  • better concurrency handling: Python is not good with threads (not OS threads)
  • simplifies the code: the grpc-python async API is newer and better than the imperative one. And it makes it easier to handle methods that return Future as asyncio can wrap a Future.
  • opens the path to supporting async read(), async write(), async process(), ... in agents. This will help to integrate with libs that have async APIs (eg. LangChain!)
  • most importantly, will make the life easier to support TopicProducer::write that returns async.

Copy link
Member

@nicoloboschi nicoloboschi left a comment

Choose a reason for hiding this comment

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

Great work!

@cbornet cbornet force-pushed the async-grpc branch 2 times, most recently from 6bd7f78 to f63f3d9 Compare November 16, 2023 12:43
Copy link
Member

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

Great stuff.
There is a change related to LangChain that seems unrelated.
I would push it to a separate PR

@cbornet cbornet force-pushed the async-grpc branch 2 times, most recently from fb38344 to 16845f7 Compare November 16, 2023 17:29
@cbornet cbornet merged commit f02bb12 into main Nov 16, 2023
10 checks passed
@cbornet cbornet deleted the async-grpc branch November 16, 2023 18:12
benfrank241 pushed a commit to vectorize-io/langstream that referenced this pull request May 2, 2024
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.

3 participants