-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* generate gRPC client * generate REST client * draft * wip * fix conversion test * old api compatible * clean deprecated * batch search + reco tests * multi-vector test * full-text filtering * Fast protobuf (#67) * generate grpc client use new grpc client in qdrant methods fix grpc parallel issue remove betterproto remove betterproto remove betterproto type annotation extend test coverage upd protobuf to master * rm eventloop * upd version * shortcut for models * v0.10.1 compatibility hotfix: make deprecated ram_data_size optional Co-authored-by: Andrey Vasnetsov <[email protected]>
- Loading branch information
Showing
44 changed files
with
3,725 additions
and
2,185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "qdrant_client" | ||
version = "0.9.7" | ||
version = "0.10.0" | ||
description = "Client library for the Qdrant vector search engine" | ||
authors = ["Andrey Vasnetsov <[email protected]>"] | ||
packages = [ | ||
|
@@ -22,8 +22,7 @@ tqdm = "^4.56.0" | |
loguru = "^0.5.3" | ||
typing-extensions = "^4.0.0" | ||
grpcio = { version = "^1.46.0", allow-prereleases = true } | ||
betterproto = { version = "2.0.0b4", allow-prereleases = true } | ||
nest-asyncio = "^1.5.5" | ||
grpcio-tools = "^1.48.0" | ||
|
||
[tool.poetry.dev-dependencies] | ||
pytest = "^7.1" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,3 @@ | ||
__version__ = '0.1.0' | ||
__version__ = '0.10.0' | ||
|
||
from .qdrant_client import QdrantClient | ||
|
||
|
||
def _in_ipython() -> bool: | ||
""" | ||
Check whether we're in an ipython environment, including jupyter notebooks. | ||
""" | ||
try: | ||
eval('__IPYTHON__') | ||
except NameError: | ||
return False | ||
else: # pragma: no cover | ||
return True | ||
|
||
|
||
if _in_ipython(): # pragma: no cover | ||
# Python asyncio design is mediocre, it is not possible to await for a future, if there is another loop running. | ||
# Ipython uses asyncio, which makes it impossible to run other async functions, so we need to monkey-patch it. | ||
# It might be dangerous to do this in production, so we are doing it for Jupyter notebooks only. | ||
import nest_asyncio | ||
nest_asyncio.apply() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from typing import Optional | ||
|
||
import grpc | ||
|
||
|
||
def get_channel(host: str, port: int, ssl: bool, metadata: Optional[list] = None) -> grpc.Channel: | ||
if ssl: | ||
|
||
if metadata: | ||
def metadata_callback(context, callback): | ||
# for more info see grpc docs | ||
callback(metadata, None) | ||
|
||
# build ssl credentials using the cert the same as before | ||
cert_creds = grpc.ssl_channel_credentials() | ||
|
||
# now build meta data credentials | ||
auth_creds = grpc.metadata_call_credentials(metadata_callback) | ||
|
||
# combine the cert credentials and the macaroon auth credentials | ||
# such that every call is properly encrypted and authenticated | ||
creds = grpc.composite_channel_credentials(cert_creds, auth_creds) | ||
else: | ||
creds = grpc.ssl_channel_credentials() | ||
|
||
# finally pass in the combined credentials when creating a channel | ||
return grpc.secure_channel(f'{host}:{port}', creds) | ||
else: | ||
return grpc.insecure_channel(f'{host}:{port}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.