Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Semantic Pizza

This solution contains two .NET console applications that demonstrate the power of Microsoft Semantic Kernel for AI-powered applications:

  1. SemanticPizza - An interactive pizza ordering chatbot with function calling capabilities
  2. SemanticMarketing - A multi-agent marketing campaign generator using AI agents

Prerequisites

  • .NET 8.0 SDK or later
  • Azure OpenAI Service account with a deployed model
  • Visual Studio, Visual Studio Code, or JetBrains Rider (optional)

Getting Started

1. Clone and Navigate to the Repository

git clone <your-repository-url>
cd SemanticPizza

2. Configure Azure OpenAI

Both projects require Azure OpenAI configuration. You'll need to set up your Azure OpenAI credentials in one of two ways:

Option A: Using appsettings.json (Not Recommended for Production)

Update the appsettings.json files in both SemanticPizza/ and SemanticMarketing/ directories:

{
  "AzureOpenAI": {
    "Endpoint": "https://your-openai-resource.openai.azure.com/",
    "ApiKey": "your-api-key-here",
    "DeploymentName": "your-deployment-name"
  }
}

Option B: Using User Secrets (Recommended)

For one of the projects, run the following commands to store your credentials securely. Both projects will use the same user secrets configuration.

# For SemanticPizza
cd SemanticPizza
dotnet user-secrets set "AzureOpenAI:Endpoint" "https://your-openai-resource.openai.azure.com/"
dotnet user-secrets set "AzureOpenAI:ApiKey" "your-api-key-here"
dotnet user-secrets set "AzureOpenAI:DeploymentName" "your-deployment-name"

# For SemanticMarketing
cd ../SemanticMarketing
dotnet user-secrets set "AzureOpenAI:Endpoint" "https://your-openai-resource.openai.azure.com/"
dotnet user-secrets set "AzureOpenAI:ApiKey" "your-api-key-here"
dotnet user-secrets set "AzureOpenAI:DeploymentName" "your-deployment-name"

3. Restore Dependencies

From the solution root directory:

dotnet restore

Running the Projects

SemanticPizza - Interactive Pizza Ordering Bot

The SemanticPizza project demonstrates function calling with AI, allowing users to interact with a pizza ordering system through natural language.

Features:

  • Natural language pizza ordering
  • Function calling for menu operations
  • Interactive chat interface
  • Custom pizza plugins

To run:

cd SemanticPizza
dotnet run

Example interactions:

  • "I'd like to order a large pepperoni pizza"
  • "What pizza options do you have?"
  • "Add a medium margherita to my order"
  • Type 'exit' to quit

SemanticMarketing - AI Marketing Campaign Generator

The SemanticMarketing project showcases multi-agent AI orchestration with two AI agents working together to create and approve marketing campaigns.

Features:

  • Multi-agent AI system
  • Creative Director agent for campaign ideas
  • Marketing Manager agent for approval workflow
  • Group chat orchestration
  • Approval-based conversation flow

To run:

cd SemanticMarketing
dotnet run

Example usage:

  1. Enter a marketing brief (e.g., "Create a summer promotion campaign for our pizza restaurant")
  2. Watch as the Creative Director generates ideas
  3. See the Marketing Manager provide feedback
  4. The conversation continues until the Marketing Manager approves the campaign

Project Structure

SemanticPizza/
├── README.md
├── SemanticPizza.sln
├── SemanticPizza/
│   ├── Program.cs              # Main pizza ordering application
│   ├── SemanticPizza.csproj
│   ├── appsettings.json
│   ├── Model/
│   │   └── MenuItem.cs         # Pizza menu item model
│   └── Plugins/
│       ├── PizzaPlugin.cs      # Custom pizza functions
│       └── Prompts/
│           ├── config.json     # Prompt configuration
│           └── skprompt.txt    # Prompt template
└── SemanticMarketing/
    ├── Program.cs              # Main marketing agents application
    ├── SemanticMarketing.csproj
    ├── appsettings.json
    ├── ApprovalGroupChatManager.cs  # Custom chat manager
    └── OpenAIConfiguration.cs  # Configuration model

Key Technologies

  • Microsoft Semantic Kernel 1.56.0 - AI orchestration framework
  • Azure OpenAI - Large language models
  • Microsoft Semantic Kernel Agents - Multi-agent AI systems
  • .NET 8.0 - Application framework
  • User Secrets - Secure configuration management

Troubleshooting

Common Issues

  1. "ArgumentNullException: OpenAI configuration is null"

    • Ensure your Azure OpenAI credentials are properly configured
    • Verify the configuration section name matches "AzureOpenAI"
  2. "Unauthorized" or "401" errors

    • Check your Azure OpenAI API key is correct
    • Verify your endpoint URL is properly formatted
    • Ensure your deployment name matches the actual deployment
  3. "Model not found" errors

    • Confirm your deployment name is correct
    • Verify the model is deployed and running in your Azure OpenAI resource
  4. Function calling not working in SemanticPizza

    • Ensure you're using a model that supports function calling (GPT-3.5-turbo or GPT-4)
    • Check that the FunctionChoiceBehavior.Required() setting is properly configured

Getting Help

License

This project is provided as-is for educational and demonstration purposes.

About

Two .NET console applications that demonstrate the power of Microsoft Semantic Kernel for AI-powered applications.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages