LlamaIndex ምስ Shannon ተጠቐም
OpenAILike class ናይ LlamaIndex ምስ base URL Shannon ተጠቐም፤ chat፣ streaming ከምኡውን function calling ብእኡ ይሰርሑ።
- ዝተፈተነ 7 ሕዳ 2026
- OpenAI Chat Completions
- ኣስታት 2 ደቒቕ
ብዛዕባ LlamaIndex
LlamaIndex ንመተግበሪታት ሰነዳትካ ዘንብቡ ማዕቀፍ Python ከምኡውን TypeScript እዩ፦ indexing፣ ምምላስ፣ agents ከምኡውን workflows። Class OpenAILike ምስ ዝኾነ ምስ OpenAI ዝሰማማዕ server ይዘራረብ፣ ስለዚ ሞዴላት Shannon ሕቶታት ክምልሱ፣ tools ክጽውዑ ከምኡውን LlamaIndex agents ክመርሑ ይኽእሉ።
እንታይ የድልየካ
- ናይ Shannon API ቁልፊ
- ቁልፍታትን ኣጠቓቕማን
- Base URL
-
https://api.shannon-ai.com/v1Endpoint:/v1/chat/completions - ኩሎም ኣብ ታሕቲ ዘለዉ ቁራጻት ኮድ ምርጫኻ ይስዕቡ።
ኣዳልዎ
-
ውህደት OpenAI-like ኣጽንብር
Shellpip install llama-index-core llama-index-llms-openai-like -
ሞዴል ፍጠር ከምኡውን stream ግበር
is_chat_model=Trueendpoint chat ይጥቀም፤is_function_calling_model=Trueagents tools ክጽውዑ የኽእሎም፤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) -
Tools ጸውዕ
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 ኣሰርሕ።
ክትርኢ ዘለካ: እቲ ሕብርታት ከም ዝመጹ ተሓቲሞም።
ምስ LlamaIndex ዝሰማምዑ ሞዴላት
ነፍሲ ወከፍ ኣብ ታሕቲ ዘሎ id ነቲ LlamaIndex ዘድልዮ የማልእ። እቲ ቀዳማይ ኣብ ቁራጻት ኮድ ነባሪ እዩ።
| ሞዴል 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 | ኣይፋል |
ቅጥዒታት ሞዴል
LlamaIndex ነዞም ዋጋታት ይሓትት። ብመሰረት ዝመረጽካዮ ሞዴል ይቕየሩ።
| ቅጥዒ | ዋጋ | ስለምንታይ |
|---|---|---|
context_window | 1022976 | LlamaIndex ዝተመለሰ ጽሑፍ ኣብዚ ክንዲ ዝኣክል tokens የእቱ። |
ክትፈልጦ ዘለካ
- ብዘይ
is_chat_model=True፣OpenAILikeነቲ ጥንታዊ endpoint/v1/completionsይጸውዕ፣ ኣብ Shannon ድማ404ይምልስ። - ብዘይ
is_function_calling_model=True፣ agents ናብ ኣብ ጽሑፍ ዝተመስረተ ጥቕሚ tools ይምለሱ። - ምምላስ embedding ሞዴል የድሊ፤ Shannon
/v1/embeddingsኣየገልግልን፣ ስለዚembed_modelናይ LlamaIndex ናብ ካልእ provider ወይ ናይ ቦታ ሞዴል ኣቐምጥ።
ምኽርታት
Settings.llm = llmሓደ ግዜ ኣቐምጥ፣ ነፍሲ ወከፍ index፣ query engine ከምኡውን agent Shannon ክጥቀም።FunctionAgentከምኡውንReActAgentክልቲኦም እዚllmይቕበሉ።- ንነዋሕቲ ሰነዳት ሞዴል ምስ ዓቢ window ምረጽ ከምኡውን
context_windowንክዛመድ ዓብዮ።
ጸገማት ምፍታሕ
| ምልክት | ምክንያት | ፍታሕ |
|---|---|---|
404 ኣብ /v1/completions | is_chat_model ኣይተቐመጠን። | is_chat_model=True ኣሕልፍ። |
| Indexing ቁልፊ OpenAI ይሓትት | ቀዳማይ embedding ሞዴል LlamaIndex ናይ OpenAI እዩ። | Settings.embed_model ናብ ዘሎካ embedding ሞዴል ኣቐምጥ። |
401 Unauthorized | እቲ ቁልፊ የለን፣ ብጌጋ ተጻሒፉ ወይ ተቐይሩ። | ቁልፊ ካብ ቁልፍታትን ኣጠቓቕማን ደጊምካ ቀዲሕ፤ ብ sk- ይጅምር። |
context_length_exceeded ወይ "prompt is too long" ዝብል መልእኽቲ | እቲ ዘተ ካብ context window ናይቲ ሞዴል ይነውሕ። | ሓድሽ chat ጀምር፣ ነቲ መሳለጥያ ከጥርኖ ፍቐደሉ፣ ወይ ዝዓበየ window ዘለዎ ሞዴል ምረጽ። |
insufficient_quota | ሚዛንካ ነዚ ጠለብ ንምኽፋል ኣይኣክልን። | credit ምላእ ወይ ፕላን ቀይር፤ እቲ ጠለብ ባዕሉ ደጊሙ ኣይፍተንን። |
ሕቶታት
LlamaIndex ምስ Shannon ይሰርሕዶ?
እወ፣ ብOpenAILike ምስ api_base="https://api.shannon-ai.com/v1"።
LlamaIndex agents ኣብ Shannon tools ክጽውዑ ይኽእሉዶ?
እወ፤ ምስ is_function_calling_model=True እቲ ሞዴል ቀዳማዊ ጸዋዕታት tools ይምልስ፣ ንሱ ፈቲንናዮ።