Responses API
አዲስPOST /v1/responses መመሪያዎችን እና የinput ንጥሎች ዝርዝር ተቀብሎ ከoutput ንጥሎች የተሠራ response object በOpenAI Responses ፎርማት ይመልሳል። ከOpenAI SDK የresponses API ጋር እና በእሱ ላይ ከተገነቡ እንደ Codex CLI ካሉ tools ጋር ይጠቀሙበት። endpoint ምንም state አይይዝም፦ ሙሉውን ውይይት በእያንዳንዱ ጥያቄ ይላኩ።
POST https://api.shannon-ai.com/v1/responses
ትንሹ ጥያቄ የሞዴል 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
}
} የጥያቄ መስኮች
ጥያቄ የሚያስፈልገው model እና input ናቸው። የሚተገብሩት ዓምድ መስኩ ምላሹን የሚቀይርባቸውን ሞዴሎች ይሰይማል። የተስተናገዱ open-weight ሞዴሎች በሞዴል ዝርዝሩ ውስጥ ያሉት አሥራ ሁለት id ዎች ናቸው፤ የShannon 3 ቤተሰብ shannon-3፣ shannon-3-pro፣ shannon-3.1 እና shannon-3.1-pro ነው። ሞዴሎችና ዋጋ
| መስክ | ዓይነት | ነባሪ | መግለጫ | የሚተገብሩት |
|---|---|---|---|---|
model | string | ግዴታ። ከሞዴል ዝርዝሩ id። ማዛመዱ ትላልቅና ትናንሽ ፊደላትን አይለይም። የጎደለ ወይም ያልታተመ id 400 unknown model ይመልሳል። | ሁሉም ሞዴሎች | |
input | string | array | እንደ አንድ የተጠቃሚ መልእክት የሚነበብ string፣ ወይም የinput ንጥሎች array። ከታች የInput ንጥሎችን ይመልከቱ። | ሁሉም ሞዴሎች | |
instructions | string | ለሞዴሉ መመሪያዎች፣ የዚህ ፎርማት system prompt። | የተስተናገዱ open-weight ሞዴሎች፣ shannon-1.6-*፣ shannon-2-*፣ shannon-coder-1 | |
stream | boolean | false | true ምላሹን እንደ server-sent events ይልካል። ከታች Streaming ን ይመልከቱ። | ሁሉም ሞዴሎች |
max_output_tokens | integer | 4096 | የምላሹ ከፍተኛ ገደብ፣ በtokens። ከ1 እስከ 65,536 ውጭ የሆነ እሴት ወደዚያ ክልል ይወሰዳል። ጥያቄው እየሄደ ሳለ ከቀሪ ሂሳብዎ የሚያዘው መጠንም ነው። ከታች የውጤት ገደብን ይመልከቱ። | የተስተናገዱ open-weight ሞዴሎች፣ shannon-1.6-*፣ shannon-2-*፣ shannon-coder-1 |
temperature | number | የsampling temperature። በተስተናገዱ open-weight ሞዴሎች ላይ እሴቶች በ0 እና 2 መካከል ይያዛሉ። | የተስተናገዱ open-weight ሞዴሎች፤ stream ባልሆኑ ምላሾች ላይ shannon-1.6-*፣ shannon-2-* እና shannon-coder-1 | |
top_p | number | Nucleus sampling። እሴቶች በ0 እና 1 መካከል ይያዛሉ። | የተስተናገዱ open-weight ሞዴሎች | |
tools | array | ሞዴሉ ሊጠራቸው የሚችላቸው functions፣ በዚህ ፎርማት ጠፍጣፋ ቅርጽ፦ {"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 ኮድ ሳይቀየር ይሰራል። ምላሹን አይለውጡም። ምንም ውይይት ስለማይቀመጥ ተከታይ ጥያቄ ቀደምት ዙሮችን በ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። | ሁሉም ሞዴሎች |
መመሪያዎችን በinstructions መስክ ውስጥ ያስቀምጡ። ከShannon 3 ቤተሰብ id ጋር ሲሆን ሊጸኑ የሚገባቸውን መመሪያዎች በuser መልእክት ውስጥ ያስቀምጡ።
የምላሽ output ንጥሎች እንዳሉ ወደ input ሊመለሱ ይችላሉ፦ message እና function_call ንጥሎች ይነበባሉ፣ reasoning ንጥሎች ይዘለላሉ።
የይዘት ክፍሎች
| ክፍል | መግለጫ | የሚገኘው በ |
|---|---|---|
{"type": "input_text", "text": "…"} | የተጠቃሚ መልእክት ጽሑፍ። | ሁሉም ሞዴሎች |
{"type": "output_text", "text": "…"} | የassistant መልእክት ጽሑፍ። | ሁሉም ሞዴሎች |
{"type": "input_image", "image_url": "…"} | ምስል፣ የbase64 ይዘት ያለው data: URL ወይም http(s) URL ሆኖ። | የShannon 3 ቤተሰብ፣ shannon-1.6-lite፣ shannon-1.6-pro፣ እና የምስል ግብዓትን የሚዘረዝሩ የተስተናገዱ open-weight ሞዴሎች |
{"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 ደረጃዎች ላይ ምስሎች እና ፋይሎች ከinput የመጨረሻው user ንጥል ይነበባሉ። መጠኖችና ገደቦች የራሳቸው ገጽ አላቸው። ምስሎች እና ፋይሎች
መመሪያዎች እና አማራጮች ያሉት ጥያቄ
ይህ ጥያቄ መመሪያዎችን፣ ውይይትን እንደ input ንጥሎች፣ የውጤት ገደብን፣ 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 ከcache የተነበቡ tokens እና ለreasoning የዋሉ tokens ይጨምራል፦
{
"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 በእያንዳንዱ ምላሽ ላይ አሉ። ኮድዎን በእነዚህ ላይ ይገንቡ።
| መስክ | ዓይነት | መግለጫ | የሚልከው |
|---|---|---|---|
id | string | resp_ እና ከዚያ 32 የሄክሳዴሲማል ቁምፊዎች። | ሁሉም ሞዴሎች |
object | string | ሁልጊዜ response። | ሁሉም ሞዴሎች |
status | string | completed። በstream ውስጥ መጀመሪያ in_progress ነው፣ በresponse.failed event ደግሞ failed። | ሁሉም ሞዴሎች |
output | array | ሞዴሉ ባመነጨው ቅደም ተከተል የoutput ንጥሎች፦ reasoning፣ message፣ function_call። | ሁሉም ሞዴሎች |
usage | object | input_tokens፣ output_tokens እና total_tokens። | ሁሉም ሞዴሎች |
usage.input_tokens_details | object | cached_tokens፦ ከprompt cache የተነበቡ የግብዓት tokens ብዛት። | የተስተናገዱ open-weight ሞዴሎች |
usage.output_tokens_details | object | reasoning_tokens፦ ለማሰብ (reasoning) የዋሉ የውጤት tokens ብዛት። | የተስተናገዱ open-weight ሞዴሎች |
model | string | የመለሰው ሞዴል ቀኖናዊ id። | የShannon 3 ቤተሰብ፣ የተስተናገዱ open-weight ሞዴሎች |
created_at | integer | የምላሹ ጊዜ፣ በUnix ሰከንዶች። | የShannon 3 ቤተሰብ፣ የተስተናገዱ open-weight ሞዴሎች |
instructions, tools, temperature, … | instructions፣ tools እና temperature ጥያቄውን ይደግማሉ። 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 SDKs የመልእክቱን ጽሑፍ በresponse.output_text ውስጥ ላንተ ያጣምሩታል።
Streaming
ለserver-sent events streamን ወደ true ያዘጋጁ። እያንዳንዱ frame የevent ስም ያለው event: መስመር እና JSON object ያለው data: መስመር አለው፤ object ስሙን በtype ይደግማል። deltas ን ከንጥላቸው ጋር በoutput_index ያዛምዱ።
በOpenAI SDK events ን በ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
}' events በዚህ ቅደም ተከተል ይደርሳሉ። ለ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 ይጀምራል፦ ባዶ summary ያለው reasoning ንጥል። |
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 | መልሱ ይጀምራል፦ status in_progress ያለው እና ይዘት የሌለው message ንጥል። |
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 ጥሪ ይጀምራል፦ call_id፣ name እና ባዶ arguments ያለው function_call ንጥል። |
response.function_call_arguments.delta | output_index, delta | የጥሪው arguments፣ በአንድ delta ውስጥ ሙሉ። |
response.function_call_arguments.done | output_index, arguments | ተመሳሳዩ arguments፣ እንደ arguments። |
response.output_item.done | output_index, item | የተጠናቀቀው function_call ንጥል። |
response.completed | response | በስኬት ሁልጊዜ የመጨረሻ፦ output እና usage ያለው ሙሉ response object። |
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.completed ምትክ በresponse.failed ያበቃል። response.status failed ነው እና response.error code (rate_limit_exceeded ወይም server_error) እና message ይይዛል።
በተስተናገዱ open-weight ሞዴሎች ላይ ብልሽት code api_error እና message ያለው error event ነው። response.completed አሁንም ይከተላል።
stream response.failed ወይም error event ሲይዝ እንደ ያልተሳካ ይውሰዱት እና ጥያቄውን እንደገና ይላኩ።
Tools
tool ኮድዎ የሚያስኬደው function ነው። በtools ውስጥ ይግለጹት፤ ሞዴሉ ሲፈልገው ምላሹ በመልእክቱ ምትክ ወይም ከጎኑ function_call ንጥል ይይዛል።
በtools ውስጥ የtool ትርጓሜ፦
[
{
"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 ን ያስኬዱ፣ ከዚያ ጥሪውንና ውጤቱን ወደ 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\"}"
}
] function አይነት ያላቸው tools ብቻ ይነበባሉ። በshannon-1.6-*፣ shannon-2-* እና shannon-coder-1 ላይ የparameters schema ወደ የጋራ የJSON Schema ቁልፍ ቃላት ይቀነሳል፦ oneOf እንደ anyOf ይነበባል፣ እንደ $ref፣ additionalProperties፣ const፣ default እና title ያሉ ቁልፍ ቃላት ወደ ሞዴሉ አይተላለፉም።
የtool_choice እሴቶች required እና ስም የተሰጠው function በተስተናገዱ open-weight ሞዴሎች ይተገበራሉ።
የtool loop በራሱ ገጽ ላይ ሙሉ በሙሉ ተብራርቷል። ፋንክሽን ጥራት
Structured output
ይህ ፎርማት structured output ን እንደ text.format ይጽፋል። schema በቀጥታ በformat ውስጥ ከname እና strict ጎን ይቀመጣል፣ በChat Completions ላይ እንዳለው በjson_schema አባል ስር አይደለም።
{"type": "json_object"}ማንኛውንም JSON object ይጠይቃል።{"type": "json_schema", "name", "schema", "strict"}የእርስዎን schema የሚከተል JSON ይጠይቃል። ካልጻፉትstricttrueነው።
{
"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 ያድርጉት። structured output የሌለው የተስተናገደ open-weight ሞዴል 400 ይመልሳል።
{"city": "Lisbon", "date": "2027-05-12"} የትኛው ሞዴል የትኛውን ቅርጽ እንደሚቀበል በራሱ ገጽ ላይ ተዘርዝሯል። የተዋቀሩ ውጤቶች
Reasoning
የሚያስብ ሞዴል reasoning ን ከመልእክቱ በፊት reasoning አይነት ያለው output ንጥል አድርጎ ይመልሳል። በstream ውስጥ እንደ response.reasoning_summary_text.delta events ይደርሳል።
የተስተናገዱ open-weight ሞዴሎች reasoning.effort ይተገብራሉ፦ off፣ low፣ medium ወይም high፣ ምንም ካልላኩ high። off የreasoning ንጥል አይመልስም። እንደ object ይላኩት፤ ባዶ string በዚህ endpoint ላይ አይነበብም።
effort ዎች በራሳቸው ገጽ ላይ ተብራርተዋል። Reasoning effort
የውጤት ገደብ
ካልላኩት max_output_tokens 4,096 ነው። ጥያቄው ሲጀምር ከቀሪ ሂሳብዎ የሚያዘው የtokens ብዛት ነው፤ ምላሹ ሲጠናቀቅ ያ መጠን ጥያቄው በተጠቀመው ይተካል። በቀረው ቀሪ ሂሳብዎ ውስጥ የማይገባ እሴት 429 Quota exceeded ይመልሳል።
በshannon-1.6-*፣ shannon-2-* እና shannon-coder-1 ላይ የምላሹን ርዝመት፣ እና በተስተናገዱ open-weight ሞዴሎች ላይ የመልሱን ጽሑፍ ርዝመት ይገድባል።
በዚህ endpoint ላይ shannon-coder-1 እንደ ሌሎች ሞዴሎች ሁሉ ከቀሪ ሂሳብዎ በtokens ይከፈላል።
የጥያቄ body እስከ 32 MiB ሊሆን ይችላል። ገደቦች እና ቀሪ ሂሳብ
ስህተቶች
ስህተቶች የOpenAI የስህተት body ይጠቀማሉ፦ type እና message ያለው error object፤ አንዳንዶቹ ደግሞ ዋጋቸው null የሆኑ code እና param ይይዛሉ። ሠንጠረዡ ይህ endpoint ብዙ ጊዜ የሚመልሳቸውን ይዘረዝራል። ሙሉው ዝርዝር፣ ምን እንደገና መላክ እንዳለበት ጨምሮ፣ የራሱ ገጽ አለው። ስህተት አስተዳደር
| Status | አይነት | መልእክት | መቼ |
|---|---|---|---|
401 | authentication_error | Missing authenticationInvalid API key | ምንም API ቁልፍ አልተላከም፣ ወይም ቁልፉ አይታወቅም ወይም ተሰርዟል። |
400 | invalid_request_error | unknown model: <id> | model ይጎድላል ወይም የታተመ id አይደለም። |
400 | invalid_request_error | No user message provided. | የShannon ደረጃዎች፦ input የተጠቃሚ ጽሑፍ አልያዘም። |
400 | invalid_request_error | <id> does not accept image input | ምስል የማይቀበል የተስተናገደ open-weight ሞዴል ላይ ምስል ተልኳል። |
400 | invalid_request_error | <id> does not accept response_format | text.format structured output ወደሌለው የተስተናገደ open-weight ሞዴል ተልኳል። |
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: … | body ትክክለኛ JSON ነው ግን መስክ የተሳሳተ አይነት አለው። |
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. | የጥያቄ ብዛት ጥበቃ፦ በመለያዎ ላይ በአንድ ደቂቃ ከ120 በላይ ጥያቄዎች። |
500 | api_error | The model backend failed to answer. Please retry. | ሞዴሉ ምላሽ አላመነጨም። ጥያቄውን እንደገና ይላኩ። |
502 | api_error | The model backend failed to answer. Please retry. | ተመሳሳይ፣ በተስተናገዱ open-weight ሞዴሎች ላይ። |
504 | api_error | upstream timed out | የተስተናገደ open-weight ሞዴል stream ላልሆነ ምላሽ ከተወሰነው የጊዜ ገደብ በላይ ወሰደ። streamን ወደ true አዘጋጅተው ይላኩት። |