diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3f0065bb133..750bab0d304 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,5 +32,5 @@ repos: rev: "v1.2.0" hooks: - id: mypy - args: [--strict, --ignore-missing-imports, --follow-imports=silent, --disable-error-code=type-abstract] + args: [--strict, --ignore-missing-imports, --follow-imports=silent, --disable-error-code=type-abstract, --config-file=./mypy.ini] additional_dependencies: ["types-requests", "pydantic", "overrides", "hypothesis", "pytest", "pypika", "numpy", "types-protobuf", "kubernetes"] diff --git a/chromadb/proto/chroma.proto b/chromadb/proto/chroma.proto deleted file mode 100644 index 7eefed74e12..00000000000 --- a/chromadb/proto/chroma.proto +++ /dev/null @@ -1,40 +0,0 @@ -syntax = "proto3"; - -package chroma; - -enum Operation { - ADD = 0; - UPDATE = 1; - UPSERT = 2; - DELETE = 3; -} - -enum ScalarEncoding { - FLOAT32 = 0; - INT32 = 1; -} - -message Vector { - int32 dimension = 1; - bytes vector = 2; - ScalarEncoding encoding = 3; -} - -message UpdateMetadataValue { - oneof value { - string string_value = 1; - int64 int_value = 2; - double float_value = 3; - } -} - -message UpdateMetadata { - map metadata = 1; -} - -message SubmitEmbeddingRecord { - string id = 1; - optional Vector vector = 2; - optional UpdateMetadata metadata = 3; - Operation operation = 4; -} diff --git a/chromadb/proto/chroma_pb2.py b/chromadb/proto/chroma_pb2.py index 4e8c62576f0..d6b22217d7d 100644 --- a/chromadb/proto/chroma_pb2.py +++ b/chromadb/proto/chroma_pb2.py @@ -1,4 +1,3 @@ -# type: ignore # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: chromadb/proto/chroma.proto @@ -7,61 +6,58 @@ from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder - # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x1b\x63hromadb/proto/chroma.proto\x12\x06\x63hroma"U\n\x06Vector\x12\x11\n\tdimension\x18\x01 \x01(\x05\x12\x0e\n\x06vector\x18\x02 \x01(\x0c\x12(\n\x08\x65ncoding\x18\x03 \x01(\x0e\x32\x16.chroma.ScalarEncoding"\xca\x01\n\x07Segment\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\t\x12#\n\x05scope\x18\x03 \x01(\x0e\x32\x14.chroma.SegmentScope\x12\x12\n\x05topic\x18\x04 \x01(\tH\x00\x88\x01\x01\x12\x17\n\ncollection\x18\x05 \x01(\tH\x01\x88\x01\x01\x12-\n\x08metadata\x18\x06 \x01(\x0b\x32\x16.chroma.UpdateMetadataH\x02\x88\x01\x01\x42\x08\n\x06_topicB\r\n\x0b_collectionB\x0b\n\t_metadata"b\n\x13UpdateMetadataValue\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x13\n\tint_value\x18\x02 \x01(\x03H\x00\x12\x15\n\x0b\x66loat_value\x18\x03 \x01(\x01H\x00\x42\x07\n\x05value"\x96\x01\n\x0eUpdateMetadata\x12\x36\n\x08metadata\x18\x01 \x03(\x0b\x32$.chroma.UpdateMetadata.MetadataEntry\x1aL\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12*\n\x05value\x18\x02 \x01(\x0b\x32\x1b.chroma.UpdateMetadataValue:\x02\x38\x01"\xb5\x01\n\x15SubmitEmbeddingRecord\x12\n\n\x02id\x18\x01 \x01(\t\x12#\n\x06vector\x18\x02 \x01(\x0b\x32\x0e.chroma.VectorH\x00\x88\x01\x01\x12-\n\x08metadata\x18\x03 \x01(\x0b\x32\x16.chroma.UpdateMetadataH\x01\x88\x01\x01\x12$\n\toperation\x18\x04 \x01(\x0e\x32\x11.chroma.OperationB\t\n\x07_vectorB\x0b\n\t_metadata"S\n\x15VectorEmbeddingRecord\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0e\n\x06seq_id\x18\x02 \x01(\x0c\x12\x1e\n\x06vector\x18\x03 \x01(\x0b\x32\x0e.chroma.Vector"q\n\x11VectorQueryResult\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0e\n\x06seq_id\x18\x02 \x01(\x0c\x12\x10\n\x08\x64istance\x18\x03 \x01(\x01\x12#\n\x06vector\x18\x04 \x01(\x0b\x32\x0e.chroma.VectorH\x00\x88\x01\x01\x42\t\n\x07_vector"@\n\x12VectorQueryResults\x12*\n\x07results\x18\x01 \x03(\x0b\x32\x19.chroma.VectorQueryResult"(\n\x15SegmentServerResponse\x12\x0f\n\x07success\x18\x01 \x01(\x08"4\n\x11GetVectorsRequest\x12\x0b\n\x03ids\x18\x01 \x03(\t\x12\x12\n\nsegment_id\x18\x02 \x01(\t"D\n\x12GetVectorsResponse\x12.\n\x07records\x18\x01 \x03(\x0b\x32\x1d.chroma.VectorEmbeddingRecord"\x86\x01\n\x13QueryVectorsRequest\x12\x1f\n\x07vectors\x18\x01 \x03(\x0b\x32\x0e.chroma.Vector\x12\t\n\x01k\x18\x02 \x01(\x05\x12\x13\n\x0b\x61llowed_ids\x18\x03 \x03(\t\x12\x1a\n\x12include_embeddings\x18\x04 \x01(\x08\x12\x12\n\nsegment_id\x18\x05 \x01(\t"C\n\x14QueryVectorsResponse\x12+\n\x07results\x18\x01 \x03(\x0b\x32\x1a.chroma.VectorQueryResults*8\n\tOperation\x12\x07\n\x03\x41\x44\x44\x10\x00\x12\n\n\x06UPDATE\x10\x01\x12\n\n\x06UPSERT\x10\x02\x12\n\n\x06\x44\x45LETE\x10\x03*(\n\x0eScalarEncoding\x12\x0b\n\x07\x46LOAT32\x10\x00\x12\t\n\x05INT32\x10\x01*(\n\x0cSegmentScope\x12\n\n\x06VECTOR\x10\x00\x12\x0c\n\x08METADATA\x10\x01\x32\x94\x01\n\rSegmentServer\x12?\n\x0bLoadSegment\x12\x0f.chroma.Segment\x1a\x1d.chroma.SegmentServerResponse"\x00\x12\x42\n\x0eReleaseSegment\x12\x0f.chroma.Segment\x1a\x1d.chroma.SegmentServerResponse"\x00\x32\xa2\x01\n\x0cVectorReader\x12\x45\n\nGetVectors\x12\x19.chroma.GetVectorsRequest\x1a\x1a.chroma.GetVectorsResponse"\x00\x12K\n\x0cQueryVectors\x12\x1b.chroma.QueryVectorsRequest\x1a\x1c.chroma.QueryVectorsResponse"\x00\x62\x06proto3' -) + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1b\x63hromadb/proto/chroma.proto\x12\x06\x63hroma\"U\n\x06Vector\x12\x11\n\tdimension\x18\x01 \x01(\x05\x12\x0e\n\x06vector\x18\x02 \x01(\x0c\x12(\n\x08\x65ncoding\x18\x03 \x01(\x0e\x32\x16.chroma.ScalarEncoding\"\xca\x01\n\x07Segment\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\t\x12#\n\x05scope\x18\x03 \x01(\x0e\x32\x14.chroma.SegmentScope\x12\x12\n\x05topic\x18\x04 \x01(\tH\x00\x88\x01\x01\x12\x17\n\ncollection\x18\x05 \x01(\tH\x01\x88\x01\x01\x12-\n\x08metadata\x18\x06 \x01(\x0b\x32\x16.chroma.UpdateMetadataH\x02\x88\x01\x01\x42\x08\n\x06_topicB\r\n\x0b_collectionB\x0b\n\t_metadata\"b\n\x13UpdateMetadataValue\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x13\n\tint_value\x18\x02 \x01(\x03H\x00\x12\x15\n\x0b\x66loat_value\x18\x03 \x01(\x01H\x00\x42\x07\n\x05value\"\x96\x01\n\x0eUpdateMetadata\x12\x36\n\x08metadata\x18\x01 \x03(\x0b\x32$.chroma.UpdateMetadata.MetadataEntry\x1aL\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12*\n\x05value\x18\x02 \x01(\x0b\x32\x1b.chroma.UpdateMetadataValue:\x02\x38\x01\"\xb5\x01\n\x15SubmitEmbeddingRecord\x12\n\n\x02id\x18\x01 \x01(\t\x12#\n\x06vector\x18\x02 \x01(\x0b\x32\x0e.chroma.VectorH\x00\x88\x01\x01\x12-\n\x08metadata\x18\x03 \x01(\x0b\x32\x16.chroma.UpdateMetadataH\x01\x88\x01\x01\x12$\n\toperation\x18\x04 \x01(\x0e\x32\x11.chroma.OperationB\t\n\x07_vectorB\x0b\n\t_metadata\"S\n\x15VectorEmbeddingRecord\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0e\n\x06seq_id\x18\x02 \x01(\x0c\x12\x1e\n\x06vector\x18\x03 \x01(\x0b\x32\x0e.chroma.Vector\"q\n\x11VectorQueryResult\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0e\n\x06seq_id\x18\x02 \x01(\x0c\x12\x10\n\x08\x64istance\x18\x03 \x01(\x01\x12#\n\x06vector\x18\x04 \x01(\x0b\x32\x0e.chroma.VectorH\x00\x88\x01\x01\x42\t\n\x07_vector\"@\n\x12VectorQueryResults\x12*\n\x07results\x18\x01 \x03(\x0b\x32\x19.chroma.VectorQueryResult\"(\n\x15SegmentServerResponse\x12\x0f\n\x07success\x18\x01 \x01(\x08\"4\n\x11GetVectorsRequest\x12\x0b\n\x03ids\x18\x01 \x03(\t\x12\x12\n\nsegment_id\x18\x02 \x01(\t\"D\n\x12GetVectorsResponse\x12.\n\x07records\x18\x01 \x03(\x0b\x32\x1d.chroma.VectorEmbeddingRecord\"\x86\x01\n\x13QueryVectorsRequest\x12\x1f\n\x07vectors\x18\x01 \x03(\x0b\x32\x0e.chroma.Vector\x12\t\n\x01k\x18\x02 \x01(\x05\x12\x13\n\x0b\x61llowed_ids\x18\x03 \x03(\t\x12\x1a\n\x12include_embeddings\x18\x04 \x01(\x08\x12\x12\n\nsegment_id\x18\x05 \x01(\t\"C\n\x14QueryVectorsResponse\x12+\n\x07results\x18\x01 \x03(\x0b\x32\x1a.chroma.VectorQueryResults*8\n\tOperation\x12\x07\n\x03\x41\x44\x44\x10\x00\x12\n\n\x06UPDATE\x10\x01\x12\n\n\x06UPSERT\x10\x02\x12\n\n\x06\x44\x45LETE\x10\x03*(\n\x0eScalarEncoding\x12\x0b\n\x07\x46LOAT32\x10\x00\x12\t\n\x05INT32\x10\x01*(\n\x0cSegmentScope\x12\n\n\x06VECTOR\x10\x00\x12\x0c\n\x08METADATA\x10\x01\x32\x94\x01\n\rSegmentServer\x12?\n\x0bLoadSegment\x12\x0f.chroma.Segment\x1a\x1d.chroma.SegmentServerResponse\"\x00\x12\x42\n\x0eReleaseSegment\x12\x0f.chroma.Segment\x1a\x1d.chroma.SegmentServerResponse\"\x00\x32\xa2\x01\n\x0cVectorReader\x12\x45\n\nGetVectors\x12\x19.chroma.GetVectorsRequest\x1a\x1a.chroma.GetVectorsResponse\"\x00\x12K\n\x0cQueryVectors\x12\x1b.chroma.QueryVectorsRequest\x1a\x1c.chroma.QueryVectorsResponse\"\x00\x62\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages( - DESCRIPTOR, "chromadb.proto.chroma_pb2", _globals -) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'chromadb.proto.chroma_pb2', _globals) if _descriptor._USE_C_DESCRIPTORS == False: - DESCRIPTOR._options = None - _UPDATEMETADATA_METADATAENTRY._options = None - _UPDATEMETADATA_METADATAENTRY._serialized_options = b"8\001" - _globals["_OPERATION"]._serialized_start = 1406 - _globals["_OPERATION"]._serialized_end = 1462 - _globals["_SCALARENCODING"]._serialized_start = 1464 - _globals["_SCALARENCODING"]._serialized_end = 1504 - _globals["_SEGMENTSCOPE"]._serialized_start = 1506 - _globals["_SEGMENTSCOPE"]._serialized_end = 1546 - _globals["_VECTOR"]._serialized_start = 39 - _globals["_VECTOR"]._serialized_end = 124 - _globals["_SEGMENT"]._serialized_start = 127 - _globals["_SEGMENT"]._serialized_end = 329 - _globals["_UPDATEMETADATAVALUE"]._serialized_start = 331 - _globals["_UPDATEMETADATAVALUE"]._serialized_end = 429 - _globals["_UPDATEMETADATA"]._serialized_start = 432 - _globals["_UPDATEMETADATA"]._serialized_end = 582 - _globals["_UPDATEMETADATA_METADATAENTRY"]._serialized_start = 506 - _globals["_UPDATEMETADATA_METADATAENTRY"]._serialized_end = 582 - _globals["_SUBMITEMBEDDINGRECORD"]._serialized_start = 585 - _globals["_SUBMITEMBEDDINGRECORD"]._serialized_end = 766 - _globals["_VECTOREMBEDDINGRECORD"]._serialized_start = 768 - _globals["_VECTOREMBEDDINGRECORD"]._serialized_end = 851 - _globals["_VECTORQUERYRESULT"]._serialized_start = 853 - _globals["_VECTORQUERYRESULT"]._serialized_end = 966 - _globals["_VECTORQUERYRESULTS"]._serialized_start = 968 - _globals["_VECTORQUERYRESULTS"]._serialized_end = 1032 - _globals["_SEGMENTSERVERRESPONSE"]._serialized_start = 1034 - _globals["_SEGMENTSERVERRESPONSE"]._serialized_end = 1074 - _globals["_GETVECTORSREQUEST"]._serialized_start = 1076 - _globals["_GETVECTORSREQUEST"]._serialized_end = 1128 - _globals["_GETVECTORSRESPONSE"]._serialized_start = 1130 - _globals["_GETVECTORSRESPONSE"]._serialized_end = 1198 - _globals["_QUERYVECTORSREQUEST"]._serialized_start = 1201 - _globals["_QUERYVECTORSREQUEST"]._serialized_end = 1335 - _globals["_QUERYVECTORSRESPONSE"]._serialized_start = 1337 - _globals["_QUERYVECTORSRESPONSE"]._serialized_end = 1404 - _globals["_SEGMENTSERVER"]._serialized_start = 1549 - _globals["_SEGMENTSERVER"]._serialized_end = 1697 - _globals["_VECTORREADER"]._serialized_start = 1700 - _globals["_VECTORREADER"]._serialized_end = 1862 + DESCRIPTOR._options = None + _UPDATEMETADATA_METADATAENTRY._options = None + _UPDATEMETADATA_METADATAENTRY._serialized_options = b'8\001' + _globals['_OPERATION']._serialized_start=1406 + _globals['_OPERATION']._serialized_end=1462 + _globals['_SCALARENCODING']._serialized_start=1464 + _globals['_SCALARENCODING']._serialized_end=1504 + _globals['_SEGMENTSCOPE']._serialized_start=1506 + _globals['_SEGMENTSCOPE']._serialized_end=1546 + _globals['_VECTOR']._serialized_start=39 + _globals['_VECTOR']._serialized_end=124 + _globals['_SEGMENT']._serialized_start=127 + _globals['_SEGMENT']._serialized_end=329 + _globals['_UPDATEMETADATAVALUE']._serialized_start=331 + _globals['_UPDATEMETADATAVALUE']._serialized_end=429 + _globals['_UPDATEMETADATA']._serialized_start=432 + _globals['_UPDATEMETADATA']._serialized_end=582 + _globals['_UPDATEMETADATA_METADATAENTRY']._serialized_start=506 + _globals['_UPDATEMETADATA_METADATAENTRY']._serialized_end=582 + _globals['_SUBMITEMBEDDINGRECORD']._serialized_start=585 + _globals['_SUBMITEMBEDDINGRECORD']._serialized_end=766 + _globals['_VECTOREMBEDDINGRECORD']._serialized_start=768 + _globals['_VECTOREMBEDDINGRECORD']._serialized_end=851 + _globals['_VECTORQUERYRESULT']._serialized_start=853 + _globals['_VECTORQUERYRESULT']._serialized_end=966 + _globals['_VECTORQUERYRESULTS']._serialized_start=968 + _globals['_VECTORQUERYRESULTS']._serialized_end=1032 + _globals['_SEGMENTSERVERRESPONSE']._serialized_start=1034 + _globals['_SEGMENTSERVERRESPONSE']._serialized_end=1074 + _globals['_GETVECTORSREQUEST']._serialized_start=1076 + _globals['_GETVECTORSREQUEST']._serialized_end=1128 + _globals['_GETVECTORSRESPONSE']._serialized_start=1130 + _globals['_GETVECTORSRESPONSE']._serialized_end=1198 + _globals['_QUERYVECTORSREQUEST']._serialized_start=1201 + _globals['_QUERYVECTORSREQUEST']._serialized_end=1335 + _globals['_QUERYVECTORSRESPONSE']._serialized_start=1337 + _globals['_QUERYVECTORSRESPONSE']._serialized_end=1404 + _globals['_SEGMENTSERVER']._serialized_start=1549 + _globals['_SEGMENTSERVER']._serialized_end=1697 + _globals['_VECTORREADER']._serialized_start=1700 + _globals['_VECTORREADER']._serialized_end=1862 # @@protoc_insertion_point(module_scope) diff --git a/chromadb/proto/chroma_pb2.pyi b/chromadb/proto/chroma_pb2.pyi index 0b52141e64a..6d06e074c06 100644 --- a/chromadb/proto/chroma_pb2.pyi +++ b/chromadb/proto/chroma_pb2.pyi @@ -1,16 +1,8 @@ -# type: ignore - from google.protobuf.internal import containers as _containers from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message -from typing import ( - ClassVar as _ClassVar, - Iterable as _Iterable, - Mapping as _Mapping, - Optional as _Optional, - Union as _Union, -) +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union DESCRIPTOR: _descriptor.FileDescriptor @@ -30,7 +22,6 @@ class SegmentScope(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): __slots__ = [] VECTOR: _ClassVar[SegmentScope] METADATA: _ClassVar[SegmentScope] - ADD: Operation UPDATE: Operation UPSERT: Operation @@ -48,12 +39,7 @@ class Vector(_message.Message): dimension: int vector: bytes encoding: ScalarEncoding - def __init__( - self, - dimension: _Optional[int] = ..., - vector: _Optional[bytes] = ..., - encoding: _Optional[_Union[ScalarEncoding, str]] = ..., - ) -> None: ... + def __init__(self, dimension: _Optional[int] = ..., vector: _Optional[bytes] = ..., encoding: _Optional[_Union[ScalarEncoding, str]] = ...) -> None: ... class Segment(_message.Message): __slots__ = ["id", "type", "scope", "topic", "collection", "metadata"] @@ -69,15 +55,7 @@ class Segment(_message.Message): topic: str collection: str metadata: UpdateMetadata - def __init__( - self, - id: _Optional[str] = ..., - type: _Optional[str] = ..., - scope: _Optional[_Union[SegmentScope, str]] = ..., - topic: _Optional[str] = ..., - collection: _Optional[str] = ..., - metadata: _Optional[_Union[UpdateMetadata, _Mapping]] = ..., - ) -> None: ... + def __init__(self, id: _Optional[str] = ..., type: _Optional[str] = ..., scope: _Optional[_Union[SegmentScope, str]] = ..., topic: _Optional[str] = ..., collection: _Optional[str] = ..., metadata: _Optional[_Union[UpdateMetadata, _Mapping]] = ...) -> None: ... class UpdateMetadataValue(_message.Message): __slots__ = ["string_value", "int_value", "float_value"] @@ -87,32 +65,20 @@ class UpdateMetadataValue(_message.Message): string_value: str int_value: int float_value: float - def __init__( - self, - string_value: _Optional[str] = ..., - int_value: _Optional[int] = ..., - float_value: _Optional[float] = ..., - ) -> None: ... + def __init__(self, string_value: _Optional[str] = ..., int_value: _Optional[int] = ..., float_value: _Optional[float] = ...) -> None: ... class UpdateMetadata(_message.Message): __slots__ = ["metadata"] - class MetadataEntry(_message.Message): __slots__ = ["key", "value"] KEY_FIELD_NUMBER: _ClassVar[int] VALUE_FIELD_NUMBER: _ClassVar[int] key: str value: UpdateMetadataValue - def __init__( - self, - key: _Optional[str] = ..., - value: _Optional[_Union[UpdateMetadataValue, _Mapping]] = ..., - ) -> None: ... + def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[UpdateMetadataValue, _Mapping]] = ...) -> None: ... METADATA_FIELD_NUMBER: _ClassVar[int] metadata: _containers.MessageMap[str, UpdateMetadataValue] - def __init__( - self, metadata: _Optional[_Mapping[str, UpdateMetadataValue]] = ... - ) -> None: ... + def __init__(self, metadata: _Optional[_Mapping[str, UpdateMetadataValue]] = ...) -> None: ... class SubmitEmbeddingRecord(_message.Message): __slots__ = ["id", "vector", "metadata", "operation"] @@ -124,13 +90,7 @@ class SubmitEmbeddingRecord(_message.Message): vector: Vector metadata: UpdateMetadata operation: Operation - def __init__( - self, - id: _Optional[str] = ..., - vector: _Optional[_Union[Vector, _Mapping]] = ..., - metadata: _Optional[_Union[UpdateMetadata, _Mapping]] = ..., - operation: _Optional[_Union[Operation, str]] = ..., - ) -> None: ... + def __init__(self, id: _Optional[str] = ..., vector: _Optional[_Union[Vector, _Mapping]] = ..., metadata: _Optional[_Union[UpdateMetadata, _Mapping]] = ..., operation: _Optional[_Union[Operation, str]] = ...) -> None: ... class VectorEmbeddingRecord(_message.Message): __slots__ = ["id", "seq_id", "vector"] @@ -140,12 +100,7 @@ class VectorEmbeddingRecord(_message.Message): id: str seq_id: bytes vector: Vector - def __init__( - self, - id: _Optional[str] = ..., - seq_id: _Optional[bytes] = ..., - vector: _Optional[_Union[Vector, _Mapping]] = ..., - ) -> None: ... + def __init__(self, id: _Optional[str] = ..., seq_id: _Optional[bytes] = ..., vector: _Optional[_Union[Vector, _Mapping]] = ...) -> None: ... class VectorQueryResult(_message.Message): __slots__ = ["id", "seq_id", "distance", "vector"] @@ -157,21 +112,13 @@ class VectorQueryResult(_message.Message): seq_id: bytes distance: float vector: Vector - def __init__( - self, - id: _Optional[str] = ..., - seq_id: _Optional[bytes] = ..., - distance: _Optional[float] = ..., - vector: _Optional[_Union[Vector, _Mapping]] = ..., - ) -> None: ... + def __init__(self, id: _Optional[str] = ..., seq_id: _Optional[bytes] = ..., distance: _Optional[float] = ..., vector: _Optional[_Union[Vector, _Mapping]] = ...) -> None: ... class VectorQueryResults(_message.Message): __slots__ = ["results"] RESULTS_FIELD_NUMBER: _ClassVar[int] results: _containers.RepeatedCompositeFieldContainer[VectorQueryResult] - def __init__( - self, results: _Optional[_Iterable[_Union[VectorQueryResult, _Mapping]]] = ... - ) -> None: ... + def __init__(self, results: _Optional[_Iterable[_Union[VectorQueryResult, _Mapping]]] = ...) -> None: ... class SegmentServerResponse(_message.Message): __slots__ = ["success"] @@ -185,18 +132,13 @@ class GetVectorsRequest(_message.Message): SEGMENT_ID_FIELD_NUMBER: _ClassVar[int] ids: _containers.RepeatedScalarFieldContainer[str] segment_id: str - def __init__( - self, ids: _Optional[_Iterable[str]] = ..., segment_id: _Optional[str] = ... - ) -> None: ... + def __init__(self, ids: _Optional[_Iterable[str]] = ..., segment_id: _Optional[str] = ...) -> None: ... class GetVectorsResponse(_message.Message): __slots__ = ["records"] RECORDS_FIELD_NUMBER: _ClassVar[int] records: _containers.RepeatedCompositeFieldContainer[VectorEmbeddingRecord] - def __init__( - self, - records: _Optional[_Iterable[_Union[VectorEmbeddingRecord, _Mapping]]] = ..., - ) -> None: ... + def __init__(self, records: _Optional[_Iterable[_Union[VectorEmbeddingRecord, _Mapping]]] = ...) -> None: ... class QueryVectorsRequest(_message.Message): __slots__ = ["vectors", "k", "allowed_ids", "include_embeddings", "segment_id"] @@ -210,19 +152,10 @@ class QueryVectorsRequest(_message.Message): allowed_ids: _containers.RepeatedScalarFieldContainer[str] include_embeddings: bool segment_id: str - def __init__( - self, - vectors: _Optional[_Iterable[_Union[Vector, _Mapping]]] = ..., - k: _Optional[int] = ..., - allowed_ids: _Optional[_Iterable[str]] = ..., - include_embeddings: bool = ..., - segment_id: _Optional[str] = ..., - ) -> None: ... + def __init__(self, vectors: _Optional[_Iterable[_Union[Vector, _Mapping]]] = ..., k: _Optional[int] = ..., allowed_ids: _Optional[_Iterable[str]] = ..., include_embeddings: bool = ..., segment_id: _Optional[str] = ...) -> None: ... class QueryVectorsResponse(_message.Message): __slots__ = ["results"] RESULTS_FIELD_NUMBER: _ClassVar[int] results: _containers.RepeatedCompositeFieldContainer[VectorQueryResults] - def __init__( - self, results: _Optional[_Iterable[_Union[VectorQueryResults, _Mapping]]] = ... - ) -> None: ... + def __init__(self, results: _Optional[_Iterable[_Union[VectorQueryResults, _Mapping]]] = ...) -> None: ... diff --git a/chromadb/proto/chroma_pb2_grpc.py b/chromadb/proto/chroma_pb2_grpc.py index af3c29b622d..6d98cc34681 100644 --- a/chromadb/proto/chroma_pb2_grpc.py +++ b/chromadb/proto/chroma_pb2_grpc.py @@ -1,4 +1,3 @@ -# type: ignore # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! """Client and server classes corresponding to protobuf-defined services.""" import grpc diff --git a/chromadb/proto/chromadb/proto/chroma.proto b/idl/chromadb/proto/chroma.proto similarity index 100% rename from chromadb/proto/chromadb/proto/chroma.proto rename to idl/chromadb/proto/chroma.proto diff --git a/idl/makefile b/idl/makefile new file mode 100644 index 00000000000..00a2f7d64a6 --- /dev/null +++ b/idl/makefile @@ -0,0 +1,8 @@ +.PHONY: proto + +proto: + @echo "Generating gRPC code..." + @python -m grpc_tools.protoc -I ./ --python_out=. --pyi_out=. --grpc_python_out=. ./chromadb/proto/*.proto + @mv chromadb/proto/*.py ../chromadb/proto/ + @mv chromadb/proto/*.pyi ../chromadb/proto/ + @echo "Done" diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 00000000000..bcbf5f20f72 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,2 @@ +[mypy-chromadb.proto.*] +ignore_errors = True