corvic-engine 0.3.0rc67__cp38-abi3-win_amd64.whl → 0.3.0rc69__cp38-abi3-win_amd64.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.
Files changed (35) hide show
  1. corvic/context/__init__.py +0 -8
  2. corvic/engine/_native.pyd +0 -0
  3. corvic/model/_base_model.py +3 -4
  4. corvic/model/_completion_model.py +2 -4
  5. corvic/model/_feature_view.py +5 -6
  6. corvic/model/_pipeline.py +1 -2
  7. corvic/model/_resource.py +1 -2
  8. corvic/model/_source.py +1 -2
  9. corvic/model/_space.py +26 -2
  10. corvic/op_graph/row_filters/_jsonlogic.py +32 -1
  11. corvic/orm/base.py +4 -5
  12. corvic/orm/ids.py +1 -2
  13. corvic/orm/mixins.py +6 -8
  14. corvic/pa_scalar/_temporal.py +1 -1
  15. corvic/result/__init__.py +1 -2
  16. corvic/system/_column_encoding.py +215 -0
  17. corvic/system/_embedder.py +24 -2
  18. corvic/system/_image_embedder.py +38 -0
  19. corvic/system/_planner.py +6 -3
  20. corvic/system/_text_embedder.py +21 -0
  21. corvic/system/client.py +2 -1
  22. corvic/system/in_memory_executor.py +503 -507
  23. corvic/system/op_graph_executor.py +7 -3
  24. corvic/system/storage.py +1 -3
  25. corvic/table/table.py +5 -5
  26. {corvic_engine-0.3.0rc67.dist-info → corvic_engine-0.3.0rc69.dist-info}/METADATA +3 -4
  27. {corvic_engine-0.3.0rc67.dist-info → corvic_engine-0.3.0rc69.dist-info}/RECORD +35 -34
  28. corvic_generated/feature/v2/feature_view_pb2.py +21 -21
  29. corvic_generated/feature/v2/space_pb2.py +59 -51
  30. corvic_generated/feature/v2/space_pb2.pyi +12 -6
  31. corvic_generated/ingest/v2/resource_pb2.py +25 -25
  32. corvic_generated/orm/v1/agent_pb2.py +2 -2
  33. corvic_generated/orm/v1/agent_pb2.pyi +4 -0
  34. {corvic_engine-0.3.0rc67.dist-info → corvic_engine-0.3.0rc69.dist-info}/WHEEL +0 -0
  35. {corvic_engine-0.3.0rc67.dist-info → corvic_engine-0.3.0rc69.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,6 @@
1
+ import asyncio
1
2
  import dataclasses
3
+ from concurrent.futures import ThreadPoolExecutor
2
4
  from io import BytesIO
3
5
  from typing import TYPE_CHECKING, Any
4
6
 
@@ -51,6 +53,15 @@ class RandomImageEmbedder(ImageEmbedder):
51
53
  )
52
54
  )
53
55
 
56
+ async def aembed(
57
+ self,
58
+ context: EmbedImageContext,
59
+ worker_threads: ThreadPoolExecutor | None = None,
60
+ ) -> Ok[EmbedImageResult] | InvalidArgumentError | InternalError:
61
+ return await asyncio.get_running_loop().run_in_executor(
62
+ worker_threads, self.embed, context
63
+ )
64
+
54
65
 
55
66
  def image_from_bytes(
56
67
  image: bytes, mode: str = "RGB"
@@ -155,6 +166,15 @@ class Clip(ImageEmbedder):
155
166
  )
156
167
  )
157
168
 
169
+ async def aembed(
170
+ self,
171
+ context: EmbedImageContext,
172
+ worker_threads: ThreadPoolExecutor | None = None,
173
+ ) -> Ok[EmbedImageResult] | InvalidArgumentError | InternalError:
174
+ return await asyncio.get_running_loop().run_in_executor(
175
+ worker_threads, self.embed, context
176
+ )
177
+
158
178
 
159
179
  class CombinedImageEmbedder(ImageEmbedder):
160
180
  def __init__(self):
@@ -168,6 +188,15 @@ class CombinedImageEmbedder(ImageEmbedder):
168
188
  return self._random_embedder.embed(context)
169
189
  return self._clip_embedder.embed(context)
170
190
 
