Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/assets/docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ The MaIN CLI (`mcli`) is your companion tool for managing AI workflows and servi
> - Set execution policies
> - Create uninstaller

Download and unpack content from this link [Download](https://1drv.ms/u/c/8dd72529df58a475/EXWkWN8pJdcggI1tAAAAAAABD0eIFVX7HhjwDubuEr1T9w?e=63TNH0)
Download and unpack content from this link [Download](https://1drv.ms/u/c/8dd72529df58a475/EXWkWN8pJdcggI1tAAAAAAABD0eIFVX7HhjwDubuEr1T9w?e=EwVACO)

```bash
.\install-mcli.ps1
```

### (Linux/Mac)
Download and unpack content from this link [Download](https://1drv.ms/u/c/8dd72529df58a475/EXWkWN8pJdcggI1zAAAAAAABMMmdRp0OgzMEwBFB4Gftvg?e=vz96CR)
Download and unpack content from this link [Download](https://1drv.ms/u/c/8dd72529df58a475/EXWkWN8pJdcggI1zAAAAAAABMMmdRp0OgzMEwBFB4Gftvg?e=GdfloG)
> - You might need some sudo permissions to set default model path or run api scripts

```bash
Expand Down
13 changes: 13 additions & 0 deletions src/assets/docs/docs-index.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,15 @@
"path":"examples/example-chat-basic-groqcloud"
}
]
},
{
"title":"Anthropic Integration",
"children":[
{
"title":"Basic chat",
"path":"examples/example-chat-basic-anthropic"
}
]
}
]
},
Expand Down Expand Up @@ -254,6 +263,10 @@
{
"title":"GroqCloud",
"path":"integrations/groqcloud"
},
{
"title":"Anthropy",
"path":"integrations/anthropy"
}
]
}
Expand Down
27 changes: 27 additions & 0 deletions src/assets/docs/examples/example-chat-basic-anthropic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 💬 Anthropic Chat Example

The **AnthropicChatExample** demonstrates how to integrate Anthropic's claude-sonnet-4 model into the framework with minimal setup, showcasing how easy it is to leverage Anthropic's capabilities for interactive chat.

### 📝 Code Example

```csharp
public async Task Start()
{
AnthropicExample.Setup(); //We need to provide Anthropic API key
Console.WriteLine("(Anthropic) ChatExample is running!");

await AIHub.Chat()
.WithModel("claude-sonnet-4-20250514")
.WithMessage("Write a haiku about programming on Monday morning.")
.CompleteAsync(interactive: true);
}
```

## 🔹 How It Works
1. **Set up Anthropic API** → `AnthropicExample.Setup()` (API key is required)
2. **Initialize a chat session** → `AIHub.Chat()`
3. **Choose a model** → `.WithModel("claude-sonnet-4-20250514")`
4. **Send a message** → `.WithMessage("Write a haiku about programming on Monday morning.")`
5. **Run the chat** → `.CompleteAsync(interactive: true);`

This example shows how Anthropic's claude-sonnet-4 model can be effortlessly integrated into the framework. With just a few lines of code, developers can enable powerful AI capabilities, thanks to the model's simple setup and ease of use. This makes it an ideal solution for anyone looking to add advanced AI features with minimal effort.
103 changes: 103 additions & 0 deletions src/assets/docs/integrations/anthropy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# 🧠 Anthropic Integration with MaIN Framework

This documentation provides a quick guide for integrating Anthropic into your MaIN-based application. The integration process is simple and ensures that everything in the MaIN framework works seamlessly with Anthropic as the backend, without requiring any additional modifications to existing functionality.

## 🚀 Quick Start

Integrating Anthropic with MaIN requires minimal configuration. All you need to do is specify your Anthropic API key and set the backend type to Anthropic. Once this is done, you can use the full functionality of the MaIN framework, and everything will work as expected, without the need for further adjustments.

### 📝 Code Example

#### Using `appsettings.json`

To configure Anthropic in your `appsettings.json`, add the following section:

```json
{
"MaIN": {
"BackendType": "Anthropic",
"AnthropicKey": "<YOUR_ANTHROPIC_KEY>"
}
}
```

#### Simple Console Initialization

Alternatively, you can set the backend type and Anthropic key programmatically during initialization using `MaINBootstrapper.Initialize`:

```csharp
MaINBootstrapper.Initialize(configureSettings: (options) =>
{
options.BackendType = BackendType.Anthropic;
options.AnthropicKey = "<YOUR_ANTHROPIC_KEY>";
});
```

#### Using ServiceBuilder for API-based Use Cases

If you're setting up MaIN in an API or web-based application (e.g., ASP.NET Core), you can configure it using `ServiceBuilder`:

```csharp
services.AddMaIN(configuration, (options) =>
{
options.BackendType = BackendType.Anthropic;
options.AnthropicKey = "<YOUR_ANTHROPIC_KEY>";
});
```

### 📦 Using Environment Variables

If you prefer not to store your Anthropic key in your `appsettings.json` or directly in the code, you can set it using an environment variable. This will automatically be detected by the MaIN framework.

For example, you can set the `ANTHROPIC_API_KEY` environment variable in different platforms:

- **On Windows (Command Prompt):**

```bash
set ANTHROPIC_API_KEY=<YOUR_ANTHROPIC_KEY>
```

- **On Windows (PowerShell):**

```bash
$env:ANTHROPIC_API_KEY="<YOUR_ANTHROPIC_KEY>"
```

- **On macOS/Linux:**

```bash
export ANTHROPIC_API_KEY=<YOUR_ANTHROPIC_KEY>
```

This way, you can securely store your API key in the environment without the need for hardcoding it.

---

## 🔹 What’s Included with Anthropic Integration

Once you configure Anthropic as the backend, **everything in the MaIN framework works the same way**. This includes all the core functionality such as chat, agents, and data retrieval tasks, which continue to operate without needing any special changes to the logic or structure.

- **No additional configuration is required** to use Anthropic with any MaIN-based feature.
- Whether you're interacting with chat models, agents, or external data sources, the behavior remains consistent.
- The integration allows MaIN to work seamlessly with Anthropic, enabling you to use the full power of the framework without worrying about backend-specific configurations.

---

## ⚠️ Important Considerations

When using Anthropic models with the MaIN framework, please note these current limitations:

- Image Generation: Anthropic models do not support direct image generation. Using features that rely on generating images will throw a `NotSupportedException`.
- Embeddings: Anthropic models do not support generating embeddings (e.g., for file processing that requires text vectorization). Any MaIN functionality dependent on embeddings will result in a `NotSupportedException`.

Please ensure your application's design accounts for these limitations to prevent errors. If these functionalities are crucial for your application, you might want to consider using a different backend, such as OpenAI or Gemini.

---

## 🔧 Features

- **Simple Setup**: All you need to do is specify your Anthropic key and set the backend type to Anthropic, either via `appsettings.json`, environment variables, or programmatically.
- **Environment Variable Support**: Supports storing your Anthropic key securely as an environment variable, making it easy to configure on different platforms.
- **Seamless Operation**: Once Anthropic is configured, everything within the MaIN framework works identically with Anthropic, with no need for adjustments or special handling for different tasks.

This integration ensures that your application remains flexible and easy to manage, allowing you to focus on using the features of MaIN while leveraging Anthropic’s powerful capabilities.
Loading