Skip to content

Commit b4d87f7

Browse files
MadzionatorPiotr Stachaczynski
andauthored
Update 0.3.0 - DeepSeek integration (#7)
* Update 0.2.10 - DeepSeek integration * feat: include new cli release --------- Co-authored-by: Piotr Stachaczynski <piotr.stachaczynski@priva.com>
1 parent 53c642b commit b4d87f7

4 files changed

Lines changed: 148 additions & 2 deletions

File tree

src/assets/docs/cli.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ The MaIN CLI (`mcli`) is your companion tool for managing AI workflows and servi
1414
> - Set execution policies
1515
> - Create uninstaller
1616
17-
Download and unpack content from this link [Download](https://1drv.ms/u/c/8dd72529df58a475/EXWkWN8pJdcggI1tAAAAAAABD0eIFVX7HhjwDubuEr1T9w?e=QplVP8)
17+
Download and unpack content from this link [Download](https://1drv.ms/u/c/8dd72529df58a475/EXWkWN8pJdcggI1tAAAAAAABD0eIFVX7HhjwDubuEr1T9w?e=m0daA8)
1818

1919
```bash
2020
.\install-mcli.ps1
2121
```
2222

2323
### (Linux/Mac)
24-
Download and unpack content from this link [Download](https://1drv.ms/u/c/8dd72529df58a475/EXWkWN8pJdcggI1zAAAAAAABMMmdRp0OgzMEwBFB4Gftvg?e=V3slNN)
24+
Download and unpack content from this link [Download](https://1drv.ms/u/c/8dd72529df58a475/EXWkWN8pJdcggI1zAAAAAAABMMmdRp0OgzMEwBFB4Gftvg?e=ilXsHh)
2525
> - You might need some sudo permissions to set default model path or run api scripts
2626
2727
```bash

src/assets/docs/docs-index.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,15 @@
145145
"path": "examples/example-chat-files-gemini"
146146
}
147147
]
148+
},
149+
{
150+
"title": "DeepSeek Integration",
151+
"children": [
152+
{
153+
"title": "Chat with Reasoning",
154+
"path": "examples/example-chat-reasoning-deepseek"
155+
}
156+
]
148157
}
149158
]
150159
},
@@ -192,6 +201,10 @@
192201
{
193202
"title": "Gemini",
194203
"path": "integrations/gemini"
204+
},
205+
{
206+
"title": "DeepSeek",
207+
"path": "integrations/deepseek"
195208
}
196209
]
197210
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# 💬 DeepSeek Chat with Reasoning Example
2+
3+
The **ChatWithReasoningDeepSeekExample** demonstrates an interactive chat session using the DeepSeek Reasoner model, focusing on eliciting thoughtful and reasoned responses from the AI.
4+
5+
```csharp
6+
public async Task Start()
7+
{
8+
DeepSeekExample.Setup(); //We need to provide DeepSeek API key
9+
Console.WriteLine("(DeepSeek) ChatExample with reasoning is running!");
10+
11+
await AIHub.Chat()
12+
.WithModel("deepseek-reasoner") // a model that supports reasoning
13+
.WithMessage("What chill pc game do you recommend?")
14+
.CompleteAsync(interactive: true);
15+
}
16+
```
17+
18+
## 🔹 How It Works
19+
20+
1. **Set up DeepSeek API**`DeepSeekExample.Setup()` (API key is required)
21+
2. **Initialize a chat session**`AIHub.Chat()`
22+
3. **Choose a model**`.WithModel("deepseek-reasoner")`
23+
4. **Send a message**`.WithMessage("What chill pc game do you recommend?")`
24+
5. **Run the chat**`.CompleteAsync(interactive: true);`
25+
26+
This example showcases how to leverage the DeepSeek Reasoner model to engage in a conversational exchange where the AI is prompted to provide recommendations based on reasoning, making it ideal for scenarios requiring more elaborate and thought-out responses.
27+
28+
## 💡 Basic Chat without Reasoning
29+
30+
If you don't require the advanced reasoning capabilities, you can simply select a DeepSeek model that isn't designed for reasoning ("`deepseek-chat`"). The integration process remains just as straightforward.
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# 🧠 DeepSeek Integration with MaIN Framework
2+
3+
This documentation provides a quick guide for integrating DeepSeek into your MaIN-based application. The integration process is simple and ensures that everything in the MaIN framework works seamlessly with DeepSeek as the backend, without requiring any additional modifications to existing functionality.
4+
5+
## 🚀 Quick Start
6+
7+
Integrating DeepSeek with MaIN requires minimal configuration. All you need to do is specify your DeepSeek API key and set the backend type to DeepSeek. 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.
8+
9+
### 📝 Code Example
10+
11+
#### Using `appsettings.json`
12+
13+
To configure DeepSeek in your `appsettings.json`, add the following section:
14+
15+
```json
16+
{
17+
"MaIN": {
18+
"BackendType": "DeepSeek",
19+
"DeepSeekKey": "<YOUR_DEEPSEEK_KEY>"
20+
}
21+
}
22+
```
23+
24+
#### Simple Console Initialization
25+
26+
Alternatively, you can set the backend type and DeepSeek key programmatically during initialization using `MaINBootstrapper.Initialize`:
27+
28+
```csharp
29+
MaINBootstrapper.Initialize(configureSettings: (options) =>
30+
{
31+
options.BackendType = BackendType.DeepSeek;
32+
options.DeepSeekKey = "<YOUR_DEEPSEEK_KEY>";
33+
});
34+
```
35+
36+
#### Using ServiceBuilder for API-based Use Cases
37+
38+
If you're setting up MaIN in an API or web-based application (e.g., ASP.NET Core), you can configure it using `ServiceBuilder`:
39+
40+
```csharp
41+
services.AddMaIN(configuration, (options) =>
42+
{
43+
options.BackendType = BackendType.DeepSeek;
44+
options.DeepSeekKey = "<YOUR_DEEPSEEK_KEY>";
45+
});
46+
```
47+
48+
### 📦 Using Environment Variables
49+
50+
If you prefer not to store your DeepSeek 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.
51+
52+
For example, you can set the `DEEPSEEK_API_KEY` environment variable in different platforms:
53+
54+
- **On Windows (Command Prompt):**
55+
56+
```bash
57+
set DEEPSEEK_API_KEY=<YOUR_DEEPSEEK_KEY>
58+
```
59+
60+
- **On Windows (PowerShell):**
61+
62+
```bash
63+
$env:DEEPSEEK_API_KEY="<YOUR_DEEPSEEK_KEY>"
64+
```
65+
66+
- **On macOS/Linux:**
67+
68+
```bash
69+
export DEEPSEEK_API_KEY=<YOUR_DEEPSEEK_KEY>
70+
```
71+
72+
This way, you can securely store your API key in the environment without the need for hardcoding it.
73+
74+
---
75+
76+
## 🔹 What’s Included with DeepSeek Integration
77+
78+
Once you configure DeepSeek 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.
79+
80+
- **No additional configuration is required** to use DeepSeek with any MaIN-based feature.
81+
- Whether you're interacting with chat models, agents, or external data sources, the behavior remains consistent.
82+
- The integration allows MaIN to work seamlessly with Gemini, enabling you to use the full power of the framework without worrying about backend-specific configurations.
83+
84+
---
85+
86+
## ⚠️ Important Considerations
87+
88+
When using DeepSeek models with the MaIN framework, please note these current limitations:
89+
90+
- Image Generation: DeepSeek models do not support direct image generation. Using features that rely on generating images will throw a `NotSupportedException`.
91+
- Embeddings: DeepSeek 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`.
92+
93+
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.
94+
95+
---
96+
97+
## 🔧 Features
98+
99+
- **Simple Setup**: All you need to do is specify your DeepSeek key and set the backend type to DeepSeek, either via `appsettings.json`, environment variables, or programmatically.
100+
- **Environment Variable Support**: Supports storing your DeepSeek key securely as an environment variable, making it easy to configure on different platforms.
101+
- **Seamless Operation**: Once DeepSeek is configured, everything within the MaIN framework works identically with DeepSeek, with no need for adjustments or special handling for different tasks.
102+
103+
This integration ensures that your application remains flexible and easy to manage, allowing you to focus on using the features of MaIN while leveraging DeepSeek’s powerful capabilities.

0 commit comments

Comments
 (0)