corvic-engine 0.3.0rc66__cp38-abi3-win_amd64.whl → 0.3.0rc68__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.
@@ -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