استدلال LLM مع إيصال
curl --request POST \
--url https://api.truthlocks.com/v1/orchestrate/llm/inference \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_id": "<string>",
"prompt_hash": "<string>",
"provider": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
model_id: '<string>',
prompt_hash: '<string>',
provider: '<string>'
})
};
fetch('https://api.truthlocks.com/v1/orchestrate/llm/inference', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/orchestrate/llm/inference"
payload = {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_id": "<string>",
"prompt_hash": "<string>",
"provider": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/orchestrate/llm/inference"
payload := strings.NewReader("{\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"model_id\": \"<string>\",\n \"prompt_hash\": \"<string>\",\n \"provider\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"response": "<string>",
"receipt_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tokens_used": 123,
"cost": 123
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}التنسيقات وسير العمل
تسجيل استدلال LLM
سجل استدعاء استدلال LLM ضمن تنسيق لتتبع التكلفة وتدقيق المصدر.
POST
/
v1
/
orchestrate
/
llm
/
inference
استدلال LLM مع إيصال
curl --request POST \
--url https://api.truthlocks.com/v1/orchestrate/llm/inference \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_id": "<string>",
"prompt_hash": "<string>",
"provider": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
model_id: '<string>',
prompt_hash: '<string>',
provider: '<string>'
})
};
fetch('https://api.truthlocks.com/v1/orchestrate/llm/inference', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/orchestrate/llm/inference"
payload = {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_id": "<string>",
"prompt_hash": "<string>",
"provider": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/orchestrate/llm/inference"
payload := strings.NewReader("{\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"model_id\": \"<string>\",\n \"prompt_hash\": \"<string>\",\n \"provider\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"response": "<string>",
"receipt_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tokens_used": 123,
"cost": 123
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}يسجل استدعاء استدلال LLM فردي حدث ضمن تنسيق قيد التشغيل. يسجل كل سجل استدلال النموذج، والمزود، وعدد الرموز، وزمن الاستجابة، والتكلفة، وتجزئات المحتوى - مما يتيح تحديد التكلفة الدقيق وتدقيق المصدر لكل قرار ذكاء اصطناعي.
يتم استدعاء نقطة النهاية هذه بواسطة أوقات تشغيل الوكيل بعد اكتمال كل استدعاء LLM API. يتم ربط سجل الاستدلال بالتنسيق الأصلي ويتم تضمينه في إيصال سجل الشفافية النهائي.
الاستجابة
الجسم
application/json

