Tlola ho ea ho litaba
Semantic Kernel

Li-framework le li-SDK

Sebelisa Semantic Kernel le Shannon

Fa OpenAIChatCompletion ea Semantic Kernel AsyncOpenAI client e supang ho Shannon; li-plugin le automatic function calling li sebetsa ho li-model tsa Shannon.

  • E lekiloe 2026 Pun 7
  • OpenAI Chat Completions
  • Metsotso e ka bang 3

Mabapi le Semantic Kernel

Semantic Kernel ke SDK e bulehileng ea mohloli ea Microsoft ea ho eketsa AI ho li-app ka Python, C# le Java, e nang le li-plugin, function calling le li-agent. Connector ea eona ea OpenAI e amohela OpenAI client ea hau, kahoo client e supang ho Shannon e etsa hore mosebetsi o mong le o mong oa kernel o sebetse ho li-model tsa Shannon.

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 Semantic Kernel

    Shell
    pip install semantic-kernel
  2. Eketsa Shannon e le chat service

    Python
    from openai import AsyncOpenAI
    from semantic_kernel import Kernel
    from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion
    
    client = AsyncOpenAI(base_url="https://api.shannon-ai.com/v1", api_key="YOUR_API_KEY")
    chat = OpenAIChatCompletion(ai_model_id="Kimi-K3-uncensored-NVFP4", async_client=client)
    
    kernel = Kernel()
    kernel.add_service(chat)
  3. Eketsa plugin 'me u lumelle model hore e e bitse

    Python
    import asyncio
    from semantic_kernel.connectors.ai.function_choice_behavior import FunctionChoiceBehavior
    from semantic_kernel.connectors.ai.open_ai import OpenAIChatPromptExecutionSettings
    from semantic_kernel.contents import ChatHistory
    from semantic_kernel.functions import kernel_function
    
    class Weather:
        @kernel_function(description="Weather for a city")
        def get_weather(self, city: str) -> str:
            return f"Sunny, 18 C in {city}"
    
    kernel.add_plugin(Weather(), plugin_name="weather")
    settings = OpenAIChatPromptExecutionSettings(function_choice_behavior=FunctionChoiceBehavior.Auto())
    
    async def main():
        history = ChatHistory()
        history.add_user_message("What is the weather in Oslo?")
        print(await chat.get_chat_message_content(history, settings, kernel=kernel))
    
    asyncio.run(main())

Hlahloba hore e a sebetsa

Romela: Tsamaisa sampole ea plugin.

U lokela ho bona: Karabo e hahiloeng ho sephetho sa plugin: letsatsi, 18 C ho Oslo.

Li-model tse loketseng Semantic Kernel

Id e 'ngoe le e 'ngoe e ka tlase e khotsofatsa seo Semantic Kernel 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

Ho molemo ho tseba

  • Fetisa AsyncOpenAI client ea hau: ke tsela ea ho seta base URL ho connector ea Python.
  • Ka FunctionChoiceBehavior.Auto(), kernel e tsamaisa function 'me e botsa model hape, kahoo potso e le 'ngoe e nka likopo tse peli.

Malebela

  1. chat.get_streaming_chat_message_contents(history, settings) e etsa stream ea karabo.
  2. Ho C#, connector ea OpenAI e amohela endpoint le eona: AddOpenAIChatCompletion(modelId: "<id>", endpoint: new Uri("https://api.shannon-ai.com/v1"), apiKey: key). Re lekile Python SDK.
  3. Ngolisa lits'ebeletso tse ngata tse nang le service_id tse fapaneng ho kopanya li-model tsa Shannon ho kernel e le 'ngoe.

Ho rarolla mathata

MatšoaoLebakaTokiso
404 Not Found base_url ha e na /v1. Sebelisa https://api.shannon-ai.com/v1.
Plugin ha e ke e bitsoe Ha ho na function_choice_behavior litlhophisong. Sebelisa FunctionChoiceBehavior.Auto() 'me u fetise kernel=.
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 Semantic Kernel e sebetsa le Shannon?

E, ka OpenAIChatCompletion e nang le AsyncOpenAI client eo base_url ea eona e leng https://api.shannon-ai.com/v1.

Na automatic function calling e a sebetsa?

E; re tsamaisitse pitso ea plugin ka FunctionChoiceBehavior.Auto().

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