endee 0.1.9__py3-none-any.whl → 0.1.10__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
endee/endee.py CHANGED
@@ -569,7 +569,7 @@ class Endee:
569
569
  token=self.token,
570
570
  url=self.base_url,
571
571
  version=self.version,
572
- params=metadata.model_dump(by_alias=True),
572
+ params=metadata.dict(by_alias=True),
573
573
  session_client_manager=self.session_manager,
574
574
  )
575
575
  else:
@@ -578,7 +578,7 @@ class Endee:
578
578
  token=self.token,
579
579
  url=self.base_url,
580
580
  version=self.version,
581
- params=metadata.model_dump(by_alias=True),
581
+ params=metadata.dict(by_alias=True),
582
582
  session_client_manager=self.client_manager,
583
583
  )
584
584
 
endee/schema.py CHANGED
@@ -2,7 +2,7 @@ import re
2
2
  import sys
3
3
  from typing import Any, Dict, List, Optional, Union
4
4
 
5
- from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
5
+ from pydantic import BaseModel, Field, root_validator, validator
6
6
 
7
7
  from .constants import (
8
8
  DEFAULT_EF_SEARCH,
@@ -20,24 +20,33 @@ from .constants import (
20
20
  class VectorItem(BaseModel):
21
21
  """Model for a single vector item in an upsert operation."""
22
22
 
23
- id: str = Field(..., min_length=1)
23
+ id: str
24
24
  vector: List[float]
25
25
  meta: Optional[Dict[str, Any]] = Field(default_factory=dict)
26
26
  filter: Optional[Dict[str, Any]] = Field(default_factory=dict)
27
27
  sparse_indices: Optional[List[int]] = None
28
28
  sparse_values: Optional[List[float]] = None
29
29
 
30
- @model_validator(mode="after")
31
- def validate_sparse_data(self) -> "VectorItem":
32
- if (self.sparse_indices is None) != (self.sparse_values is None):
30
+ @validator("id")
31
+ @classmethod
32
+ def validate_id(cls, v: str) -> str:
33
+ if len(v) < 1:
34
+ raise ValueError("id must not be empty")
35
+ return v
36
+
37
+ @root_validator
38
+ @classmethod
39
+ def validate_sparse_data(cls, values: Dict[str, Any]) -> Dict[str, Any]:
40
+ sparse_indices = values.get("sparse_indices")
41
+ sparse_values = values.get("sparse_values")
42
+
43
+ if (sparse_indices is None) != (sparse_values is None):
33
44
  raise ValueError(
34
45
  "Both sparse_indices and sparse_values must be provided together"
35
46
  )
36
- if self.sparse_indices is not None and len(self.sparse_indices) != len(
37
- self.sparse_values
38
- ):
47
+ if sparse_indices is not None and len(sparse_indices) != len(sparse_values):
39
48
  raise ValueError("sparse_indices and sparse_values must match in length")
40
- return self
49
+ return values
41
50
 
42
51
 
43
52
  class QueryRequest(BaseModel):
@@ -51,10 +60,15 @@ class QueryRequest(BaseModel):
51
60
  sparse_indices: Optional[List[int]] = None
52
61
  sparse_values: Optional[List[float]] = None
53
62
 
54
- @model_validator(mode="after")
55
- def validate_query_type(self) -> "QueryRequest":
56
- has_dense = self.vector is not None
57
- has_sparse = self.sparse_indices is not None or self.sparse_values is not None
63
+ @root_validator
64
+ @classmethod
65
+ def validate_query_type(cls, values: Dict[str, Any]) -> Dict[str, Any]:
66
+ vector = values.get("vector")
67
+ sparse_indices = values.get("sparse_indices")
68
+ sparse_values = values.get("sparse_values")
69
+
70
+ has_dense = vector is not None
71
+ has_sparse = sparse_indices is not None or sparse_values is not None
58
72
 
59
73
  if not has_dense and not has_sparse:
60
74
  raise ValueError(
@@ -62,17 +76,15 @@ class QueryRequest(BaseModel):
62
76
  " must be provided."
63
77
  )
64
78
 
65
- if (self.sparse_indices is None) != (self.sparse_values is None):
79
+ if (sparse_indices is None) != (sparse_values is None):
66
80
  raise ValueError(
67
81
  "Both sparse_indices and sparse_values must be provided together"
68
82
  )
69
83
 
70
- if self.sparse_indices is not None and len(self.sparse_indices) != len(
71
- self.sparse_values
72
- ):
84
+ if sparse_indices is not None and len(sparse_indices) != len(sparse_values):
73
85
  raise ValueError("sparse_indices and sparse_values must match in length")
74
86
 
75
- return self
87
+ return values
76
88
 
77
89
 
78
90
  class IndexCreateRequest(BaseModel):
@@ -87,7 +99,7 @@ class IndexCreateRequest(BaseModel):
87
99
  version: Optional[int] = None
88
100
  sparse_dim: int = Field(default=0, ge=0, le=sys.maxsize)
89
101
 
90
- @field_validator("name")
102
+ @validator("name")
91
103
  @classmethod
92
104
  def validate_name(cls, v: str) -> str:
93
105
  if not re.match(r"^[a-zA-Z0-9_]+$", v):
@@ -101,7 +113,7 @@ class IndexCreateRequest(BaseModel):
101
113
  )
102
114
  return v
103
115
 
104
- @field_validator("space_type")
116
+ @validator("space_type")
105
117
  @classmethod
106
118
  def validate_space_type(cls, v: str) -> str:
107
119
  v = v.lower()
@@ -111,7 +123,7 @@ class IndexCreateRequest(BaseModel):
111
123
  )