191
+ async def aembed(
192
+ self,
193
+ context: EmbedImageContext,
194
+ worker_threads: ThreadPoolExecutor | None = None,
195
+ ) -> Ok[EmbedImageResult] | InvalidArgumentError | InternalError:
196
+ return await asyncio.get_running_loop().run_in_executor(
197
+ worker_threads, self.embed, context
198
+ )
199
+
171
200
 
172
201
  class IdentityImageEmbedder(ImageEmbedder):
173
202
  """A deterministic image embedder.
@@ -251,6 +280,15 @@ class IdentityImageEmbedder(ImageEmbedder):
251
280
  )
252
281
  )
253
282
 
283
+ async def aembed(
284
+ self,
285
+ context: EmbedImageContext,
286
+ worker_threads: ThreadPoolExecutor | None = None,
287
+ ) -> Ok[EmbedImageResult] | InvalidArgumentError | InternalError:
288
+ return await asyncio.get_running_loop().run_in_executor(
289
+ worker_threads, self.embed, context
290
+ )
291
+
254
292
  def preimage(
255
293
  self,
256
294
  embedding: list[float],
corvic/system/_planner.py CHANGED
@@ -1,3 +1,4 @@
1
+ from concurrent.futures import ThreadPoolExecutor
1
2
  from typing import ClassVar
2
3
 
3
4
  from more_itertools import flatten
@@ -182,8 +183,10 @@ class ValidateFirstExecutor(OpGraphExecutor):
182
183
  def __init__(self, wrapped_executor: OpGraphExecutor):
183
184
  self._wrapped_executor = wrapped_executor
184
185
 
185
- def execute(
186
- self, context: ExecutionContext
186
+ async def execute(
187
+ self,
188
+ context: ExecutionContext,
189
+ worker_threads: ThreadPoolExecutor | None = None,
187
190
  ) -> (
188
191
  Ok[ExecutionResult]
189
192
  | InvalidArgumentError
@@ -201,4 +204,4 @@ class ValidateFirstExecutor(OpGraphExecutor):
201
204
  return InvalidArgumentError(
202
205
  "sql_output_slice_args set but impossible on a given op_graph"
203
206
  )
204
- return self._wrapped_executor.execute(context)
207
+ return await self._wrapped_executor.execute(context, worker_threads)
@@ -1,3 +1,6 @@
1
+ import asyncio
2
+ from concurrent.futures import ThreadPoolExecutor
3
+
1
4
  import numpy as np
2
5
  import polars as pl
3
6
 
@@ -40,6 +43,15 @@ class RandomTextEmbedder(TextEmbedder):
40
43
  )
41
44
  )
42
45
 
46
+ async def aembed(
47
+ self,
48
+ context: EmbedTextContext,
49
+ worker_threads: ThreadPoolExecutor | None = None,
50
+ ) -> Ok[EmbedTextResult] | InvalidArgumentError | InternalError:
51
+ return await asyncio.get_running_loop().run_in_executor(
52
+ worker_threads, self.embed, context
53
+ )
54
+
43
55
 
44
56
  class IdentityTextEmbedder(TextEmbedder):
45
57
  """A deterministic text embedder.
@@ -90,6 +102,15 @@ class IdentityTextEmbedder(TextEmbedder):
90
102
  )
91
103
  )
92
104
 
105
+ async def aembed(
106
+ self,
107
+ context: EmbedTextContext,
108
+ worker_threads: ThreadPoolExecutor | None = None,
109
+ ) -> Ok[EmbedTextResult] | InvalidArgumentError | InternalError:
110
+ return await asyncio.get_running_loop().run_in_executor(
111
+ worker_threads, self.embed, context
112
+ )
113
+
93
114
  def preimage(self, embedding: list[float], *, normalized: bool = False) -> str:
94
115
  """Reconstruct the text from a given embedding vector."""
95
116
  if normalized:
corvic/system/client.py CHANGED
@@ -1,7 +1,8 @@
1
1
  """Corvic system client protocol."""
2
2
 
3
+ from typing import Protocol
4
+
3
5
  import sqlalchemy as sa
4
- from typing_extensions import Protocol
5
6
 
6
7
  from corvic.system._embedder import ImageEmbedder, TextEmbedder
7
8
  from corvic.system.op_graph_executor import OpGraphExecutor