🔍RepoLensrepolens.ru
  • /trending
  • /top500
  • /weekly
  • /categories
  • /about

© 2026 RepoLens · repolens.ru

root@repolens:~# updating the stack

@exvadimka

Данные обновляются автоматически через GitHub API

← к каталогу

📦 semantic-kernel/ microsoft

Integrate cutting-edge LLM technology quickly and easily into your apps

Открыть на GitHub ↗обновлён 6д назад
Звёзды
★ 28.4k
Форки
4.7k
За неделю
—
За месяц
—
Рост %
—
Язык
C#

Установка и запуск

Installation

First, set the environment variable for your AI Services:

Azure OpenAI:

export AZURE_OPENAI_API_KEY=AAA....

or OpenAI directly:

export OPENAI_API_KEY=sk-...

Basic Agent - Python

Create a simple assistant that responds to user prompts:

import asyncio
from semantic_kernel.agents import ChatCompletionAgent
from semantic_kernel.connectors.ai.open_ai import AzureChatCompletion

async def main():
    # Initialize a chat agent with basic instructions
    agent = ChatCompletionAgent(
        service=AzureChatCompletion(),
        name="SK-Assistant",
        instructions="You are a helpful assistant.",
    )

    # Get a response to a user message
    response = await agent.get_response(messages="Write a haiku about Semantic Kernel.")
    print(response.content)

asyncio.run(main()) 

# Output:
# Language's essence,
# Semantic threads intertwine,
# Meaning's core revealed.

Basic Agent - .NET

using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Agents;

var builder = Kernel.CreateBuilder();
builder.AddAzureOpenAIChatCompletion(
                Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT"),
                Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT"),
                Environment.GetEnvironmentVariable("AZURE_OPENAI_API_KEY")
                );
var kernel = builder.Build();

ChatCompletionAgent agent =
    new()
    {
        Name = "SK-Agent",
        Instructions = "You are a helpful assistant.",
        Kernel = kernel,
    };

await foreach (AgentResponseItem<ChatMessageContent> response 
    in agent.InvokeAsync("Write a haiku about Semantic Kernel."))
{
    Console.WriteLine(response.Message);
}

// Output:
// Language's essence,
// Semantic threads intertwine,
// Meaning's core revealed.

Из README репозитория · полный README на GitHub

Категории

🤖AI🔧DevTools

Теги

aiartificial-intelligencellmopenaisdk