mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-19 02:01:02 +02:00
More API doc hacking
This commit is contained in:
parent
3678509c7e
commit
5c00b8e71b
2 changed files with 98 additions and 11 deletions
|
|
@ -105,12 +105,3 @@ The client class is
|
||||||
|
|
||||||
https://github.com/trustgraph-ai/trustgraph/blob/master/trustgraph-base/trustgraph/clients/embeddings_client.py
|
https://github.com/trustgraph-ai/trustgraph/blob/master/trustgraph-base/trustgraph/clients/embeddings_client.py
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,105 @@
|
||||||
|
|
||||||
|
# TrustGraph Embeddings API
|
||||||
|
|
||||||
|
## Request/response
|
||||||
|
|
||||||
|
### Request
|
||||||
|
|
||||||
|
Some LLM system permit specifying a separate `system` prompt. When
|
||||||
|
the same system prompt is used repeatedly, this can result in lower
|
||||||
|
token costs for the system part or quicker LLM response.
|
||||||
|
|
||||||
|
The request contains the following fields:
|
||||||
|
- `system`: A string, the system part
|
||||||
|
- `prompt`: A string, the user part
|
||||||
|
|
||||||
|
### Response
|
||||||
|
|
||||||
|
The request contains the following fields:
|
||||||
|
- `response`: LLM response
|
||||||
|
|
||||||
|
## REST service
|
||||||
|
|
||||||
|
The REST service accepts a request object containing the question field.
|
||||||
|
The response is a JSON object containing the `answer` field. Interim
|
||||||
|
responses are not provided.
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
|
||||||
|
Request:
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"system": "You are a helpful agent",
|
||||||
|
"prompt": "What does NASA stand for?"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Response:
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"response": "National Aeronautics and Space Administration"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Websocket
|
||||||
|
|
||||||
|
Agent requests have a `request` object containing the `system` and
|
||||||
|
`prompt` fields.
|
||||||
|
Responses have a `response` object containing `response` field.
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
|
||||||
|
Request:
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": "blrqotfefnmnh7de-1",
|
||||||
|
"service": "text-completion",
|
||||||
|
"request": {
|
||||||
|
"system": "You are a helpful agent",
|
||||||
|
"prompt": "What does NASA stand for?"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Responses:
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
{"id":"blrqotfefnmnh7de-1","service":"text-completion","request":{"system":"You are a helpful agent","prompt":"What does NASA stand for?"}}
|
{
|
||||||
|
"id": "blrqotfefnmnh7de-1",
|
||||||
|
"response": {
|
||||||
|
"response": "National Aeronautics and Space Administration"
|
||||||
|
},
|
||||||
|
"complete": true
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Pulsar
|
||||||
|
|
||||||
|
The Pulsar schema for the Agent API is defined in Python code here:
|
||||||
|
|
||||||
|
https://github.com/trustgraph-ai/trustgraph/blob/master/trustgraph-base/trustgraph/schema/models.py
|
||||||
|
|
||||||
{"id": "blrqotfefnmnh7de-1", "response": {"response": "NASA stands for the National Aeronautics and Space Administration.\n"}, "complete": true}
|
Default request queue:
|
||||||
|
`non-persistent://tg/request/text-completion`
|
||||||
|
|
||||||
|
Default response queue:
|
||||||
|
`non-persistent://tg/response/text-completion`
|
||||||
|
|
||||||
|
Request schema:
|
||||||
|
`trustgraph.schema.TextCompletionRequest`
|
||||||
|
|
||||||
|
Response schema:
|
||||||
|
`trustgraph.schema.TextCompletionResponse`
|
||||||
|
|
||||||
|
## Pulsar Python client
|
||||||
|
|
||||||
|
The client class is
|
||||||
|
`trustgraph.clients.LlmClient`
|
||||||
|
|
||||||
|
https://github.com/trustgraph-ai/trustgraph/blob/master/trustgraph-base/trustgraph/clients/llm_client.py
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue