From 1a273cc87503bab5a0455200fff15a36a50a870f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E6=98=9F=E7=B9=81?= Date: Thu, 14 Mar 2024 13:40:48 +0800 Subject: [PATCH 1/2] refactor: provide pure api access for semantic kernel --- Cnblogs.DashScope.Sdk.sln | 7 ++ README.md | 111 +++++++++++++++++- README.zh-Hans.md | 105 ++++++++++++++++- sample/Cnblogs.DashScope.Sample/Program.cs | 54 ++++++++- sample/Cnblogs.DashScope.Sample/SampleType.cs | 3 + .../SampleTypeDescriptor.cs | 1 + .../WeatherReportParameters.cs | 19 +++ .../ServiceCollectionInjector.cs | 2 +- .../BackgroundGenerationInput.cs | 2 +- .../BackgroundGenerationOutput.cs | 2 +- .../BackgroundGenerationParameters.cs | 2 +- .../BackgroundGenerationResult.cs | 2 +- .../BackgroundGenerationTextResult.cs | 2 +- .../BackgroundGenerationTextResultGradient.cs | 2 +- ...ndGenerationTextResultGradientColorStop.cs | 2 +- .../BackgroundGenerationTextResultLayer.cs | 4 +- .../BackgroundGenerationTextResultParams.cs | 2 +- .../BackgroundGenerationTextResultUrl.cs | 2 +- .../BackgroundGenerationUsage.cs | 2 +- .../BatchGetEmbeddingsInput.cs | 2 +- .../BatchGetEmbeddingsOutput.cs | 2 +- .../BatchGetEmbeddingsParameters.cs | 2 +- src/Cnblogs.DashScope.Core/ChatMessage.cs | 12 ++ .../Cnblogs.DashScope.Core.csproj | 10 ++ .../DashScopeClient.cs | 4 +- .../DashScopeClientCore.cs | 4 +- .../DashScopeError.cs | 2 +- .../DashScopeException.cs | 2 +- .../DashScopeTask.cs | 2 +- .../DashScopeTaskList.cs | 2 +- .../DashScopeTaskListItem.cs | 2 +- .../DashScopeTaskMetrics.cs | 2 +- .../DashScopeTaskOperationResponse.cs | 2 +- .../DashScopeTaskOutput.cs | 4 +- .../DashScopeTaskStatus.cs | 2 +- .../FunctionCall.cs | 2 +- .../IBackgroundGenerationParameters.cs | 2 +- .../IBatchGetEmbeddingsParameters.cs | 2 +- .../IDashScopeClient.cs | 2 +- .../IFunctionDefinition.cs | 22 ++++ .../IImageSynthesisParameters.cs | 2 +- .../IIncrementalOutputParameter.cs | 2 +- .../IMultimodalParameters.cs | 2 +- .../IProbabilityParameter.cs | 2 +- .../ISeedParameter.cs | 2 +- .../ITextEmbeddingParameters.cs | 2 +- .../ITextGenerationParameters.cs | 2 +- .../ImageGenerationInput.cs | 2 +- .../ImageGenerationOutput.cs | 4 +- .../ImageGenerationResult.cs | 2 +- .../ImageGenerationUsage.cs | 2 +- .../ImageStyles.cs | 2 +- .../ImageSynthesisInput.cs | 2 +- .../ImageSynthesisOutput.cs | 2 +- .../ImageSynthesisParameters.cs | 2 +- .../ImageSynthesisResult.cs | 2 +- .../ImageSynthesisUsage.cs | 2 +- .../Internals/ApiLinks.cs | 2 +- .../Internals/DashScopeDateTimeConvertor.cs | 2 +- .../Internals/DashScopeDefaults.cs | 2 +- .../Internals/DashScopeZeroAsNullConvertor.cs | 2 +- .../Internals/IMessage.cs | 2 +- .../ModelRequest.cs | 2 +- .../ModelResponse.cs | 2 +- .../MultimodalChoice.cs | 2 +- .../MultimodalInput.cs | 2 +- .../MultimodalMessage.cs | 4 +- .../MultimodalMessageContent.cs | 2 +- .../MultimodalOutput.cs | 2 +- .../MultimodalParameters.cs | 2 +- .../MultimodalTokenUsage.cs | 2 +- .../ResultFormats.cs | 4 +- .../TextEmbeddingInput.cs | 2 +- .../TextEmbeddingItem.cs | 2 +- .../TextEmbeddingOutput.cs | 2 +- .../TextEmbeddingParameters.cs | 2 +- .../TextEmbeddingTokenUsage.cs | 2 +- .../TextGenerationChoice.cs | 2 +- .../TextGenerationInput.cs | 2 +- .../TextGenerationOutput.cs | 2 +- .../TextGenerationParameters.cs | 2 +- .../TextGenerationStop.cs | 2 +- .../TextGenerationStopConvertor.cs | 2 +- .../TextGenerationTokenUsage.cs | 2 +- .../TextTypes.cs | 2 +- .../TokenizationOutput.cs | 2 +- .../TokenizationUsage.cs | 2 +- .../ToolCall.cs | 2 +- .../ToolDefinition.cs | 4 +- .../ToolTypes.cs | 2 +- .../BaiChuan/BaiChuanLlmName.cs | 4 +- .../BaiChuan/BaiChuanTextGenerationApi.cs | 4 +- src/Cnblogs.DashScope.Sdk/ChatMessage.cs | 11 -- .../Cnblogs.DashScope.Sdk.csproj | 3 + .../FunctionDefinition.cs | 31 ++++- .../Llama2/Llama2ModelNames.cs | 4 +- .../Llama2/Llama2TextGenerationApi.cs | 4 +- .../QWen/QWenLlmNames.cs | 4 +- .../QWen/QWenTextGenerationApi.cs | 4 +- .../QWenMultimodalGenerationApi.cs | 4 +- .../QWenMultimodalModelNames.cs | 4 +- .../TextEmbedding/TextEmbeddingApi.cs | 4 +- .../TextEmbedding/TextEmbeddingModelNames.cs | 4 +- .../{Internals => }/ThrowHelper.cs | 2 +- .../Wanx/WanxGenerationApi.cs | 4 +- .../Wanx/WanxModelNames.cs | 4 +- .../BaiChuanApiTests.cs | 3 +- .../DashScopeClientTests.cs | 3 +- .../ErrorTests.cs | 3 +- .../Llama2TextGenerationApiTests.cs | 3 +- .../MultimodalGenerationSerializationTests.cs | 1 + .../QWenMultimodalApiTests.cs | 3 +- .../QWenTextGenerationApiTests.cs | 3 +- .../ServiceCollectionInjectorTests.cs | 1 + .../TaskSerializationTests.cs | 3 +- .../TextEmbeddingApiTests.cs | 3 +- .../TextGenerationSerializationTests.cs | 1 + .../TextGenerationStopConverterTests.cs | 1 + .../Utils/Cases.cs | 4 +- .../Utils/Snapshots.cs | 7 +- .../Utils/Sut.cs | 3 +- .../WanxApiTests.cs | 3 +- 122 files changed, 507 insertions(+), 153 deletions(-) create mode 100644 sample/Cnblogs.DashScope.Sample/WeatherReportParameters.cs rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/BackgroundGenerationInput.cs (96%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/BackgroundGenerationOutput.cs (92%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/BackgroundGenerationParameters.cs (90%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/BackgroundGenerationResult.cs (83%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/BackgroundGenerationTextResult.cs (90%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/BackgroundGenerationTextResultGradient.cs (94%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/BackgroundGenerationTextResultGradientColorStop.cs (89%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/BackgroundGenerationTextResultLayer.cs (97%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/BackgroundGenerationTextResultParams.cs (90%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/BackgroundGenerationTextResultUrl.cs (83%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/BackgroundGenerationUsage.cs (84%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/BatchGetEmbeddingsInput.cs (87%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/BatchGetEmbeddingsOutput.cs (87%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/BatchGetEmbeddingsParameters.cs (90%) create mode 100644 src/Cnblogs.DashScope.Core/ChatMessage.cs create mode 100644 src/Cnblogs.DashScope.Core/Cnblogs.DashScope.Core.csproj rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/DashScopeClient.cs (92%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/DashScopeClientCore.cs (99%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/DashScopeError.cs (94%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/DashScopeException.cs (96%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/DashScopeTask.cs (93%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/DashScopeTaskList.cs (94%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/DashScopeTaskListItem.cs (96%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/DashScopeTaskMetrics.cs (93%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/DashScopeTaskOperationResponse.cs (91%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/DashScopeTaskOutput.cs (94%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/DashScopeTaskStatus.cs (95%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/FunctionCall.cs (87%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/IBackgroundGenerationParameters.cs (94%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/IBatchGetEmbeddingsParameters.cs (81%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/IDashScopeClient.cs (99%) create mode 100644 src/Cnblogs.DashScope.Core/IFunctionDefinition.cs rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/IImageSynthesisParameters.cs (95%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/IIncrementalOutputParameter.cs (87%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/IMultimodalParameters.cs (84%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/IProbabilityParameter.cs (94%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/ISeedParameter.cs (86%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/ITextEmbeddingParameters.cs (87%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/ITextGenerationParameters.cs (97%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/ImageGenerationInput.cs (93%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/ImageGenerationOutput.cs (92%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/ImageGenerationResult.cs (82%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/ImageGenerationUsage.cs (83%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/ImageStyles.cs (96%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/ImageSynthesisInput.cs (92%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/ImageSynthesisOutput.cs (87%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/ImageSynthesisParameters.cs (91%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/ImageSynthesisResult.cs (90%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/ImageSynthesisUsage.cs (83%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/Internals/ApiLinks.cs (93%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/Internals/DashScopeDateTimeConvertor.cs (96%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/Internals/DashScopeDefaults.cs (74%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/Internals/DashScopeZeroAsNullConvertor.cs (95%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/Internals/IMessage.cs (87%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/ModelRequest.cs (96%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/ModelResponse.cs (94%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/MultimodalChoice.cs (89%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/MultimodalInput.cs (89%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/MultimodalMessage.cs (82%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/MultimodalMessageContent.cs (93%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/MultimodalOutput.cs (84%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/MultimodalParameters.cs (91%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/MultimodalTokenUsage.cs (94%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/ResultFormats.cs (67%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/TextEmbeddingInput.cs (86%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/TextEmbeddingItem.cs (88%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/TextEmbeddingOutput.cs (85%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/TextEmbeddingParameters.cs (85%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/TextEmbeddingTokenUsage.cs (84%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/TextGenerationChoice.cs (92%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/TextGenerationInput.cs (93%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/TextGenerationOutput.cs (95%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/TextGenerationParameters.cs (95%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/TextGenerationStop.cs (99%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/TextGenerationStopConvertor.cs (99%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/TextGenerationTokenUsage.cs (93%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/TextTypes.cs (90%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/TokenizationOutput.cs (86%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/TokenizationUsage.cs (82%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/ToolCall.cs (88%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/ToolDefinition.cs (72%) rename src/{Cnblogs.DashScope.Sdk => Cnblogs.DashScope.Core}/ToolTypes.cs (86%) delete mode 100644 src/Cnblogs.DashScope.Sdk/ChatMessage.cs rename src/Cnblogs.DashScope.Sdk/{Internals => }/ThrowHelper.cs (90%) diff --git a/Cnblogs.DashScope.Sdk.sln b/Cnblogs.DashScope.Sdk.sln index 67deebe..7f4e6a5 100644 --- a/Cnblogs.DashScope.Sdk.sln +++ b/Cnblogs.DashScope.Sdk.sln @@ -14,6 +14,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cnblogs.DashScope.Sample", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cnblogs.DashScope.AspNetCore", "src\Cnblogs.DashScope.AspNetCore\Cnblogs.DashScope.AspNetCore.csproj", "{C910495B-87AB-4AC1-989C-B6720695A139}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cnblogs.DashScope.Core", "src\Cnblogs.DashScope.Core\Cnblogs.DashScope.Core.csproj", "{CC389455-A3EA-4F09-B524-4DC351A1E1AA}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -24,6 +26,7 @@ Global {BC102292-E664-47F5-B0C7-C4D7A2301002} = {CFC8ECB3-5248-46CD-A56C-EC088F2A3804} {8885149A-78F0-4C8E-B9AA-87A46EA69219} = {2E15D1EC-4A07-416E-8BE6-D907F509FD35} {C910495B-87AB-4AC1-989C-B6720695A139} = {008988ED-0A3B-4272-BCC3-7B4110699345} + {CC389455-A3EA-4F09-B524-4DC351A1E1AA} = {008988ED-0A3B-4272-BCC3-7B4110699345} EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {FA6A118A-8D26-4B7A-9952-8504B8A0025B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -42,5 +45,9 @@ Global {C910495B-87AB-4AC1-989C-B6720695A139}.Debug|Any CPU.Build.0 = Debug|Any CPU {C910495B-87AB-4AC1-989C-B6720695A139}.Release|Any CPU.ActiveCfg = Release|Any CPU {C910495B-87AB-4AC1-989C-B6720695A139}.Release|Any CPU.Build.0 = Release|Any CPU + {CC389455-A3EA-4F09-B524-4DC351A1E1AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CC389455-A3EA-4F09-B524-4DC351A1E1AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CC389455-A3EA-4F09-B524-4DC351A1E1AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CC389455-A3EA-4F09-B524-4DC351A1E1AA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/README.md b/README.md index 5c677f3..8565b07 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,11 @@ English | [简体中文](https://github.com/cnblogs/dashscope-sdk/blob/main/READ An unofficial DashScope SDK maintained by Cnblogs. -# Usage +# Quick Start ## Console App -Install Cnblogs.DashScope.Sdk package. +Install `Cnblogs.DashScope.Sdk` package. ```csharp var client = new DashScopeClient("your-api-key"); @@ -55,8 +55,109 @@ public class YourService(IDashScopeClient client) - Text Generation API(qwen-turbo, qwen-max, etc.) - `dashScopeClient.GetQwenCompletionAsync()` and `dashScopeClient.GetQWenCompletionStreamAsync()` - BaiChuan Models - Use `dashScopeClient.GetBaiChuanTextCompletionAsync()` - LLaMa2 Models - `dashScopeClient.GetLlama2TextCompletionAsync()` -- Multimodal Generation API(qwen-vl-max, etc.) - `dashScopeClient.GetQWenMultimodalCompletionAsync` and `dashScopeClient.GetQWenMultimodalCompletionStreamAsync` +- Multimodal Generation API(qwen-vl-max, etc.) - `dashScopeClient.GetQWenMultimodalCompletionAsync()` and `dashScopeClient.GetQWenMultimodalCompletionStreamAsync()` - Wanx Models(Image generation, background generation, etc) - Image Synthesis - `CreateWanxImageSynthesisTaskAsync()` and `GetWanxImageSynthesisTaskAsync()` - - Image Generation - `CreateWanxImageGenerationTaskAsync` and `GetWanxImageGenerationTaskAsync()` - - Background Image Generation - `CreateWanxBackgroundGenerationTaskAsync` and `GetWanxBackgroundGenerationTaskAsync` + - Image Generation - `CreateWanxImageGenerationTaskAsync()` and `GetWanxImageGenerationTaskAsync()` + - Background Image Generation - `CreateWanxBackgroundGenerationTaskAsync()` and `GetWanxBackgroundGenerationTaskAsync()` + + +# Examples + +Visit [tests](./test) for more usage of each api. + +## Single Text Completion + +```csharp +var prompt = "hello" +var completion = await client.GetQWenCompletionAsync(QWenLlm.QWenMax, prompt); +Console.WriteLine(completion.Output.Text); +``` + +## Multi-round chat + +```csharp +var history = new List +{ + new("user", "Please remember this number, 42"), + new("assistant", "I have remembered this number."), + new("user", "What was the number I metioned before?") +} +var parameters = new TextGenerationParameters() +{ + ResultFormat = ResultFormats.Message +}; +var completion = await client.GetQWenChatCompletionAsync(QWenLlm.QWenMax, history, parameters); +Console.WriteLine(completion.Output.Choices[0].Message.Content); // The number is 42 +``` + +## Function Call + +Creates a function with parameters + +```csharp +string GetCurrentWeather(GetCurrentWeatherParameters parameters) +{ + // actual implementation should be different. + return "Sunny, 14" + parameters.Unit switch + { + TemperatureUnit.Celsius => "℃", + TemperatureUnit.Fahrenheit => "℉" + }; +} + +public record GetCurrentWeatherParameters( + [property: Required] + [property: Description("The city and state, e.g. San Francisco, CA")] + string Location, + [property: JsonConverter(typeof(EnumStringConverter))] + TemperatureUnit Unit = TemperatureUnit.Celsius); + +public enum TemperatureUnit +{ + Celsius, + Fahrenheit +} +``` + +Append tool information to chat messages. + +```csharp +var tools = new List() +{ + new( + ToolTypes.Function, + new FunctionDefinition( + nameof(GetCurrentWeather), + "Get the weather abount given location", + new JsonSchemaBuilder().FromType().Build())) +}; + +var history = new List +{ + new("user", "What is the weather today in C.A?") +}; + +var parameters = new TextGenerationParamters() +{ + ResultFormat = ResultFormats.Message, + Tools = tools +}; + +// send question with available tools. +var completion = await client.GetQWenChatCompletionAsync(QWenLlm.QWenMax, history, parameters); +history.Add(completion.Output.Choice[0].Message); + +// model responding with tool calls. +Console.WriteLine(completion.Output.Choice[0].Message.ToolCalls[0].Function.Name); // GetCurrentWeather + +// calling tool that model requests and append result into history. +var result = GetCurrentWeather(JsonSerializer.Deserialize(completion.Output.Choice[0].Message.ToolCalls[0].Function.Arguments)); +history.Add(new("tool", result, nameof(GetCurrentWeather))); + +// get back answers. +completion = await client.GetQWenChatCompletionAsync(QWenLlm.QWenMax, history, parameters); +Console.WriteLine(completion.Output.Choice[0].Message.Content); +``` + +Append the tool calling result with `tool` role, then model will generate answers based on tool calling result. diff --git a/README.zh-Hans.md b/README.zh-Hans.md index 8845ee3..5ffb4ad 100644 --- a/README.zh-Hans.md +++ b/README.zh-Hans.md @@ -7,7 +7,7 @@ 由博客园维护并使用的非官方灵积服务 SDK -# 使用方法 +# 快速开始 ## 控制台应用 @@ -55,8 +55,105 @@ public class YourService(IDashScopeClient client) - 通义千问(`qwen-turbo`, `qwen-max` 等) - `dashScopeClient.GetQwenCompletionAsync()` and `dashScopeClient.GetQWenCompletionStreamAsync()` - 百川开源大模型 - Use `dashScopeClient.GetBaiChuanTextCompletionAsync()` - LLaMa2 大语言模型 - `dashScopeClient.GetLlama2TextCompletionAsync()` -- 通义千问 VL 和通义千问 Audio(`qwen-vl-max`, `qwen-audio`) - `dashScopeClient.GetQWenMultimodalCompletionAsync` and `dashScopeClient.GetQWenMultimodalCompletionStreamAsync` +- 通义千问 VL 和通义千问 Audio(`qwen-vl-max`, `qwen-audio`) - `dashScopeClient.GetQWenMultimodalCompletionAsync()` and `dashScopeClient.GetQWenMultimodalCompletionStreamAsync()` - 通义万相系列 - 文生图 - `CreateWanxImageSynthesisTaskAsync()` and `GetWanxImageSynthesisTaskAsync()` - - 人像风格重绘 - `CreateWanxImageGenerationTaskAsync` and `GetWanxImageGenerationTaskAsync()` - - 图像背景生成 - `CreateWanxBackgroundGenerationTaskAsync` and `GetWanxBackgroundGenerationTaskAsync` + - 人像风格重绘 - `CreateWanxImageGenerationTaskAsync()` and `GetWanxImageGenerationTaskAsync()` + - 图像背景生成 - `CreateWanxBackgroundGenerationTaskAsync()` and `GetWanxBackgroundGenerationTaskAsync()` + + +# 示例 + +查看 [测试](./test) 获得更多 API 使用示例。 + +## 单轮对话 + +```csharp +var prompt = "你好" +var completion = await client.GetQWenCompletionAsync(QWenLlm.QWenMax, prompt); +Console.WriteLine(completion.Output.Text); +``` + +## 多轮对话 + +```csharp +var history = new List +{ + new("user", "Please remember this number, 42"), + new("assistant", "I have remembered this number."), + new("user", "What was the number I metioned before?") +} +var parameters = new TextGenerationParameters() +{ + ResultFormat = ResultFormats.Message +}; +var completion = await client.GetQWenChatCompletionAsync(QWenLlm.QWenMax, history, parameters); +Console.WriteLine(completion.Output.Choices[0].Message.Content); // The number is 42 +``` + +## 工具调用 + +创建一个可供模型使用的方法。 + +```csharp +string GetCurrentWeather(GetCurrentWeatherParameters parameters) +{ + // implementation is irrenlvent + return "Sunny" +} + +public record GetCurrentWeatherParameters( + [property: Required] + [property: Description("The city and state, e.g. San Francisco, CA")] + string Location, + [property: JsonConverter(typeof(EnumStringConverter))] + TemperatureUnit Unit = TemperatureUnit.Celsius); + +public enum TemperatureUnit +{ + Celsius, + Fahrenheit +} +``` + +对话时带上方法的名称、描述和参数列表,参数列表以 JSON Schema 的形式提供。 + +```csharp +var tools = new List() +{ + new( + ToolTypes.Function, + new FunctionDefinition( + nameof(GetCurrentWeather), + "获取当前天气", + new JsonSchemaBuilder().FromType().Build())) +}; + +var history = new List +{ + new("user", "杭州现在天气如何?") +}; + +var parameters = new TextGenerationParamters() +{ + ResultFormat = ResultFormats.Message, + Tools = tools +}; + +// 向模型提问并提供可用的方法 +var completion = await client.GetQWenChatCompletionAsync(QWenLlm.QWenMax, history, parameters); + +// 模型试图调用方法 +Console.WriteLine(completion.Output.Choice[0].Message.ToolCalls[0].Function.Name); // GetCurrentWeather +history.Add(completion.Output.Choice[0].Message); + +// 调用方法并将结果保存到聊天记录中 +var result = GetCurrentWeather(JsonSerializer.Deserialize(completion.Output.Choice[0].Message.ToolCalls[0].Function.Arguments)); +history.Add(new("tool", result, nameof(GetCurrentWeather))); + +// 模型根据调用结果返回答案 +completion = await client.GetQWenChatCompletionAsync(QWenLlm.QWenMax, history, parameters); +Console.WriteLine(completion.Output.Choice[0].Message.Content) // 现在浙江省杭州市的天气是大部多云,气温为 18 摄氏度。 +``` + +当模型认为应当调用工具时,返回消息中 `ToolCalls` 会提供调用的详情,本地在调用完成后可以把结果以 `tool` 角色返回。 diff --git a/sample/Cnblogs.DashScope.Sample/Program.cs b/sample/Cnblogs.DashScope.Sample/Program.cs index 07facc0..54f21f5 100644 --- a/sample/Cnblogs.DashScope.Sample/Program.cs +++ b/sample/Cnblogs.DashScope.Sample/Program.cs @@ -1,9 +1,13 @@ using System.Text; +using System.Text.Json; +using Cnblogs.DashScope.Core; using Cnblogs.DashScope.Sample; using Cnblogs.DashScope.Sdk; using Cnblogs.DashScope.Sdk.QWen; +using Json.Schema; +using Json.Schema.Generation; -const string apiKey = "your api key"; +const string apiKey = "sk-eeff76d62cc946e5af8d1444f079a34e"; var dashScopeClient = new DashScopeClient(apiKey); Console.WriteLine("Choose the sample you want to run:"); @@ -12,6 +16,7 @@ Console.WriteLine($"{(int)sampleType}.{sampleType.GetDescription()}"); } +Console.WriteLine(); Console.Write("Choose an option: "); var type = (SampleType)int.Parse(Console.ReadLine()!); @@ -31,6 +36,9 @@ case SampleType.ChatCompletion: await ChatStreamAsync(); break; + case SampleType.ChatCompletionWithTool: + await ChatWithToolsAsync(); + break; } return; @@ -88,3 +96,47 @@ async Task ChatStreamAsync() // ReSharper disable once FunctionNeverReturns } + +async Task ChatWithToolsAsync() +{ + var history = new List(); + var tools = new List + { + new( + ToolTypes.Function, + new FunctionDefinition( + nameof(GetWeather), + "获得当前天气", + new JsonSchemaBuilder().FromType().Build())) + }; + var chatParameters = new TextGenerationParameters() { ResultFormat = ResultFormats.Message, Tools = tools }; + var question = new ChatMessage("user", "请问现在杭州的天气如何?"); + history.Add(question); + Console.WriteLine($"{question.Role} > {question.Content}"); + + var response = await dashScopeClient.GetQWenChatCompletionAsync(QWenLlm.QWenMax, history, chatParameters); + var toolCallMessage = response.Output.Choices![0].Message; + history.Add(toolCallMessage); + Console.WriteLine( + $"{toolCallMessage.Role} > {toolCallMessage.ToolCalls![0].Function!.Name}{toolCallMessage.ToolCalls[0].Function!.Arguments}"); + + var toolResponse = GetWeather( + JsonSerializer.Deserialize(toolCallMessage.ToolCalls[0].Function!.Arguments!)!); + var toolMessage = new ChatMessage("tool", toolResponse, nameof(GetWeather)); + history.Add(toolMessage); + Console.WriteLine($"{toolMessage.Role} > {toolMessage.Content}"); + + var answer = await dashScopeClient.GetQWenChatCompletionAsync(QWenLlm.QWenMax, history, chatParameters); + Console.WriteLine($"{answer.Output.Choices![0].Message.Role} > {answer.Output.Choices[0].Message.Content}"); + + string GetWeather(WeatherReportParameters parameters) + { + return "大部多云,气温 " + + parameters.Unit switch + { + TemperatureUnit.Celsius => "18 摄氏度", + TemperatureUnit.Fahrenheit => "64 华氏度", + _ => throw new InvalidOperationException() + }; + } +} diff --git a/sample/Cnblogs.DashScope.Sample/SampleType.cs b/sample/Cnblogs.DashScope.Sample/SampleType.cs index 0e2ceb3..f016cd0 100644 --- a/sample/Cnblogs.DashScope.Sample/SampleType.cs +++ b/sample/Cnblogs.DashScope.Sample/SampleType.cs @@ -12,4 +12,7 @@ public enum SampleType [Description("Conversation between user and assistant")] ChatCompletion, + + [Description("Conversation with tools")] + ChatCompletionWithTool } diff --git a/sample/Cnblogs.DashScope.Sample/SampleTypeDescriptor.cs b/sample/Cnblogs.DashScope.Sample/SampleTypeDescriptor.cs index 0fbc28d..8ffebbc 100644 --- a/sample/Cnblogs.DashScope.Sample/SampleTypeDescriptor.cs +++ b/sample/Cnblogs.DashScope.Sample/SampleTypeDescriptor.cs @@ -9,6 +9,7 @@ public static string GetDescription(this SampleType sampleType) SampleType.TextCompletion => "Simple prompt completion", SampleType.TextCompletionSse => "Simple prompt completion with incremental output", SampleType.ChatCompletion => "Conversation between user and assistant", + SampleType.ChatCompletionWithTool => "Function call sample", _ => throw new ArgumentOutOfRangeException(nameof(sampleType), sampleType, "Unsupported sample option") }; } diff --git a/sample/Cnblogs.DashScope.Sample/WeatherReportParameters.cs b/sample/Cnblogs.DashScope.Sample/WeatherReportParameters.cs new file mode 100644 index 0000000..f711d40 --- /dev/null +++ b/sample/Cnblogs.DashScope.Sample/WeatherReportParameters.cs @@ -0,0 +1,19 @@ +using System.Text.Json.Serialization; +using Json.More; +using Json.Schema.Generation; + +namespace Cnblogs.DashScope.Sample; + +public record WeatherReportParameters( + [property: Required] + [property: Description("要获取天气的省市名称,例如浙江省杭州市")] + string Location, + [property: JsonConverter(typeof(EnumStringConverter))] + [property: Description("温度单位")] + TemperatureUnit Unit = TemperatureUnit.Celsius); + +public enum TemperatureUnit +{ + Celsius, + Fahrenheit +} diff --git a/src/Cnblogs.DashScope.AspNetCore/ServiceCollectionInjector.cs b/src/Cnblogs.DashScope.AspNetCore/ServiceCollectionInjector.cs index d2e53e2..6d91b83 100644 --- a/src/Cnblogs.DashScope.AspNetCore/ServiceCollectionInjector.cs +++ b/src/Cnblogs.DashScope.AspNetCore/ServiceCollectionInjector.cs @@ -1,5 +1,5 @@ using System.Net.Http.Headers; -using Cnblogs.DashScope.Sdk; +using Cnblogs.DashScope.Core; using Microsoft.Extensions.Configuration; // ReSharper disable once CheckNamespace diff --git a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationInput.cs b/src/Cnblogs.DashScope.Core/BackgroundGenerationInput.cs similarity index 96% rename from src/Cnblogs.DashScope.Sdk/BackgroundGenerationInput.cs rename to src/Cnblogs.DashScope.Core/BackgroundGenerationInput.cs index 9c42091..bd820dc 100644 --- a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationInput.cs +++ b/src/Cnblogs.DashScope.Core/BackgroundGenerationInput.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The input of background generation task. diff --git a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationOutput.cs b/src/Cnblogs.DashScope.Core/BackgroundGenerationOutput.cs similarity index 92% rename from src/Cnblogs.DashScope.Sdk/BackgroundGenerationOutput.cs rename to src/Cnblogs.DashScope.Core/BackgroundGenerationOutput.cs index f324a75..88c97bd 100644 --- a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationOutput.cs +++ b/src/Cnblogs.DashScope.Core/BackgroundGenerationOutput.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The output of background generation task. diff --git a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationParameters.cs b/src/Cnblogs.DashScope.Core/BackgroundGenerationParameters.cs similarity index 90% rename from src/Cnblogs.DashScope.Sdk/BackgroundGenerationParameters.cs rename to src/Cnblogs.DashScope.Core/BackgroundGenerationParameters.cs index 351564a..118e8f6 100644 --- a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationParameters.cs +++ b/src/Cnblogs.DashScope.Core/BackgroundGenerationParameters.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The parameters of background generation task. diff --git a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationResult.cs b/src/Cnblogs.DashScope.Core/BackgroundGenerationResult.cs similarity index 83% rename from src/Cnblogs.DashScope.Sdk/BackgroundGenerationResult.cs rename to src/Cnblogs.DashScope.Core/BackgroundGenerationResult.cs index 66aee4f..1219597 100644 --- a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationResult.cs +++ b/src/Cnblogs.DashScope.Core/BackgroundGenerationResult.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The result of background generation task. diff --git a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationTextResult.cs b/src/Cnblogs.DashScope.Core/BackgroundGenerationTextResult.cs similarity index 90% rename from src/Cnblogs.DashScope.Sdk/BackgroundGenerationTextResult.cs rename to src/Cnblogs.DashScope.Core/BackgroundGenerationTextResult.cs index b0ed348..62f50cd 100644 --- a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationTextResult.cs +++ b/src/Cnblogs.DashScope.Core/BackgroundGenerationTextResult.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The results of background generation task. diff --git a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationTextResultGradient.cs b/src/Cnblogs.DashScope.Core/BackgroundGenerationTextResultGradient.cs similarity index 94% rename from src/Cnblogs.DashScope.Sdk/BackgroundGenerationTextResultGradient.cs rename to src/Cnblogs.DashScope.Core/BackgroundGenerationTextResultGradient.cs index 5ed9b4c..8940daa 100644 --- a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationTextResultGradient.cs +++ b/src/Cnblogs.DashScope.Core/BackgroundGenerationTextResultGradient.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The gradient of background generation text. diff --git a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationTextResultGradientColorStop.cs b/src/Cnblogs.DashScope.Core/BackgroundGenerationTextResultGradientColorStop.cs similarity index 89% rename from src/Cnblogs.DashScope.Sdk/BackgroundGenerationTextResultGradientColorStop.cs rename to src/Cnblogs.DashScope.Core/BackgroundGenerationTextResultGradientColorStop.cs index 15f47fc..8d1115b 100644 --- a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationTextResultGradientColorStop.cs +++ b/src/Cnblogs.DashScope.Core/BackgroundGenerationTextResultGradientColorStop.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The color stop of gradient in background generation result. diff --git a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationTextResultLayer.cs b/src/Cnblogs.DashScope.Core/BackgroundGenerationTextResultLayer.cs similarity index 97% rename from src/Cnblogs.DashScope.Sdk/BackgroundGenerationTextResultLayer.cs rename to src/Cnblogs.DashScope.Core/BackgroundGenerationTextResultLayer.cs index 78b04a8..e498b78 100644 --- a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationTextResultLayer.cs +++ b/src/Cnblogs.DashScope.Core/BackgroundGenerationTextResultLayer.cs @@ -1,7 +1,7 @@ using System.Text.Json.Serialization; -using Cnblogs.DashScope.Sdk.Internals; +using Cnblogs.DashScope.Core.Internals; -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents one layer of background generation text result. diff --git a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationTextResultParams.cs b/src/Cnblogs.DashScope.Core/BackgroundGenerationTextResultParams.cs similarity index 90% rename from src/Cnblogs.DashScope.Sdk/BackgroundGenerationTextResultParams.cs rename to src/Cnblogs.DashScope.Core/BackgroundGenerationTextResultParams.cs index d77f256..96b5be0 100644 --- a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationTextResultParams.cs +++ b/src/Cnblogs.DashScope.Core/BackgroundGenerationTextResultParams.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The generated styles of text in one image of background generation task. diff --git a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationTextResultUrl.cs b/src/Cnblogs.DashScope.Core/BackgroundGenerationTextResultUrl.cs similarity index 83% rename from src/Cnblogs.DashScope.Sdk/BackgroundGenerationTextResultUrl.cs rename to src/Cnblogs.DashScope.Core/BackgroundGenerationTextResultUrl.cs index 0989104..248f5f3 100644 --- a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationTextResultUrl.cs +++ b/src/Cnblogs.DashScope.Core/BackgroundGenerationTextResultUrl.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The generated background text url. diff --git a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationUsage.cs b/src/Cnblogs.DashScope.Core/BackgroundGenerationUsage.cs similarity index 84% rename from src/Cnblogs.DashScope.Sdk/BackgroundGenerationUsage.cs rename to src/Cnblogs.DashScope.Core/BackgroundGenerationUsage.cs index cdf02c8..64c1242 100644 --- a/src/Cnblogs.DashScope.Sdk/BackgroundGenerationUsage.cs +++ b/src/Cnblogs.DashScope.Core/BackgroundGenerationUsage.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The usage of background generation task. diff --git a/src/Cnblogs.DashScope.Sdk/BatchGetEmbeddingsInput.cs b/src/Cnblogs.DashScope.Core/BatchGetEmbeddingsInput.cs similarity index 87% rename from src/Cnblogs.DashScope.Sdk/BatchGetEmbeddingsInput.cs rename to src/Cnblogs.DashScope.Core/BatchGetEmbeddingsInput.cs index c395484..b9ab6e0 100644 --- a/src/Cnblogs.DashScope.Sdk/BatchGetEmbeddingsInput.cs +++ b/src/Cnblogs.DashScope.Core/BatchGetEmbeddingsInput.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents input of batch embedding. diff --git a/src/Cnblogs.DashScope.Sdk/BatchGetEmbeddingsOutput.cs b/src/Cnblogs.DashScope.Core/BatchGetEmbeddingsOutput.cs similarity index 87% rename from src/Cnblogs.DashScope.Sdk/BatchGetEmbeddingsOutput.cs rename to src/Cnblogs.DashScope.Core/BatchGetEmbeddingsOutput.cs index 3747c5d..9c23500 100644 --- a/src/Cnblogs.DashScope.Sdk/BatchGetEmbeddingsOutput.cs +++ b/src/Cnblogs.DashScope.Core/BatchGetEmbeddingsOutput.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The output of batch get embeddings api. diff --git a/src/Cnblogs.DashScope.Sdk/BatchGetEmbeddingsParameters.cs b/src/Cnblogs.DashScope.Core/BatchGetEmbeddingsParameters.cs similarity index 90% rename from src/Cnblogs.DashScope.Sdk/BatchGetEmbeddingsParameters.cs rename to src/Cnblogs.DashScope.Core/BatchGetEmbeddingsParameters.cs index 5fb5b8e..ada826e 100644 --- a/src/Cnblogs.DashScope.Sdk/BatchGetEmbeddingsParameters.cs +++ b/src/Cnblogs.DashScope.Core/BatchGetEmbeddingsParameters.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Optional parameter of batch get embeddings request. diff --git a/src/Cnblogs.DashScope.Core/ChatMessage.cs b/src/Cnblogs.DashScope.Core/ChatMessage.cs new file mode 100644 index 0000000..8fcfe9d --- /dev/null +++ b/src/Cnblogs.DashScope.Core/ChatMessage.cs @@ -0,0 +1,12 @@ +using Cnblogs.DashScope.Core.Internals; + +namespace Cnblogs.DashScope.Core; + +/// +/// Represents a chat message between the user and the model. +/// +/// The role of this message. +/// The content of this message. +/// Used when role is tool, represents the function name of this message generated by. +/// Calls to the function. +public record ChatMessage(string Role, string Content, string? Name = null, List? ToolCalls = null) : IMessage; diff --git a/src/Cnblogs.DashScope.Core/Cnblogs.DashScope.Core.csproj b/src/Cnblogs.DashScope.Core/Cnblogs.DashScope.Core.csproj new file mode 100644 index 0000000..015c83a --- /dev/null +++ b/src/Cnblogs.DashScope.Core/Cnblogs.DashScope.Core.csproj @@ -0,0 +1,10 @@ + + + + Cnblogs.DashScopeSDK + true + Cnblogs;Dashscope;AI;Sdk;Embedding; + Provide pure api access to DashScope without extra references. Cnblogs.DashScope.Sdk should be used for general purpose. + + + diff --git a/src/Cnblogs.DashScope.Sdk/DashScopeClient.cs b/src/Cnblogs.DashScope.Core/DashScopeClient.cs similarity index 92% rename from src/Cnblogs.DashScope.Sdk/DashScopeClient.cs rename to src/Cnblogs.DashScope.Core/DashScopeClient.cs index 1b97d3b..639128e 100644 --- a/src/Cnblogs.DashScope.Sdk/DashScopeClient.cs +++ b/src/Cnblogs.DashScope.Core/DashScopeClient.cs @@ -1,7 +1,7 @@ using System.Net.Http.Headers; -using Cnblogs.DashScope.Sdk.Internals; +using Cnblogs.DashScope.Core.Internals; -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The DashScopeClient for direct usage diff --git a/src/Cnblogs.DashScope.Sdk/DashScopeClientCore.cs b/src/Cnblogs.DashScope.Core/DashScopeClientCore.cs similarity index 99% rename from src/Cnblogs.DashScope.Sdk/DashScopeClientCore.cs rename to src/Cnblogs.DashScope.Core/DashScopeClientCore.cs index 3f382e7..3cdc656 100644 --- a/src/Cnblogs.DashScope.Sdk/DashScopeClientCore.cs +++ b/src/Cnblogs.DashScope.Core/DashScopeClientCore.cs @@ -4,9 +4,9 @@ using System.Text; using System.Text.Json; using System.Text.Json.Serialization; -using Cnblogs.DashScope.Sdk.Internals; +using Cnblogs.DashScope.Core.Internals; -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Core implementations for , should only been created by DI container. diff --git a/src/Cnblogs.DashScope.Sdk/DashScopeError.cs b/src/Cnblogs.DashScope.Core/DashScopeError.cs similarity index 94% rename from src/Cnblogs.DashScope.Sdk/DashScopeError.cs rename to src/Cnblogs.DashScope.Core/DashScopeError.cs index 5c971c0..000d9a9 100644 --- a/src/Cnblogs.DashScope.Sdk/DashScopeError.cs +++ b/src/Cnblogs.DashScope.Core/DashScopeError.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Error response for DashScope api call. diff --git a/src/Cnblogs.DashScope.Sdk/DashScopeException.cs b/src/Cnblogs.DashScope.Core/DashScopeException.cs similarity index 96% rename from src/Cnblogs.DashScope.Sdk/DashScopeException.cs rename to src/Cnblogs.DashScope.Core/DashScopeException.cs index b5eedf3..d4aba49 100644 --- a/src/Cnblogs.DashScope.Sdk/DashScopeException.cs +++ b/src/Cnblogs.DashScope.Core/DashScopeException.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents error detail for DashScope API calls. diff --git a/src/Cnblogs.DashScope.Sdk/DashScopeTask.cs b/src/Cnblogs.DashScope.Core/DashScopeTask.cs similarity index 93% rename from src/Cnblogs.DashScope.Sdk/DashScopeTask.cs rename to src/Cnblogs.DashScope.Core/DashScopeTask.cs index 0a2d00a..5bdd476 100644 --- a/src/Cnblogs.DashScope.Sdk/DashScopeTask.cs +++ b/src/Cnblogs.DashScope.Core/DashScopeTask.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents the fetch result of an asynchronous task. diff --git a/src/Cnblogs.DashScope.Sdk/DashScopeTaskList.cs b/src/Cnblogs.DashScope.Core/DashScopeTaskList.cs similarity index 94% rename from src/Cnblogs.DashScope.Sdk/DashScopeTaskList.cs rename to src/Cnblogs.DashScope.Core/DashScopeTaskList.cs index 0272a19..bb8581d 100644 --- a/src/Cnblogs.DashScope.Sdk/DashScopeTaskList.cs +++ b/src/Cnblogs.DashScope.Core/DashScopeTaskList.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents one page of DashScope task list. diff --git a/src/Cnblogs.DashScope.Sdk/DashScopeTaskListItem.cs b/src/Cnblogs.DashScope.Core/DashScopeTaskListItem.cs similarity index 96% rename from src/Cnblogs.DashScope.Sdk/DashScopeTaskListItem.cs rename to src/Cnblogs.DashScope.Core/DashScopeTaskListItem.cs index 7a098d8..89d357e 100644 --- a/src/Cnblogs.DashScope.Sdk/DashScopeTaskListItem.cs +++ b/src/Cnblogs.DashScope.Core/DashScopeTaskListItem.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents one list item of dash scope task list. diff --git a/src/Cnblogs.DashScope.Sdk/DashScopeTaskMetrics.cs b/src/Cnblogs.DashScope.Core/DashScopeTaskMetrics.cs similarity index 93% rename from src/Cnblogs.DashScope.Sdk/DashScopeTaskMetrics.cs rename to src/Cnblogs.DashScope.Core/DashScopeTaskMetrics.cs index e625498..bcc8be2 100644 --- a/src/Cnblogs.DashScope.Sdk/DashScopeTaskMetrics.cs +++ b/src/Cnblogs.DashScope.Core/DashScopeTaskMetrics.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The metrics of one DashScope task. diff --git a/src/Cnblogs.DashScope.Sdk/DashScopeTaskOperationResponse.cs b/src/Cnblogs.DashScope.Core/DashScopeTaskOperationResponse.cs similarity index 91% rename from src/Cnblogs.DashScope.Sdk/DashScopeTaskOperationResponse.cs rename to src/Cnblogs.DashScope.Core/DashScopeTaskOperationResponse.cs index cab10da..923e6e2 100644 --- a/src/Cnblogs.DashScope.Sdk/DashScopeTaskOperationResponse.cs +++ b/src/Cnblogs.DashScope.Core/DashScopeTaskOperationResponse.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The operation result of operation to DashScope task. diff --git a/src/Cnblogs.DashScope.Sdk/DashScopeTaskOutput.cs b/src/Cnblogs.DashScope.Core/DashScopeTaskOutput.cs similarity index 94% rename from src/Cnblogs.DashScope.Sdk/DashScopeTaskOutput.cs rename to src/Cnblogs.DashScope.Core/DashScopeTaskOutput.cs index 78d9d2c..8ca43f9 100644 --- a/src/Cnblogs.DashScope.Sdk/DashScopeTaskOutput.cs +++ b/src/Cnblogs.DashScope.Core/DashScopeTaskOutput.cs @@ -1,7 +1,7 @@ using System.Text.Json.Serialization; -using Cnblogs.DashScope.Sdk.Internals; +using Cnblogs.DashScope.Core.Internals; -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The common properties of DashScope task. diff --git a/src/Cnblogs.DashScope.Sdk/DashScopeTaskStatus.cs b/src/Cnblogs.DashScope.Core/DashScopeTaskStatus.cs similarity index 95% rename from src/Cnblogs.DashScope.Sdk/DashScopeTaskStatus.cs rename to src/Cnblogs.DashScope.Core/DashScopeTaskStatus.cs index 0b7e8ac..83a3509 100644 --- a/src/Cnblogs.DashScope.Sdk/DashScopeTaskStatus.cs +++ b/src/Cnblogs.DashScope.Core/DashScopeTaskStatus.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents status of DashScope task. diff --git a/src/Cnblogs.DashScope.Sdk/FunctionCall.cs b/src/Cnblogs.DashScope.Core/FunctionCall.cs similarity index 87% rename from src/Cnblogs.DashScope.Sdk/FunctionCall.cs rename to src/Cnblogs.DashScope.Core/FunctionCall.cs index 88c84e4..a1a4266 100644 --- a/src/Cnblogs.DashScope.Sdk/FunctionCall.cs +++ b/src/Cnblogs.DashScope.Core/FunctionCall.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents a call to function. diff --git a/src/Cnblogs.DashScope.Sdk/IBackgroundGenerationParameters.cs b/src/Cnblogs.DashScope.Core/IBackgroundGenerationParameters.cs similarity index 94% rename from src/Cnblogs.DashScope.Sdk/IBackgroundGenerationParameters.cs rename to src/Cnblogs.DashScope.Core/IBackgroundGenerationParameters.cs index 00ed219..ef59055 100644 --- a/src/Cnblogs.DashScope.Sdk/IBackgroundGenerationParameters.cs +++ b/src/Cnblogs.DashScope.Core/IBackgroundGenerationParameters.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The parameters of background generation task. diff --git a/src/Cnblogs.DashScope.Sdk/IBatchGetEmbeddingsParameters.cs b/src/Cnblogs.DashScope.Core/IBatchGetEmbeddingsParameters.cs similarity index 81% rename from src/Cnblogs.DashScope.Sdk/IBatchGetEmbeddingsParameters.cs rename to src/Cnblogs.DashScope.Core/IBatchGetEmbeddingsParameters.cs index 377346e..d2640e0 100644 --- a/src/Cnblogs.DashScope.Sdk/IBatchGetEmbeddingsParameters.cs +++ b/src/Cnblogs.DashScope.Core/IBatchGetEmbeddingsParameters.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Optional parameter of batch get embeddings request. diff --git a/src/Cnblogs.DashScope.Sdk/IDashScopeClient.cs b/src/Cnblogs.DashScope.Core/IDashScopeClient.cs similarity index 99% rename from src/Cnblogs.DashScope.Sdk/IDashScopeClient.cs rename to src/Cnblogs.DashScope.Core/IDashScopeClient.cs index 295da7a..dda6183 100644 --- a/src/Cnblogs.DashScope.Sdk/IDashScopeClient.cs +++ b/src/Cnblogs.DashScope.Core/IDashScopeClient.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// DashScope APIs. diff --git a/src/Cnblogs.DashScope.Core/IFunctionDefinition.cs b/src/Cnblogs.DashScope.Core/IFunctionDefinition.cs new file mode 100644 index 0000000..f11d65a --- /dev/null +++ b/src/Cnblogs.DashScope.Core/IFunctionDefinition.cs @@ -0,0 +1,22 @@ +namespace Cnblogs.DashScope.Core; + +/// +/// The function definition contract. +/// +public interface IFunctionDefinition +{ + /// + /// The name of the function. + /// + public string Name { get; } + + /// + /// Descriptions about the functions for model to reference on. + /// + public string Description { get; } + + /// + /// JSON schema of the function parameters. + /// + public object? Parameters { get; } +} diff --git a/src/Cnblogs.DashScope.Sdk/IImageSynthesisParameters.cs b/src/Cnblogs.DashScope.Core/IImageSynthesisParameters.cs similarity index 95% rename from src/Cnblogs.DashScope.Sdk/IImageSynthesisParameters.cs rename to src/Cnblogs.DashScope.Core/IImageSynthesisParameters.cs index 4bb23e1..5e241c6 100644 --- a/src/Cnblogs.DashScope.Sdk/IImageSynthesisParameters.cs +++ b/src/Cnblogs.DashScope.Core/IImageSynthesisParameters.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Optional parameters for image synthesis task. diff --git a/src/Cnblogs.DashScope.Sdk/IIncrementalOutputParameter.cs b/src/Cnblogs.DashScope.Core/IIncrementalOutputParameter.cs similarity index 87% rename from src/Cnblogs.DashScope.Sdk/IIncrementalOutputParameter.cs rename to src/Cnblogs.DashScope.Core/IIncrementalOutputParameter.cs index a02287c..66ba5a0 100644 --- a/src/Cnblogs.DashScope.Sdk/IIncrementalOutputParameter.cs +++ b/src/Cnblogs.DashScope.Core/IIncrementalOutputParameter.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Marks parameter accepts incremental output. diff --git a/src/Cnblogs.DashScope.Sdk/IMultimodalParameters.cs b/src/Cnblogs.DashScope.Core/IMultimodalParameters.cs similarity index 84% rename from src/Cnblogs.DashScope.Sdk/IMultimodalParameters.cs rename to src/Cnblogs.DashScope.Core/IMultimodalParameters.cs index 0013748..42faaf7 100644 --- a/src/Cnblogs.DashScope.Sdk/IMultimodalParameters.cs +++ b/src/Cnblogs.DashScope.Core/IMultimodalParameters.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Optional parameters for multi-model generation request. diff --git a/src/Cnblogs.DashScope.Sdk/IProbabilityParameter.cs b/src/Cnblogs.DashScope.Core/IProbabilityParameter.cs similarity index 94% rename from src/Cnblogs.DashScope.Sdk/IProbabilityParameter.cs rename to src/Cnblogs.DashScope.Core/IProbabilityParameter.cs index 05c8150..0b9eb74 100644 --- a/src/Cnblogs.DashScope.Sdk/IProbabilityParameter.cs +++ b/src/Cnblogs.DashScope.Core/IProbabilityParameter.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Marks parameter accepts top_p and top_k options. diff --git a/src/Cnblogs.DashScope.Sdk/ISeedParameter.cs b/src/Cnblogs.DashScope.Core/ISeedParameter.cs similarity index 86% rename from src/Cnblogs.DashScope.Sdk/ISeedParameter.cs rename to src/Cnblogs.DashScope.Core/ISeedParameter.cs index d5ee95c..f1f377b 100644 --- a/src/Cnblogs.DashScope.Sdk/ISeedParameter.cs +++ b/src/Cnblogs.DashScope.Core/ISeedParameter.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Marks parameter supports seed option. diff --git a/src/Cnblogs.DashScope.Sdk/ITextEmbeddingParameters.cs b/src/Cnblogs.DashScope.Core/ITextEmbeddingParameters.cs similarity index 87% rename from src/Cnblogs.DashScope.Sdk/ITextEmbeddingParameters.cs rename to src/Cnblogs.DashScope.Core/ITextEmbeddingParameters.cs index ebd7d2e..cf8ff68 100644 --- a/src/Cnblogs.DashScope.Sdk/ITextEmbeddingParameters.cs +++ b/src/Cnblogs.DashScope.Core/ITextEmbeddingParameters.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The optional parameters for text embedding. diff --git a/src/Cnblogs.DashScope.Sdk/ITextGenerationParameters.cs b/src/Cnblogs.DashScope.Core/ITextGenerationParameters.cs similarity index 97% rename from src/Cnblogs.DashScope.Sdk/ITextGenerationParameters.cs rename to src/Cnblogs.DashScope.Core/ITextGenerationParameters.cs index 68b6d02..2e2072a 100644 --- a/src/Cnblogs.DashScope.Sdk/ITextGenerationParameters.cs +++ b/src/Cnblogs.DashScope.Core/ITextGenerationParameters.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The text generation options. diff --git a/src/Cnblogs.DashScope.Sdk/ImageGenerationInput.cs b/src/Cnblogs.DashScope.Core/ImageGenerationInput.cs similarity index 93% rename from src/Cnblogs.DashScope.Sdk/ImageGenerationInput.cs rename to src/Cnblogs.DashScope.Core/ImageGenerationInput.cs index a86ace3..d21dca1 100644 --- a/src/Cnblogs.DashScope.Sdk/ImageGenerationInput.cs +++ b/src/Cnblogs.DashScope.Core/ImageGenerationInput.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The input of image generation. diff --git a/src/Cnblogs.DashScope.Sdk/ImageGenerationOutput.cs b/src/Cnblogs.DashScope.Core/ImageGenerationOutput.cs similarity index 92% rename from src/Cnblogs.DashScope.Sdk/ImageGenerationOutput.cs rename to src/Cnblogs.DashScope.Core/ImageGenerationOutput.cs index e8b732b..3fb91bb 100644 --- a/src/Cnblogs.DashScope.Sdk/ImageGenerationOutput.cs +++ b/src/Cnblogs.DashScope.Core/ImageGenerationOutput.cs @@ -1,7 +1,7 @@ using System.Text.Json.Serialization; -using Cnblogs.DashScope.Sdk.Internals; +using Cnblogs.DashScope.Core.Internals; -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The output of image generation task. diff --git a/src/Cnblogs.DashScope.Sdk/ImageGenerationResult.cs b/src/Cnblogs.DashScope.Core/ImageGenerationResult.cs similarity index 82% rename from src/Cnblogs.DashScope.Sdk/ImageGenerationResult.cs rename to src/Cnblogs.DashScope.Core/ImageGenerationResult.cs index 2229fed..51dc834 100644 --- a/src/Cnblogs.DashScope.Sdk/ImageGenerationResult.cs +++ b/src/Cnblogs.DashScope.Core/ImageGenerationResult.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The result of image generation task. diff --git a/src/Cnblogs.DashScope.Sdk/ImageGenerationUsage.cs b/src/Cnblogs.DashScope.Core/ImageGenerationUsage.cs similarity index 83% rename from src/Cnblogs.DashScope.Sdk/ImageGenerationUsage.cs rename to src/Cnblogs.DashScope.Core/ImageGenerationUsage.cs index c7f07c8..afbdb95 100644 --- a/src/Cnblogs.DashScope.Sdk/ImageGenerationUsage.cs +++ b/src/Cnblogs.DashScope.Core/ImageGenerationUsage.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The usage of one image generation request. diff --git a/src/Cnblogs.DashScope.Sdk/ImageStyles.cs b/src/Cnblogs.DashScope.Core/ImageStyles.cs similarity index 96% rename from src/Cnblogs.DashScope.Sdk/ImageStyles.cs rename to src/Cnblogs.DashScope.Core/ImageStyles.cs index 5c09199..42e6d12 100644 --- a/src/Cnblogs.DashScope.Sdk/ImageStyles.cs +++ b/src/Cnblogs.DashScope.Core/ImageStyles.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Available styles for image synthesis task. diff --git a/src/Cnblogs.DashScope.Sdk/ImageSynthesisInput.cs b/src/Cnblogs.DashScope.Core/ImageSynthesisInput.cs similarity index 92% rename from src/Cnblogs.DashScope.Sdk/ImageSynthesisInput.cs rename to src/Cnblogs.DashScope.Core/ImageSynthesisInput.cs index 44a3cf8..9c78118 100644 --- a/src/Cnblogs.DashScope.Sdk/ImageSynthesisInput.cs +++ b/src/Cnblogs.DashScope.Core/ImageSynthesisInput.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The inputs of image synthesis task diff --git a/src/Cnblogs.DashScope.Sdk/ImageSynthesisOutput.cs b/src/Cnblogs.DashScope.Core/ImageSynthesisOutput.cs similarity index 87% rename from src/Cnblogs.DashScope.Sdk/ImageSynthesisOutput.cs rename to src/Cnblogs.DashScope.Core/ImageSynthesisOutput.cs index dfb9281..f0752c3 100644 --- a/src/Cnblogs.DashScope.Sdk/ImageSynthesisOutput.cs +++ b/src/Cnblogs.DashScope.Core/ImageSynthesisOutput.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The output of one image synthesis task. diff --git a/src/Cnblogs.DashScope.Sdk/ImageSynthesisParameters.cs b/src/Cnblogs.DashScope.Core/ImageSynthesisParameters.cs similarity index 91% rename from src/Cnblogs.DashScope.Sdk/ImageSynthesisParameters.cs rename to src/Cnblogs.DashScope.Core/ImageSynthesisParameters.cs index ccef97d..58497fe 100644 --- a/src/Cnblogs.DashScope.Sdk/ImageSynthesisParameters.cs +++ b/src/Cnblogs.DashScope.Core/ImageSynthesisParameters.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Optional parameters for image synthesis task. diff --git a/src/Cnblogs.DashScope.Sdk/ImageSynthesisResult.cs b/src/Cnblogs.DashScope.Core/ImageSynthesisResult.cs similarity index 90% rename from src/Cnblogs.DashScope.Sdk/ImageSynthesisResult.cs rename to src/Cnblogs.DashScope.Core/ImageSynthesisResult.cs index 3217529..4974cff 100644 --- a/src/Cnblogs.DashScope.Sdk/ImageSynthesisResult.cs +++ b/src/Cnblogs.DashScope.Core/ImageSynthesisResult.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The result of one image synthesis subtask. diff --git a/src/Cnblogs.DashScope.Sdk/ImageSynthesisUsage.cs b/src/Cnblogs.DashScope.Core/ImageSynthesisUsage.cs similarity index 83% rename from src/Cnblogs.DashScope.Sdk/ImageSynthesisUsage.cs rename to src/Cnblogs.DashScope.Core/ImageSynthesisUsage.cs index bf1c52b..2bbfe63 100644 --- a/src/Cnblogs.DashScope.Sdk/ImageSynthesisUsage.cs +++ b/src/Cnblogs.DashScope.Core/ImageSynthesisUsage.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The usage of one image synthesis request. diff --git a/src/Cnblogs.DashScope.Sdk/Internals/ApiLinks.cs b/src/Cnblogs.DashScope.Core/Internals/ApiLinks.cs similarity index 93% rename from src/Cnblogs.DashScope.Sdk/Internals/ApiLinks.cs rename to src/Cnblogs.DashScope.Core/Internals/ApiLinks.cs index 6f76b7c..dbefc94 100644 --- a/src/Cnblogs.DashScope.Sdk/Internals/ApiLinks.cs +++ b/src/Cnblogs.DashScope.Core/Internals/ApiLinks.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk.Internals; +namespace Cnblogs.DashScope.Core.Internals; internal static class ApiLinks { diff --git a/src/Cnblogs.DashScope.Sdk/Internals/DashScopeDateTimeConvertor.cs b/src/Cnblogs.DashScope.Core/Internals/DashScopeDateTimeConvertor.cs similarity index 96% rename from src/Cnblogs.DashScope.Sdk/Internals/DashScopeDateTimeConvertor.cs rename to src/Cnblogs.DashScope.Core/Internals/DashScopeDateTimeConvertor.cs index 2489058..c4c9987 100644 --- a/src/Cnblogs.DashScope.Sdk/Internals/DashScopeDateTimeConvertor.cs +++ b/src/Cnblogs.DashScope.Core/Internals/DashScopeDateTimeConvertor.cs @@ -2,7 +2,7 @@ using System.Text.Json; using System.Text.Json.Serialization; -namespace Cnblogs.DashScope.Sdk.Internals; +namespace Cnblogs.DashScope.Core.Internals; internal class DashScopeDateTimeConvertor : JsonConverter { diff --git a/src/Cnblogs.DashScope.Sdk/Internals/DashScopeDefaults.cs b/src/Cnblogs.DashScope.Core/Internals/DashScopeDefaults.cs similarity index 74% rename from src/Cnblogs.DashScope.Sdk/Internals/DashScopeDefaults.cs rename to src/Cnblogs.DashScope.Core/Internals/DashScopeDefaults.cs index 8f51c4b..5c1b537 100644 --- a/src/Cnblogs.DashScope.Sdk/Internals/DashScopeDefaults.cs +++ b/src/Cnblogs.DashScope.Core/Internals/DashScopeDefaults.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk.Internals; +namespace Cnblogs.DashScope.Core.Internals; internal static class DashScopeDefaults { diff --git a/src/Cnblogs.DashScope.Sdk/Internals/DashScopeZeroAsNullConvertor.cs b/src/Cnblogs.DashScope.Core/Internals/DashScopeZeroAsNullConvertor.cs similarity index 95% rename from src/Cnblogs.DashScope.Sdk/Internals/DashScopeZeroAsNullConvertor.cs rename to src/Cnblogs.DashScope.Core/Internals/DashScopeZeroAsNullConvertor.cs index 307da43..0c06c9f 100644 --- a/src/Cnblogs.DashScope.Sdk/Internals/DashScopeZeroAsNullConvertor.cs +++ b/src/Cnblogs.DashScope.Core/Internals/DashScopeZeroAsNullConvertor.cs @@ -1,7 +1,7 @@ using System.Text.Json; using System.Text.Json.Serialization; -namespace Cnblogs.DashScope.Sdk.Internals; +namespace Cnblogs.DashScope.Core.Internals; internal class DashScopeZeroAsNullConvertor : JsonConverter { diff --git a/src/Cnblogs.DashScope.Sdk/Internals/IMessage.cs b/src/Cnblogs.DashScope.Core/Internals/IMessage.cs similarity index 87% rename from src/Cnblogs.DashScope.Sdk/Internals/IMessage.cs rename to src/Cnblogs.DashScope.Core/Internals/IMessage.cs index cdde960..f6957b3 100644 --- a/src/Cnblogs.DashScope.Sdk/Internals/IMessage.cs +++ b/src/Cnblogs.DashScope.Core/Internals/IMessage.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk.Internals; +namespace Cnblogs.DashScope.Core.Internals; internal interface IMessage where TContent : class diff --git a/src/Cnblogs.DashScope.Sdk/ModelRequest.cs b/src/Cnblogs.DashScope.Core/ModelRequest.cs similarity index 96% rename from src/Cnblogs.DashScope.Sdk/ModelRequest.cs rename to src/Cnblogs.DashScope.Core/ModelRequest.cs index 287a3b6..69ad50c 100644 --- a/src/Cnblogs.DashScope.Sdk/ModelRequest.cs +++ b/src/Cnblogs.DashScope.Core/ModelRequest.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents a request for model generation. diff --git a/src/Cnblogs.DashScope.Sdk/ModelResponse.cs b/src/Cnblogs.DashScope.Core/ModelResponse.cs similarity index 94% rename from src/Cnblogs.DashScope.Sdk/ModelResponse.cs rename to src/Cnblogs.DashScope.Core/ModelResponse.cs index b0599f7..6e41559 100644 --- a/src/Cnblogs.DashScope.Sdk/ModelResponse.cs +++ b/src/Cnblogs.DashScope.Core/ModelResponse.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents the generated response from the model. diff --git a/src/Cnblogs.DashScope.Sdk/MultimodalChoice.cs b/src/Cnblogs.DashScope.Core/MultimodalChoice.cs similarity index 89% rename from src/Cnblogs.DashScope.Sdk/MultimodalChoice.cs rename to src/Cnblogs.DashScope.Core/MultimodalChoice.cs index 46409d6..7a49584 100644 --- a/src/Cnblogs.DashScope.Sdk/MultimodalChoice.cs +++ b/src/Cnblogs.DashScope.Core/MultimodalChoice.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents one generation choice. diff --git a/src/Cnblogs.DashScope.Sdk/MultimodalInput.cs b/src/Cnblogs.DashScope.Core/MultimodalInput.cs similarity index 89% rename from src/Cnblogs.DashScope.Sdk/MultimodalInput.cs rename to src/Cnblogs.DashScope.Core/MultimodalInput.cs index 7025ac9..775b4d5 100644 --- a/src/Cnblogs.DashScope.Sdk/MultimodalInput.cs +++ b/src/Cnblogs.DashScope.Core/MultimodalInput.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents inputs of a multi-model generation request. diff --git a/src/Cnblogs.DashScope.Sdk/MultimodalMessage.cs b/src/Cnblogs.DashScope.Core/MultimodalMessage.cs similarity index 82% rename from src/Cnblogs.DashScope.Sdk/MultimodalMessage.cs rename to src/Cnblogs.DashScope.Core/MultimodalMessage.cs index c40649a..0996690 100644 --- a/src/Cnblogs.DashScope.Sdk/MultimodalMessage.cs +++ b/src/Cnblogs.DashScope.Core/MultimodalMessage.cs @@ -1,6 +1,6 @@ -using Cnblogs.DashScope.Sdk.Internals; +using Cnblogs.DashScope.Core.Internals; -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents a multimodal message. diff --git a/src/Cnblogs.DashScope.Sdk/MultimodalMessageContent.cs b/src/Cnblogs.DashScope.Core/MultimodalMessageContent.cs similarity index 93% rename from src/Cnblogs.DashScope.Sdk/MultimodalMessageContent.cs rename to src/Cnblogs.DashScope.Core/MultimodalMessageContent.cs index 4676039..27f9d75 100644 --- a/src/Cnblogs.DashScope.Sdk/MultimodalMessageContent.cs +++ b/src/Cnblogs.DashScope.Core/MultimodalMessageContent.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents one content of a . diff --git a/src/Cnblogs.DashScope.Sdk/MultimodalOutput.cs b/src/Cnblogs.DashScope.Core/MultimodalOutput.cs similarity index 84% rename from src/Cnblogs.DashScope.Sdk/MultimodalOutput.cs rename to src/Cnblogs.DashScope.Core/MultimodalOutput.cs index ffa2e59..b34c177 100644 --- a/src/Cnblogs.DashScope.Sdk/MultimodalOutput.cs +++ b/src/Cnblogs.DashScope.Core/MultimodalOutput.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents output of multi-model generation. diff --git a/src/Cnblogs.DashScope.Sdk/MultimodalParameters.cs b/src/Cnblogs.DashScope.Core/MultimodalParameters.cs similarity index 91% rename from src/Cnblogs.DashScope.Sdk/MultimodalParameters.cs rename to src/Cnblogs.DashScope.Core/MultimodalParameters.cs index 4af0a62..8a4a263 100644 --- a/src/Cnblogs.DashScope.Sdk/MultimodalParameters.cs +++ b/src/Cnblogs.DashScope.Core/MultimodalParameters.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Optional parameters for multi-model generation request. diff --git a/src/Cnblogs.DashScope.Sdk/MultimodalTokenUsage.cs b/src/Cnblogs.DashScope.Core/MultimodalTokenUsage.cs similarity index 94% rename from src/Cnblogs.DashScope.Sdk/MultimodalTokenUsage.cs rename to src/Cnblogs.DashScope.Core/MultimodalTokenUsage.cs index b7f8d25..d85575f 100644 --- a/src/Cnblogs.DashScope.Sdk/MultimodalTokenUsage.cs +++ b/src/Cnblogs.DashScope.Core/MultimodalTokenUsage.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The token usage data of multimodal generation request. diff --git a/src/Cnblogs.DashScope.Sdk/ResultFormats.cs b/src/Cnblogs.DashScope.Core/ResultFormats.cs similarity index 67% rename from src/Cnblogs.DashScope.Sdk/ResultFormats.cs rename to src/Cnblogs.DashScope.Core/ResultFormats.cs index e6c7432..58a328f 100644 --- a/src/Cnblogs.DashScope.Sdk/ResultFormats.cs +++ b/src/Cnblogs.DashScope.Core/ResultFormats.cs @@ -1,7 +1,7 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// -/// Available values for .. +/// Available values for .. /// public static class ResultFormats { diff --git a/src/Cnblogs.DashScope.Sdk/TextEmbeddingInput.cs b/src/Cnblogs.DashScope.Core/TextEmbeddingInput.cs similarity index 86% rename from src/Cnblogs.DashScope.Sdk/TextEmbeddingInput.cs rename to src/Cnblogs.DashScope.Core/TextEmbeddingInput.cs index 7f02596..41295eb 100644 --- a/src/Cnblogs.DashScope.Sdk/TextEmbeddingInput.cs +++ b/src/Cnblogs.DashScope.Core/TextEmbeddingInput.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The inputs for text embedding api diff --git a/src/Cnblogs.DashScope.Sdk/TextEmbeddingItem.cs b/src/Cnblogs.DashScope.Core/TextEmbeddingItem.cs similarity index 88% rename from src/Cnblogs.DashScope.Sdk/TextEmbeddingItem.cs rename to src/Cnblogs.DashScope.Core/TextEmbeddingItem.cs index 50a6347..cd643e9 100644 --- a/src/Cnblogs.DashScope.Sdk/TextEmbeddingItem.cs +++ b/src/Cnblogs.DashScope.Core/TextEmbeddingItem.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents one result of text embedding request. diff --git a/src/Cnblogs.DashScope.Sdk/TextEmbeddingOutput.cs b/src/Cnblogs.DashScope.Core/TextEmbeddingOutput.cs similarity index 85% rename from src/Cnblogs.DashScope.Sdk/TextEmbeddingOutput.cs rename to src/Cnblogs.DashScope.Core/TextEmbeddingOutput.cs index 88e6bde..9a5821b 100644 --- a/src/Cnblogs.DashScope.Sdk/TextEmbeddingOutput.cs +++ b/src/Cnblogs.DashScope.Core/TextEmbeddingOutput.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents output of text embedding request. diff --git a/src/Cnblogs.DashScope.Sdk/TextEmbeddingParameters.cs b/src/Cnblogs.DashScope.Core/TextEmbeddingParameters.cs similarity index 85% rename from src/Cnblogs.DashScope.Sdk/TextEmbeddingParameters.cs rename to src/Cnblogs.DashScope.Core/TextEmbeddingParameters.cs index a6afb7c..48cb090 100644 --- a/src/Cnblogs.DashScope.Sdk/TextEmbeddingParameters.cs +++ b/src/Cnblogs.DashScope.Core/TextEmbeddingParameters.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The optional parameters for text embedding. diff --git a/src/Cnblogs.DashScope.Sdk/TextEmbeddingTokenUsage.cs b/src/Cnblogs.DashScope.Core/TextEmbeddingTokenUsage.cs similarity index 84% rename from src/Cnblogs.DashScope.Sdk/TextEmbeddingTokenUsage.cs rename to src/Cnblogs.DashScope.Core/TextEmbeddingTokenUsage.cs index b1ddb5c..0eceb00 100644 --- a/src/Cnblogs.DashScope.Sdk/TextEmbeddingTokenUsage.cs +++ b/src/Cnblogs.DashScope.Core/TextEmbeddingTokenUsage.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The token usage of text embedding request. diff --git a/src/Cnblogs.DashScope.Sdk/TextGenerationChoice.cs b/src/Cnblogs.DashScope.Core/TextGenerationChoice.cs similarity index 92% rename from src/Cnblogs.DashScope.Sdk/TextGenerationChoice.cs rename to src/Cnblogs.DashScope.Core/TextGenerationChoice.cs index ea474af..85ac92e 100644 --- a/src/Cnblogs.DashScope.Sdk/TextGenerationChoice.cs +++ b/src/Cnblogs.DashScope.Core/TextGenerationChoice.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents one choice of model made. diff --git a/src/Cnblogs.DashScope.Sdk/TextGenerationInput.cs b/src/Cnblogs.DashScope.Core/TextGenerationInput.cs similarity index 93% rename from src/Cnblogs.DashScope.Sdk/TextGenerationInput.cs rename to src/Cnblogs.DashScope.Core/TextGenerationInput.cs index 869bae4..f3d7384 100644 --- a/src/Cnblogs.DashScope.Sdk/TextGenerationInput.cs +++ b/src/Cnblogs.DashScope.Core/TextGenerationInput.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Input parameters for text generation. diff --git a/src/Cnblogs.DashScope.Sdk/TextGenerationOutput.cs b/src/Cnblogs.DashScope.Core/TextGenerationOutput.cs similarity index 95% rename from src/Cnblogs.DashScope.Sdk/TextGenerationOutput.cs rename to src/Cnblogs.DashScope.Core/TextGenerationOutput.cs index 36ddf27..7288b8a 100644 --- a/src/Cnblogs.DashScope.Sdk/TextGenerationOutput.cs +++ b/src/Cnblogs.DashScope.Core/TextGenerationOutput.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The output of one text completion request. diff --git a/src/Cnblogs.DashScope.Sdk/TextGenerationParameters.cs b/src/Cnblogs.DashScope.Core/TextGenerationParameters.cs similarity index 95% rename from src/Cnblogs.DashScope.Sdk/TextGenerationParameters.cs rename to src/Cnblogs.DashScope.Core/TextGenerationParameters.cs index d103dee..e4308f6 100644 --- a/src/Cnblogs.DashScope.Sdk/TextGenerationParameters.cs +++ b/src/Cnblogs.DashScope.Core/TextGenerationParameters.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The text generation options. diff --git a/src/Cnblogs.DashScope.Sdk/TextGenerationStop.cs b/src/Cnblogs.DashScope.Core/TextGenerationStop.cs similarity index 99% rename from src/Cnblogs.DashScope.Sdk/TextGenerationStop.cs rename to src/Cnblogs.DashScope.Core/TextGenerationStop.cs index f3ace3a..cc3c567 100644 --- a/src/Cnblogs.DashScope.Sdk/TextGenerationStop.cs +++ b/src/Cnblogs.DashScope.Core/TextGenerationStop.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents stop parameter in , can be int, string, int array or string array. diff --git a/src/Cnblogs.DashScope.Sdk/TextGenerationStopConvertor.cs b/src/Cnblogs.DashScope.Core/TextGenerationStopConvertor.cs similarity index 99% rename from src/Cnblogs.DashScope.Sdk/TextGenerationStopConvertor.cs rename to src/Cnblogs.DashScope.Core/TextGenerationStopConvertor.cs index 5509228..769df58 100644 --- a/src/Cnblogs.DashScope.Sdk/TextGenerationStopConvertor.cs +++ b/src/Cnblogs.DashScope.Core/TextGenerationStopConvertor.cs @@ -1,7 +1,7 @@ using System.Text.Json; using System.Text.Json.Serialization; -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// JSON convertor for . diff --git a/src/Cnblogs.DashScope.Sdk/TextGenerationTokenUsage.cs b/src/Cnblogs.DashScope.Core/TextGenerationTokenUsage.cs similarity index 93% rename from src/Cnblogs.DashScope.Sdk/TextGenerationTokenUsage.cs rename to src/Cnblogs.DashScope.Core/TextGenerationTokenUsage.cs index 9b56c3d..8021388 100644 --- a/src/Cnblogs.DashScope.Sdk/TextGenerationTokenUsage.cs +++ b/src/Cnblogs.DashScope.Core/TextGenerationTokenUsage.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The token usage per request. diff --git a/src/Cnblogs.DashScope.Sdk/TextTypes.cs b/src/Cnblogs.DashScope.Core/TextTypes.cs similarity index 90% rename from src/Cnblogs.DashScope.Sdk/TextTypes.cs rename to src/Cnblogs.DashScope.Core/TextTypes.cs index 1b27c2d..edb4f69 100644 --- a/src/Cnblogs.DashScope.Sdk/TextTypes.cs +++ b/src/Cnblogs.DashScope.Core/TextTypes.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Available text types for text embedding. diff --git a/src/Cnblogs.DashScope.Sdk/TokenizationOutput.cs b/src/Cnblogs.DashScope.Core/TokenizationOutput.cs similarity index 86% rename from src/Cnblogs.DashScope.Sdk/TokenizationOutput.cs rename to src/Cnblogs.DashScope.Core/TokenizationOutput.cs index 732c99a..6665327 100644 --- a/src/Cnblogs.DashScope.Sdk/TokenizationOutput.cs +++ b/src/Cnblogs.DashScope.Core/TokenizationOutput.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The output for tokenizer. diff --git a/src/Cnblogs.DashScope.Sdk/TokenizationUsage.cs b/src/Cnblogs.DashScope.Core/TokenizationUsage.cs similarity index 82% rename from src/Cnblogs.DashScope.Sdk/TokenizationUsage.cs rename to src/Cnblogs.DashScope.Core/TokenizationUsage.cs index d2bfc8c..68df7e9 100644 --- a/src/Cnblogs.DashScope.Sdk/TokenizationUsage.cs +++ b/src/Cnblogs.DashScope.Core/TokenizationUsage.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// The usage of tokenization. diff --git a/src/Cnblogs.DashScope.Sdk/ToolCall.cs b/src/Cnblogs.DashScope.Core/ToolCall.cs similarity index 88% rename from src/Cnblogs.DashScope.Sdk/ToolCall.cs rename to src/Cnblogs.DashScope.Core/ToolCall.cs index 43f7cbd..e795d08 100644 --- a/src/Cnblogs.DashScope.Sdk/ToolCall.cs +++ b/src/Cnblogs.DashScope.Core/ToolCall.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Represents a call to tool. diff --git a/src/Cnblogs.DashScope.Sdk/ToolDefinition.cs b/src/Cnblogs.DashScope.Core/ToolDefinition.cs similarity index 72% rename from src/Cnblogs.DashScope.Sdk/ToolDefinition.cs rename to src/Cnblogs.DashScope.Core/ToolDefinition.cs index 8c5a93d..85a2ef3 100644 --- a/src/Cnblogs.DashScope.Sdk/ToolDefinition.cs +++ b/src/Cnblogs.DashScope.Core/ToolDefinition.cs @@ -1,8 +1,8 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Definition of a tool that model can call during generation. /// /// The type of this tool. Use to get all available options. /// Not null when is tool. -public record ToolDefinition(string Type, FunctionDefinition? Function); +public record ToolDefinition(string Type, IFunctionDefinition? Function); diff --git a/src/Cnblogs.DashScope.Sdk/ToolTypes.cs b/src/Cnblogs.DashScope.Core/ToolTypes.cs similarity index 86% rename from src/Cnblogs.DashScope.Sdk/ToolTypes.cs rename to src/Cnblogs.DashScope.Core/ToolTypes.cs index acb2acf..248b71f 100644 --- a/src/Cnblogs.DashScope.Sdk/ToolTypes.cs +++ b/src/Cnblogs.DashScope.Core/ToolTypes.cs @@ -1,4 +1,4 @@ -namespace Cnblogs.DashScope.Sdk; +namespace Cnblogs.DashScope.Core; /// /// Available tool types for . diff --git a/src/Cnblogs.DashScope.Sdk/BaiChuan/BaiChuanLlmName.cs b/src/Cnblogs.DashScope.Sdk/BaiChuan/BaiChuanLlmName.cs index be96cda..b5ffff1 100644 --- a/src/Cnblogs.DashScope.Sdk/BaiChuan/BaiChuanLlmName.cs +++ b/src/Cnblogs.DashScope.Sdk/BaiChuan/BaiChuanLlmName.cs @@ -1,6 +1,4 @@ -using Cnblogs.DashScope.Sdk.Internals; - -namespace Cnblogs.DashScope.Sdk.BaiChuan; +namespace Cnblogs.DashScope.Sdk.BaiChuan; internal static class BaiChuanLlmName { diff --git a/src/Cnblogs.DashScope.Sdk/BaiChuan/BaiChuanTextGenerationApi.cs b/src/Cnblogs.DashScope.Sdk/BaiChuan/BaiChuanTextGenerationApi.cs index b1185dc..7dc3feb 100644 --- a/src/Cnblogs.DashScope.Sdk/BaiChuan/BaiChuanTextGenerationApi.cs +++ b/src/Cnblogs.DashScope.Sdk/BaiChuan/BaiChuanTextGenerationApi.cs @@ -1,4 +1,6 @@ -namespace Cnblogs.DashScope.Sdk.BaiChuan; +using Cnblogs.DashScope.Core; + +namespace Cnblogs.DashScope.Sdk.BaiChuan; /// /// BaiChuan LLM generation apis, doc: https://help.aliyun.com/zh/dashscope/developer-reference/api-details-2 diff --git a/src/Cnblogs.DashScope.Sdk/ChatMessage.cs b/src/Cnblogs.DashScope.Sdk/ChatMessage.cs deleted file mode 100644 index dbb1edc..0000000 --- a/src/Cnblogs.DashScope.Sdk/ChatMessage.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Cnblogs.DashScope.Sdk.Internals; - -namespace Cnblogs.DashScope.Sdk; - -/// -/// Represents a chat message between the user and the model. -/// -/// The role of this message. -/// The content of this message. -/// Calls to the function. -public record ChatMessage(string Role, string Content, List? ToolCalls = null) : IMessage; diff --git a/src/Cnblogs.DashScope.Sdk/Cnblogs.DashScope.Sdk.csproj b/src/Cnblogs.DashScope.Sdk/Cnblogs.DashScope.Sdk.csproj index 698eb2a..414eac5 100644 --- a/src/Cnblogs.DashScope.Sdk/Cnblogs.DashScope.Sdk.csproj +++ b/src/Cnblogs.DashScope.Sdk/Cnblogs.DashScope.Sdk.csproj @@ -7,4 +7,7 @@ + + + diff --git a/src/Cnblogs.DashScope.Sdk/FunctionDefinition.cs b/src/Cnblogs.DashScope.Sdk/FunctionDefinition.cs index d2d47a0..1344496 100644 --- a/src/Cnblogs.DashScope.Sdk/FunctionDefinition.cs +++ b/src/Cnblogs.DashScope.Sdk/FunctionDefinition.cs @@ -1,11 +1,32 @@ -using Json.Schema; +using Cnblogs.DashScope.Core; +using Json.Schema; namespace Cnblogs.DashScope.Sdk; /// /// Definition of function that can be called by model. /// -/// The name of the function. -/// Descriptions about this function that help model to decide when to call this function. -/// The parameters JSON schema. -public record FunctionDefinition(string Name, string Description, JsonSchema? Parameters); +public record FunctionDefinition : IFunctionDefinition +{ + /// + /// Create a new function definition. + /// + /// The name of the function. + /// Descriptions about this function for model to reference on. + /// Parameter maps of this function. + public FunctionDefinition(string name, string description, JsonSchema? parameters) + { + Name = name; + Description = description; + Parameters = parameters; + } + + /// + public string Name { get; } + + /// + public string Description { get; } + + /// + public object? Parameters { get; } +} diff --git a/src/Cnblogs.DashScope.Sdk/Llama2/Llama2ModelNames.cs b/src/Cnblogs.DashScope.Sdk/Llama2/Llama2ModelNames.cs index 7e83541..44357d3 100644 --- a/src/Cnblogs.DashScope.Sdk/Llama2/Llama2ModelNames.cs +++ b/src/Cnblogs.DashScope.Sdk/Llama2/Llama2ModelNames.cs @@ -1,6 +1,4 @@ -using Cnblogs.DashScope.Sdk.Internals; - -namespace Cnblogs.DashScope.Sdk.Llama2; +namespace Cnblogs.DashScope.Sdk.Llama2; internal static class Llama2ModelNames { diff --git a/src/Cnblogs.DashScope.Sdk/Llama2/Llama2TextGenerationApi.cs b/src/Cnblogs.DashScope.Sdk/Llama2/Llama2TextGenerationApi.cs index a71ce9b..67d19d5 100644 --- a/src/Cnblogs.DashScope.Sdk/Llama2/Llama2TextGenerationApi.cs +++ b/src/Cnblogs.DashScope.Sdk/Llama2/Llama2TextGenerationApi.cs @@ -1,4 +1,6 @@ -namespace Cnblogs.DashScope.Sdk.Llama2; +using Cnblogs.DashScope.Core; + +namespace Cnblogs.DashScope.Sdk.Llama2; /// /// Extensions for llama2 text generation, docs: https://help.aliyun.com/zh/dashscope/developer-reference/api-details-11 diff --git a/src/Cnblogs.DashScope.Sdk/QWen/QWenLlmNames.cs b/src/Cnblogs.DashScope.Sdk/QWen/QWenLlmNames.cs index 76f5067..9ea15fe 100644 --- a/src/Cnblogs.DashScope.Sdk/QWen/QWenLlmNames.cs +++ b/src/Cnblogs.DashScope.Sdk/QWen/QWenLlmNames.cs @@ -1,6 +1,4 @@ -using Cnblogs.DashScope.Sdk.Internals; - -namespace Cnblogs.DashScope.Sdk.QWen; +namespace Cnblogs.DashScope.Sdk.QWen; internal static class QWenLlmNames { diff --git a/src/Cnblogs.DashScope.Sdk/QWen/QWenTextGenerationApi.cs b/src/Cnblogs.DashScope.Sdk/QWen/QWenTextGenerationApi.cs index a648712..d271e68 100644 --- a/src/Cnblogs.DashScope.Sdk/QWen/QWenTextGenerationApi.cs +++ b/src/Cnblogs.DashScope.Sdk/QWen/QWenTextGenerationApi.cs @@ -1,4 +1,6 @@ -namespace Cnblogs.DashScope.Sdk.QWen; +using Cnblogs.DashScope.Core; + +namespace Cnblogs.DashScope.Sdk.QWen; /// /// Extension methods for QWen text generation api, docs: https://help.aliyun.com/zh/dashscope/developer-reference/api-details diff --git a/src/Cnblogs.DashScope.Sdk/QWenMultimodal/QWenMultimodalGenerationApi.cs b/src/Cnblogs.DashScope.Sdk/QWenMultimodal/QWenMultimodalGenerationApi.cs index 8cb7afb..8d006cf 100644 --- a/src/Cnblogs.DashScope.Sdk/QWenMultimodal/QWenMultimodalGenerationApi.cs +++ b/src/Cnblogs.DashScope.Sdk/QWenMultimodal/QWenMultimodalGenerationApi.cs @@ -1,4 +1,6 @@ -namespace Cnblogs.DashScope.Sdk.QWenMultimodal; +using Cnblogs.DashScope.Core; + +namespace Cnblogs.DashScope.Sdk.QWenMultimodal; /// /// Extension methods for qwen-vl and qwen-audio: https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-qianwen-vl-plus-api?spm=a2c4g.11186623.0.0.6cd412b09sQtru#8f79b5d0f8ker diff --git a/src/Cnblogs.DashScope.Sdk/QWenMultimodal/QWenMultimodalModelNames.cs b/src/Cnblogs.DashScope.Sdk/QWenMultimodal/QWenMultimodalModelNames.cs index 532c0c2..6a4af1e 100644 --- a/src/Cnblogs.DashScope.Sdk/QWenMultimodal/QWenMultimodalModelNames.cs +++ b/src/Cnblogs.DashScope.Sdk/QWenMultimodal/QWenMultimodalModelNames.cs @@ -1,6 +1,4 @@ -using Cnblogs.DashScope.Sdk.Internals; - -namespace Cnblogs.DashScope.Sdk.QWenMultimodal; +namespace Cnblogs.DashScope.Sdk.QWenMultimodal; internal static class QWenMultimodalModelNames { diff --git a/src/Cnblogs.DashScope.Sdk/TextEmbedding/TextEmbeddingApi.cs b/src/Cnblogs.DashScope.Sdk/TextEmbedding/TextEmbeddingApi.cs index 2b8c749..31d16e1 100644 --- a/src/Cnblogs.DashScope.Sdk/TextEmbedding/TextEmbeddingApi.cs +++ b/src/Cnblogs.DashScope.Sdk/TextEmbedding/TextEmbeddingApi.cs @@ -1,4 +1,6 @@ -namespace Cnblogs.DashScope.Sdk.TextEmbedding; +using Cnblogs.DashScope.Core; + +namespace Cnblogs.DashScope.Sdk.TextEmbedding; /// /// Extensions for text embedding, doc: https://help.aliyun.com/zh/dashscope/developer-reference/text-embedding-api-details diff --git a/src/Cnblogs.DashScope.Sdk/TextEmbedding/TextEmbeddingModelNames.cs b/src/Cnblogs.DashScope.Sdk/TextEmbedding/TextEmbeddingModelNames.cs index 63d77b4..528de61 100644 --- a/src/Cnblogs.DashScope.Sdk/TextEmbedding/TextEmbeddingModelNames.cs +++ b/src/Cnblogs.DashScope.Sdk/TextEmbedding/TextEmbeddingModelNames.cs @@ -1,6 +1,4 @@ -using Cnblogs.DashScope.Sdk.Internals; - -namespace Cnblogs.DashScope.Sdk.TextEmbedding; +namespace Cnblogs.DashScope.Sdk.TextEmbedding; internal static class TextEmbeddingModelNames { diff --git a/src/Cnblogs.DashScope.Sdk/Internals/ThrowHelper.cs b/src/Cnblogs.DashScope.Sdk/ThrowHelper.cs similarity index 90% rename from src/Cnblogs.DashScope.Sdk/Internals/ThrowHelper.cs rename to src/Cnblogs.DashScope.Sdk/ThrowHelper.cs index 4dd89ab..e06e79f 100644 --- a/src/Cnblogs.DashScope.Sdk/Internals/ThrowHelper.cs +++ b/src/Cnblogs.DashScope.Sdk/ThrowHelper.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace Cnblogs.DashScope.Sdk.Internals; +namespace Cnblogs.DashScope.Sdk; internal static class ThrowHelper { diff --git a/src/Cnblogs.DashScope.Sdk/Wanx/WanxGenerationApi.cs b/src/Cnblogs.DashScope.Sdk/Wanx/WanxGenerationApi.cs index 3bdccab..c216d5a 100644 --- a/src/Cnblogs.DashScope.Sdk/Wanx/WanxGenerationApi.cs +++ b/src/Cnblogs.DashScope.Sdk/Wanx/WanxGenerationApi.cs @@ -1,4 +1,6 @@ -namespace Cnblogs.DashScope.Sdk.Wanx; +using Cnblogs.DashScope.Core; + +namespace Cnblogs.DashScope.Sdk.Wanx; /// /// Wanx painting model diff --git a/src/Cnblogs.DashScope.Sdk/Wanx/WanxModelNames.cs b/src/Cnblogs.DashScope.Sdk/Wanx/WanxModelNames.cs index 9475d9f..ab04555 100644 --- a/src/Cnblogs.DashScope.Sdk/Wanx/WanxModelNames.cs +++ b/src/Cnblogs.DashScope.Sdk/Wanx/WanxModelNames.cs @@ -1,6 +1,4 @@ -using Cnblogs.DashScope.Sdk.Internals; - -namespace Cnblogs.DashScope.Sdk.Wanx; +namespace Cnblogs.DashScope.Sdk.Wanx; internal static class WanxModelNames { diff --git a/test/Cnblogs.DashScope.Sdk.UnitTests/BaiChuanApiTests.cs b/test/Cnblogs.DashScope.Sdk.UnitTests/BaiChuanApiTests.cs index 6d887d4..1184b1a 100644 --- a/test/Cnblogs.DashScope.Sdk.UnitTests/BaiChuanApiTests.cs +++ b/test/Cnblogs.DashScope.Sdk.UnitTests/BaiChuanApiTests.cs @@ -1,4 +1,5 @@ -using Cnblogs.DashScope.Sdk.BaiChuan; +using Cnblogs.DashScope.Core; +using Cnblogs.DashScope.Sdk.BaiChuan; using Cnblogs.DashScope.Sdk.UnitTests.Utils; using NSubstitute; diff --git a/test/Cnblogs.DashScope.Sdk.UnitTests/DashScopeClientTests.cs b/test/Cnblogs.DashScope.Sdk.UnitTests/DashScopeClientTests.cs index 6971cf6..8741448 100644 --- a/test/Cnblogs.DashScope.Sdk.UnitTests/DashScopeClientTests.cs +++ b/test/Cnblogs.DashScope.Sdk.UnitTests/DashScopeClientTests.cs @@ -1,4 +1,5 @@ -using FluentAssertions; +using Cnblogs.DashScope.Core; +using FluentAssertions; namespace Cnblogs.DashScope.Sdk.UnitTests; diff --git a/test/Cnblogs.DashScope.Sdk.UnitTests/ErrorTests.cs b/test/Cnblogs.DashScope.Sdk.UnitTests/ErrorTests.cs index 76a3b49..8f8296f 100644 --- a/test/Cnblogs.DashScope.Sdk.UnitTests/ErrorTests.cs +++ b/test/Cnblogs.DashScope.Sdk.UnitTests/ErrorTests.cs @@ -1,4 +1,5 @@ -using Cnblogs.DashScope.Sdk.UnitTests.Utils; +using Cnblogs.DashScope.Core; +using Cnblogs.DashScope.Sdk.UnitTests.Utils; using FluentAssertions; using NSubstitute; using NSubstitute.ExceptionExtensions; diff --git a/test/Cnblogs.DashScope.Sdk.UnitTests/Llama2TextGenerationApiTests.cs b/test/Cnblogs.DashScope.Sdk.UnitTests/Llama2TextGenerationApiTests.cs index 5ec0890..29c1a8c 100644 --- a/test/Cnblogs.DashScope.Sdk.UnitTests/Llama2TextGenerationApiTests.cs +++ b/test/Cnblogs.DashScope.Sdk.UnitTests/Llama2TextGenerationApiTests.cs @@ -1,4 +1,5 @@ -using Cnblogs.DashScope.Sdk.Llama2; +using Cnblogs.DashScope.Core; +using Cnblogs.DashScope.Sdk.Llama2; using Cnblogs.DashScope.Sdk.UnitTests.Utils; using NSubstitute; diff --git a/test/Cnblogs.DashScope.Sdk.UnitTests/MultimodalGenerationSerializationTests.cs b/test/Cnblogs.DashScope.Sdk.UnitTests/MultimodalGenerationSerializationTests.cs index c0e4238..ace9d1d 100644 --- a/test/Cnblogs.DashScope.Sdk.UnitTests/MultimodalGenerationSerializationTests.cs +++ b/test/Cnblogs.DashScope.Sdk.UnitTests/MultimodalGenerationSerializationTests.cs @@ -1,4 +1,5 @@ using System.Text; +using Cnblogs.DashScope.Core; using Cnblogs.DashScope.Sdk.UnitTests.Utils; using FluentAssertions; using NSubstitute; diff --git a/test/Cnblogs.DashScope.Sdk.UnitTests/QWenMultimodalApiTests.cs b/test/Cnblogs.DashScope.Sdk.UnitTests/QWenMultimodalApiTests.cs index 67421b5..b5cec43 100644 --- a/test/Cnblogs.DashScope.Sdk.UnitTests/QWenMultimodalApiTests.cs +++ b/test/Cnblogs.DashScope.Sdk.UnitTests/QWenMultimodalApiTests.cs @@ -1,4 +1,5 @@ -using Cnblogs.DashScope.Sdk.QWenMultimodal; +using Cnblogs.DashScope.Core; +using Cnblogs.DashScope.Sdk.QWenMultimodal; using Cnblogs.DashScope.Sdk.UnitTests.Utils; using NSubstitute; diff --git a/test/Cnblogs.DashScope.Sdk.UnitTests/QWenTextGenerationApiTests.cs b/test/Cnblogs.DashScope.Sdk.UnitTests/QWenTextGenerationApiTests.cs index de9fa99..ad9d5fb 100644 --- a/test/Cnblogs.DashScope.Sdk.UnitTests/QWenTextGenerationApiTests.cs +++ b/test/Cnblogs.DashScope.Sdk.UnitTests/QWenTextGenerationApiTests.cs @@ -1,4 +1,5 @@ -using Cnblogs.DashScope.Sdk.QWen; +using Cnblogs.DashScope.Core; +using Cnblogs.DashScope.Sdk.QWen; using Cnblogs.DashScope.Sdk.UnitTests.Utils; using NSubstitute; diff --git a/test/Cnblogs.DashScope.Sdk.UnitTests/ServiceCollectionInjectorTests.cs b/test/Cnblogs.DashScope.Sdk.UnitTests/ServiceCollectionInjectorTests.cs index 92d9f28..02230cc 100644 --- a/test/Cnblogs.DashScope.Sdk.UnitTests/ServiceCollectionInjectorTests.cs +++ b/test/Cnblogs.DashScope.Sdk.UnitTests/ServiceCollectionInjectorTests.cs @@ -1,4 +1,5 @@ using System.Net.Http.Headers; +using Cnblogs.DashScope.Core; using FluentAssertions; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; diff --git a/test/Cnblogs.DashScope.Sdk.UnitTests/TaskSerializationTests.cs b/test/Cnblogs.DashScope.Sdk.UnitTests/TaskSerializationTests.cs index f8e07b1..149d2db 100644 --- a/test/Cnblogs.DashScope.Sdk.UnitTests/TaskSerializationTests.cs +++ b/test/Cnblogs.DashScope.Sdk.UnitTests/TaskSerializationTests.cs @@ -1,4 +1,5 @@ -using Cnblogs.DashScope.Sdk.UnitTests.Utils; +using Cnblogs.DashScope.Core; +using Cnblogs.DashScope.Sdk.UnitTests.Utils; using FluentAssertions; namespace Cnblogs.DashScope.Sdk.UnitTests; diff --git a/test/Cnblogs.DashScope.Sdk.UnitTests/TextEmbeddingApiTests.cs b/test/Cnblogs.DashScope.Sdk.UnitTests/TextEmbeddingApiTests.cs index a030f43..bbe1abb 100644 --- a/test/Cnblogs.DashScope.Sdk.UnitTests/TextEmbeddingApiTests.cs +++ b/test/Cnblogs.DashScope.Sdk.UnitTests/TextEmbeddingApiTests.cs @@ -1,4 +1,5 @@ -using Cnblogs.DashScope.Sdk.TextEmbedding; +using Cnblogs.DashScope.Core; +using Cnblogs.DashScope.Sdk.TextEmbedding; using Cnblogs.DashScope.Sdk.UnitTests.Utils; using NSubstitute; diff --git a/test/Cnblogs.DashScope.Sdk.UnitTests/TextGenerationSerializationTests.cs b/test/Cnblogs.DashScope.Sdk.UnitTests/TextGenerationSerializationTests.cs index ea790e4..6e1b537 100644 --- a/test/Cnblogs.DashScope.Sdk.UnitTests/TextGenerationSerializationTests.cs +++ b/test/Cnblogs.DashScope.Sdk.UnitTests/TextGenerationSerializationTests.cs @@ -1,4 +1,5 @@ using System.Text; +using Cnblogs.DashScope.Core; using Cnblogs.DashScope.Sdk.UnitTests.Utils; using FluentAssertions; using NSubstitute; diff --git a/test/Cnblogs.DashScope.Sdk.UnitTests/TextGenerationStopConverterTests.cs b/test/Cnblogs.DashScope.Sdk.UnitTests/TextGenerationStopConverterTests.cs index 59b215c..26c4af3 100644 --- a/test/Cnblogs.DashScope.Sdk.UnitTests/TextGenerationStopConverterTests.cs +++ b/test/Cnblogs.DashScope.Sdk.UnitTests/TextGenerationStopConverterTests.cs @@ -1,4 +1,5 @@ using System.Text.Json; +using Cnblogs.DashScope.Core; using FluentAssertions; namespace Cnblogs.DashScope.Sdk.UnitTests; diff --git a/test/Cnblogs.DashScope.Sdk.UnitTests/Utils/Cases.cs b/test/Cnblogs.DashScope.Sdk.UnitTests/Utils/Cases.cs index da5d33d..ad439df 100644 --- a/test/Cnblogs.DashScope.Sdk.UnitTests/Utils/Cases.cs +++ b/test/Cnblogs.DashScope.Sdk.UnitTests/Utils/Cases.cs @@ -1,4 +1,6 @@ -namespace Cnblogs.DashScope.Sdk.UnitTests.Utils; +using Cnblogs.DashScope.Core; + +namespace Cnblogs.DashScope.Sdk.UnitTests.Utils; internal class Cases { diff --git a/test/Cnblogs.DashScope.Sdk.UnitTests/Utils/Snapshots.cs b/test/Cnblogs.DashScope.Sdk.UnitTests/Utils/Snapshots.cs index 4d938c2..87e4b77 100644 --- a/test/Cnblogs.DashScope.Sdk.UnitTests/Utils/Snapshots.cs +++ b/test/Cnblogs.DashScope.Sdk.UnitTests/Utils/Snapshots.cs @@ -1,4 +1,5 @@ -using Json.Schema; +using Cnblogs.DashScope.Core; +using Json.Schema; using Json.Schema.Generation; namespace Cnblogs.DashScope.Sdk.UnitTests.Utils; @@ -319,11 +320,11 @@ public static readonly Message = new( "assistant", string.Empty, - [ + ToolCalls: [ new( string.Empty, ToolTypes.Function, - new( + new FunctionCall( "get_current_weather", """{"location": "浙江省杭州市", "unit": "Celsius"}""")) ]) diff --git a/test/Cnblogs.DashScope.Sdk.UnitTests/Utils/Sut.cs b/test/Cnblogs.DashScope.Sdk.UnitTests/Utils/Sut.cs index d7d8c01..b6f1755 100644 --- a/test/Cnblogs.DashScope.Sdk.UnitTests/Utils/Sut.cs +++ b/test/Cnblogs.DashScope.Sdk.UnitTests/Utils/Sut.cs @@ -1,4 +1,5 @@ -using NSubstitute; +using Cnblogs.DashScope.Core; +using NSubstitute; using NSubstitute.Extensions; namespace Cnblogs.DashScope.Sdk.UnitTests.Utils; diff --git a/test/Cnblogs.DashScope.Sdk.UnitTests/WanxApiTests.cs b/test/Cnblogs.DashScope.Sdk.UnitTests/WanxApiTests.cs index c6251c4..5a2c830 100644 --- a/test/Cnblogs.DashScope.Sdk.UnitTests/WanxApiTests.cs +++ b/test/Cnblogs.DashScope.Sdk.UnitTests/WanxApiTests.cs @@ -1,4 +1,5 @@ -using Cnblogs.DashScope.Sdk.UnitTests.Utils; +using Cnblogs.DashScope.Core; +using Cnblogs.DashScope.Sdk.UnitTests.Utils; using Cnblogs.DashScope.Sdk.Wanx; using NSubstitute; using NSubstitute.Extensions; From c628b31b00701583ffdfd5a12f045d00f8efb91f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E6=98=9F=E7=B9=81?= Date: Thu, 14 Mar 2024 13:48:52 +0800 Subject: [PATCH 2/2] docs: adds breaking change warning in README.md --- README.md | 2 ++ README.zh-Hans.md | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8565b07..3358cc1 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ English | [简体中文](https://github.com/cnblogs/dashscope-sdk/blob/main/READ An unofficial DashScope SDK maintained by Cnblogs. +**Warning**: this project is under active development, **Breaking Changes** may introduced without notice or major version change. Make sure you read the Release Notes before upgrading. + # Quick Start ## Console App diff --git a/README.zh-Hans.md b/README.zh-Hans.md index 5ffb4ad..54f33ec 100644 --- a/README.zh-Hans.md +++ b/README.zh-Hans.md @@ -5,7 +5,9 @@ # Cnblogs.DashScopeSDK -由博客园维护并使用的非官方灵积服务 SDK +由博客园维护并使用的非官方灵积服务 SDK。 + +使用前注意:当前项目正在积极开发中,小版本也可能包含破坏性更改,升级前请查看对应版本 Release Note 进行迁移。 # 快速开始