Mergy Client is a C# console application that provides a question-answering system using the Anthropic AI service. It allows users to interact with an AI model based on a provided knowledge base.
- Loads a custom knowledge base from a file
- Interacts with the Anthropic AI service using the Claude 3.5 Sonnet model
- Maintains a conversation history
- Supports streaming responses from the AI
- Allows clearing of conversation history
- Handles errors and provides user-friendly messages
- .NET 8.0 SDK
- An Anthropic API key
-
Clone the repository:
git clone https://github.com/yourusername/MergyClient.git cd MergyClient
-
Set up your Anthropic API key:
- Option 1: Use user secrets
dotnet user-secrets set "AnthropicServiceOptions:ApiKey" "your-api-key-here"
- Option 2: Set an environment variable named
AnthropicServiceOptions__ApiKey
- Option 1: Use user secrets
-
Prepare your knowledge base:
- Create a file named
knowledge_base.txt
in the project directory - Add your knowledge base content to this file
- Create a file named
-
Build and run the application:
dotnet run
-
When prompted, either:
- Press Enter to use the default
knowledge_base.txt
file - Enter the path to your custom knowledge base file
- Press Enter to use the default
-
Start asking questions. The AI will respond based on the provided knowledge base.
-
Special commands:
- Type 'exit' to quit the program
- Type 'clear' to clear the conversation history
You can modify the following constants in Program.cs
to adjust the behavior:
modelName
: The Anthropic model to use (default: "claude-3-5-sonnet-20240620")maxHistoryItems
: Maximum number of conversation history items to keep (default: 10)maxTokens
: Maximum number of tokens for AI responses (default: 1000)defaultKnowledgeBasePath
: Default path for the knowledge base file (default: "knowledge_base.txt")
- Betalgo.Ranul.Anthropic (v0.0.1)
- Microsoft.Extensions.Configuration (v8.0.0)
- Microsoft.Extensions.Configuration.UserSecrets (v8.0.0)
- Microsoft.Extensions.DependencyInjection (v8.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (v8.0.0)
This project is licensed under the MIT License. See the LICENSE file for details.