LlamaIndex ကို Shannon ဖြင့် အသုံးပြုခြင်း
Shannon ၏ base URL ဖြင့် LlamaIndex ၏ OpenAILike class ကို သုံးပါ။ chat၊ streaming နှင့် function calling တို့ ၎င်းမှတစ်ဆင့် အလုပ်လုပ်သည်။
- 2026 နို 7 တွင် စမ်းသပ်ထားသည်
- OpenAI Chat Completions
- ခန့်မှန်း 2 မိနစ်
LlamaIndex အကြောင်း
LlamaIndex သည် သင့်စာရွက်စာတမ်းများကို ဖတ်သော app များအတွက် Python နှင့် TypeScript framework ဖြစ်သည်- indexing၊ retrieval၊ agent နှင့် workflow များ။ ၎င်း၏ OpenAILike class သည် OpenAI-compatible server မည်သည့်အရာနှင့်မဆို ဆက်သွယ်နိုင်သဖြင့် Shannon model များသည် မေးခွန်းများကို ဖြေခြင်း၊ tool များခေါ်ခြင်းနှင့် LlamaIndex agent များကို မောင်းနှင်ခြင်းတို့ ပြုလုပ်နိုင်သည်။
လိုအပ်သည်များ
- Shannon API key တစ်ခု
- Keys & usage စာမျက်နှာ
- အခြေ URL
-
https://api.shannon-ai.com/v1အဆုံးမှတ်:/v1/chat/completions - အောက်ပါ နမူနာအားလုံးသည် သင့်ရွေးချယ်မှုအတိုင်း ပြောင်းလဲသည်။
သတ်မှတ်ပုံ
-
OpenAI-like integration ကို install လုပ်ပါ
Shellpip install llama-index-core llama-index-llms-openai-like -
Model ကို ဖန်တီးပြီး stream လုပ်ပါ
is_chat_model=Trueသည် chat endpoint ကို သုံးသည်။is_function_calling_model=Trueသည် agent များကို tool ခေါ်စေသည်။context_windowသည် စာသားမည်မျှဆန့်သည်ကို LlamaIndex အား ပြောပြသည်။Pythonfrom llama_index.llms.openai_like import OpenAILike llm = OpenAILike( model="Kimi-K3-uncensored-NVFP4", api_base="https://api.shannon-ai.com/v1", api_key="YOUR_API_KEY", context_window=1022976, is_chat_model=True, is_function_calling_model=True, ) for r in llm.stream_complete("Name three colours a cat can be."): print(r.delta, end="", flush=True) -
Tool များကို ခေါ်ပါ
Pythonfrom llama_index.core.tools import FunctionTool def get_weather(city: str) -> str: """Weather for a city.""" return f"Sunny in {city}" tool = FunctionTool.from_defaults(fn=get_weather) resp = llm.chat_with_tools([tool], user_msg="What is the weather in Oslo?") print(llm.get_tool_calls_from_response(resp)) # [ToolSelection(tool_name='get_weather', tool_kwargs={'city': 'Oslo'})]
အလုပ်လုပ်ကြောင်း စစ်ဆေးပါ
ပို့ရန်: streaming နမူနာကို run ပါ။
မြင်ရမည့်အရာ: အရောင်များသည် stream ဝင်လာသည်နှင့်အမျှ ပုံနှိပ်ပေါ်လာသည်။
LlamaIndex နှင့် ကိုက်ညီသော model များ
အောက်ပါ id တိုင်းသည် LlamaIndex ၏ လိုအပ်ချက်နှင့် ကိုက်ညီသည်။ ပထမ id သည် code နမူနာများတွင် default ဖြစ်သည်။
| မော်ဒယ် ID | Context အရွယ် | အများဆုံး output | ပုံ ထည့်သွင်းမှု |
|---|---|---|---|
Kimi-K3-uncensored-NVFP4 | 1,022,976 | 262,144 | ဟုတ် |
Kimi-K3-uncensored-3BIT-REAP | 225,280 | 225,280 | ဟုတ် |
shannon-3 | 196,608 | 65,536 | ဟုတ် |
shannon-coder-1 | 131,072 | 65,536 | မဟုတ် |
Model ဆက်တင်များ
LlamaIndex က ဤတန်ဖိုးများကို တောင်းသည်။ ၎င်းတို့သည် သင်ရွေးထားသော model အပေါ် မူတည်သည်။
| ဆက်တင် | တန်ဖိုး | အကြောင်းရင်း |
|---|---|---|
context_window | 1022976 | LlamaIndex သည် ရယူထားသော စာသားကို ဤ token အရေအတွက်အတွင်း ဆန့်အောင် ညှိသည်။ |
သိထားသင့်သည်များ
is_chat_model=Trueမပါလျှင်OpenAILikeသည် Shannon တွင်404ပြန်သော/v1/completionsendpoint အဟောင်းကို ခေါ်သည်။is_function_calling_model=Trueမပါလျှင် agent များသည် စာသားအခြေပြု tool သုံးမှုသို့ ပြန်ကျသွားသည်။- Retrieval တွင် embedding model လိုအပ်သည်။ Shannon သည်
/v1/embeddingsကို မပံ့ပိုးသဖြင့် LlamaIndex ၏embed_modelကို အခြား provider သို့မဟုတ် local model တစ်ခုသို့ သတ်မှတ်ပါ။
အကြံပြုချက်များ
- index၊ query engine နှင့် agent တိုင်း Shannon ကို သုံးစေရန်
Settings.llm = llmကို တစ်ကြိမ်သတ်မှတ်ပါ။ FunctionAgentနှင့်ReActAgentနှစ်ခုလုံး ဤllmကို လက်ခံသည်။- စာရွက်စာတမ်းရှည်များအတွက် window ကြီးသော model ကို ရွေးပြီး
context_windowကို ကိုက်အောင် တိုးပါ။
ပြဿနာဖြေရှင်းခြင်း
| လက္ခဏာ | အကြောင်းရင်း | ဖြေရှင်းနည်း |
|---|---|---|
/v1/completions တွင် 404 | is_chat_model ကို မသတ်မှတ်ထားပါ။ | is_chat_model=True ကို ပေးပါ။ |
| Indexing လုပ်ရာတွင် OpenAI key တောင်းသည် | LlamaIndex ၏ ပုံသေ embedding model မှာ OpenAI ၏ model ဖြစ်သည်။ | Settings.embed_model ကို သင့်တွင်ရှိသော embedding model တစ်ခုသို့ သတ်မှတ်ပါ။ |
401 Unauthorized | Key မရှိခြင်း၊ စာလုံးပေါင်းမှားခြင်း သို့မဟုတ် လဲလှယ်ပြီးသွားခြင်း ဖြစ်သည်။ | Keys & usage မှ key ကို ထပ်မံကူးယူပါ။ ၎င်းသည် sk- ဖြင့် စတင်သည်။ |
context_length_exceeded သို့မဟုတ် "prompt is too long" စာတို | စကားပြောဆိုမှုသည် model ၏ context window ထက် ပိုရှည်နေသည်။ | chat အသစ် စတင်ပါ၊ tool ကို ချုံ့ခွင့်ပေးပါ သို့မဟုတ် window ပိုကြီးသော model ကို ရွေးပါ။ |
insufficient_quota | သင့် လက်ကျန်ငွေသည် request အတွက် ပေးချေရန် မလုံလောက်ပါ။ | Top up ပြုလုပ်ပါ သို့မဟုတ် plan ပြောင်းပါ။ request ကို အလိုအလျောက် ပြန်မပို့ပါ။ |
မေးခွန်းများ
LlamaIndex သည် Shannon နှင့် အလုပ်လုပ်ပါသလား။
လုပ်ပါသည်၊ api_base="https://api.shannon-ai.com/v1" ပါသော OpenAILike မှတစ်ဆင့် ဖြစ်သည်။
LlamaIndex agent များသည် Shannon ပေါ်တွင် tool များ ခေါ်နိုင်ပါသလား။
နိုင်ပါသည်။ is_function_calling_model=True ဖြင့် model သည် native tool call များ ပြန်ပေးပြီး ၎င်းကို စမ်းသပ်ပြီးဖြစ်သည်။