Semantic Kernel:接入本地deepseek-r1:1.5b
Ollama中deepseek排名的第一,下载次数是17M,第二名的llama 3.3是1.3M,可见火热度。
Ollama的具体地址见:https://ollama.com/search
我们用SK结合Ollama来测一下本地模型,首先安装Ollama,然后拉取deepseek-r1:1.5b到本地,下面是用SK的Ollama来加载1.5b。
using Microsoft.SemanticKernel; using Microsoft.SemanticKernel.ChatCompletion; using Microsoft.SemanticKernel.Connectors.Ollama; using OpenAI.Chat; using System.ComponentModel; #pragma warning disable var modelId = "deepseek-r1:1.5b"; var endpoint = new Uri("http://localhost:11434"); var builder = Kernel.CreateBuilder(); builder.Services.AddOllamaChatCompletion(modelId, endpoint); var kernel = builder.Build(); var chatCompletionService = kernel.GetRequiredService<IChatCompletionService>(); var streamContent = chatCompletionService.GetStreamingChatMessageContentsAsync("出几道勾股定理的题"); await foreach (var content in streamContent) { Console.Write(content.Content); }
下面是测试结果,不论他结果正确与否,这速是挺快,在本地跑效果还是挺好的(视频原速播放): 跳转公众号观看
https://mp.weixin.qq.com/s/KdhXed2_bqKituUKjSySoQ
依然没有支持function calling,在一定程度上对开发不够友好。从结果可以看出,deepseek-r1用了很大篇幅在推理,<think>过后才给出结果。
文章来源微信公众号
想要更快更方便的了解相关知识,可以关注微信公众号
****欢迎关注我的asp.net core系统课程****
《asp.net core精要讲解》 https://ke.qq.com/course/265696
《asp.net core 3.0》 https://ke.qq.com/course/437517
《asp.net core项目实战》 https://ke.qq.com/course/291868
《基于.net core微服务》 https://ke.qq.com/course/299524
《asp.net core精要讲解》 https://ke.qq.com/course/265696
《asp.net core 3.0》 https://ke.qq.com/course/437517
《asp.net core项目实战》 https://ke.qq.com/course/291868
《基于.net core微服务》 https://ke.qq.com/course/299524