| layout | title | nav_order | has_children |
|---|---|---|---|
default |
Semantic Kernel Tutorial |
89 |
true |
Build enterprise AI applications with Microsoft's SDK for integrating LLMs.
Semantic KernelView Repo is Microsoft's open-source SDK for integrating LLMs into applications. It provides a unified way to orchestrate AI services, plugins, and memory, making it easy to build sophisticated AI applications.
| Feature | Description |
|---|---|
| Multi-Language | C#, Python, and Java SDKs |
| Plugin System | Extensible function architecture |
| Planners | AI-powered task planning |
| Memory | Vector store integrations |
| Connectors | OpenAI, Azure, Hugging Face |
| Enterprise Ready | Built for production at scale |
flowchart TD
A[Application] --> B[Semantic Kernel]
B --> C[Plugins]
B --> D[AI Services]
B --> E[Memory]
C --> F[Native Functions]
C --> G[Semantic Functions]
D --> H[OpenAI]
D --> I[Azure OpenAI]
D --> J[Hugging Face]
E --> K[Vector Stores]
E --> L[Conversation History]
B --> M[Planners]
M --> N[Auto Planning]
M --> O[Step Execution]
classDef app fill:#e1f5fe,stroke:#01579b
classDef kernel fill:#0078d4,stroke:#005a9e,color:#fff
classDef component fill:#fff3e0,stroke:#ef6c00
classDef service fill:#e8f5e8,stroke:#1b5e20
class A app
class B kernel
class C,D,E,M component
class F,G,H,I,J,K,L,N,O service
- repository:
microsoft/semantic-kernel - stars: about 27.5k
- latest release:
python-1.41.0(published 2026-03-13)
- Chapter 1: Getting Started - Installation, setup, and first kernel
- Chapter 2: Plugins & Functions - Native and semantic functions
- Chapter 3: Prompt Engineering - Prompt templates and configuration
- Chapter 4: AI Services - OpenAI, Azure, and other connectors
- Chapter 5: Memory & Embeddings - Vector stores and semantic memory
- Chapter 6: Planners - Automatic task planning and execution
- Chapter 7: Agents - Building autonomous AI agents
- Chapter 8: Production Deployment - Enterprise patterns and scaling
- Build AI Applications with Microsoft's enterprise SDK
- Create Plugins with native and semantic functions
- Engineer Prompts with templates and variables
- Connect AI Services from multiple providers
- Implement Memory with vector stores
- Use Planners for complex task automation
- Deploy at Scale with enterprise patterns
- Python 3.8+ or .NET 6+
- API key for OpenAI or Azure OpenAI
- Understanding of async programming
- (Optional) Azure subscription
# Install Semantic Kernel
pip install semantic-kernel
# Install connectors
pip install semantic-kernel[openai]
pip install semantic-kernel[azure]import semantic_kernel as sk
from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion
# Create kernel
kernel = sk.Kernel()
# Add AI service
kernel.add_service(
OpenAIChatCompletion(
service_id="chat",
ai_model_id="gpt-4o"
)
)
# Create a semantic function
prompt = """
Summarize the following text in {{$style}} style:
{{$input}}
"""
summarize = kernel.create_function_from_prompt(
function_name="summarize",
plugin_name="TextPlugin",
prompt=prompt
)
# Invoke the function
result = await kernel.invoke(
summarize,
input="Long text here...",
style="professional"
)
print(result)from semantic_kernel.functions import kernel_function
class MathPlugin:
@kernel_function(
name="add",
description="Adds two numbers together"
)
def add(self, a: float, b: float) -> float:
return a + b
@kernel_function(
name="multiply",
description="Multiplies two numbers"
)
def multiply(self, a: float, b: float) -> float:
return a * b
# Add plugin to kernel
kernel.add_plugin(MathPlugin(), plugin_name="math")
# Use in prompts or planners
result = await kernel.invoke(
kernel.plugins["math"]["add"],
a=5, b=3
)# Create prompt template
prompt_config = sk.PromptTemplateConfig(
template="""
You are a helpful assistant.
User: {{$user_input}}
Respond in a {{$tone}} tone.
""",
input_variables=[
{"name": "user_input", "description": "User's message"},
{"name": "tone", "description": "Response tone", "default": "friendly"}
]
)
# Register function
chat = kernel.create_function_from_prompt(
function_name="chat",
plugin_name="Assistant",
prompt_template_config=prompt_config
)from semantic_kernel.memory import SemanticTextMemory
from semantic_kernel.connectors.memory.chroma import ChromaMemoryStore
# Create memory with vector store
memory = SemanticTextMemory(
storage=ChromaMemoryStore(persist_directory="./memory"),
embeddings_generator=OpenAITextEmbedding(model_id="text-embedding-3-small")
)
# Save information
await memory.save_information(
collection="docs",
id="doc1",
text="Semantic Kernel is Microsoft's AI SDK."
)
# Search memory
results = await memory.search(
collection="docs",
query="What is Semantic Kernel?",
limit=5
)from semantic_kernel.planners import SequentialPlanner
# Create planner
planner = SequentialPlanner(kernel)
# Generate plan from goal
plan = await planner.create_plan(
goal="Research AI trends and write a summary email"
)
# Execute the plan
result = await plan.invoke(kernel)using Microsoft.SemanticKernel;
// Create kernel
var builder = Kernel.CreateBuilder();
builder.AddOpenAIChatCompletion("gpt-4o", apiKey);
var kernel = builder.Build();
// Invoke prompt
var result = await kernel.InvokePromptAsync(
"What is {{$topic}}?",
new() { ["topic"] = "Semantic Kernel" }
);
Console.WriteLine(result);- Chapters 1-3: Setup, plugins, and prompts
- Build simple AI-powered applications
- Chapters 4-6: Services, memory, and planners
- Create sophisticated AI workflows
- Chapters 7-8: Agents and production deployment
- Build enterprise-grade AI systems
Ready to build with Semantic Kernel? Let's begin with Chapter 1: Getting Started!
Generated for Awesome Code Docs
- Start Here: Chapter 1: Getting Started with Semantic Kernel
- Back to Main Catalog
- Browse A-Z Tutorial Directory
- Search by Intent
- Explore Category Hubs
- Chapter 1: Getting Started with Semantic Kernel
- Chapter 2: Plugins & Functions
- Chapter 3: Prompt Engineering
- Chapter 4: AI Services & Connectors
- Chapter 5: Memory & Embeddings
- Chapter 6: Planners
- Chapter 7: Agents & Tool Use
- Chapter 8: Production Deployment & Operations
Generated by AI Codebase Knowledge Builder