Skip to content

Latest commit

 

History

History
90 lines (70 loc) · 2.95 KB

README-CN.md

File metadata and controls

90 lines (70 loc) · 2.95 KB

AllInAI.Sharp.API.Sample

AllInAI.Sharp.API

中文简介 | English

AllInAI.Sharp.API的使用示例文档。AllInAI.Sharp.API一款调用各大平台语言模型的SDK,能帮助使用者快速对接各大模型。已整合OpenAI,chatGLM,文心千帆,同义千问,stable-diffusion 等 支持设置反向代理,支持流式接口 AllInAI SDK 在聊天和图片接口中整合统一的入参和出参。方便调用。

Version

* V1.1.5 添加openai 语音文字转换Translations接口,语音转英文
* V1.1.4 添加openai 语音文字转换接口whisper

* V1.1.3 修复文心千帆模型调用模型问题

* V1.1.2 修复文心千帆模型调用返回为空的问题

已完成模型有

  • OpenAI
  • chatGLM
  • 文心千帆
  • 同义千问
  • stable-diffusion

使用范例

发起聊天

1.设置基础配置: key -- 模型的秘钥key BaseUrl -- 代理地址 AIType -- 模型类型,对应枚举Enums.AITypeEnum

2.调用接口 1.chat

AuthOption authOption = new AuthOption() { Key = "sk-***", BaseUrl = "https://api.openai.com", AIType = Enums.AITypeEnum.OpenAi };

ChatService chatService = new ChatService(authOption);
CompletionReq completionReq = new CompletionReq();
List<MessageDto> messages = new List<MessageDto>();
messages.Add(new MessageDto() { Role = "user", Content = "Hello!" });
completionReq.Model = "gpt-3.5-turbo";
completionReq.Messages = messages;
CompletionRes completionRes = await chatService.Completion(completionReq);

2.image

AuthOption authOption = new AuthOption() {BaseUrl = "http://43.134.164.127:77", AIType = Enums.AITypeEnum.SD };
ImgService imgService = new ImgService(authOption);
Txt2ImgReq imgReq = new Txt2ImgReq();
imgReq.Steps = 20;
imgReq.Size = "1024x1024";
imgReq.N = 1;
imgReq.Prompt = "kitty";
imgReq.ResponseFormat = "b64_json";
ImgRes imgRes = await imgService.Txt2Img(imgReq);

如何贡献

Fork & Clone Create Feature/name(your github id)/issuexxx branch Commit with commit message, like solve issue xxx,add xxx Create Pull Request 如果你希望参与贡献,欢迎 Pull Requests,或给我们 Issues

捐赠

如果你觉得这个项目对你有帮助,可以请 raokun 喝杯咖啡表示支持,raokun 开源的动力离不开各位的支持和鼓励。

微信

支付宝