အကြောင်းအရာသို့ ကျော်သွားရန်
ဝဘ်ရှာဖွေမှု

ဝဘ်ရှာဖွေမှု

web_search: true ကို သတ်မှတ်လျှင် model သည် တိုက်ရိုက်ရလဒ်များဖြင့် ၎င်း၏ အဖြေကို အခြေခံသည်။

POST https://api.shannon-ai.com/v1/chat/completions

ပြန်ကြားချက်သည် ထပ်တိုးချက်နှစ်ခုပါသော သာမန် chat completion ဖြစ်သည်။ အဖြေသည် ထောင့်ကွင်းထဲရှိ နံပါတ်များဖြင့် ရှာဖွေမှုရလဒ်များကို ညွှန်းသည်၊ sources က နံပါတ်တစ်ခုစီ ကိုယ်စားပြုသည့်အရာကို ပြောပြပြီး annotations က တစ်ခုစီကို ကိုးကားထားသည့်နေရာကို အမှတ်အသားပြုသည်-

200 JSON
{
  "id": "chatcmpl-3e5a7c9b1d2f4a6c8e0b2d4f6a8c1e3b",
  "object": "chat.completion",
  "created": 1791590400,
  "model": "shannon-3",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Saturday in Lisbon is forecast to be sunny with a high near 24 °C [1]. Sunday turns cloudy, with a chance of light rain in the afternoon [2].",
        "reasoning_content": null,
        "annotations": [
          {
            "type": "url_citation",
            "url_citation": {
              "start_index": 66,
              "end_index": 69,
              "url": "https://weather.example/lisbon/weekend",
              "title": "Lisbon weather: weekend outlook"
            }
          },
          {
            "type": "url_citation",
            "url_citation": {
              "start_index": 137,
              "end_index": 140,
              "url": "https://forecast.example/pt/lisbon/sunday",
              "title": "Sunday forecast for Lisbon"
            }
          }
        ]
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 2874,
    "completion_tokens": 41,
    "total_tokens": 2915
  },
  "sources": [
    {
      "index": 1,
      "title": "Lisbon weather: weekend outlook",
      "url": "https://weather.example/lisbon/weekend"
    },
    {
      "index": 2,
      "title": "Sunday forecast for Lisbon",
      "url": "https://forecast.example/pt/lisbon/sunday"
    },
    {
      "index": 3,
      "title": "Portugal: the week ahead",
      "url": "https://news.example/portugal/weather-week"
    }
  ]
}

ရှာဖွေမှုကို ဖွင့်ခြင်း

ရှာဖွေမှုသည် request ၏ field တစ်ခုဖြစ်ပြီး default အားဖြင့် ပိတ်ထားသည်။ request က မပို့လျှင် ဘာမျှ မရှာပါ။

Field Type Default ဖော်ပြချက် အသုံးပြုသော model
web_search boolean false true သည် ဤ request အတွက် web ရှာဖွေမှုကို run ပြီး မဖြေမီ ရလဒ်များကို model သို့ ပေးသည်။ shannon-coder-1 မှလွဲ၍ Shannon model တိုင်း
Endpoint Web ရှာဖွေမှု လုပ်ပုံ
/v1/chat/completions ဟုတ်သည် request body ထဲတွင် "web_search": true ထည့်ပါ။
/v1/messages ဟုတ်သည် request body ထဲတွင် "web_search": true ထည့်ပါ။
/v1/responses — ဤ endpoint သည် model တစ်ခုတည်းမှ ဖြေသည်။ ရှာဖွေထားသော အဖြေအတွက် အထက်ပါနှစ်ခုအနက် တစ်ခုကို သုံးပါ။

/v1/messages တွင် field သည် body ၏ အပေါ်ဆုံးအဆင့်၊ model နှင့် messages ဘေးတွင် ရှိသည်-

Request body
{
  "model": "shannon-3",
  "web_search": true,
  "messages": [
    {
      "role": "user",
      "content": "What is the weather forecast for Lisbon this weekend?"
    }
  ]
}

ရှာဖွေထားသော request တစ်ခုက လုပ်ဆောင်သည့်အရာ

  • API သည် နောက်ဆုံး user message အတွက် web တွင် ရှာဖွေသည်။ စကားပြောဆိုမှု၏ ယခင် turn များက ရှာဖွေမှုအတွက် အကြောင်းအရာ ပေးသည်။
  • web_search: true ပို့သော request တိုင်းတွင် ရှာဖွေမှု run သည်။ ရှာမရှာကို model က မရွေးပါ။
  • ရလဒ်များကို နံပါတ်တပ် အရင်းအမြစ်များအဖြစ် model ရှေ့တွင် ချပေးပြီး model သည် ၎င်းတို့မှ အဖြေကို ရေးသည်။
  • ရှာဖွေမှုပြီးသောအခါ ပြန်ကြားချက် စတင်သည်။ stream လုပ်သော request သည် ထိုအချိန်အထိ header သော်လည်းကောင်း event သော်လည်းကောင်း ဘာမျှ မပို့သဖြင့် ပထမ chunk မတိုင်မီ ပိုကြာကြာ စောင့်ရန် စီစဉ်ပါ။

