mirror of
https://github.com/qdrant/qdrant-client.git
synced 2026-07-23 11:11:01 -05:00
* new: remove vectors_count, update http and grpc models * fix: update inspection cache * new: add conversions and update interface * fix: fix some conversions * fix: fix typo * fix: fix isinstance * fix: regen async * fix: fix update_filter usage, fix isinstance * tests: collection metadata test * fix: address backward compatibility in test * new: update models, add max payload index count and copy vectors * fix; update _inspection_cache * new: add read consistency to count points * Allow uuids in interface (#1085) * new: direct uuid support * tests: add uuid tests * fix: update inspection cache * new: add collection metadata and tests to local mode (#1089) * new: add collection metadata and tests to local mode * fix: regen async client * new: implement parametrized rrf in local mode (#1087) * new: implement parametrized rrf in local mode * refactoring: use a variable for a magic value * fix: adjust conversion according to AI * Update filter (#1090) * new: add missing update_filter, implement it in local mode * fix: fix type hint, fix update operation, fix rest uploader, add tests * fix: fix update filter is None case * fix: mypy was not a good boy * Text any filter (#1091) * new: add match text any local mode * tests: add match text any tests * new: update models, remove init_from and locks (#1100) * new: update models, remove init_from and locks * deprecate: remove init from tests * deprecate: remove lock tests * new: convert ascii_folding * fix: fix type stub * new: convert acorn * new: convert shard key with fallback * new: update grpcio and grpcio tools in generator (#1106) * new: update grpcio and grpcio tools in generator * fix: bind grpcio and tools versions to 1.62.0 in generator * Remove deprecated methods (#1103) * deprecate: remove old api methods * deprecate: remove type stub for removed methods * deprecate: remove old api methods from test_qdrant_client * deprecate: replace search with query points in test_in_memory * deprecate: replace search methods in fastembed mixin with query points * deprecate: replace old api methods in test async qdrant client * deprecate: replace search with query points in test delete points * deprecate: replace discover and context with query points in test_discovery * deprecate: replace recommend_groups with query_points_groups in test_group_recommend * deprecate: replace search_groups in test_group_search * deprecate: replace recommend with query points in test_recommendation * deprecate: replace search with query points in test search * deprecate: replace context and discover with query points in test sparse discovery * deprecate: replace search with query points in test sparse idf search * deprecate: replace recommend with query points in test sparse recommend * deprecate: replace search with query points in test sparse search * deprecate: replace missing search request with query request in qdrant_fastembed * deprecate: replace search with query points in test multivector search queries * deprecate: replace upload records with upload points in test_updates * deprecate: remove redundant structs (#1104) * deprecate: remove redundant structs * fix: do not use removed conversions in local mode * fix: remove redundant conversions, simplify types.QueryRequest * deprecate: replace old style grpc vector conversion to a new one (#1105) * deprecate: replace old style grpc vector conversion to a new one * fix: ignore union attr in conversion * review fixes --------- Co-authored-by: generall <andrey@vasnetsov.com> --------- Co-authored-by: generall <andrey@vasnetsov.com> --------- Co-authored-by: generall <andrey@vasnetsov.com> * new: deprecate add, query, query_batch in fastembed mixin (#1102) * new: deprecate add, query, query_batch in fastembed mixin * 1.16 -> 1.17 --------- Co-authored-by: generall <andrey@vasnetsov.com> --------- Co-authored-by: generall <andrey@vasnetsov.com> * new: yet another update * new: add initial_state to create shard key (#1109) * new: drop python3.9, replace union and optional with | where possible * fix: fix missing type hints, regen async * fix: remove redundant optional * fix: fix ai comments * fix: update type hints from merge * new: update pyproject and lock * new: replace optional and union with | * new: remove optional and union from qdrant local * new: replace union with | in client classes * fix: replace remaining union, optional, etc, address review comments * new: adjust numpy versioning --------- Co-authored-by: generall <andrey@vasnetsov.com>
75 lines
2.6 KiB
Python
75 lines
2.6 KiB
Python
import importlib.util
|
|
import sys
|
|
import time
|
|
from pathlib import Path
|
|
from types import ModuleType
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from qdrant_client import models
|
|
from qdrant_client._pydantic_compat import model_config
|
|
from qdrant_client.embed.schema_parser import ModelSchemaParser
|
|
|
|
from pydantic.version import VERSION as PYDANTIC_VERSION
|
|
|
|
|
|
def dynamic_import(file_path: str | Path, module_name: str) -> ModuleType:
|
|
# Create a module spec from the file path
|
|
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
|
if spec is None:
|
|
raise ImportError(f"Cannot create a spec for module '{module_name}' at '{file_path}'")
|
|
|
|
# Create a new module based on the spec
|
|
module = importlib.util.module_from_spec(spec)
|
|
|
|
# Execute the module to load its contents
|
|
spec.loader.exec_module(module) # type: ignore
|
|
|
|
# Optionally, add the module to sys.modules to access it globally
|
|
sys.modules[module_name] = module
|
|
return module
|
|
|
|
|
|
if __name__ == "__main__":
|
|
semver = PYDANTIC_VERSION.split(".")
|
|
major, minor, patch = int(semver[0]), int(semver[1]), int(semver[2])
|
|
if (major, minor, patch) < (2, 11, 0):
|
|
raise RuntimeError(
|
|
f"populate_inspection_cache.py requires pydantic >= 2.11.0, current version is: {PYDANTIC_VERSION}"
|
|
)
|
|
current_path = Path(__name__)
|
|
file_path = current_path.parent.parent / "qdrant_client" / "embed" / "_inspection_cache.py"
|
|
|
|
parser = ModelSchemaParser()
|
|
a = time.perf_counter()
|
|
for model_name in dir(models):
|
|
if not model_name[0].isupper():
|
|
continue
|
|
|
|
model = getattr(models, model_name)
|
|
if not isinstance(model, type):
|
|
continue
|
|
|
|
if not issubclass(model, BaseModel) or model == BaseModel:
|
|
continue
|
|
|
|
config = model_config(model)
|
|
if "extra" not in config or config["extra"] != "forbid": # type: ignore
|
|
continue
|
|
|
|
parser.parse_model(model)
|
|
print(time.perf_counter() - a)
|
|
|
|
parser._persist(file_path)
|
|
module_name = "_inspections_cache"
|
|
|
|
# Import the newly created file dynamically
|
|
_inspections_cache = dynamic_import(file_path, module_name)
|
|
result = _inspections_cache.INCLUDED_RECURSIVE_REFS
|
|
|
|
assert parser.name_recursive_ref_mapping == _inspections_cache.NAME_RECURSIVE_REF_MAPPING
|
|
assert parser._defs == _inspections_cache.DEFS
|
|
assert parser._recursive_refs == set(_inspections_cache.RECURSIVE_REFS)
|
|
assert parser._included_recursive_refs == set(_inspections_cache.INCLUDED_RECURSIVE_REFS)
|
|
assert parser._excluded_recursive_refs == set(_inspections_cache.EXCLUDED_RECURSIVE_REFS)
|