Discover how the Awesome AI Suite leverages Semantic Kernel to bring creative AI characters and agents to life. Dive into this innovative console app and explore the fusion of personality-driven AI and groundbreaking concepts
![Initial cover]()
![Interaction]()
Project Structure
![project-structure]()
Key Files
character.json
The character.json file contains the structure with the prompts of the different personalities that are presented at the start of the application.
[
{
"Code": "C0001",
"Name": "Rosie",
"ShortDescription": "",
"Description": "",
"Objectives": [
"",
"",
],
"Plugin": {
"isCustomPlugin": false,
"name": ""
}
},
Application.cs
This Application
class serves as the entry point for a console-based project called "Character Universe." Its purpose is to interact with users, enabling them to select characters from a predefined list, and to facilitate dynamic interactions with artificial intelligence (AI) components through the AISemanticService
. Here's a breakdown of its functionality:
Key Features and Responsibilities
1. Display and Character Selection
Uses Spectre.Console
to create visually appealing console outputs. For example:
- Displays the title "Character Universe" in a stylized manner using the
FigletText
class.
- Prompts the user to select a character from a list of names retrieved using
CharacterJsonHelper.GetAllCharacterNames()
.
2. Character Information
After the user selects a character, retrieves details about the character (e.g., its description) using CharacterJsonHelper.GetCharacterByName()
.
- Integration with AI Services
Semantic AI Interaction: Initiates AI-driven responses using the AISemanticService
. For example:
Sends the character's description as an initial prompt.
Processes user inputs dynamically to invoke AI responses.
Plugin Support: Supports "custom plugins" associated with characters. If a character has a custom plugin, the service invokes the plugin's specific behavior.
- Real-Time User Interaction:
Continuously reads user input in an infinite loop.
Skips invalid or empty inputs.
Sends the input to the AI service, ensuring real-time interaction.
- Extensibility
Designed to work with plugins (character.Plugin.IsCustomPlugin
), allowing for custom behaviors and extensibility without changing the core logic.
How does it work?
- The application starts by displaying a welcome banner and prompting the user to choose a character.
- Once a character is selected, the application retrieves its details and uses the AI service to initiate interactions.
- As users input text, the program either sends it directly to the AI service or processes it through a character-specific plugin.
InvokePromptAsync method in AISemanticService.cs
The InvokePromptAsync
method in this snippet is designed to interact with an AI semantic kernel. It sends a prompt to the kernel, retrieves the AI's response, and displays it in a visually styled way using Spectre.Console
. Here's a detailed explanation of its components and functionality:
Purpose of the Method
This method sends a prompt (text) to the AI engine and provides feedback to the user in a console application. It handles variable replacement, refines the prompt, displays a loading spinner while the AI processes, and presents the AI's response in the console.
Get Started
Download the project from the top of this article.
This project is an exciting way to deepen AI concepts while having fun! Contribute by improving the code, adding features, or sharing feedback. Don’t hesitate to open issues or submit pull requests—your input matters! Let’s collaborate and push the boundaries of what AI can achieve together.
Happy Coding!