Tlola ho ea ho litaba
LlamaIndex

Li-framework le li-SDK

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/v1 Endpoint: /v1/chat/completions
Snippet e 'ngoe le e 'ngoe e ka tlase e latela khetho ea hau.

E hlophise

  1. Kenya OpenAI-like integration

    Shell
    pip install llama-index-core llama-index-llms-openai-like
  2. Theha model 'me u etse streaming

    is_chat_model=True e sebelisa chat endpoint; is_function_calling_model=True e lumella li-agent ho bitsa li-tool; context_window e bolella LlamaIndex hore na mongolo o kae o kenang.

    Python
    from 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)
  3. Bitsa li-tool

    Python
    from 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 modelFensetere ea contextTsoa e kholo ka ho fetisisaKenyo 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.

TlhophisoBolengHobaneng
context_window 1022976 LlamaIndex e kenya mongolo o fumanoeng ho palo ena ea tokens.

Ho molemo ho tseba

  • Ntle le is_chat_model=True, OpenAILike e bitsa endpoint ea khale ea /v1/completions, e khutlisang 404 ho 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 seta embed_model ea LlamaIndex ho mofani e mong kapa model ea lehae.

Malebela

  1. Seta Settings.llm = llm hang feela hore index, query engine le agent e 'ngoe le e 'ngoe e sebelise Shannon.
  2. FunctionAgent le ReActAgent kaofela li amohela llm ena.
  3. Bakeng sa litokomane tse telele, khetha model e nang le window e kholo 'me u phahamise context_window hore e lumellane.

Ho rarolla mathata

MatšoaoLebakaTokiso
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.

SHANNON Pontšo ea lenaneo la NVIDIA Inception SHANNON LAB LLC ke setho sa lenaneo la NVIDIA Inception.

Kgetha puo ya hao

Dipuo tsohle di lekana. Kgetha eo o batlang ho e sebedisa ha o bala.

Yuropa

Middle East le Afrika Leboea

Asia Boroa

Asia Boroa-Botjhabela

Asia Botjhabela

Asia e Bohareng le Caucasus

Afrika

Oceania

Lipuo tse Entsoeng le tsa Khale