ပြန်ကြားချက်တွင် ပါဝင်သည့်အရာ

  • ပြန်ကြားချက်သည် ၎င်း၏ endpoint ၏ ပုံမှန်ပုံစံရှိသည်။ အဖြေသည် choices[0].message.content ထဲတွင် ရှိသည် (/v1/messages တွင် text block)။
  • စာသားတွင် ၎င်းတို့ ထောက်ခံသော ဖော်ပြချက်များနောက်တွင် [1] နှင့် [2] ကဲ့သို့ အမှတ်အသားများ ပါနိုင်သည်။ နံပါတ်တစ်ခုစီသည် model ဖတ်ခဲ့သော ရလဒ်တစ်ခုကို ကိုယ်စားပြုသည်။
  • sources သည် ထိုရလဒ်များကို အမည်ဖြင့်ဖော်ပြသည်- model ကို ပေးခဲ့သော ရလဒ်တစ်ခုစီအတွက် entry တစ်ခုစီ ရှိပြီး index၊ title နှင့် url ပါသည်။ အမှတ်အသား [1] သည် index 1 ရှိသော entry ဖြစ်သည်။ အဖြေက မကိုးကားသော ရလဒ်များကိုလည်း စာရင်းတွင် ထည့်ထားသည်။
  • /v1/chat/completions တွင် message တွင် OpenAI ပုံစံဖြင့် annotations လည်း ပါသည်- အမှတ်အသားတစ်ခုက အမည်ပေးသော source တစ်ခုစီအတွက် url_citation တစ်ခုစီ ရှိပြီး url၊ title၊ start_index နှင့် end_index ပါသည်။ ၎င်းတို့သည် content ထဲရှိ အမှတ်အသား၏ နေရာဖြစ်ပြီး စာလုံးအရေအတွက်ဖြင့် ရေတွက်သည် (အဆုံးကို မထည့်ပါ)။
  • stream တွင် sources သည် နောက်ဆုံး chunk နှင့်အတူ လာပြီး /v1/messages တွင် message_delta event နှင့်အတူ လာသည်။ annotations များသည် နောက်ဆုံး chunk မတိုင်မီ chunk တစ်ခုတွင် delta.annotations အဖြစ် လာသည်။
  • sources သည် ဤ request ၏ ရှာဖွေမှုတွင် တစ်စုံတစ်ရာ တွေ့ခဲ့မှသာ ရှိသည်။ ၎င်းမပါသော ပြန်ကြားချက်ကို ရှာဖွေမှုရလဒ်များမပါဘဲ ရေးခဲ့ခြင်း ဖြစ်သည်။

ရှာဖွေမှုများကို မည်သို့ ရေတွက်သည်

plan တိုင်းတွင် တစ်နေ့လျှင် ရှာဖွေမှုအရေအတွက် တစ်ခု ပါဝင်သည်-

Plan တစ်နေ့လျှင် ရှာဖွေမှုများ
အခမဲ့ 3
အပေါင်း 30
Standard 50
ပရို 60
  • ရှာဖွေမှုက တစ်စုံတစ်ခု တွေ့ရှိသော request သည် ထိုနေ့၏ allowance မှ ရှာဖွေမှုတစ်ခု သုံးသည်။ ဘာမျှမတွေ့သော ရှာဖွေမှုသည် တစ်ခုမျှ မသုံးပါ။
  • Chat နှင့် API တို့သည် key ပိုင်ဆိုင်သော account ၏ allowance ကို မျှဝေသုံးသည်။
  • ရေတွက်မှုသည် နေ့တိုင်း 00:00 UTC တွင် ပြန်စသည်။
  • ရှာဖွေမှုရလဒ်များသည် request ၏ input tokens ဖြစ်ပြီး prompt ၏ ကျန်အပိုင်းနှင့်အတူ ကျသင့်ငွေတောင်းသည်။

Plan များကို နှိုင်းယှဉ်ကြည့်ပါ

ထိုနေ့၏ ရှာဖွေမှုများ ကုန်သွားသောအခါ

ထိုနေ့၏ နောက်ဆုံးရှာဖွေမှုပြီးနောက် web_search: true ပို့သော request ကို မငြင်းပယ်ပါ။ ၎င်းကို ရှာဖွေမှုမပါဘဲ ဖြေသည်- status မှာ 200 ဖြစ်ပြီး ပြန်ကြားချက်တွင် sources မပါပါ။

ကိုယ်ပိုင် tool တစ်ခုအဖြစ် ရှာဖွေမှု

web_search: true သည် ဤနေရာတွင် ဖော်ပြသော ရှာဖွေမှု၏ တစ်ခုတည်းသော ခလုတ်ဖြစ်သည်။ tools တွင် သင်သတ်မှတ်ပြီး web_search ဟု အမည်ပေးသော function သည် သင့်ကိုယ်ပိုင် tool များထဲမှ တစ်ခုဖြစ်သည်- model က call တစ်ခုပြန်ပေးပြီး သင့် code က ရှာဖွေမှုကို run ကာ ရလဒ်ကို ပြန်ပို့သည်။

/v1/messages ပေါ်ရှိ web_search_20250305 သို့မဟုတ် /v1/responses ပေါ်ရှိ {"type": "web_search"} ကဲ့သို့ အခြား platform များ၏ ရှာဖွေမှု tool type များသည် ဤနေရာတွင် ရှာဖွေမှုကို မစတင်ပါ။

အမှားများ

Web ရှာဖွေမှုသည် status code သို့မဟုတ် error type အသစ် မထည့်ပါ။ ဘာမျှ မတွေ့သော ရှာဖွေမှု၊ သို့မဟုတ် ရှာဖွေမှုမကျန်တော့သည့်နေ့သည် ရှာဖွေမှုရလဒ်မပါသော သာမန်အဖြေကို ပေးသည်။ အခြားအမှားတိုင်းသည် ရှာဖွေမှုမပါသော request နှင့် တူညီသည်။ အမှားကိုင်တွယ်မှု