Responses API
புதியதுPOST /v1/responses அறிவுறுத்தல்களையும் input உருப்படிகளின் பட்டியலையும் ஏற்று, OpenAI Responses வடிவத்தில் output உருப்படிகளால் ஆன response object-ஐத் தரும். OpenAI SDK-யின் responses API-யுடனும் Codex CLI போன்ற அதன் மேல் கட்டப்பட்ட கருவிகளுடனும் பயன்படுத்துங்கள். இந்த endpoint எந்த நிலையையும் வைத்திருப்பதில்லை: ஒவ்வொரு கோரிக்கையுடனும் முழு உரையாடலை அனுப்புங்கள்.
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. மாடல் reasoning செய்திருந்தால் அதன் 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 | பதிலின் உச்ச வரம்பு, டோக்கன்களில். 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 | மாடல் அழைக்கக்கூடிய செயல்பாடுகள், இந்த வடிவத்தின் தட்டையான வடிவில்: {"type": "function", "name", "description", "parameters"}. கீழே உள்ள Tools பகுதியைப் பாருங்கள். | அனைத்து மாடல்கள் | |
tool_choice | string | object | auto | "auto" மாடலே முடிவு செய்யும். "required" ஒரு tool-ஐ அழைக்க வைக்கும். {"type": "function", "name": "…"} அந்த tool-ஐயே அழைக்க வைக்கும். | ஹோஸ்ட் செய்யப்பட்ட open-weight மாடல்கள் |
reasoning | object | off, low, medium அல்லது high கொண்ட {"effort": "…"}. வேறு எந்த மதிப்பும் 400 தரும். | ஹோஸ்ட் செய்யப்பட்ட open-weight மாடல்கள் | |
text | object | {"format": {…}} JSON பதிலைக் கேட்கும். கீழே உள்ள கட்டமைக்கப்பட்ட வெளியீட்டைப் பாருங்கள். | அனைத்து Shannon நிலைகள்; ஹோஸ்ட் செய்யப்பட்ட open-weight மாடல்கள் ஒவ்வொரு id-க்கும் பட்டியலிட்டபடி |
previous_response_id, store, metadata, parallel_tool_calls, truncation, include, user மற்றும் prompt_cache_key ஏற்கப்படுகின்றன, எனவே ஏற்கனவே உள்ள கிளையன்ட் குறியீடு மாற்றமின்றி இயங்கும். அவை பதிலை மாற்றாது. உரையாடல் சேமிக்கப்படாததால், அடுத்த கோரிக்கை முந்தைய சுற்றுகளை 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 உருப்படியிலிருந்து படிக்கப்படும். அளவுகளும் வரம்புகளும் தனிப் பக்கத்தில் உள்ளன. படங்களும் கோப்புகளும்
அறிவுறுத்தல்களும் விருப்பங்களும் கொண்ட கோரிக்கை
இந்தக் கோரிக்கை instructions, உள்ளீட்டு items வடிவில் ஒரு உரையாடல், வெளியீட்டு வரம்பு, 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 hexadecimal எழுத்துகள். | அனைத்து மாடல்கள் |
object | string | எப்போதும் response. | அனைத்து மாடல்கள் |
status | string | completed. stream-ல் முதலில் in_progress ஆக இருக்கும்; response.failed நிகழ்வில் failed ஆகும். | அனைத்து மாடல்கள் |
output | array | மாடல் உருவாக்கிய வரிசையில் output items: 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 | பதிலளித்த மாடலின் நிலையான (canonical) 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 items
| உருப்படி | விளக்கம் |
|---|---|
{"id": "rs_…", "type": "reasoning", "summary": [{"type": "summary_text", "text": "…"}]} | மாடலின் reasoning ஒரு summary_text பகுதியாக. மாடல் reasoning செய்தபோது மட்டுமே இருக்கும். |
{"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
server-sent events பெற stream-ஐ true ஆக அமைக்கவும். ஒவ்வொரு frame-லும் நிகழ்வின் பெயருடன் ஒரு event: வரியும், JSON object உடன் ஒரு data: வரியும் இருக்கும்; அந்த object type-ல் பெயரை மீண்டும் தரும். deltas-ஐ output_index மூலம் அவற்றின் item-உடன் பொருத்தவும்.
OpenAI SDK மூலம் நிகழ்வுகளை அவற்றின் 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
}' நிகழ்வுகள் இந்த வரிசையில் வரும். reasoning, செய்தி மற்றும் tool அழைப்புகளுக்கான குழுக்கள் பதிலில் அவை இருந்தால் மட்டுமே தோன்றும்.
| நிகழ்வு | தரவுப் பகுதி | எப்போது |
|---|---|---|
response.created | response | எப்போதும் முதலில். response.status in_progress ஆகவும், response.output காலியாகவும் இருக்கும். |
response.in_progress | response | எப்போதும் இரண்டாவதாக, அதே object உடன். |
response.output_item.added | output_index, item | reasoning தொடங்குகிறது: காலியான summary கொண்ட reasoning item. |
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 item. |
response.output_item.added | output_index, item | பதில் தொடங்குகிறது: நிலை in_progress மற்றும் உள்ளடக்கம் இல்லாத message item. |
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 | நிலை completed உடன் முடிந்த message item. |
response.output_item.added | output_index, item | ஒரு tool அழைப்பு தொடங்குகிறது: call_id, name மற்றும் காலியான arguments கொண்ட function_call item. |
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 item. |
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 நிகழ்வு. அதன் பின்னரும் response.completed வரும்.
stream-ல் response.failed அல்லது error நிகழ்வு இருந்தால் அது தோல்வியடைந்ததாகக் கருதி, கோரிக்கையை மீண்டும் அனுப்பவும்.
Tools
tool என்பது உங்கள் குறியீடு இயக்கும் function. அதை tools-ல் விவரிக்கவும்; மாடலுக்கு அது தேவைப்படும்போது, பதிலில் செய்திக்குப் பதிலாக அல்லது அதனுடன் சேர்த்து function_call item இருக்கும்.
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-ஐ text.format ஆக எழுதுகிறது. schema நேரடியாக format-க்குள், name மற்றும் strict அருகில் இருக்கும்; Chat Completions-ல் உள்ளது போல json_schema உறுப்பின் கீழ் அல்ல.
{"type": "json_object"}எந்த JSON object-ஐயும் கேட்கிறது.{"type": "json_schema", "name", "schema", "strict"}உங்கள் schema-வைப் பின்பற்றும் JSON-ஐக் கேட்கிறது. நீங்கள்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 செய்யவும். structured output இல்லாத ஹோஸ்ட் செய்யப்பட்ட open-weight மாடல் 400 தரும்.
{"city": "Lisbon", "date": "2027-05-12"} எந்த மாடல் எந்த வடிவத்தை ஏற்கும் என்பது அதற்கான தனிப் பக்கத்தில் பட்டியலிடப்பட்டுள்ளது. கட்டமைக்கப்பட்ட வெளியீடுகள்
Reasoning
reasoning செய்யும் மாடல் தனது reasoning-ஐ reasoning வகை output item ஆக, செய்திக்கு முன் தரும். stream-ல் அது response.reasoning_summary_text.delta நிகழ்வுகளாக வரும்.
ஹோஸ்ட் செய்யப்பட்ட open-weight மாடல்கள் reasoning.effort-ஐச் செயல்படுத்தும்: off, low, medium அல்லது high; எதுவும் அனுப்பாவிட்டால் high. off என்றால் reasoning item வராது. அதை object ஆக அனுப்பவும்; இந்த endpoint-ல் தனி string படிக்கப்படாது.
effort நிலைகள் அவற்றுக்கான தனிப் பக்கத்தில் விவரிக்கப்பட்டுள்ளன. Reasoning effort
வெளியீட்டு வரம்பு
நீங்கள் அனுப்பாவிட்டால் max_output_tokens 4,096. கோரிக்கை தொடங்கும்போது உங்கள் இருப்பிலிருந்து ஒதுக்கி வைக்கப்படும் டோக்கன்களின் எண்ணிக்கை அது; பதில் முடிந்ததும், அந்த அளவு கோரிக்கை பயன்படுத்தியதால் மாற்றப்படும். மீதமுள்ள இருப்புக்குள் பொருந்தாத மதிப்பு 429 Quota exceeded தரும்.
இது shannon-1.6-*, shannon-2-* மற்றும் shannon-coder-1-ல் பதிலின் நீளத்தையும், ஹோஸ்ட் செய்யப்பட்ட open-weight மாடல்களில் பதில் உரையின் நீளத்தையும் வரையறுக்கும்.
இந்த endpoint-ல் shannon-coder-1 மற்ற மாடல்களைப் போலவே உங்கள் இருப்பிலிருந்து டோக்கன்களில் கட்டணம் விதிக்கப்படுகிறது.
கோரிக்கை body 32 MiB வரை இருக்கலாம். வரம்புகளும் இருப்பும்
பிழைகள்
பிழைகள் OpenAI பிழை body-யைப் பயன்படுத்துகின்றன: type மற்றும் message கொண்ட error object; சிலவற்றில் null மதிப்புடன் code மற்றும் param-ம் இருக்கும். இந்த endpoint அடிக்கடி தருவதை அட்டவணை பட்டியலிடுகிறது. எதை மீண்டும் முயற்சிப்பது என்பதுடன் முழுப் பட்டியல் தனிப் பக்கத்தில் உள்ளது. கையாளுவதில் பிழை
| நிலை | வகை | செய்தி | எப்போது |
|---|---|---|---|
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-ல் பயனர் உரை இல்லை. |
400 | invalid_request_error | <id> does not accept image input | பட உள்ளீடு இல்லாத ஹோஸ்ட் செய்யப்பட்ட open-weight மாடலுக்குப் படம் அனுப்பப்பட்டது. |
400 | invalid_request_error | <id> does not accept response_format | கட்டமைக்கப்பட்ட வெளியீடு இல்லாத ஹோஸ்ட் செய்யப்பட்ட open-weight மாடலுக்கு text.format அனுப்பப்பட்டது. |
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 | stream செய்யாத பதிலின் நேர வரம்பை விட ஹோஸ்ட் செய்யப்பட்ட open-weight மாடல் அதிக நேரம் எடுத்தது. stream-ஐ true ஆக அமைத்து அனுப்புங்கள். |