### Setup Python Evaluation Server Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Demos/QualityCheck/README.md Commands to initialize the Python environment, install dependencies, and launch the Uvicorn server for LLM evaluation. ```bash cd python-server python -m venv venv source venv/bin/activate pip install "huggingface_hub[cli]" huggingface-cli login --token pip install -r requirements.txt cd app uvicorn main:app --port 8080 --reload ``` -------------------------------- ### Initialize and Run Copilot Studio Agent Environment Source: https://github.com/microsoft/semantic-kernel/blob/main/python/samples/demos/copilot_studio_agent/README.md This snippet demonstrates the setup process for a Python environment to interact with a Copilot Studio agent. It covers virtual environment creation, dependency installation, and launching the chat interface via Chainlit. ```bash python -m venv .venv # On Mac/Linux source .venv/bin/activate # On Windows .venv\Scripts\Activate.ps1 pip install -r requirements.txt chainlit run --port 8081 .\chat.py ``` -------------------------------- ### Start Development Server Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Demos/ProcessWithCloudEvents/ProcessWithCloudEvents.Client/README.md Command to launch the React development server for the application. ```bash yarn run dev ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Demos/ProcessWithCloudEvents/ProcessWithCloudEvents.Client/README.md Commands to navigate to the client directory and install necessary Node.js packages using Yarn. ```bash cd /dotnet/samples/Demos/ProcessWithCloudEvents/ProcessWithCloudEvents.Client yarn install ``` -------------------------------- ### Install Semantic Kernel SDK Source: https://github.com/microsoft/semantic-kernel/blob/main/python/samples/getting_started/00-getting-started.ipynb Installs the Semantic Kernel SDK from PyPI. It's recommended to run this within a virtual environment. This snippet also shows how to check the installed version. ```python # Note: if using a virtual environment, do not run this cell %pip install -U semantic-kernel from semantic_kernel import __version__ __version__ ``` -------------------------------- ### Install and Instantiate Semantic Kernel Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/notebooks/01-basic-loading-the-kernel.ipynb This snippet shows how to add the Semantic Kernel NuGet package and instantiate the kernel with a logger. ```APIDOC ## Install Semantic Kernel SDK ### Description Install the Semantic Kernel SDK using the provided NuGet package. ### Method Add NuGet Package ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```python #r "nuget: Microsoft.SemanticKernel, 1.23.0" ``` ## Instantiate Kernel ### Description Instantiate the Semantic Kernel with a logger. ### Method C# Code ### Endpoint N/A ### Parameters N/A ### Request Example ```csharp using Microsoft.SemanticKernel; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.DependencyInjection; using Kernel = Microsoft.SemanticKernel.Kernel; // Inject your logger // see Microsoft.Extensions.Logging.ILogger @ https://learn.microsoft.com/dotnet/core/extensions/logging ILoggerFactory myLoggerFactory = NullLoggerFactory.Instance; var builder = Kernel.CreateBuilder(); builder.Services.AddSingleton(myLoggerFactory); var kernel = builder.Build(); ``` ### Response N/A ### Response Example N/A ``` -------------------------------- ### Setup Logging Source: https://github.com/microsoft/semantic-kernel/blob/main/python/samples/concepts/README.md Demonstrates the process of setting up and configuring logging within the Semantic Kernel application to monitor operations and debug issues. ```python import logging # Configure logging (example using basicConfig) logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') # Example of logging a message # logging.info("Semantic Kernel logging is set up.") print("Code examples for setting up logging would go here.") ``` -------------------------------- ### GET /CalendarEvents Source: https://github.com/microsoft/semantic-kernel/blob/main/prompt_template_samples/CalendarPlugin/AssistantShowCalendarEvents/skprompt.txt Retrieves a list of calendar events occurring within a specified start and end date range. ```APIDOC ## GET /CalendarEvents ### Description Retrieves a list of calendar events within a defined time period. The API is useful for fetching events for specific windows such as work weeks or upcoming holidays. ### Method GET ### Endpoint /CalendarEvents ### Parameters #### Query Parameters - **from** (string) - Required - The start date and time for the event search (ISO 8601 format). - **to** (string) - Required - The end date and time for the event search (ISO 8601 format). ### Request Example CalendarEvents -from 2022-05-22T00:00:00-08:00 -to 2022-05-23T00:00:00-08:00 ### Response #### Success Response (200) - **events** (array) - A list of event objects found within the specified time range. #### Response Example { "events": [ { "id": "1", "title": "Team Meeting", "start": "2022-05-22T10:00:00-08:00", "end": "2022-05-22T11:00:00-08:00" } ] } ``` -------------------------------- ### Define and Configure Process Steps Source: https://github.com/microsoft/semantic-kernel/blob/main/docs/decisions/0054-processes.md How to instantiate a KernelProcess and add steps with defined entry points. ```APIDOC ## POST /process/define ### Description Initializes a new KernelProcess and registers steps to the process workflow. ### Method POST ### Parameters #### Request Body - **processName** (string) - Required - The name of the process instance. - **steps** (array) - Required - List of step types to add to the process. ### Request Example { "processName": "ChatBot", "steps": ["UserInputStep", "ChatBotResponseStep"] } ### Response #### Success Response (200) - **status** (string) - Confirmation of process initialization. ``` -------------------------------- ### Ollama Chat Completion in C# Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Concepts/README.md Shows how to perform chat completions using the Ollama service. This example sets up the kernel with an Ollama service and sends a user message to get a response. ```csharp using Microsoft.SemanticKernel; using Microsoft.SemanticKernel.Chat; using System; using System.Threading.Tasks; public class Ollama_ChatCompletion { public static async Task RunAsync() { // Setup Kernel with Ollama chat completion service var builder = Kernel.CreateBuilder(); builder.AddOllamaChatCompletion("ollama", "http://localhost:11434", "llama3"); // Specify model if needed var kernel = builder.Build(); var chatHistory = new ChatHistory(); chatHistory.AddUserMessage("Explain the importance of low-latency LLMs."); Console.WriteLine("Sending message to Ollama..."); // Get response from Ollama var response = await kernel.InvokeAsync(chatHistory); Console.WriteLine($"Ollama response: {response}"); } } ``` -------------------------------- ### Define Resource Constraints for Guided Conversation Source: https://github.com/microsoft/semantic-kernel/blob/main/python/samples/demos/guided_conversations/notebooks/01_guided_conversation_teaching.ipynb Configures constraints to control conversation length using units like turns or time. This example sets an exact limit of 10 turns for the conversation. ```python from guided_conversation.utils.resources import ResourceConstraint, ResourceConstraintMode, ResourceConstraintUnit resource_constraint = ResourceConstraint( quantity=10, unit=ResourceConstraintUnit.TURNS, mode=ResourceConstraintMode.EXACT, ) ``` -------------------------------- ### Configure and Run Client Agent Source: https://github.com/microsoft/semantic-kernel/blob/main/python/samples/demos/mcp_with_oauth/README.md Instructions for setting up the environment variables and launching the client agent to interact with the MCP servers. ```bash echo "AZURE_OPENAI_ENDPOINT=\nAZURE_OPENAI_CHAT_DEPLOYMENT_NAME=" > samples/demos/mcp_with_oauth/agent/.env cd samples/demos/mcp_with_oauth uv --env-file .env run agent ``` -------------------------------- ### Initialize Semantic Kernel and AI Service for Artifacts in Python Source: https://github.com/microsoft/semantic-kernel/blob/main/python/samples/demos/guided_conversations/notebooks/02_artifact.ipynb Initializes a Semantic Kernel instance and configures an AzureChatCompletion service. This setup is required before integrating the Artifact component into a guided conversation. It demonstrates adding the AI service to the kernel, which will be used for processing and generating conversational responses related to the artifact. ```python from semantic_kernel import Kernel from semantic_kernel.connectors.ai.open_ai import AzureChatCompletion from guided_conversation.plugins.artifact import Artifact from guided_conversation.utils.conversation_helpers import Conversation kernel = Kernel() service_id = "artifact_chat_completion" chat_service = AzureChatCompletion( service_id=service_id, deployment_name="gpt-4o-2024-05-13", api_version="2024-05-01-preview", ) kernel.add_service(chat_service) ``` -------------------------------- ### Running Azure OpenAI Assistants Migration Sample Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/AgentFrameworkMigration/README.md Illustrates the console command for navigating to an Azure OpenAI Assistants sample and running it. This allows for testing the migration of Assistant API functionalities. ```bash cd "AzureOpenAIAssistants\Step01_Basics" dotnet run ``` -------------------------------- ### Install Semantic Kernel SDK Source: https://github.com/microsoft/semantic-kernel/blob/main/python/samples/getting_started/01-basic-loading-the-kernel.ipynb Installs the required Semantic Kernel package via pip and verifies the installed version. ```python %pip install -U semantic-kernel from semantic_kernel import __version__ __version__ ``` -------------------------------- ### Set up Local Chroma Server Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/src/VectorData/Chroma/README.md Instructions to clone the Chroma repository and start a local Chroma server using Docker Compose. This is a prerequisite for using the Chroma connector with Semantic Kernel. ```bash git clone https://github.com/chroma-core/chroma.git cd chroma docker-compose up -d --build ``` -------------------------------- ### Install Semantic Kernel Dependencies Source: https://github.com/microsoft/semantic-kernel/blob/main/python/samples/getting_started/05-memory-and-embeddings.ipynb Installs the required Semantic Kernel SDK packages via pip and verifies the installation version. ```python %pip install -U semantic-kernel[azure] from semantic_kernel import __version__ print(__version__) ``` -------------------------------- ### Initialize AWS Bedrock Agent Clients Source: https://github.com/microsoft/semantic-kernel/blob/main/python/samples/concepts/agents/bedrock_agent/README.md Demonstrates how to instantiate the Bedrock runtime and management clients using boto3, and how to create a Bedrock agent within the Semantic Kernel framework. ```python runtime_client=boto.client( "bedrock-runtime", aws_access_key_id="your_access_key", aws_secret_access_key="your_secret_key", region_name="your_region" ) client=boto.client( "bedrock", aws_access_key_id="your_access_key", aws_secret_access_key="your_secret_key", region_name="your_region" ) bedrock_agent = BedrockAgent.create_and_prepare_agent( name="your_agent_name", instructions="your_instructions", runtime_client=runtime_client, client=client ) ``` -------------------------------- ### Install AICodeSandbox Package Source: https://github.com/microsoft/semantic-kernel/blob/main/python/samples/demos/document_generator/README.md Installs the AICodeSandbox package, which provides a sandbox environment for executing AI-generated Python code. Docker must also be installed and running. ```bash pip install ai-code-sandbox ``` -------------------------------- ### Install Semantic Kernel with AutoGen Support Source: https://github.com/microsoft/semantic-kernel/blob/main/python/samples/concepts/agents/autogen_conversable_agent/README.md This command installs the semantic-kernel package with the necessary extras to support AutoGen Conversable Agents. Ensure you have Python and pip installed. ```bash pip install semantic-kernel[autogen] ``` -------------------------------- ### Initialize and Configure Qdrant Vector Store Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Demos/VectorStoreRAG/README.md Provides commands to start a Qdrant instance via Docker and configure connection settings using .NET user secrets. ```cli docker run -d --name qdrant -p 6333:6333 -p 6334:6334 qdrant/qdrant:latest dotnet user-secrets set "VectorStores:Qdrant:Host" "" dotnet user-secrets set "VectorStores:Qdrant:Port" "6334" dotnet user-secrets set "VectorStores:Qdrant:Https" "true" dotnet user-secrets set "VectorStores:Qdrant:ApiKey" "" ``` -------------------------------- ### Running OpenAI Migration Sample Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/AgentFrameworkMigration/README.md Details the console command to navigate to an OpenAI sample directory and execute it. This is useful for verifying the migration of direct OpenAI API integrations. ```bash cd "OpenAI\Step01_Basics" dotnet run ``` -------------------------------- ### Running OpenAI Assistants Migration Sample Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/AgentFrameworkMigration/README.md Provides the console command to navigate to an OpenAI Assistants sample and run it. This helps in testing the migration of OpenAI Assistants API usage. ```bash cd "OpenAIAssistants\Step01_Basics" dotnet run ``` -------------------------------- ### Install Semantic Kernel with Copilot Studio Dependencies Source: https://github.com/microsoft/semantic-kernel/blob/main/python/samples/getting_started_with_agents/copilot_studio/README.md Installs the necessary Semantic Kernel package along with the Copilot Studio client and hosting core libraries. Ensure Python 3.10+ is installed. ```bash pip install semantic-kernel pip install microsoft-agents-hosting-core microsoft-agents-copilotstudio-client ``` -------------------------------- ### Create and Use Bing Search Plugin (C#) Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/notebooks/09-RAG-with-BingSearch.ipynb Demonstrates creating a Semantic Kernel instance, configuring an AI backend, initializing a Bing Text Search plugin, adding it to the kernel, and invoking it within a prompt to retrieve search results. ```csharp using Microsoft.SemanticKernel; using Microsoft.SemanticKernel.Data; using Microsoft.SemanticKernel.Plugins.Web.Bing; using Kernel = Microsoft.SemanticKernel.Kernel; // Create a kernel with OpenAI chat completion var builder = Kernel.CreateBuilder(); // Configure AI backend used by the kernel var (useAzureOpenAI, model, azureEndpoint, apiKey, orgId) = Settings.LoadFromFile(); if (useAzureOpenAI) builder.AddAzureOpenAIChatCompletion(model, azureEndpoint, apiKey); else builder.AddOpenAIChatCompletion(model, apiKey, orgId); var kernel = builder.Build(); // Create a text search using Bing search #pragma warning disable SKEXP0050 var textSearch = new BingTextSearch(apiKey: BING_KEY); // Build a text search plugin with Bing search and add to the kernel var searchPlugin = textSearch.CreateWithSearch("SearchPlugin"); kernel.Plugins.Add(searchPlugin); // Invoke prompt and use text search plugin to provide grounding information var query = "What is the Semantic Kernel?"; var prompt = "{{SearchPlugin.Search $query}}. {{$query}}"; KernelArguments arguments = new() { { "query", query } }; Console.WriteLine(await kernel.InvokePromptAsync(prompt, arguments)); ``` -------------------------------- ### Install Semantic Kernel - Python Source: https://github.com/microsoft/semantic-kernel/blob/main/README.md Install the semantic-kernel Python package using pip. ```bash pip install semantic-kernel ``` -------------------------------- ### Install Semantic Kernel Source: https://github.com/microsoft/semantic-kernel/blob/main/python/README.md Install the Semantic Kernel package and optional integrations for extended functionality. ```bash pip install --upgrade semantic-kernel # Optional: Add integrations pip install --upgrade semantic-kernel[hugging_face] pip install --upgrade semantic-kernel[all] ``` -------------------------------- ### Running Azure OpenAI Migration Sample Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/AgentFrameworkMigration/README.md Provides the console command to navigate to an Azure OpenAI sample directory and execute it with 'dotnet run'. This facilitates testing the migration of Azure OpenAI integrations. ```bash cd "AzureOpenAI\Step01_Basics" dotnet run ``` -------------------------------- ### Install uv and Python on Windows (non-WSL) Source: https://github.com/microsoft/semantic-kernel/blob/main/python/DEV_SETUP.md Installs the uv package manager and specified Python versions (3.10, 3.11, 3.12) on Windows using PowerShell. It then creates a virtual environment and installs Semantic Kernel with development dependencies. ```powershell powershell -c "irm https://astral.sh/uv/install.ps1 | iex" uv python install 3.10 3.11 3.12 $PYTHON_VERSION = "3.10" uv venv --python $PYTHON_VERSION uv sync --all-extras --dev uv run pre-commit install -c python/.pre-commit-config.yaml ``` -------------------------------- ### Utilize the Process Framework Source: https://github.com/microsoft/semantic-kernel/blob/main/python/samples/concepts/README.md Provides examples of using Semantic Kernel's Process Framework, including scenarios involving cycles with fan-in, nested processes, and planning and execution of tasks. ```python # Example for Cycles with Fan-In # This would involve defining a process with multiple branches that converge. # Example for Nested Process # This demonstrates creating processes within other processes. # Example for Plan and Execute # This shows how to define a plan and have the kernel execute it. print("Code examples for the Process Framework would go here.") ``` -------------------------------- ### Initialize Semantic Kernel and AI Services Source: https://github.com/microsoft/semantic-kernel/blob/main/python/samples/getting_started/02-running-prompts-from-file.ipynb Demonstrates how to instantiate the Semantic Kernel and configure it with specific AI services like Azure OpenAI or standard OpenAI, including credential handling. ```python from semantic_kernel import Kernel from services import Service from samples.service_settings import ServiceSettings kernel = Kernel() service_settings = ServiceSettings() selectedService = ( Service.AzureOpenAI if service_settings.global_llm_service is None else Service(service_settings.global_llm_service.lower()) ) kernel.remove_all_services() if selectedService == Service.AzureOpenAI: from azure.identity import AzureCliCredential from semantic_kernel.connectors.ai.open_ai import AzureChatCompletion kernel.add_service(AzureChatCompletion(service_id="default", credential=AzureCliCredential())) ``` -------------------------------- ### Install and Reference Nightly Packages Source: https://github.com/microsoft/semantic-kernel/blob/main/docs/FAQS.md Commands and project file syntax to install specific nightly versions of Semantic Kernel packages. ```powershell dotnet add package Microsoft.SemanticKernel.Core --version 0.26.231003.1-nightly ``` ```xml ``` -------------------------------- ### Running Azure AI Foundry Migration Sample Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/AgentFrameworkMigration/README.md Shows the console command to navigate to an Azure AI Foundry sample directory and run it using the 'dotnet run' command. This is an example of how to execute the migration samples from the command line. ```bash cd "AzureAIFoundry\Step01_Basics" dotnet run ``` -------------------------------- ### Running Agent Orchestration Handoff Sample Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/AgentFrameworkMigration/README.md Shows the console command to navigate to the agent handoff orchestration sample directory and run it. This demonstrates agent handoff patterns. ```bash cd "AgentOrchestrations\Step03_Handoff" dotnet run ``` -------------------------------- ### Separated Vector Collection and Record Management Interfaces (C#) Source: https://github.com/microsoft/semantic-kernel/blob/main/docs/decisions/0050-updated-vector-store-design.md This design separates concerns into two interfaces: 'IVectorCollectionStore' for managing collections (creation, listing, existence checks, deletion) and 'IVectorRecordStore' for managing individual records (get, delete, upsert). This separation allows for more specialized implementations and flexibility, such as creating collection-specific factories or enabling custom collection creation logic while reusing record management. Examples include AzureAISearchVectorCollectionStore, RedisVectorCollectionStore, and WeaviateVectorCollectionStore for collections, and AzureAISearchVectorRecordStore for records. ```csharp interface IVectorCollectionStore { virtual Task CreateChatHistoryCollectionAsync(string name, CancellationToken cancellationToken = default); virtual Task CreateSemanticCacheCollectionAsync(string name, CancellationToken cancellationToken = default); IAsyncEnumerable ListCollectionNamesAsync(CancellationToken cancellationToken = default); Task CollectionExistsAsync(string name, CancellationToken cancellationToken = default); Task DeleteCollectionAsync(string name, CancellationToken cancellationToken = default); } class AzureAISearchVectorCollectionStore: IVectorCollectionStore; class RedisVectorCollectionStore: IVectorCollectionStore; class WeaviateVectorCollectionStore: IVectorCollectionStore; // Customers can inherit from our implementations and replace just the creation scenarios to match their schemas. class CustomerCollectionStore: AzureAISearchVectorCollectionStore, IVectorCollectionStore; // We can also create implementations that create indices based on an MLIndex specification. class MLIndexAzureAISearchVectorCollectionStore(MLIndex mlIndexSpec): AzureAISearchVectorCollectionStore, IVectorCollectionStore; interface IVectorRecordStore { Task GetAsync(string key, GetRecordOptions? options = default, CancellationToken cancellationToken = default); Task DeleteAsync(string key, DeleteRecordOptions? options = default, CancellationToken cancellationToken = default); Task UpsertAsync(TRecord record, UpsertRecordOptions? options = default, CancellationToken cancellationToken = default); } class AzureAISearchVectorRecordStore(): IVectorRecordStore; ``` -------------------------------- ### Download and Start Milvus Standalone Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/src/VectorData/Milvus/README.md This snippet shows how to download the Milvus standalone docker-compose file for v2.2.14 and start the Milvus service using docker-compose. ```bash wget https://github.com/milvus-io/milvus/releases/download/v2.2.14/milvus-standalone-docker-compose.yml -O docker-compose.yml docker-compose up -d ``` -------------------------------- ### Initialize RedisMemoryStore Source: https://github.com/microsoft/semantic-kernel/blob/main/python/semantic_kernel/connectors/memory_stores/redis/README.md This documentation covers the initialization of the Redis memory connector within a Semantic Kernel instance. ```APIDOC ## RedisMemoryStore Initialization ### Description Initializes the Redis memory store connector to enable vector similarity search using Redis and RediSearch. ### Method N/A (Library Class Initialization) ### Endpoint semantic_kernel.connectors.memory.redis.RedisMemoryStore ### Parameters #### Constructor Parameters - **connection_string** (string) - Required - The connection string for the Redis instance. ### Request Example ```python from semantic_kernel.connectors.memory.redis import RedisMemoryStore redis_store = RedisMemoryStore(connection_string="redis://localhost:6379") ``` ### Response #### Success Response (Object) - **instance** (RedisMemoryStore) - An initialized memory store object ready to be used by the kernel. ### Response Example ```python # The store is passed to the kernel kernel.use_memory(storage=redis_store, embeddings_generator=embedding_generator) ``` ``` -------------------------------- ### Caller Code Example for HybridChatClient in C# Source: https://github.com/microsoft/semantic-kernel/blob/main/docs/decisions/0064-hybrid-model-orchestration.md This example demonstrates how to instantiate and use the HybridChatClient with a FallbackChatCompletionHandler. It shows the creation of individual chat clients, the handler, and then combining them into a HybridChatClient. ```csharp IChatClient onnxChatClient = new OnnxChatClient(...); IChatClient openAIChatClient = new OpenAIChatClient(...); // Tries the first client and falls back to the next one if the first one fails FallbackChatCompletionHandler handler = new FallbackChatCompletionHandler(...); IChatClient hybridChatClient = new HybridChatClient([onnxChatClient, openAIChatClient], handler); ... var result = await hybridChatClient.CompleteAsync("Do I need an umbrella?", ...); ``` -------------------------------- ### Install Semantic Kernel with Weaviate Support Source: https://github.com/microsoft/semantic-kernel/blob/main/python/samples/getting_started/third_party/weaviate-persistent-memory.ipynb This command installs the Semantic Kernel library with the necessary dependencies for Weaviate memory store integration. It ensures that all required packages are up-to-date. ```python # Note: if using a virtual environment, do not run this cell %pip install -U semantic-kernel[weaviate] from semantic_kernel import __version__ __version__ ``` -------------------------------- ### C#: Query Products by Price via Natural Language Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Demos/StructuredDataPlugin/README.md Demonstrates querying the database for products under a specific price threshold using a natural language command invoked via the Semantic Kernel. ```csharp var result = await kernel.InvokeAsync("Find all products under $50"); ``` -------------------------------- ### Install Semantic Kernel Libraries (C#) Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/notebooks/09-RAG-with-BingSearch.ipynb Installs the necessary Semantic Kernel NuGet packages for C# development, including core libraries, web plugins, and prompt template handlers. ```csharp #r "nuget: Microsoft.SemanticKernel, 1.23.0" #r "nuget: Microsoft.SemanticKernel.Plugins.Web, 1.23.0-alpha" #r "nuget: Microsoft.SemanticKernel.Plugins.Core, 1.23.0-alpha" #r "nuget: Microsoft.SemanticKernel.PromptTemplates.Handlebars, 1.23.0-alpha" ``` -------------------------------- ### Render and Execute Semantic Functions Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/notebooks/03-semantic-function-inline.ipynb Demonstrates how to render a prompt template for preview and how to register a function with the kernel to execute it against input data. ```csharp var promptTemplateConfig = new PromptTemplateConfig(skPrompt); var promptTemplateFactory = new KernelPromptTemplateFactory(); var promptTemplate = promptTemplateFactory.Create(promptTemplateConfig); var renderedPrompt = await promptTemplate.RenderAsync(kernel); Console.WriteLine(renderedPrompt); var summaryFunction = kernel.CreateFunctionFromPrompt(skPrompt, executionSettings); var summaryResult = await kernel.InvokeAsync(summaryFunction, new() { ["input"] = input }); Console.WriteLine(summaryResult); ``` -------------------------------- ### Install Semantic Kernel Only (Mac/Linux/WSL) Source: https://github.com/microsoft/semantic-kernel/blob/main/python/DEV_SETUP.md Installs only Semantic Kernel and its dependencies, without affecting uv, Python, or pre-commit hooks. This is useful if you only need to update SK or its dependencies. The Python version can be specified. ```bash make install-sk ``` ```bash make install-sk PYTHON_VERSION=3.12 ``` -------------------------------- ### Install Semantic Kernel with MCP Extra Source: https://github.com/microsoft/semantic-kernel/blob/main/python/samples/concepts/mcp/README.md This command installs the Semantic Kernel library with the necessary extras for Model Context Protocol (MCP) integration. This is a prerequisite for running the MCP client-side samples. ```bash pip install semantic-kernel[mcp] ``` -------------------------------- ### Running Agent Orchestration Concurrent Sample Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/AgentFrameworkMigration/README.md Illustrates the console command to navigate to the concurrent agent orchestration sample directory and run it. This demonstrates concurrent agent workflows. ```bash cd "AgentOrchestrations\Step01_Concurrent" dotnet run ``` -------------------------------- ### Start Protected MCP Server Source: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Demos/ModelContextProtocolPluginAuth/README.md Launches the ProtectedMCPServer, which hosts the MCP services and weather tools. This server is essential for the client application to interact with MCP functionalities. It is started using the .NET CLI. ```bash cd \samples\ProtectedMCPServer dotnet run ```