112
124
  return v
113
125
 
114
- @field_validator("precision")
126
+ @validator("precision")
115
127
  @classmethod
116
128
  def validate_precision(cls, v: Union[str, Precision]) -> Union[str, Precision]:
117
129
  if isinstance(v, Precision):
@@ -126,7 +138,8 @@ class IndexCreateRequest(BaseModel):
126
138
  class IndexMetadata(BaseModel):
127
139
  """Model for index metadata returned by the server."""
128
140
 
129
- model_config = ConfigDict(populate_by_name=True)
141
+ class Config:
142
+ allow_population_by_field_name = True
130
143
 
131
144
  name: Optional[str] = Field(None, alias="name")
132
145
  lib_token: str
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: endee
3
- Version: 0.1.9
3
+ Version: 0.1.10
4
4
  Summary: Endee is the Next-Generation Vector Database for Scalable, High-Performance AI
5
5
  Home-page: https://endee.io
6
6
  Author: Endee Labs
@@ -29,7 +29,7 @@ Requires-Dist: httpx[http2]>=0.28.1
29
29
  Requires-Dist: numpy>=2.2.4
30
30
  Requires-Dist: msgpack>=1.1.0
31
31
  Requires-Dist: orjson>=3.11.5
32
- Requires-Dist: pydantic>=2.0.0
32
+ Requires-Dist: pydantic==1.10.26
33
33
  Dynamic: author
34
34
  Dynamic: author-email
35
35
  Dynamic: classifier
@@ -0,0 +1,13 @@
1
+ endee/__init__.py,sha256=PZnr7T97fJlLfv9bMPeiSy8vcySBpFgBF2b4VJZbE1s,58
2
+ endee/compression.py,sha256=HdNKSpdOFJVv_iGYV9UcLj-1_VMcX8tl1dH7mZB9x50,1134
3
+ endee/constants.py,sha256=kg96MFbtbNIZbjyYS32SqBf-pWYL1TUJztlcE96PGxk,4297
4
+ endee/endee.py,sha256=SFDLLEiBixTC389RdniEcJWhav1T1gCnZ64iakBihto,19831
5
+ endee/exceptions.py,sha256=u1JZKvKHUyLlWlfaCXgN8vzASkbwIJeEQqtllKVr2ug,7505
6
+ endee/index.py,sha256=0X_AU_4ROSQsklwTpo8iYjpEU3MUAslwCrpGGenyvAM,22751
7
+ endee/schema.py,sha256=Y52cI_97hPW_7c0L8lip0fv_a2pNZWKOQ2dH4pJITUM,5026
8
+ endee/utils.py,sha256=UGRMf_2DLDE9Ze-2HDoeAv97Mc6w8ABIX9M1MFOBwVc,1258
9
+ endee-0.1.10.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ endee-0.1.10.dist-info/METADATA,sha256=volhvIuSQ6qoZWPhwmhiEOOaBdHEARmC3iqyhKLwIy0,24338
11
+ endee-0.1.10.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
12
+ endee-0.1.10.dist-info/top_level.txt,sha256=zOEvXIfzdm7vXJaVX_jq5OX3fTftKq14KzynxlAp8ZQ,6
13
+ endee-0.1.10.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- endee/__init__.py,sha256=PZnr7T97fJlLfv9bMPeiSy8vcySBpFgBF2b4VJZbE1s,58
2
- endee/compression.py,sha256=HdNKSpdOFJVv_iGYV9UcLj-1_VMcX8tl1dH7mZB9x50,1134
3
- endee/constants.py,sha256=kg96MFbtbNIZbjyYS32SqBf-pWYL1TUJztlcE96PGxk,4297
4
- endee/endee.py,sha256=4sCNsUNqJqPP41IyUjT2MZnC6QvkBjerGVUnJhEZJXs,19843
5
- endee/exceptions.py,sha256=u1JZKvKHUyLlWlfaCXgN8vzASkbwIJeEQqtllKVr2ug,7505
6
- endee/index.py,sha256=0X_AU_4ROSQsklwTpo8iYjpEU3MUAslwCrpGGenyvAM,22751
7
- endee/schema.py,sha256=3Akwmtqv3oqr3-5iDXDYcOLGxY0zVSOUhoJhnJV4qVA,4707
8
- endee/utils.py,sha256=UGRMf_2DLDE9Ze-2HDoeAv97Mc6w8ABIX9M1MFOBwVc,1258
9
- endee-0.1.9.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- endee-0.1.9.dist-info/METADATA,sha256=ATehjQEJ2m-ye-PjlnaGuelAu9z1x1SOSQxqjlSqvMQ,24335
11
- endee-0.1.9.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
12
- endee-0.1.9.dist-info/top_level.txt,sha256=zOEvXIfzdm7vXJaVX_jq5OX3fTftKq14KzynxlAp8ZQ,6
13
- endee-0.1.9.dist-info/RECORD,,
File without changes