Semantic Kernel Starters

repository·main·Indexed 19 days ago

https://github.com/microsoft/semantic-kernel-starters

A collection of self-contained, multi-language starter projects designed to help developers quickly build applications with Microsoft Semantic Kernel. It includes templates for various runtimes such as Console, Azure Functions, and Flask, with specific starters available for C#, Python, TypeScript, and Java.

Tokens
12K
Snippets
43
Records
74
Agent score
64%

What's inside semantic-kernel-starters

  1. Overview of the ChatGPT plugin starter components

    main

    This starter project provides the scaffolding to create a ChatGPT plugin with the following capabilities:

    • Plugin Discovery: An endpoint that serves the ai-plugin.json file required for ChatGPT to discover your plugin.
    • Semantic Function Generation: A generator that automatically converts prompts into semantic function endpoints.
    • Native Function Support: The ability to add additional native functions as endpoints to the plugin.
  2. Available Semantic Kernel Starter Projects

    main

    The repository provides starter projects across multiple languages and runtimes. Use these as templates for building your own Semantic Kernel applications.

    C# Starters

    • sk-csharp-hello-world: Hello World console application.
    • sk-csharp-console-chat: Console-based chat application.
    • sk-csharp-azure-functions: Hello World Azure Functions starter.
    • sk-csharp-chatgpt-plugin: Joke ChatGPT Plugin using Azure Functions.

    Python Starters

    • sk-python-hello-world: Hello World console application.
    • sk-python-azure-functions: Hello World Azure Functions starter.
    • sk-python-azure-functions-chatgpt-plugin: Joke ChatGPT Plugin using Azure Functions.
    • sk-python-flask-chatgpt-plugin: Joke ChatGPT Plugin using Flask.

    TypeScript Starters

    • sk-typescript-console-chat: Console-based chat application.

    Java Starters

    • sk-java-hello-world: Hello World console application.
  3. Important: Migration to main Semantic Kernel repositories

    main

    [IMPORTANT]

    This repository is being consolidated. It is planned to be removed in the near future. For the most up-to-date and official samples, please use the following links instead of this repository:

  4. Understand the Azure Functions Python V2 Programming Model

    main

    The Azure Functions Python V2 programming model uses a decorator-based approach that aligns with standard Python frameworks.

    Key characteristics:

    • No function.json required: Triggers and bindings are defined directly in the code using decorators.
    • File Organization: You can define multiple functions in a single file or organize them across multiple files using Blueprints.
    • Main Entry Point: The primary functions file must be named function_app.py.
    • Constraint: You cannot mix V1 and V2 programming models within the same Function App.

    For detailed technical specifications, refer to the Azure Functions Python developer guide.

  5. Project structure for Azure Functions in Python

    main

    A standard Azure Functions Python project uses the following file structure:

    FilePurpose
    function_app.pyRequired. Defines functions along with their triggers and bindings via decorators.
    local.settings.jsonStores app settings and connection strings for local development. Not published to Azure.
    requirements.txtList of Python packages to be installed when publishing to Azure.
    host.jsonConfiguration options affecting all functions in the app instance. Published to Azure.
    blueprint.pyOptional. Used for logical grouping of functions in separate files, referenced in function_app.py.
    .funcignoreOptional. Declares files to exclude from Azure publishing (e.g., .venv/, tests/, local.settings.json).
    .vscode/Optional. VS Code configuration.
    .venv/Optional. Local Python virtual environment.
    DockerfileOptional. Used for custom container publishing.
    tests/Optional. Test cases for the function app.
  6. Getting Started with the Process Framework declarative example

    main

    To begin working with the declarative process for generating product documentation, open the product-documentation.process.yaml file in Visual Studio Code.

    Recommendation: It is highly recommended to use the Semantic Kernel Tools VS Code extension to interact with these process files effectively.

    # Open this file in VS Code to start working with processes
    product-documentation.process.yaml
  7. Setup the Process Framework project

    main

    To set up the environment for the Process Framework example, ensure you have .NET 8 installed. Follow these steps to build the project and configure your Azure OpenAI credentials using .NET user secrets:

    1. Build the process node logic:
      dotnet build
    2. Configure your Azure OpenAI deployment name:
      dotnet user-secrets set "AZUREOPENAI_DEPLOYMENT_NAME" "YOUR_DEPLOYMENT_NAME"
    3. Configure your Azure OpenAI endpoint:
      dotnet user-secrets set "AZUREOPENAI_ENDPOINT" "YOUR_ENDPOINT"
    4. Authenticate with Azure to access the deployment:
      az login
    dotnet build
    dotnet user-secrets set "AZUREOPENAI_DEPLOYMENT_NAME" "YOUR_DEPLOYMENT_NAME"
    dotnet user-secrets set "AZUREOPENAI_ENDPOINT" "YOUR_ENDPOINT"
    az login
  8. Prerequisites for Semantic Kernel Python Azure Functions Starter

    main

    Before running this starter, ensure you have the following installed and configured:

    • Python: Version >=3.8 and <3.11
    • Azure Functions Core Tools: For running the function host.
    • Azurite: An Azure Storage API emulator. You must run the services from the VS Code status bar.
    • Semantic Kernel Tools: VS Code extension for Semantic Kernel.
  9. Configure Azure OpenAI using .NET Secret Manager

    main

    To use Azure OpenAI, set the following keys via .NET Secret Manager:

    • serviceType: Set to AzureOpenAI.
    • serviceId: The service identifier.
    • deploymentId: Your Azure OpenAI deployment ID.
    • modelId: The model ID.
    • endpoint: Your Azure OpenAI endpoint URL.
    • apiKey: Your Azure OpenAI API key.
    cd sk-csharp-console-chat
    dotnet user-secrets set "serviceType" "AzureOpenAI"
    dotnet user-secrets set "serviceId" "gpt-35-turbo"
    dotnet user-secrets set "deploymentId" "gpt-35-turbo"
    dotnet user-secrets set "modelId" "gpt-3.5-turbo"
    dotnet user-secrets set "endpoint" "https:// ... your endpoint ... .openai.azure.com/"
    dotnet user-secrets set "apiKey" "... your Azure OpenAI key ..."