Sebelisa LlamaIndex le Shannon
Sebelisa sehlopha sa OpenAILike sa LlamaIndex ka base URL ea Shannon; chat, streaming le function calling li sebetsa ka sona.
- E lekiloe 2026 Pun 7
- OpenAI Chat Completions
- Metsotso e ka bang 2
Mabapi le LlamaIndex
LlamaIndex ke moralo oa Python le TypeScript oa li-app tse balang litokomane tsa hau: indexing, retrieval, li-agent le li-workflow. Sehlopha sa eona sa OpenAILike se bua le seva efe kapa efe e lumellanang le OpenAI, kahoo li-model tsa Shannon li ka araba lipotso, tsa bitsa li-tool 'me tsa tsamaisa li-agent tsa LlamaIndex.
Seo u se hlokang
- Senotlolo sa API sa Shannon
- Linotlolo le tšebeliso
- Base URL
-
https://api.shannon-ai.com/v1Endpoint:/v1/chat/completions - Snippet e 'ngoe le e 'ngoe e ka tlase e latela khetho ea hau.
E hlophise
-
Kenya OpenAI-like integration
Shellpip install llama-index-core llama-index-llms-openai-like -
Theha model 'me u etse streaming
is_chat_model=Truee sebelisa chat endpoint;is_function_calling_model=Truee lumella li-agent ho bitsa li-tool;context_windowe bolella LlamaIndex hore na mongolo o kae o kenang.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) -
Bitsa li-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'})]
Hlahloba hore e a sebetsa
Romela: Tsamaisa sampole ea streaming.
U lokela ho bona: Mebala e hatisoa ha e ntse e fihla.
Li-model tse loketseng LlamaIndex
Id e 'ngoe le e 'ngoe e ka tlase e khotsofatsa seo LlamaIndex e se hlokang. Ea pele ke default ho li-snippet.
| Id ea model | Fensetere ea context | Tsoa e kholo ka ho fetisisa | Kenyo ea setšoantšo |
|---|---|---|---|
Kimi-K3-uncensored-NVFP4 | 1,022,976 | 262,144 | E |
Kimi-K3-uncensored-3BIT-REAP | 225,280 | 225,280 | E |
shannon-3 | 196,608 | 65,536 | E |
shannon-coder-1 | 131,072 | 65,536 | Che |
Li-setting tsa model
LlamaIndex e kopa boleng bona. Bo itšetlehile ka model eo u e khethileng.
| Tlhophiso | Boleng | Hobaneng |
|---|---|---|
context_window | 1022976 | LlamaIndex e kenya mongolo o fumanoeng ho palo ena ea tokens. |
Ho molemo ho tseba
- Ntle le
is_chat_model=True,OpenAILikee bitsa endpoint ea khale ea/v1/completions, e khutlisang404ho Shannon. - Ntle le
is_function_calling_model=True, li-agent li khutlela ho tool use e thehiloeng mongolong. - Retrieval e hloka model ea embedding; Shannon ha e sebeletse
/v1/embeddings, kahoo setaembed_modelea LlamaIndex ho mofani e mong kapa model ea lehae.
Malebela
- Seta
Settings.llm = llmhang feela hore index, query engine le agent e 'ngoe le e 'ngoe e sebelise Shannon. FunctionAgentleReActAgentkaofela li amohelallmena.- Bakeng sa litokomane tse telele, khetha model e nang le window e kholo 'me u phahamise
context_windowhore e lumellane.
Ho rarolla mathata
| Matšoao | Lebaka | Tokiso |
|---|---|---|
404 ho /v1/completions | is_chat_model ha e setiloe. | Fetisa is_chat_model=True. |
| Indexing e kopa senotlolo sa OpenAI | Model ea default ea embedding ea LlamaIndex ke ea OpenAI. | Seta Settings.embed_model ho model ea embedding eo u nang le eona. |
401 Unauthorized | Senotlolo ha se eo, se ngotsoe hampe kapa se fetotsoe. | Kopitsa senotlolo hape ho tsoa ho Keys & usage; se qala ka sk-. |
context_length_exceeded / “prompt is too long” | Puisano e telele ho feta window ea model. | Qala chat e ncha, tlohela tool e e compact, kapa khetha model e nang le window e kholoanyane. |
insufficient_quota | Balance ea hau e ke ke ea lefella kopo. | Eketsa credit kapa fetola plan; kopo ha e lekoe hape ka boeona. |
Lipotso
Na LlamaIndex e sebetsa le Shannon?
E, ka OpenAILike e nang le api_base="https://api.shannon-ai.com/v1".
Na li-agent tsa LlamaIndex li ka bitsa li-tool ho Shannon?
E; ka is_function_calling_model=True model e khutlisa tool calls tsa tlhaho, tseo re li lekileng.