lambdadb 0.7.4.dev0__tar.gz → 0.7.5.dev0__tar.gz

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.
Files changed (72) hide show
  1. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/PKG-INFO +36 -1
  2. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/README.md +35 -1
  3. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/pyproject.toml +1 -2
  4. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/__init__.py +9 -0
  5. lambdadb-0.7.5.dev0/src/lambdadb/models/indexconfigs_union.py +275 -0
  6. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/version.py +1 -1
  7. lambdadb-0.7.4.dev0/src/lambdadb/models/indexconfigs_union.py +0 -162
  8. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/LICENSE +0 -0
  9. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/py.typed +0 -0
  10. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/__init__.py +0 -0
  11. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/_hooks/__init__.py +0 -0
  12. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/_hooks/registration.py +0 -0
  13. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/_hooks/sdkhooks.py +0 -0
  14. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/_hooks/types.py +0 -0
  15. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/basesdk.py +0 -0
  16. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/collection.py +0 -0
  17. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/collections.py +0 -0
  18. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/docs.py +0 -0
  19. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/errors/__init__.py +0 -0
  20. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/errors/apierror.py +0 -0
  21. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/errors/badrequest_error.py +0 -0
  22. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/errors/internalservererror.py +0 -0
  23. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/errors/lambdadberror.py +0 -0
  24. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/errors/no_response_error.py +0 -0
  25. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/errors/resourcealreadyexists_error.py +0 -0
  26. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/errors/resourcenotfound_error.py +0 -0
  27. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/errors/responsevalidationerror.py +0 -0
  28. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/errors/toomanyrequests_error.py +0 -0
  29. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/errors/unauthenticated_error.py +0 -0
  30. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/httpclient.py +0 -0
  31. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/bulkupsertdocsop.py +0 -0
  32. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/collectionresponse.py +0 -0
  33. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/createcollectionop.py +0 -0
  34. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/deletecollectionop.py +0 -0
  35. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/deletedocsop.py +0 -0
  36. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/fetchdocsop.py +0 -0
  37. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/fieldsselector_union.py +0 -0
  38. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/getbulkupsertdocsop.py +0 -0
  39. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/getcollectionop.py +0 -0
  40. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/listcollectionsop.py +0 -0
  41. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/listdocsop.py +0 -0
  42. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/messageresponse.py +0 -0
  43. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/partitionconfig.py +0 -0
  44. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/partitionfilter.py +0 -0
  45. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/querycollectionop.py +0 -0
  46. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/security.py +0 -0
  47. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/status.py +0 -0
  48. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/updatecollectionop.py +0 -0
  49. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/updatedocsop.py +0 -0
  50. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/models/upsertdocsop.py +0 -0
  51. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/py.typed +0 -0
  52. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/sdk.py +0 -0
  53. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/sdkconfiguration.py +0 -0
  54. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/types/__init__.py +0 -0
  55. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/types/basemodel.py +0 -0
  56. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/utils/__init__.py +0 -0
  57. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/utils/annotations.py +0 -0
  58. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/utils/datetimes.py +0 -0
  59. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/utils/enums.py +0 -0
  60. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/utils/eventstreaming.py +0 -0
  61. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/utils/forms.py +0 -0
  62. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/utils/headers.py +0 -0
  63. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/utils/logger.py +0 -0
  64. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/utils/metadata.py +0 -0
  65. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/utils/queryparams.py +0 -0
  66. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/utils/requestbodies.py +0 -0
  67. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/utils/retries.py +0 -0
  68. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/utils/security.py +0 -0
  69. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/utils/serializers.py +0 -0
  70. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/utils/unmarshal_json_response.py +0 -0
  71. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/utils/url.py +0 -0
  72. {lambdadb-0.7.4.dev0 → lambdadb-0.7.5.dev0}/src/lambdadb/utils/values.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lambdadb
3
- Version: 0.7.4.dev0
3
+ Version: 0.7.5.dev0
4
4
  Summary: The Official LambdaDB Python SDK.
5
5
  License-File: LICENSE
6
6
  Author: Functional Systems, Inc.
