Welcome to the Semantic Kernel Intro Agents project! This application demonstrates how to build interactive, intelligent agents using Semantic Kernel and Azure OpenAI. π With plugins like NewsPlugin
for fetching the latest news and ArchivePlugin
for data storage, this project showcases extensible and powerful AI functionality for real-world applications. π
- π€ Interactive AI Chat: Engage with an AI agent in real-time, powered by Azure OpenAI's GPT models.
- π° News Retrieval: Stay informed with the latest news headlines using the
NewsPlugin
. - πΎ Data Archival: Save conversation history or other data locally with the
ArchivePlugin
. - π§ Extensibility: Designed for flexibilityβeasily add custom plugins or extend existing ones.
- π Real-Time Streaming Responses: Enjoy smooth, streaming responses during chat interactions.
Before running the project, ensure you have the following:
- β .NET 8.0 SDK: Download here.
- β
Azure OpenAI Credentials:
- Deployment Name: The name of your deployed Azure OpenAI model.
- Endpoint URL: The endpoint for your Azure OpenAI service.
- API Key: The authentication key for accessing Azure OpenAI.
- β
Configuration:
- Populate the
appsettings.json
file with your Azure OpenAI credentials.
- Populate the
-
Configuration Loading:
- The application reads Azure OpenAI credentials (
DeploymentName
,Endpoint
,ApiKey
) fromappsettings.json
for secure configuration management.
- The application reads Azure OpenAI credentials (
-
Semantic Kernel Setup:
- A Kernel Builder is initialized to configure the Semantic Kernel environment.
- The Azure OpenAI service is integrated as a chat completion backend.
-
Plugins:
- The application integrates plugins to expand functionality:
NewsPlugin
: Retrieves news headlines from the New York Times RSS feeds.ArchivePlugin
: Saves runtime data to local storage for later use.
- The application integrates plugins to expand functionality:
-
Interactive Loop:
- Users input prompts, and the AI agent responds in real-time.
- Chat history is maintained to ensure context-aware conversations.
-
Streaming Responses:
- The AI responses are streamed for a smoother user experience, displaying the output as it is generated.
C:\Users\rsung\OneDrive\Desktop\AIResearch\semantickernel\sk-intro-agents
βββ .gitignore # Git ignore rules
βββ README.md # Project documentation
βββ sk-intro-agents.sln # Solution file
βββ notebooks/ # Jupyter notebooks (optional)
βββ src/ # Source code directory
β βββ appsettings.Development.json # Environment-specific config
β βββ appsettings.json # Main configuration file
β βββ ArchivePlugin.cs # Plugin for data archival
β βββ NewsPlugin.cs # Plugin for fetching news
β βββ Program.cs # Main entry point
β βββ sk-intro-agents.csproj # Project configuration
β βββ archives/ # Archived runtime-generated data
β βββ bin/ # Build output (auto-generated)
β βββ obj/ # Build object files (auto-generated)
- Purpose: Fetches top news articles from the New York Times RSS feed for a specified category.
- Key Features:
- Retrieves up to 10 news items.
- Uses the SimpleFeedReader library for RSS feed parsing.
- Sample Input:
tech
- Sample Output:
1. TikTok Faces U.S. Ban After Losing Bid to Overturn New Law
2. Bitcoin Price Surges to a Milestone: $100,000
-
Purpose: Saves conversation data or any runtime information to local storage.
-
Key Features:
-
Writes data into text files in the archives/ folder.
-
Useful for maintaining logs or preserving user interactions.
Data is saved as C:\archives<filename>.txt.
Edit the appsettings.json file in the src/ directory to include your Azure OpenAI credentials:
{
"AzureOpenAI": {
"DeploymentName": "your-deployment-name",
"Endpoint": "https://your-endpoint.azure.com",
"ApiKey": "your-api-key"
}
}
- Clone the Repository
git clone <repository-url>
cd sk-intro-agents
- Restore Dependencies
dotnet restore
- Build the Project
dotnet build
- Run the Application
dotnet run
-
Prompt: Enter
hi
ortech news please
. -
Response: The AI will respond in real-time with interactive, context-aware replies.
Prompt: hi
Response: Hello! How can I assist you today?
Prompt: tech news please
Response: Here are some of the latest updates in the technology sector:
1. TikTok Faces U.S. Ban After Losing Bid to Overturn New Law
2. Bitcoin Price Surges to a Milestone: $100,000