Peke ki ngā ihirangi
LlamaIndex

Ngā framework me ngā SDK

Whakamahia a LlamaIndex me Shannon

Whakamahia te karaehe OpenAILike a LlamaIndex me te base URL a Shannon; ka mahi te chat, te rere me te karanga function mā roto.

  • I whakamātauria 7 Noe 2026
  • OpenAI Chat Completions
  • Tata ki te 2 meneti

Mō LlamaIndex

He anga Python me TypeScript a LlamaIndex mō ngā taupānga e pānui ana i ō tuhinga: te whakarārangi, te rapu, ngā kaiwhakaahei me ngā rerekētanga mahi. Ka kōrero tana karaehe OpenAILike ki tētahi tūmau hototahi ki OpenAI, no reira ka taea e ngā model Shannon te whakautu pātai, te karanga tool me te kawe i ngā kaiwhakaahei LlamaIndex.

Ngā mea e hiahiatia ana

He API key Shannon
Ngā kī me te whakamahinga
URL pūtake
https://api.shannon-ai.com/v1 Pito mutunga: /v1/chat/completions
Ka whai ia wāhanga waehere i raro iho i tō kōwhiringa.

Whakaritea

  1. Whakaurua te whakaurunga āhua-OpenAI

    Shell
    pip install llama-index-core llama-index-llms-openai-like
  2. Hangaia te model ka rere

    Ka whakamahi te is_chat_model=True i te endpoint chat; ka tuku te is_function_calling_model=True i ngā kaiwhakaahei ki te karanga tool; ka kī te context_window ki a LlamaIndex te nui o te kuputuhi ka uru.

    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. Karanga i ngā 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'})]

Tirohia kei te mahi

Tukuna: Whakahaerehia te tauira rere.

Me kite koe i: Ka taia ngā tae i a rātou e rere mai ana.

Ngā model e hāngai ana ki LlamaIndex

Ka tutuki i ia id i raro iho ngā hiahia o LlamaIndex. Ko te tuatahi te taunoa i ngā wāhanga waehere.

Id tauiraMatapihi horopakiOutput nui rawaInput whakaahua
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 Kāo

Ngā tautuhinga model

Ka tono a LlamaIndex i ēnei uara. Ka whai rātou i te model i kōwhiria e koe.

TautuhingaUaraHe aha ai
context_window 1022976 Ka whakauru a LlamaIndex i te kuputuhi kua rapua ki roto i te maha nei o ngā token.

He pai kia mōhio

  • Ki te kore te is_chat_model=True, ka karanga te OpenAILike i te endpoint tawhito /v1/completions, ka hoki mai te 404 i runga i a Shannon.
  • Ki te kore te is_function_calling_model=True, ka hoki ngā kaiwhakaahei ki te whakamahi tool i runga i te kuputuhi.
  • Ka hiahia te rapu ki tētahi model embedding; kāore a Shannon e whakahaere i te /v1/embeddings, no reira tautuhia te embed_model a LlamaIndex ki tētahi atu kaiwhakarato, model rohe rānei.

Ngā tohutohu

  1. Tautuhia te Settings.llm = llm kotahi anake kia whakamahia a Shannon e ia taurangi, muna rapu me kaiwhakaahei.
  2. Ka tango te FunctionAgent me te ReActAgent i tēnei llm.
  3. Mō ngā tuhinga roa, kōwhiria tētahi model whai matapihi nui ka whakanuia te context_window kia ōrite.

Te whakatika raruraru

TohuTakeWhakatika
He 404 i runga i te /v1/completions Kāore i tautuhia te is_chat_model. Tukuna te is_chat_model=True.
Ka tonoa e te whakarārangi tētahi key OpenAI Ko te model embedding taunoa a LlamaIndex nō OpenAI. Tautuhia te Settings.embed_model ki tētahi model embedding kei a koe.
401 Unauthorized Kei te ngaro te key, kua hē te pato, kua hurihia rānei. Tāruatia anō te key mai i Keys & usage; ka tīmata ki te sk-.
context_length_exceeded, te karere "prompt is too long" rānei He roa ake te kōrero i te matapihi horopaki o te model. Tīmatahia he kōrerorero hou, tukuna te taputapu kia whakamāmā, kōwhiria rānei he model he nui ake te matapihi.
insufficient_quota Kāore e rawaka tō toenga hei utu i te tono. Tāpiri nama, huri mahere rānei; kāore te tono e ngana anō ko ia anake.

Ngā pātai

Ka mahi a LlamaIndex me Shannon?

Āe, mā te OpenAILike me te api_base="https://api.shannon-ai.com/v1".

Ka taea e ngā kaiwhakaahei LlamaIndex te karanga tool i runga i a Shannon?

Āe; me te is_function_calling_model=True ka whakahoki te model i ngā karanga tool taketake, i whakamātauria e mātou.

Kōwhiria tō reo

He ōrite ngā reo katoa. Kōwhiria te reo e hiahia ana koe ki te whakamahi.

Ūropi

Te Rāwhiti Waenga me Āwherika ki te Raki

Āhia ki te Tonga

Āhia ki te Tonga-ma-Rāwhiti

Āhia ki te Rāwhiti

Āhia Waenga me Kōkahu

Āwherika

Te Moana-nui-a-Kiwa

Reo Hanga me te Reo Tawhito