mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-18 09:41:03 +02:00
Tidying clients
This commit is contained in:
parent
93bb2adb9e
commit
dc0bcba269
2 changed files with 10 additions and 9 deletions
|
|
@ -4,12 +4,17 @@ from .. schema import EmbeddingsReqeust, EmbeddingsResponse
|
|||
|
||||
class EmbeddingsClient(RequestResponse):
|
||||
async def embed(self, text, timeout=30):
|
||||
|
||||
resp = await self.request(
|
||||
EmbeddingsRequest(
|
||||
text = text
|
||||
),
|
||||
timeout=timeout
|
||||
)
|
||||
|
||||
if resp.error:
|
||||
raise RuntimeError(resp.error.message)
|
||||
|
||||
return resp.vectors
|
||||
|
||||
class EmbeddingsClientSpec(RequestResponseSpec):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue