weaviate-python-client
weaviate-python-client copied to clipboard
Introduce `WeaviateAsyncClient` as async alternative to `WeaviateClient`
- Changes base implementation to be purely async using
httpx
andgrpclib
(instead of google's grpc due to issues) - Uses base implementation in
WeaviateAsyncClient
directly - Subdivides the codebase into
**/asy/*.py
and**/sy/*.py
directories within each namespace directory - Replace
WeaviateClient
internal calls with event-loop-wrapped blocking calls using the base async implementation -
WeaviateClient
spins up its own personal event loop thread that it schedules async calls to. Should this be a global singleton instead? -
client.batch
is only available on theWeaviateClient
object, since it is a purely sync algorithm. It depends on the new higher-level event loop thread
Great to see you again! Thanks for the contribution.
beep boop - the Weaviate bot 👋🤖
PS:
Are you already a member of the Weaviate Slack channel?
I'm following this as well. I'm looking forward to the async client :)
Codecov Report
Attention: Patch coverage is 93.09133%
with 118 lines
in your changes missing coverage. Please review.
Please upload report for BASE (
dev/1.26@4602a26
). Learn more about missing BASE report.
Additional details and impacted files
@@ Coverage Diff @@
## dev/1.26 #1007 +/- ##
===========================================
Coverage ? 94.27%
===========================================
Files ? 213
Lines ? 20490
Branches ? 0
===========================================
Hits ? 19317
Misses ? 1173
Partials ? 0
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@rolandgvc, we have released v4.7.0b0
here as an initial pre-release of the new async implementation!
We're aiming to have a week or two of community engagement on the beta to get feedback and find bugs. If you're happy to test it out it would be great to hear your feedback too 😁
Here's some example usage to see how it works!
import weaviate
import weaviate.classes as wvc
async def async_example() -> None:
async with weaviate.use_async_with_local() as client:
collection = await client.collections.create(
properties=[
wvc.config.Property(name="name", data_type=DataType.TEXT),
],
vectorizer_config=wvc.config.Configure.Vectorizer.none(),
)
await collection.data.insert_many(
[
{"name": "John Doe"},
]
)
res = await collection.query.fetch_objects()
assert len(res.objects) == 1
assert res.objects[0].properties["name"] == "John Doe"
Hi great work y'all we really needed this 👏 Is there some documentation about this? From what I gather in test cases, we can use use_async flag on client instantiation and sync functions become async?
One more, is this ready for production code yet or should we wait for the full release?
One more, is this ready for production code yet or should we wait for the full release?
please wait for the full release for production - but please try it out now so we can release it as quickly as possible :)
Is there some documentation about this? From what I gather in test cases, we can use use_async flag on client instantiation and sync functions become async?
Not yet - basically you instantiate the async client and then all functions are async
Great looking forward to the release 👍 This might be too big of a hussle now but I would suggest embedding the async functions into WeaviateClient rather than creating a separate AsyncClient class, as a lot of projects (and ours) use a wrapper class for interacting with weaviate, therefore a singleton client is used. Now a separate async client is needed to be instantiated, which is a bit inconvenient
This might be too big of a hussle now but I would suggest embedding the async functions into WeaviateClient rather than creating a separate AsyncClient class, as a lot of projects (and ours) use a wrapper class for interacting with weaviate, therefore a separate async wrapper class is needed instead of just adding new async methods, which is a bit inconvenient
The sync class is now basically a wrapper around the async functions - the clients itself are duplicated for typing reasons, but almost everything else is async under the hood and called from the sync client
Hi when is this going to be in the release version