IntelligentAI 0.0.8
See the version list below for details.
dotnet add package IntelligentAI --version 0.0.8
NuGet\Install-Package IntelligentAI -Version 0.0.8
<PackageReference Include="IntelligentAI" Version="0.0.8" />
<PackageVersion Include="IntelligentAI" Version="0.0.8" />
<PackageReference Include="IntelligentAI" />
paket add IntelligentAI --version 0.0.8
#r "nuget: IntelligentAI, 0.0.8"
#:package IntelligentAI@0.0.8
#addin nuget:?package=IntelligentAI&version=0.0.8
#tool nuget:?package=IntelligentAI&version=0.0.8
Code Setup
Getting Started
Using our dotnet package
To start using the Intelligent SDK from scratch, you first need to install the main Nuget package in the project you want to use the components. You can use the NuGet package manager in your IDE for that or use the following command when using a CLI:
dotnet add package IntelligentAI
Register Services
Add the following in Program.cs:
builder.Services.AddAiService(new AiOptions("intelligent api address"));
Quick Start
This is literally all you need in your services to use intelligent components.
private readonly IAiModelService _model;
public YourClass(IAiModelService model)
{
_model = model;
}
Argument
var request = new AiArguments("杭州西湖哪里好玩?");
int model = 6; // 编号为 6 代表阿里云在线 qwen-long 模型
var _cts = new CancellationTokenSource();
var promptId = "prompt10";
var replaces = new Dictionary<string, string>()
{
["正文"] = Content // 提示词占位符替换
};
Text answer
var answer = await _model.AnswerTextAsync(request, model, cancellationToken: _cts.Token);
Streaming answer
StringBuilder streamingContentBuilder = new StringBuilder();
string botAnswer;
// ReturnType: IAsyncEnumerable<string>
// Requirements: .net 8.0 or above
var stream = _model.AnswerStringsAsync(request, model, cancellationToken: _cts.Token);
// ContentType: text/event-stream
var stream = _model.AnswerStreamAsync(request, model, cancellationToken: _cts.Token);
await foreach (var message in stream)
{
streamingContentBuilder.Append(message);
// You can get the answer here
botAnswer = streamingContentBuilder.ToString();
}
// Or you can get the full answer here
botAnswer = streamingContentBuilder.ToString();
Prompt answer
var answer = await _model.AnswerTextByPromptAsync(promptId, replaces, model, cancellationToken);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.Http (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 1.1.0 | 110 | 6/4/2026 | |
| 1.0.2 | 283 | 5/15/2025 | |
| 1.0.1 | 169 | 1/22/2025 | |
| 1.0.0 | 539 | 10/17/2024 | |
| 0.1.1-beta | 219 | 9/11/2024 | |
| 0.1.0-beta | 124 | 9/11/2024 | |
| 0.0.8 | 222 | 9/3/2024 | |
| 0.0.7 | 251 | 8/27/2024 | |
| 0.0.6 | 268 | 8/13/2024 | |
| 0.0.5 | 220 | 8/12/2024 | |
| 0.0.4 | 231 | 8/9/2024 | |
| 0.0.3 | 218 | 8/9/2024 | |
| 0.0.2 | 213 | 8/7/2024 | |
| 0.0.1 | 206 | 8/7/2024 | |
| 0.0.1-alpha | 165 | 8/5/2024 |
- 创建大模型时如果 ServiceKey 不可用,返回 InvalidOperationException
- 参数序列化保留中文字符
- 去除无关的工具类