@@ -159,6 +159,40 @@ with LambdaDB(
159
159
  coll.docs.upsert(docs=[{"id": "1", "text": "hello"}])
160
160
  ```
161
161
 
162
+ ### Create a collection with managed embeddings
163
+
164
+ Managed embedding vector fields set `managedEmbedding=True` and put provider/model/source
165
+ settings under `embedding`. Do not set top-level `dimensions` or `similarity` on managed
166
+ embedding vector fields. For unmanaged vector fields, keep using top-level `dimensions`.
167
+
168
+ ```python
169
+ from lambdadb import LambdaDB, models
170
+
171
+ with LambdaDB(
172
+ project_api_key="<YOUR_PROJECT_API_KEY>",
173
+ base_url="https://api.lambdadb.ai",
174
+ project_name="playground",
175
+ ) as client:
176
+ client.collections.create(
177
+ collection_name="articles",
178
+ index_configs={
179
+ "body": {
180
+ "type": models.TypeText.TEXT,
181
+ "analyzers": [models.Analyzer.ENGLISH],
182
+ },
183
+ "bodyEmbedding": {
184
+ "type": models.TypeVector.VECTOR,
185
+ "managedEmbedding": True,
186
+ "embedding": {
187
+ "provider": models.Provider.OPENAI,
188
+ "model": "text-embedding-3-small",
189
+ "sourceField": "body",
190
+ },
191
+ },
192
+ },
193
+ )
194
+ ```
195
+
162
196
  ### List all collections (sync / async)
163
197
 
164
198
  ```python
@@ -568,3 +602,4 @@ looking for the latest version.
568
602
 
569
603
  While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
570
604
  We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
605
+
@@ -138,6 +138,40 @@ with LambdaDB(
138
138
  coll.docs.upsert(docs=[{"id": "1", "text": "hello"}])
139
139
  ```
140
140
 
141
+ ### Create a collection with managed embeddings
142
+
143
+ Managed embedding vector fields set `managedEmbedding=True` and put provider/model/source
144
+ settings under `embedding`. Do not set top-level `dimensions` or `similarity` on managed
145
+ embedding vector fields. For unmanaged vector fields, keep using top-level `dimensions`.
146
+
147
+ ```python
148
+ from lambdadb import LambdaDB, models
149
+
150
+ with LambdaDB(
151
+ project_api_key="<YOUR_PROJECT_API_KEY>",
152
+ base_url="https://api.lambdadb.ai",
153
+ project_name="playground",
154
+ ) as client:
155
+ client.collections.create(
156
+ collection_name="articles",
157
+ index_configs={
158
+ "body": {
159
+ "type": models.TypeText.TEXT,
160
+ "analyzers": [models.Analyzer.ENGLISH],
161
+ },
162
+ "bodyEmbedding": {
163
+ "type": models.TypeVector.VECTOR,
164
+ "managedEmbedding": True,
165
+ "embedding": {
166
+ "provider": models.Provider.OPENAI,
167
+ "model": "text-embedding-3-small",
168
+ "sourceField": "body",
169
+ },
170
+ },
171
+ },
172
+ )
173
+ ```
174
+
141
175
  ### List all collections (sync / async)
142
176
 
143
177
  ```python
@@ -546,4 +580,4 @@ looking for the latest version.
546
580
  ## Contributions
547
581
 
548
582
  While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
549
- We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
583
+ We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
@@ -1,7 +1,7 @@
1
1
 
2
2
  [project]
3
3
  name = "lambdadb"
4
- version = "0.7.4.dev0"
4
+ version = "0.7.5.dev0"
5
5
  description = "The Official LambdaDB Python SDK."
6
6
  authors = [{ name = "Functional Systems, Inc." },]
7
7
  readme = "README.md"
@@ -57,4 +57,3 @@ ignore_missing_imports = true
57
57
  venvPath = "."
58
58
  venv = ".venv"
59
59
  extraPaths = ["src"]
60
-
@@ -63,6 +63,8 @@ if TYPE_CHECKING:
63
63
  )
64
64
  from .indexconfigs_union import (
65
65
  Analyzer,
66
+ EmbeddingConfig,
67
+ EmbeddingConfigTypedDict,
66
68
  IndexConfigs,
67
69
  IndexConfigsObject,
68
70
  IndexConfigsObjectTypedDict,
@@ -73,6 +75,7 @@ if TYPE_CHECKING:
73
75
  IndexConfigsUnionTypedDict,
74
76
  IndexConfigsVector,
75
77
  IndexConfigsVectorTypedDict,
78
+ Provider,
76
79
  Similarity,
77
80
  Type,
78
81
  TypeObject,
@@ -146,6 +149,8 @@ __all__ = [
146
149
  "DeleteDocsRequestBody",
147
150
  "DeleteDocsRequestBodyTypedDict",
148
151
  "DeleteDocsRequestTypedDict",
152
+ "EmbeddingConfig",
153
+ "EmbeddingConfigTypedDict",
149
154
  "FetchDocsDoc",
150
155
  "FetchDocsDocTypedDict",
151
156
  "FetchDocsRequest",
@@ -194,6 +199,7 @@ __all__ = [
194
199
  "PartitionConfigTypedDict",
195
200
  "PartitionFilter",
196
201
  "PartitionFilterTypedDict",
202
+ "Provider",
197
203
  "QueryCollectionDoc",
198
204
  "QueryCollectionDocTypedDict",
199
205
  "QueryCollectionRequest",
@@ -268,6 +274,8 @@ _dynamic_imports: dict[str, str] = {
268
274
  "GetCollectionResponse": ".getcollectionop",
269
275
  "GetCollectionResponseTypedDict": ".getcollectionop",
270
276
  "Analyzer": ".indexconfigs_union",
277
+ "EmbeddingConfig": ".indexconfigs_union",
278
+ "EmbeddingConfigTypedDict": ".indexconfigs_union",
271
279
  "IndexConfigs": ".indexconfigs_union",
272
280
  "IndexConfigsObject": ".indexconfigs_union",
273
281
  "IndexConfigsObjectTypedDict": ".indexconfigs_union",
@@ -278,6 +286,7 @@ _dynamic_imports: dict[str, str] = {
278
286
  "IndexConfigsUnionTypedDict": ".indexconfigs_union",
279
287
  "IndexConfigsVector": ".indexconfigs_union",
280
288
  "IndexConfigsVectorTypedDict": ".indexconfigs_union",
289
+ "Provider": ".indexconfigs_union",
281
290
  "Similarity": ".indexconfigs_union",
282
291
  "Type": ".indexconfigs_union",
283
292
  "TypeObject": ".indexconfigs_union",
@@ -0,0 +1,275 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from enum import Enum
5
+ from lambdadb.types import BaseModel, UNSET_SENTINEL
6
+ from lambdadb.utils import get_discriminator
7
+ import pydantic
8
+ from pydantic import Discriminator, Tag, model_serializer, model_validator
9
+ from typing import Any, Dict, List, Optional, Union
10
+ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
11
+
12
+
13
+ MIN_VECTOR_DIMENSIONS = 1
14
+ MAX_VECTOR_DIMENSIONS = 4096
15
+
16
+
17
+ class TypeObject(str, Enum):
18
+ OBJECT = "object"
19
+
20
+
21
+ class IndexConfigsObjectTypedDict(TypedDict):
22
+ type: TypeObject
23
+ object_index_configs: Dict[str, Any]
24
+
25
+
26
+ class IndexConfigsObject(BaseModel):
27
+ type: TypeObject
28
+
29
+ object_index_configs: Annotated[
30
+ Dict[str, Any], pydantic.Field(alias="objectIndexConfigs")
31
+ ]
32
+
33
+
34
+ class Type(str, Enum):
35
+ KEYWORD = "keyword"
36
+ LONG = "long"
37
+ DOUBLE = "double"
38
+ DATETIME = "datetime"
39
+ BOOLEAN = "boolean"
40
+ SPARSE_VECTOR = "sparseVector"
41
+
42
+
43
+ class IndexConfigsTypedDict(TypedDict):
44
+ r"""Types that do not need additional parameters."""
45
+
46
+ type: Type
47
+
48
+
49
+ class IndexConfigs(BaseModel):
50
+ r"""Types that do not need additional parameters."""
51
+
52
+ type: Type
53
+
54
+
55
+ class TypeVector(str, Enum):
56
+ VECTOR = "vector"
57
+
58
+
59
+ class Provider(str, Enum):
60
+ r"""Embedding provider."""
61
+
62
+ OPENAI = "openai"
63
+
64
+
65
+ class Similarity(str, Enum):
66
+ r"""Vector similarity metric."""
67
+
68
+ COSINE = "cosine"
69
+ EUCLIDEAN = "euclidean"
70
+ DOT_PRODUCT = "dot_product"
71
+ MAX_INNER_PRODUCT = "max_inner_product"
72
+
73
+
74
+ class EmbeddingConfigTypedDict(TypedDict):
75
+ r"""Managed embedding configuration for vector fields."""
76
+
77
+ provider: Provider
78
+ r"""Embedding provider."""
79
+ model: str
80
+ r"""Embedding model name. See /guides/collections/managed-embeddings for the current supported providers and models."""
81
+ source_field: str
82
+ r"""Source text field name used to generate embeddings."""
83
+ dimensions: NotRequired[int]
84
+ r"""Resolved embedding dimensions. Optional in requests and resolved in stored collection metadata."""
85
+ similarity: NotRequired[Similarity]
86
+ r"""Resolved vector similarity metric. Optional in requests and resolved in stored collection metadata."""
87
+
88
+
89
+ class EmbeddingConfig(BaseModel):
90
+ r"""Managed embedding configuration for vector fields."""
91
+
92
+ provider: Provider
93
+ r"""Embedding provider."""
94
+
95
+ model: str
96
+ r"""Embedding model name. See /guides/collections/managed-embeddings for the current supported providers and models."""
97
+
98
+ source_field: Annotated[str, pydantic.Field(alias="sourceField")]
99
+ r"""Source text field name used to generate embeddings."""
100
+
101
+ dimensions: Optional[int] = None
102
+ r"""Resolved embedding dimensions. Optional in requests and resolved in stored collection metadata."""
103
+
104
+ similarity: Optional[Similarity] = Similarity.COSINE
105
+ r"""Resolved vector similarity metric. Optional in requests and resolved in stored collection metadata."""
106
+
107
+ @model_serializer(mode="wrap")
108
+ def serialize_model(self, handler):
109
+ optional_fields = set(["dimensions", "similarity"])
110
+ serialized = handler(self)
111
+ m = {}
112
+
113
+ for n, f in type(self).model_fields.items():
114
+ k = f.alias or n
115
+ val = self._get_serialized_value(serialized, n, f.alias)
116
+
117
+ if val != UNSET_SENTINEL:
118
+ if val is not None or k not in optional_fields:
119
+ m[k] = val
120
+
121
+ return m
122
+
123
+
124
+ class IndexConfigsVectorTypedDict(TypedDict):
125
+ type: TypeVector
126
+ managed_embedding: NotRequired[bool]
127
+ r"""Set to true for managed embedding vector fields, or false/omit for unmanaged vector fields."""
128
+ dimensions: NotRequired[int]
129
+ r"""Vector dimensions for unmanaged vector fields."""
130
+ similarity: NotRequired[Similarity]
131
+ r"""Vector similarity metric for unmanaged vector fields."""
132
+ embedding: NotRequired[EmbeddingConfigTypedDict]
133
+ r"""Managed embedding configuration for vector fields."""
134
+
135
+
136
+ class IndexConfigsVector(BaseModel):
137
+ type: TypeVector
138
+
139
+ managed_embedding: Annotated[
140
+ Optional[bool], pydantic.Field(alias="managedEmbedding")
141
+ ] = None
142
+ r"""Set to true for managed embedding vector fields, or false/omit for unmanaged vector fields."""
143
+
144
+ dimensions: Optional[int] = None
145
+ r"""Vector dimensions for unmanaged vector fields."""
146
+
147
+ similarity: Optional[Similarity] = Similarity.COSINE
148
+ r"""Vector similarity metric for unmanaged vector fields."""
149
+
150
+ embedding: Optional[EmbeddingConfig] = None
151
+ r"""Managed embedding configuration for vector fields."""
152
+
153
+ @model_validator(mode="after")
154
+ def validate_vector_type(self):
155
+ if self.managed_embedding is None and self.embedding is not None:
156
+ raise ValueError(
157
+ "managedEmbedding=true is required when embedding config is provided"
158
+ )
159
+
160
+ if self.managed_embedding is True:
161
+ if "dimensions" in self.model_fields_set and self.dimensions is not None:
162
+ raise ValueError(
163
+ "Top-level dimensions are not allowed for managed embedding field"
164
+ )
165
+ if "similarity" in self.model_fields_set and self.similarity is not None:
166
+ raise ValueError(
167
+ "Top-level similarity is not allowed for managed embedding field"
168
+ )
169
+ if self.embedding is None:
170
+ raise ValueError("embedding is required when managedEmbedding=true")
171
+
172
+ return self
173
+
174
+ if self.embedding is not None:
175
+ raise ValueError("embedding is not allowed when managedEmbedding=false")
176
+
177
+ if self.dimensions is None:
178
+ raise ValueError("Dimensions is required field")
179
+ if (
180
+ self.dimensions > MAX_VECTOR_DIMENSIONS
181
+ or self.dimensions < MIN_VECTOR_DIMENSIONS
182
+ ):
183
+ raise ValueError(
184
+ f"Dimensions must be between {MIN_VECTOR_DIMENSIONS} and {MAX_VECTOR_DIMENSIONS}"
185
+ )
186
+
187
+ return self
188
+
189
+ @model_serializer(mode="wrap")
190
+ def serialize_model(self, handler):
191
+ optional_fields = set(
192
+ ["managedEmbedding", "dimensions", "similarity", "embedding"]
193
+ )
194
+ serialized = handler(self)
195
+ m = {}
196
+
197
+ for n, f in type(self).model_fields.items():
198
+ k = f.alias or n
199
+ val = self._get_serialized_value(serialized, n, f.alias)
200
+
201
+ if self.managed_embedding is True and k == "similarity":
202
+ continue
203
+
204
+ if val != UNSET_SENTINEL:
205
+ if val is not None or k not in optional_fields:
206
+ m[k] = val
207
+
208
+ return m
209
+
210
+
211
+ class TypeText(str, Enum):
212
+ TEXT = "text"
213
+
214
+
215
+ class Analyzer(str, Enum):
216
+ STANDARD = "standard"
217
+ KOREAN = "korean"
218
+ JAPANESE = "japanese"
219
+ ENGLISH = "english"
220
+
221
+
222
+ class IndexConfigsTextTypedDict(TypedDict):
223
+ type: TypeText
224
+ analyzers: NotRequired[List[Analyzer]]
225
+ r"""Analyzers."""
226
+
227
+
228
+ class IndexConfigsText(BaseModel):
229
+ type: TypeText
230
+
231
+ analyzers: Optional[List[Analyzer]] = None
232
+ r"""Analyzers."""
233
+
234
+ @model_serializer(mode="wrap")
235
+ def serialize_model(self, handler):
236
+ optional_fields = set(["analyzers"])
237
+ serialized = handler(self)
238
+ m = {}
239
+
240
+ for n, f in type(self).model_fields.items():
241
+ k = f.alias or n
242
+ val = self._get_serialized_value(serialized, n, f.alias)
243
+
244
+ if val != UNSET_SENTINEL:
245
+ if val is not None or k not in optional_fields:
246
+ m[k] = val
247
+
248
+ return m
249
+
250
+
251
+ IndexConfigsUnionTypedDict = TypeAliasType(
252
+ "IndexConfigsUnionTypedDict",
253
+ Union[
254
+ IndexConfigsTypedDict,
255
+ IndexConfigsTextTypedDict,
256
+ IndexConfigsObjectTypedDict,
257
+ IndexConfigsVectorTypedDict,
258
+ ],
259
+ )
260
+
261
+
262
+ IndexConfigsUnion = Annotated[
263
+ Union[
264
+ Annotated[IndexConfigsText, Tag("text")],
265
+ Annotated[IndexConfigsVector, Tag("vector")],
266
+ Annotated[IndexConfigs, Tag("keyword")],
267
+ Annotated[IndexConfigs, Tag("long")],
268
+ Annotated[IndexConfigs, Tag("double")],
269
+ Annotated[IndexConfigs, Tag("datetime")],
270
+ Annotated[IndexConfigs, Tag("boolean")],
271
+ Annotated[IndexConfigs, Tag("sparseVector")],
272
+ Annotated[IndexConfigsObject, Tag("object")],
273
+ ],
274
+ Discriminator(lambda m: get_discriminator(m, "type", "type")),
275
+ ]
@@ -3,7 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  TITLE: str = "lambdadb"
6
- SDK_VERSION: str = "0.7.4.dev0"
6
+ SDK_VERSION: str = "0.7.5.dev0"
7
7
  OPENAPI_DOC_VERSION: str = "1.1.1"
8
8
  GEN_VERSION: str = "2.798.0"
9
9
 
@@ -1,162 +0,0 @@
1
- """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
-
3
- from __future__ import annotations
4
- from enum import Enum
5
- from lambdadb.types import BaseModel, UNSET_SENTINEL
6
- from lambdadb.utils import get_discriminator
7
- import pydantic
8
- from pydantic import Discriminator, Tag, model_serializer
9
- from typing import Any, Dict, List, Optional, Union
10
- from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
11
-
12
-
13
- class TypeObject(str, Enum):
14
- OBJECT = "object"
15
-
16
-
17
- class IndexConfigsObjectTypedDict(TypedDict):
18
- type: TypeObject
19
- object_index_configs: Dict[str, Any]
20
-
21
-
22
- class IndexConfigsObject(BaseModel):
23
- type: TypeObject
24
-
25
- object_index_configs: Annotated[
26
- Dict[str, Any], pydantic.Field(alias="objectIndexConfigs")
27
- ]
28
-
29
-
30
- class Type(str, Enum):
31
- KEYWORD = "keyword"
32
- LONG = "long"
33
- DOUBLE = "double"
34
- DATETIME = "datetime"
35
- BOOLEAN = "boolean"
36
- SPARSE_VECTOR = "sparseVector"
37
-
38
-
39
- class IndexConfigsTypedDict(TypedDict):
40
- r"""Types that do not need additional parameters."""
41
-
42
- type: Type
43
-
44
-
45
- class IndexConfigs(BaseModel):
46
- r"""Types that do not need additional parameters."""
47
-
48
- type: Type
49
-
50
-
51
- class TypeVector(str, Enum):
52
- VECTOR = "vector"
53
-
54
-
55
- class Similarity(str, Enum):
56
- r"""Vector similarity metric."""
57
-
58
- COSINE = "cosine"
59
- EUCLIDEAN = "euclidean"
60
- DOT_PRODUCT = "dot_product"
61
- MAX_INNER_PRODUCT = "max_inner_product"
62
-
63
-
64
- class IndexConfigsVectorTypedDict(TypedDict):
65
- type: TypeVector
66
- dimensions: int
67
- r"""Vector dimensions."""
68
- similarity: NotRequired[Similarity]
69
- r"""Vector similarity metric."""
70
-
71
-
72
- class IndexConfigsVector(BaseModel):
73
- type: TypeVector
74
-
75
- dimensions: int
76
- r"""Vector dimensions."""
77
-
78
- similarity: Optional[Similarity] = Similarity.COSINE
79
- r"""Vector similarity metric."""
80
-
81
- @model_serializer(mode="wrap")
82
- def serialize_model(self, handler):
83
- optional_fields = set(["similarity"])
84
- serialized = handler(self)
85
- m = {}
86
-
87
- for n, f in type(self).model_fields.items():
88
- k = f.alias or n
89
- val = self._get_serialized_value(serialized, n, f.alias)
90
-
91
- if val != UNSET_SENTINEL:
92
- if val is not None or k not in optional_fields:
93
- m[k] = val
94
-
95
- return m
96
-
97
-
98
- class TypeText(str, Enum):
99
- TEXT = "text"
100
-
101
-
102
- class Analyzer(str, Enum):
103
- STANDARD = "standard"
104
- KOREAN = "korean"
105
- JAPANESE = "japanese"
106
- ENGLISH = "english"
107
-
108
-
109
- class IndexConfigsTextTypedDict(TypedDict):
110
- type: TypeText
111
- analyzers: NotRequired[List[Analyzer]]
112
- r"""Analyzers."""
113
-
114
-
115
- class IndexConfigsText(BaseModel):
116
- type: TypeText
117
-
118
- analyzers: Optional[List[Analyzer]] = None
119
- r"""Analyzers."""
120
-
121
- @model_serializer(mode="wrap")
122
- def serialize_model(self, handler):
123
- optional_fields = set(["analyzers"])
124
- serialized = handler(self)
125
- m = {}
126
-
127
- for n, f in type(self).model_fields.items():
128
- k = f.alias or n
129
- val = self._get_serialized_value(serialized, n, f.alias)
130
-
131
- if val != UNSET_SENTINEL:
132
- if val is not None or k not in optional_fields:
133
- m[k] = val
134
-
135
- return m
136
-
137
-
138
- IndexConfigsUnionTypedDict = TypeAliasType(
139
- "IndexConfigsUnionTypedDict",
140
- Union[
141
- IndexConfigsTypedDict,
142
- IndexConfigsTextTypedDict,
143
- IndexConfigsObjectTypedDict,
144
- IndexConfigsVectorTypedDict,
145
- ],
146
- )
147
-
148
-
149
- IndexConfigsUnion = Annotated[
150
- Union[
151
- Annotated[IndexConfigsText, Tag("text")],
152
- Annotated[IndexConfigsVector, Tag("vector")],
153
- Annotated[IndexConfigs, Tag("keyword")],
154
- Annotated[IndexConfigs, Tag("long")],
155
- Annotated[IndexConfigs, Tag("double")],
156
- Annotated[IndexConfigs, Tag("datetime")],
157
- Annotated[IndexConfigs, Tag("boolean")],
158
- Annotated[IndexConfigs, Tag("sparseVector")],
159
- Annotated[IndexConfigsObject, Tag("object")],
160
- ],
161
- Discriminator(lambda m: get_discriminator(m, "type", "type")),
162
- ]
File without changes
File without changes