Shandisa LlamaIndex ne-Shannon
Shandisa OpenAILike class yeLlamaIndex ne-base URL yeShannon; chat, streaming ne-function calling zvinoshanda kuburikidza nayo.
- Yakaedzwa 2026 Mbu 7
- OpenAI Chat Completions
- Anenge 2 min
Nezve LlamaIndex
LlamaIndex i-framework ye-Python ne-TypeScript yema-app anoverenga magwaro ako: indexing, retrieval, agents ne-workflows. Class yayo ye-OpenAILike inotaura ne-server ipi neipi ye-OpenAI-compatible, saka Shannon models dzinogona kupindura mibvunzo, kudana tools nekufambisa LlamaIndex agents.
Zvaunoda
- Shannon API key
- Makiyi nekushandiswa
- Base URL
-
https://api.shannon-ai.com/v1Endpoint:/v1/chat/completions - Snippet yega yega iri pazasi inotevera sarudzo yako.
Iseta
-
Isa OpenAI-like integration
Shellpip install llama-index-core llama-index-llms-openai-like -
Gadzira model uye u-stream
is_chat_model=Trueinoshandisa chat endpoint;is_function_calling_model=Trueinobvumira ma-agent kudana tools;context_windowinoudza LlamaIndex kuti mashoko mangani anokwana.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) -
Dana 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'})]
Ongorora kuti inoshanda
Tumira: Mhanyisa streaming sample.
Unofanira kuona: Ruvara runoprintwa sezvarunosvika mu-stream.
Ma-model anokodzera LlamaIndex
Id imwe neimwe iri pazasi inozadzisa zvinodiwa ne LlamaIndex. Yekutanga ndiyo default mu-snippets.
| Id ye-model | Context window | Output yakakura | Kupinza mifananidzo |
|---|---|---|---|
Kimi-K3-uncensored-NVFP4 | 1,022,976 | 262,144 | Hongu |
Kimi-K3-uncensored-3BIT-REAP | 225,280 | 225,280 | Hongu |
shannon-3 | 196,608 | 65,536 | Hongu |
shannon-coder-1 | 131,072 | 65,536 | Kwete |
Ma-setting e-model
LlamaIndex inokumbira ma-value aya. Anoenderana ne-model yawasarudza.
| Setting | Kukosha | Sei |
|---|---|---|
context_window | 1022976 | LlamaIndex inokwanisa mashoko akatorwa mu-tokens idzi zvishoma. |
Zvakanaka kuziva
- Pasina
is_chat_model=True,OpenAILikeinodana/v1/completionsendpoint yekare, inodzosa404paShannon. - Pasina
is_function_calling_model=True, ma-agent anodzokera kutext-based tool use. - Retrieval inoda embedding model; Shannon haishandi
/v1/embeddings, saka isaembed_modelyeLlamaIndex kune imwe provider kana local model.
Mazano
- Isa
Settings.llm = llmkamwe chete kuti index, query engine ne-agent imwe neimwe ishandise Shannon. FunctionAgentne-ReActAgentdzese dzinotorallmiyi.- Kumagwaro akareba, sarudza model ine window huru uye simudza
context_windowkuti ienderane.
Kugadzirisa matambudziko
| Chiratidzo | Chikonzero | Gadziriro |
|---|---|---|
404 pa-/v1/completions | is_chat_model haina kuiswa. | Tumira is_chat_model=True. |
| Indexing inokumbira OpenAI key | Default embedding model yeLlamaIndex ndeyeOpenAI. | Isa Settings.embed_model kune embedding model yaunayo. |
401 Unauthorized | Key haipo, yanyorwa zvisizvo kana kuti yakachinjwa. | Kopa key zvakare kubva ku-Keys & usage; inotanga ne sk-. |
context_length_exceeded / “prompt is too long” | Hurukuro yakareba kupfuura window ye-model. | Tanga chat itsva, rega tool iidimbure, kana sarudza model ine window huru. |
insufficient_quota | Balance yako haikwani kubhadhara request. | Wedzera credit kana chinja plan; request haidzokororwi yoga. |
Mibvunzo
LlamaIndex inoshanda neShannon here?
Hongu, kuburikidza ne-OpenAILike ne-api_base="https://api.shannon-ai.com/v1".
Ma-agent eLlamaIndex anogona kudana tools paShannon here?
Hongu; ne-is_function_calling_model=True model inodzosa native tool calls, dzatakaedza.