Responses API
ថ្មីPOST /v1/responses ទទួលការណែនាំ និងបញ្ជីធាតុ input ហើយត្រឡប់ response object ដែលបង្កើតពីធាតុ output ក្នុងទ្រង់ទ្រាយ OpenAI Responses។ ប្រើវាជាមួយ responses API របស់ OpenAI SDK និងឧបករណ៍ដែលសាងសង់លើវា ដូចជា Codex CLI។ endpoint នេះមិនរក្សា state ទេ៖ សូមផ្ញើការសន្ទនាទាំងមូលជាមួយរាល់ request។
POST https://api.shannon-ai.com/v1/responses
request តូចបំផុតគឺ model id និងអត្ថបទ។ ចម្លើយមិន stream ទេ លុះត្រាតែអ្នកសុំ។
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.shannon-ai.com/v1",
)
response = client.responses.create(
model="shannon-3",
input="Say hello in one sentence.",
)
print(response.output_text) import OpenAI from "openai";
const client = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://api.shannon-ai.com/v1",
});
const response = await client.responses.create({
model: "shannon-3",
input: "Say hello in one sentence.",
});
console.log(response.output_text); curl https://api.shannon-ai.com/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "shannon-3",
"input": "Say hello in one sentence."
}' ចម្លើយគឺជា response object។ output របស់វាមាន reasoning នៅពេលម៉ូដែលបានវែកញែក និងសារ៖
{
"id": "resp_5f0c1e7a9b3d4c62a8e1f07d2b46c9a3",
"object": "response",
"created_at": 1791625200,
"model": "shannon-3",
"status": "completed",
"error": null,
"incomplete_details": null,
"instructions": null,
"metadata": {},
"parallel_tool_calls": true,
"temperature": null,
"tool_choice": "auto",
"tools": [],
"top_p": null,
"output": [
{
"id": "rs_8a2e6c1f4b7d4e03b9c5a1d70f3e2b64",
"type": "reasoning",
"summary": [
{
"type": "summary_text",
"text": "The user wants a greeting in one sentence. Keep it short and friendly."
}
]
},
{
"id": "msg_1c7b9e3a5d2f4a86b0e4c8d19a6f7e25",
"type": "message",
"role": "assistant",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "Hello, it is good to meet you.",
"annotations": []
}
]
}
],
"usage": {
"input_tokens": 1184,
"output_tokens": 46,
"total_tokens": 1230
}
} Field នៃ request
model និង input គឺជាអ្វីដែល request ត្រូវការ។ ជួរឈរ Applied by ប្រាប់ឈ្មោះម៉ូដែលដែល field ផ្លាស់ប្តូរចម្លើយ។ ម៉ូដែល open-weight ដែលបង្ហោះគឺជា id ទាំងដប់ពីរនៃបញ្ជីម៉ូដែល៖ ក្រុម Shannon 3 គឺ shannon-3, shannon-3-pro, shannon-3.1 និង shannon-3.1-pro។ ម៉ូដែល និងតម្លៃ
| Field | ប្រភេទ | លំនាំដើម | ការពិពណ៌នា | អនុវត្តដោយ |
|---|---|---|---|---|
model | string | ចាំបាច់។ id មួយពីបញ្ជីម៉ូដែល។ ការផ្គូផ្គងមិនប្រកាន់អក្សរធំតូចទេ។ id ដែលបាត់ ឬមិនបានបោះពុម្ពផ្សាយត្រឡប់ 400 unknown model។ | គ្រប់ម៉ូដែល | |
input | string | array | string ដែលត្រូវបានអានជាសារ user មួយ ឬ array នៃធាតុ input។ សូមមើល Input items ខាងក្រោម។ | គ្រប់ម៉ូដែល | |
instructions | string | ការណែនាំសម្រាប់ម៉ូដែល គឺជា system prompt នៃទ្រង់ទ្រាយនេះ។ | ម៉ូដែល open-weight ដែលបង្ហោះ, shannon-1.6-*, shannon-2-*, shannon-coder-1 | |
stream | boolean | false | true ផ្ញើចម្លើយជា server-sent event។ សូមមើល Streaming ខាងក្រោម។ | គ្រប់ម៉ូដែល |
max_output_tokens | integer | 4096 | ដែនកំណត់ខាងលើនៃចម្លើយ គិតជា token។ តម្លៃក្រៅពី 1 ដល់ 65,536 ត្រូវបានរំកិលចូលក្នុងដែននោះ។ វាក៏ជាចំនួនដែលដាក់ទុកពីសមតុល្យរបស់អ្នកខណៈពេល request ដំណើរការ។ សូមមើល Output limit ខាងក្រោម។ | ម៉ូដែល open-weight ដែលបង្ហោះ, shannon-1.6-*, shannon-2-*, shannon-coder-1 |
temperature | number | Sampling temperature។ លើម៉ូដែល open-weight ដែលបង្ហោះ តម្លៃត្រូវបានរក្សារវាង 0 និង 2។ | ម៉ូដែល open-weight ដែលបង្ហោះ៖ shannon-1.6-*, shannon-2-* និង shannon-coder-1 លើចម្លើយដែលមិន stream | |
top_p | number | Nucleus sampling។ តម្លៃត្រូវបានរក្សារវាង 0 និង 1។ | ម៉ូដែល open-weight ដែលបង្ហោះ | |
tools | array | function ដែលម៉ូដែលអាចហៅ ក្នុងទម្រង់រាបស្មើនៃទ្រង់ទ្រាយនេះ៖ {"type": "function", "name", "description", "parameters"}។ សូមមើល Tools ខាងក្រោម។ | គ្រប់ម៉ូដែល | |
tool_choice | string | object | auto | "auto" ឱ្យម៉ូដែលសម្រេច។ "required" ធ្វើឱ្យវាហៅ tool។ {"type": "function", "name": "…"} ធ្វើឱ្យវាហៅ tool នោះ។ | ម៉ូដែល open-weight ដែលបង្ហោះ |
reasoning | object | {"effort": "…"} ជាមួយ off, low, medium ឬ high។ តម្លៃផ្សេងទៀតត្រឡប់ 400។ | ម៉ូដែល open-weight ដែលបង្ហោះ | |
text | object | {"format": {…}} សុំចម្លើយជា JSON។ សូមមើល Structured output ខាងក្រោម។ | គ្រប់ថ្នាក់ Shannon៖ ម៉ូដែល open-weight ដែលបង្ហោះដូចបានរាយតាម id |
previous_response_id, store, metadata, parallel_tool_calls, truncation, include, user និង prompt_cache_key ត្រូវបានទទួលយក ដើម្បីឱ្យកូដ client ដែលមានស្រាប់ដំណើរការដដែល។ ពួកវាមិនផ្លាស់ប្តូរចម្លើយទេ។ ដោយសារគ្មានការសន្ទនាត្រូវបានរក្សាទុក request បន្តបន្ទាប់ត្រូវមានវេនមុនៗក្នុង input។
ធាតុ input
ធាតុ input គឺជាសារ ដែលមាន role និង content ឬធាតុមានប្រភេទដែលផ្ទុកការហៅ tool ឬលទ្ធផលរបស់វា។ content គឺជា string ឬ array នៃផ្នែក។
| ធាតុ | ការពិពណ៌នា | អនុវត្តដោយ |
|---|---|---|
{"role": "user", "content": …} | អ្វីដែលអ្នកសួរ។ content គឺជា string ឬផ្នែក input_text និង input_image។ | គ្រប់ម៉ូដែល |
{"role": "assistant", "content": …} | ចម្លើយមុនរបស់ម៉ូដែល។ content គឺជា string ឬផ្នែក output_text។ | គ្រប់ម៉ូដែល |
{"role": "system", "content": …}{"role": "developer", "content": …} | ការណែនាំនៅក្នុងការសន្ទនា។ | ម៉ូដែល open-weight ដែលបង្ហោះ |
{"type": "function_call", "call_id": "…", "name": "…", "arguments": "…"} | ការហៅ tool ដែលម៉ូដែលបានធ្វើក្នុងចម្លើយមុន។ arguments គឺជា JSON string។ | គ្រប់ម៉ូដែល |
{"type": "function_call_output", "call_id": "…", "output": "…"} | លទ្ធផលនៃការហៅនោះ។ call_id គឺជា id នៃការហៅ ហើយ output គឺជាលទ្ធផលជា string។ | គ្រប់ម៉ូដែល |
សូមដាក់ការណែនាំក្នុង field instructions។ ជាមួយ id ក្រុម Shannon 3 សូមដាក់ការណែនាំដែលត្រូវតែអនុវត្តតាមក្នុងសារ user។
ធាតុនៃ output របស់ចម្លើយអាចត្រឡប់ទៅ input ដូចដែលវាជា៖ ធាតុ message និង function_call ត្រូវបានអាន ធាតុ reasoning ត្រូវបានរំលង។
ផ្នែកខ្លឹមសារ
| ផ្នែក | ការពិពណ៌នា | មានលើ |
|---|---|---|
{"type": "input_text", "text": "…"} | អត្ថបទនៃសារ user។ | គ្រប់ម៉ូដែល |
{"type": "output_text", "text": "…"} | អត្ថបទនៃសារ assistant។ | គ្រប់ម៉ូដែល |
{"type": "input_image", "image_url": "…"} | រូបភាព ជា data: URL ដែលមានខ្លឹមសារ base64 ឬជា http(s) URL។ | ក្រុម Shannon 3, shannon-1.6-lite, shannon-1.6-pro និងម៉ូដែល open-weight ដែលបង្ហោះដែលរាយ input រូបភាព |
{"type": "input_file", "file_data": "data:application/pdf;base64,…"} | ឯកសារមួយ (PDF, Word, PowerPoint ឬ Excel)៖ file_data ផ្ទុក data: URL ឬ file_url ផ្ទុក http(s) URL។ | ក្រុម Shannon 3 |
លើថ្នាក់ Shannon រូបភាព និងឯកសារត្រូវបានអានពីធាតុ user ចុងក្រោយនៃ input។ ទំហំ និងដែនកំណត់មានទំព័រផ្ទាល់ខ្លួន។ រូបភាព និងឯកសារ
Request ដែលមានការណែនាំ និងជម្រើស
request នេះផ្ញើការណែនាំ ការសន្ទនាជាធាតុ input ដែនកំណត់ output temperature និង reasoning effort។ វាប្រើម៉ូដែល open-weight ដែលបង្ហោះ ដែលអនុវត្តទាំងអស់។
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.shannon-ai.com/v1",
)
response = client.responses.create(
model="DeepSeek-V4-Flash-0731-W4A16-AUTOROUND-REAP",
instructions="You are a physics teacher. Answer in two sentences.",
input=[
{"role": "user", "content": "Why is the sky blue?"},
{"role": "assistant", "content": "Air scatters blue light more than red light."},
{"role": "user", "content": "And why are sunsets red?"},
],
max_output_tokens=512,
temperature=0.3,
reasoning={"effort": "low"},
)
for item in response.output:
if item.type == "reasoning":
print("reasoning:", item.summary[0].text)
elif item.type == "message":
print("answer:", item.content[0].text)
print(response.usage) import OpenAI from "openai";
const client = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://api.shannon-ai.com/v1",
});
const response = await client.responses.create({
model: "DeepSeek-V4-Flash-0731-W4A16-AUTOROUND-REAP",
instructions: "You are a physics teacher. Answer in two sentences.",
input: [
{ role: "user", content: "Why is the sky blue?" },
{ role: "assistant", content: "Air scatters blue light more than red light." },
{ role: "user", content: "And why are sunsets red?" },
],
max_output_tokens: 512,
temperature: 0.3,
reasoning: { effort: "low" },
});
for (const item of response.output) {
if (item.type === "reasoning") console.log("reasoning:", item.summary[0].text);
if (item.type === "message") console.log("answer:", item.content[0].text);
}
console.log(response.usage); curl https://api.shannon-ai.com/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "DeepSeek-V4-Flash-0731-W4A16-AUTOROUND-REAP",
"instructions": "You are a physics teacher. Answer in two sentences.",
"input": [
{"role": "user", "content": "Why is the sky blue?"},
{"role": "assistant", "content": "Air scatters blue light more than red light."},
{"role": "user", "content": "And why are sunsets red?"}
],
"max_output_tokens": 512,
"temperature": 0.3,
"reasoning": {"effort": "low"}
}' ចម្លើយរបស់ម៉ូដែល open-weight ដែលបង្ហោះមាន id, object, model, created_at, status, output និង usage។ usage របស់វាបន្ថែម token ដែលអានពី cache និង token ដែលចំណាយលើ reasoning៖
{
"usage": {
"input_tokens": 58,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 67,
"output_tokens_details": {
"reasoning_tokens": 19
},
"total_tokens": 125
}
} Response object
id, object, status, output និង usage មានក្នុងរាល់ចម្លើយ។ សូមសាងសង់កូដរបស់អ្នកលើទាំងនេះ។
| Field | ប្រភេទ | ការពិពណ៌នា | ផ្ញើដោយ |
|---|---|---|---|
id | string | resp_ តាមពីក្រោយដោយតួអក្សរ hexadecimal ចំនួន 32។ | គ្រប់ម៉ូដែល |
object | string | តែងតែជា response។ | គ្រប់ម៉ូដែល |
status | string | completed។ ក្នុង stream វាជា in_progress ជាមុនសិន ហើយជា failed ក្នុង event response.failed។ | គ្រប់ម៉ូដែល |
output | array | ធាតុ output តាមលំដាប់ដែលម៉ូដែលបង្កើត៖ reasoning, message, function_call។ | គ្រប់ម៉ូដែល |
usage | object | input_tokens, output_tokens និង total_tokens។ | គ្រប់ម៉ូដែល |
usage.input_tokens_details | object | cached_tokens៖ ចំនួន input token ដែលបានអានចេញពី prompt cache។ | ម៉ូដែល open-weight ដែលបង្ហោះ |
usage.output_tokens_details | object | reasoning_tokens៖ ចំនួន output token ដែលបានចំណាយលើការវែកញែក (reasoning)។ | ម៉ូដែល open-weight ដែលបង្ហោះ |
model | string | id ស្តង់ដារនៃម៉ូដែលដែលបានឆ្លើយ។ | ក្រុម Shannon 3, ម៉ូដែល open-weight ដែលបង្ហោះ |
created_at | integer | ពេលវេលានៃចម្លើយ ជាវិនាទី Unix។ | ក្រុម Shannon 3, ម៉ូដែល open-weight ដែលបង្ហោះ |
instructions, tools, temperature, … | instructions, tools និង temperature ធ្វើឡើងវិញនូវ request។ error និង incomplete_details គឺ null, metadata គឺ {}, parallel_tool_calls គឺ true, tool_choice គឺ auto ហើយ top_p គឺ null។ | ក្រុម Shannon 3 |
ធាតុ output
| ធាតុ | ការពិពណ៌នា |
|---|---|
{"id": "rs_…", "type": "reasoning", "summary": [{"type": "summary_text", "text": "…"}]} | reasoning របស់ម៉ូដែលជាផ្នែក summary_text មួយ។ មានតែនៅពេលម៉ូដែលបានវែកញែក។ |
{"id": "msg_…", "type": "message", "role": "assistant", "content": [{"type": "output_text", "text": "…"}]} | ចម្លើយ៖ ផ្នែក output_text មួយដែលមានអត្ថបទ។ |
{"id": "fc_…", "type": "function_call", "call_id": "call_…", "name": "…", "arguments": "…"} | ការហៅ tool។ arguments គឺជា JSON string។ សូមផ្ញើលទ្ធផលត្រឡប់មកវិញជាមួយ call_id ដូចគ្នា។ |
OpenAI SDK ភ្ជាប់អត្ថបទនៃសារឱ្យអ្នកក្នុង response.output_text។
Streaming
កំណត់ stream ជា true សម្រាប់ server-sent event។ រាល់ frame មានបន្ទាត់ event: ដែលមានឈ្មោះ event និងបន្ទាត់ data: ដែលមាន JSON object៖ object ធ្វើឡើងវិញនូវឈ្មោះក្នុង type។ សូមផ្គូផ្គង delta ទៅធាតុរបស់វាតាម output_index។
ជាមួយ OpenAI SDK សូមអាន event តាម type របស់ពួកវា៖
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.shannon-ai.com/v1",
)
stream = client.responses.create(
model="shannon-3",
input="Explain server-sent events in three sentences.",
stream=True,
)
for event in stream:
kind = getattr(event, "type", "error") # an event without a type is an error event
if kind == "response.reasoning_summary_text.delta":
pass # a piece of reasoning: event.delta
elif kind == "response.output_text.delta":
print(event.delta, end="", flush=True)
elif kind == "response.output_item.done" and event.item.type == "function_call":
print("\ntool call:", event.item.name, event.item.arguments)
elif kind == "response.completed":
print("\n", event.response.usage)
elif kind in ("response.failed", "error"):
raise RuntimeError("the stream failed, send the request again") import OpenAI from "openai";
const client = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://api.shannon-ai.com/v1",
});
const stream = await client.responses.create({
model: "shannon-3",
input: "Explain server-sent events in three sentences.",
stream: true,
});
for await (const event of stream) {
if (event.type === "response.reasoning_summary_text.delta") {
// a piece of reasoning: event.delta
} else if (event.type === "response.output_text.delta") {
process.stdout.write(event.delta);
} else if (event.type === "response.output_item.done" && event.item.type === "function_call") {
console.log("\ntool call:", event.item.name, event.item.arguments);
} else if (event.type === "response.completed") {
console.log("\n", event.response.usage);
} else if (event.type === "response.failed" || event.type === "error") {
throw new Error("the stream failed, send the request again");
}
} curl -N https://api.shannon-ai.com/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "shannon-3",
"input": "Explain server-sent events in three sentences.",
"stream": true
}' event មកដល់តាមលំដាប់នេះ។ ក្រុមសម្រាប់ reasoning សារ និងការហៅ tool លេចឡើងតែនៅពេលចម្លើយមានពួកវា។
| Event | Payload | ពេលណា |
|---|---|---|
response.created | response | តែងតែដំបូង។ response.status គឺ in_progress ហើយ response.output ទទេ។ |
response.in_progress | response | តែងតែទីពីរ ជាមួយ object ដូចគ្នា។ |
response.output_item.added | output_index, item | reasoning ចាប់ផ្តើម៖ ធាតុ reasoning ដែលមាន summary ទទេ។ |
response.reasoning_summary_text.delta | output_index, summary_index, delta | បំណែកមួយនៃ reasoning។ |
response.reasoning_summary_text.done | output_index, summary_index, text | reasoning ពេញលេញ៖ text ទាំងមូលរបស់វា។ |
response.output_item.done | output_index, item | ធាតុ reasoning ដែលបានបញ្ចប់។ |
response.output_item.added | output_index, item | ចម្លើយចាប់ផ្តើម៖ ធាតុ message ដែលមាន status in_progress និងគ្មានខ្លឹមសារ។ |
response.content_part.added | output_index, content_index, part | ផ្នែក output_text ទទេមួយបើក។ |
response.output_text.delta | output_index, content_index, delta | បំណែកមួយនៃចម្លើយ។ |
response.output_text.done | output_index, content_index, text | ចម្លើយពេញលេញ៖ text ទាំងមូលរបស់វា។ |
response.content_part.done | output_index, content_index, part | ផ្នែក output_text ដែលបានបញ្ចប់។ |
response.output_item.done | output_index, item | ធាតុ message ដែលបានបញ្ចប់ ដែលមាន status completed។ |
response.output_item.added | output_index, item | ការហៅ tool ចាប់ផ្តើម៖ ធាតុ function_call ជាមួយ call_id, name និង arguments ទទេ។ |
response.function_call_arguments.delta | output_index, delta | argument នៃការហៅ ពេញលេញក្នុង delta មួយ។ |
response.function_call_arguments.done | output_index, arguments | argument ដូចគ្នា ជា arguments។ |
response.output_item.done | output_index, item | ធាតុ function_call ដែលបានបញ្ចប់។ |
response.completed | response | តែងតែចុងក្រោយនៅពេលជោគជ័យ៖ response object ទាំងមូលជាមួយ output និង usage។ |
event: response.created
data: {"type":"response.created","response":{"id":"resp_5f0c…","object":"response","status":"in_progress","output":[], …}}
event: response.in_progress
data: {"type":"response.in_progress","response":{"id":"resp_5f0c…","object":"response","status":"in_progress","output":[], …}}
event: response.output_item.added
data: {"type":"response.output_item.added","output_index":0,"item":{"id":"msg_1c7b…","type":"message","role":"assistant","status":"in_progress","content":[]}}
event: response.content_part.added
data: {"type":"response.content_part.added","output_index":0,"content_index":0,"part":{"type":"output_text","text":""}}
event: response.output_text.delta
data: {"type":"response.output_text.delta","output_index":0,"content_index":0,"delta":"Server-sent"}
event: response.output_text.delta
data: {"type":"response.output_text.delta","output_index":0,"content_index":0,"delta":" events let a server push text over one HTTP reply."}
event: response.output_text.done
data: {"type":"response.output_text.done","output_index":0,"content_index":0,"text":"Server-sent events let a server push text over one HTTP reply."}
event: response.content_part.done
data: {"type":"response.content_part.done","output_index":0,"content_index":0,"part":{"type":"output_text","text":"Server-sent events let a server push text over one HTTP reply."}}
event: response.output_item.done
data: {"type":"response.output_item.done","output_index":0,"item":{"id":"msg_1c7b…","type":"message","role":"assistant","status":"completed","content":[{"type":"output_text","text":"Server-sent events let a server push text over one HTTP reply.","annotations":[]}]}}
event: response.completed
data: {"type":"response.completed","response":{"id":"resp_5f0c…","object":"response","status":"completed","output":[…],"usage":{"input_tokens":1190,"output_tokens":18,"total_tokens":1208}, …}} Stream ដែលបរាជ័យ
លើថ្នាក់ Shannon ចម្លើយដែលបរាជ័យបញ្ចប់ដោយ response.failed ជំនួស response.completed។ response.status របស់វាគឺ failed ហើយ response.error មាន code គឺ rate_limit_exceeded ឬ server_error និង message។
លើម៉ូដែល open-weight ដែលបង្ហោះ ការបរាជ័យគឺជា event error ដែលមាន code api_error និង message។ response.completed នៅតែតាមក្រោយវា។
សូមចាត់ទុក stream ថាបរាជ័យនៅពេលវាមាន response.failed ឬ event error ហើយផ្ញើ request ម្តងទៀត។
Tool
tool គឺជា function ដែលកូដរបស់អ្នកដំណើរការ។ សូមពិពណ៌នាវាក្នុង tools៖ នៅពេលម៉ូដែលចង់បានវា ចម្លើយមានធាតុ function_call ជំនួស ឬក្បែរសារ។
និយមន័យ tool ក្នុង tools៖
[
{
"type": "function",
"name": "get_weather",
"description": "Current weather for a city.",
"parameters": {
"type": "object",
"properties": {
"city": {
"type": "string"
}
},
"required": [
"city"
]
}
}
] output នៃចម្លើយដែលហៅវា៖
[
{
"id": "call_3d9a7c1e5b2f4a60c8e1d7f09b24a6c5",
"type": "function_call",
"name": "get_weather",
"call_id": "call_3d9a7c1e5b2f4a60c8e1d7f09b24a6c5",
"arguments": "{\"city\":\"Paris\"}"
}
] សូមដំណើរការ function បន្ទាប់មកផ្ញើ request ម្តងទៀតដោយបន្ថែមការហៅ និងលទ្ធផលរបស់វាទៅ input៖
[
{
"role": "user",
"content": "What is the weather in Paris?"
},
{
"type": "function_call",
"call_id": "call_3d9a7c1e5b2f4a60c8e1d7f09b24a6c5",
"name": "get_weather",
"arguments": "{\"city\":\"Paris\"}"
},
{
"type": "function_call_output",
"call_id": "call_3d9a7c1e5b2f4a60c8e1d7f09b24a6c5",
"output": "{\"temperature_c\": 18, \"sky\": \"cloudy\"}"
}
] មានតែ tool ប្រភេទ function ប៉ុណ្ណោះត្រូវបានអាន។ លើ shannon-1.6-*, shannon-2-* និង shannon-coder-1 schema parameters ត្រូវបានកាត់បន្ថយទៅ keyword JSON Schema ទូទៅ៖ oneOf ត្រូវបានអានជា anyOf ហើយ keyword ដូចជា $ref, additionalProperties, const, default និង title មិនត្រូវបានបញ្ជូនទៅម៉ូដែលទេ។
តម្លៃ tool_choice គឺ required និង function ដែលមានឈ្មោះ ត្រូវបានអនុវត្តដោយម៉ូដែល open-weight ដែលបង្ហោះ។
tool loop ត្រូវបានពិពណ៌នាពេញលេញនៅលើទំព័រផ្ទាល់ខ្លួន។ ការហៅមុខងារ
Output មានរចនាសម្ព័ន្ធ
ទ្រង់ទ្រាយនេះសរសេរ output មានរចនាសម្ព័ន្ធជា text.format។ schema ស្ថិតដោយផ្ទាល់ក្នុង format ក្បែរ name និង strict មិនមែនក្រោម member json_schema ដូចលើ Chat Completions ទេ។
{"type": "json_object"}សុំ JSON object ណាមួយ។{"type": "json_schema", "name", "schema", "strict"}សុំ JSON ដែលធ្វើតាម schema របស់អ្នក។strictគឺtrueនៅពេលអ្នកទុកវាចោល។
{
"model": "shannon-1.6-lite",
"input": "Extract the city and the date: 'The conference opens in Lisbon on 12 May 2027.'",
"text": {
"format": {
"type": "json_schema",
"name": "event",
"strict": true,
"schema": {
"type": "object",
"properties": {
"city": {
"type": "string"
},
"date": {
"type": "string",
"description": "ISO 8601 date"
}
},
"required": [
"city",
"date"
]
}
}
}
} JSON មកដល់ជាអត្ថបទក្នុងផ្នែក output_text នៃសារ៖ សូមញែក (parse) វាដោយខ្លួនឯង។ ម៉ូដែល open-weight ដែលបង្ហោះដែលគ្មាន output មានរចនាសម្ព័ន្ធត្រឡប់ 400។
{"city": "Lisbon", "date": "2027-05-12"} ម៉ូដែលណាទទួលទម្រង់ណា ត្រូវបានរាយនៅលើទំព័រផ្ទាល់ខ្លួន។ លទ្ធផលមានរចនាសម្ព័ន្ធ
Reasoning
ម៉ូដែលដែលវែកញែកត្រឡប់ reasoning របស់វាជាធាតុ output ប្រភេទ reasoning មុនសារ។ ក្នុង stream វាមកដល់ជា event response.reasoning_summary_text.delta។
ម៉ូដែល open-weight ដែលបង្ហោះអនុវត្ត reasoning.effort៖ off, low, medium ឬ high ជាមួយ high នៅពេលអ្នកមិនផ្ញើអ្វី។ off មិនត្រឡប់ធាតុ reasoning ទេ។ សូមផ្ញើវាជា object៖ string ទទេមិនត្រូវបានអានលើ endpoint នេះទេ។
effort ត្រូវបានពិពណ៌នានៅលើទំព័រផ្ទាល់ខ្លួនរបស់ពួកវា។ កម្រិត reasoning
ដែនកំណត់ output
max_output_tokens គឺ 4,096 នៅពេលអ្នកមិនផ្ញើវា។ វាជាចំនួន token ដែលដាក់ទុកពីសមតុល្យរបស់អ្នកនៅពេល request ចាប់ផ្តើម៖ នៅពេលចម្លើយពេញលេញ ចំនួននោះត្រូវបានជំនួសដោយអ្វីដែល request បានប្រើ។ តម្លៃដែលមិនស្ថិតក្នុងសមតុល្យដែលនៅសល់របស់អ្នកត្រឡប់ 429 Quota exceeded។
វាកំណត់ប្រវែងចម្លើយលើ shannon-1.6-*, shannon-2-* និង shannon-coder-1 និងប្រវែងអត្ថបទចម្លើយលើម៉ូដែល open-weight ដែលបង្ហោះ។
លើ endpoint នេះ shannon-coder-1 ត្រូវបានគិតជា token ពីសមតុល្យរបស់អ្នក ដូចម៉ូដែលផ្សេងទៀតទាំងអស់។
ខ្លឹមសារ request អាចធំរហូតដល់ 32 MiB។ ដែនកំណត់ និងសមតុល្យ
កំហុស
កំហុសប្រើខ្លឹមសារ error របស់ OpenAI៖ object error ដែលមាន type និង message៖ ខ្លះក៏មាន code និង param ដែលមានតម្លៃ null ដែរ។ តារាងរាយអ្វីដែល endpoint នេះត្រឡប់ញឹកញាប់បំផុត។ បញ្ជីពេញលេញ ជាមួយអ្វីដែលត្រូវព្យាយាមម្តងទៀត មានទំព័រផ្ទាល់ខ្លួន។ ការគ្រប់គ្រងកំហុស
| Status | ប្រភេទ | សារ | ពេលណា |
|---|---|---|---|
401 | authentication_error | Missing authenticationInvalid API key | គ្មាន API key ត្រូវបានផ្ញើ ឬ key មិនស្គាល់ ឬត្រូវបានដកហូត។ |
400 | invalid_request_error | unknown model: <id> | model បាត់ ឬមិនមែនជា id ដែលបានបោះពុម្ពផ្សាយទេ។ |
400 | invalid_request_error | No user message provided. | ថ្នាក់ Shannon៖ input មិនមានអត្ថបទរបស់ user ទេ។ |
400 | invalid_request_error | <id> does not accept image input | រូបភាពត្រូវបានផ្ញើទៅម៉ូដែល open-weight ដែលបង្ហោះដែលគ្មាន input រូបភាព។ |
400 | invalid_request_error | <id> does not accept response_format | text.format ត្រូវបានផ្ញើទៅម៉ូដែល open-weight ដែលបង្ហោះដែលគ្មាន output មានរចនាសម្ព័ន្ធ។ |
400 | invalid_request_error | unknown reasoning effort '<value>'; expected off, low, medium or high | reasoning.effort មានតម្លៃក្រៅបញ្ជី។ |
422 | invalid_request_error | Failed to deserialize the JSON body into the target type: … | ខ្លឹមសារជា JSON ត្រឹមត្រូវ ប៉ុន្តែ field មានប្រភេទខុស។ |
429 | rate_limit_error | Quota exceeded. Upgrade your plan at shannon-ai.com/plan | max_output_tokens ធំជាងអ្វីដែលនៅសល់នៃសមតុល្យរបស់អ្នក។ |
429 | rate_limit_error | Too many requests. Retry in <n>s. | Flood protection៖ លើសពី 120 request ក្នុងមួយនាទីលើគណនីរបស់អ្នក។ |
500 | api_error | The model backend failed to answer. Please retry. | ម៉ូដែលមិនបានបង្កើតចម្លើយទេ។ សូមផ្ញើ request ម្តងទៀត។ |
502 | api_error | The model backend failed to answer. Please retry. | ដូចគ្នា លើម៉ូដែល open-weight ដែលបង្ហោះ។ |
504 | api_error | upstream timed out | ម៉ូដែល open-weight ដែលបង្ហោះប្រើពេលយូរជាងកំណត់ពេលនៃចម្លើយដែលមិន stream។ សូមផ្ញើវាដោយកំណត់ stream ជា true។ |