mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-19 18:21:03 +02:00
Clients
This commit is contained in:
parent
c4d961bdb7
commit
c05ad5c215
4 changed files with 11 additions and 11 deletions
|
|
@ -15,6 +15,6 @@ from . request_response_spec import RequestResponseSpec
|
||||||
from . llm_service import LlmService, LlmResult
|
from . llm_service import LlmService, LlmResult
|
||||||
from . embeddings_service import EmbeddingsService
|
from . embeddings_service import EmbeddingsService
|
||||||
from . embeddings_client import EmbeddingsClientSpec
|
from . embeddings_client import EmbeddingsClientSpec
|
||||||
from . text_completion_client import TextCompletionsClientSpec
|
from . text_completion_client import TextCompletionClientSpec
|
||||||
from . prompt_client import PromptClientSpec
|
from . prompt_client import PromptClientSpec
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
from . request_response_spec import RequestResponse, RequestResponseSpec
|
from . request_response_spec import RequestResponse, RequestResponseSpec
|
||||||
from .. schema import EmbeddingsReqeust, EmbeddingsResponse
|
from .. schema import EmbeddingsRequest, EmbeddingsResponse
|
||||||
|
|
||||||
class EmbeddingsClient(RequestResponse):
|
class EmbeddingsClient(RequestResponse):
|
||||||
async def embed(self, text, timeout=30):
|
async def embed(self, text, timeout=30):
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from . request_response_spec import RequestResponse, RequestResponseSpec
|
from . request_response_spec import RequestResponse, RequestResponseSpec
|
||||||
from .. schema import EmbeddingsReqeust, EmbeddingsResponse
|
from .. schema import PromptRequest, PromptResponse
|
||||||
|
|
||||||
class PromptClient(RequestResponse):
|
class PromptClient(RequestResponse):
|
||||||
|
|
||||||
|
|
@ -42,11 +42,11 @@ class PromptClientSpec(RequestResponseSpec):
|
||||||
def __init__(
|
def __init__(
|
||||||
self, request_name, response_name,
|
self, request_name, response_name,
|
||||||
):
|
):
|
||||||
super(EmbeddingsRequestResponseSpec, self).__init__(
|
super(PromptClientSpec, self).__init__(
|
||||||
request_name = request_name,
|
request_name = request_name,
|
||||||
request_schema = EmbeddingsRequest,
|
request_schema = PromptRequest,
|
||||||
response_name = response_name,
|
response_name = response_name,
|
||||||
response_schema = EmbeddingsResponse,
|
response_schema = PromptResponse,
|
||||||
impl = TextCompletionClient,
|
impl = PromptClient,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
from . request_response_spec import RequestResponse, RequestResponseSpec
|
from . request_response_spec import RequestResponse, RequestResponseSpec
|
||||||
from .. schema import EmbeddingsReqeust, EmbeddingsResponse
|
from .. schema import TextCompletionRequest, TextCompletionResponse
|
||||||
|
|
||||||
class TextCompletionClient(RequestResponse):
|
class TextCompletionClient(RequestResponse):
|
||||||
async def text_completion(self, system, prompt, timeout=600):
|
async def text_completion(self, system, prompt, timeout=600):
|
||||||
|
|
@ -20,11 +20,11 @@ class TextCompletionClientSpec(RequestResponseSpec):
|
||||||
def __init__(
|
def __init__(
|
||||||
self, request_name, response_name,
|
self, request_name, response_name,
|
||||||
):
|
):
|
||||||
super(EmbeddingsRequestResponseSpec, self).__init__(
|
super(TextCompletionClientSpec, self).__init__(
|
||||||
request_name = request_name,
|
request_name = request_name,
|
||||||
request_schema = EmbeddingsRequest,
|
request_schema = TextCompletionRequest,
|
||||||
response_name = response_name,
|
response_name = response_name,
|
||||||
response_schema = EmbeddingsResponse,
|
response_schema = TextCompletionResponse,
|
||||||
impl = TextCompletionClient,
|
impl = TextCompletionClient,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue