惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tailwind CSS Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
雷峰网
雷峰网
量子位
有赞技术团队
有赞技术团队
阮一峰的网络日志
阮一峰的网络日志
The Cloudflare Blog
博客园 - Franky
罗磊的独立博客
宝玉的分享
宝玉的分享
博客园_首页
腾讯CDC
The GitHub Blog
The GitHub Blog
D
DataBreaches.Net
IT之家
IT之家
D
Docker
Microsoft Security Blog
Microsoft Security Blog
博客园 - 司徒正美
V
V2EX
月光博客
月光博客
N
Netflix TechBlog - Medium
爱范儿
爱范儿
I
InfoQ
P
Proofpoint News Feed

博客园 - 桂素伟

Semantic Kernel:开启MCP Semantic Kernel:Phi-4 mini的tools .NET10:解决json序列化时引用自己 .NET10:字符数字 Semantic Kernel:接入azure中的deepseek-r1 C#中的Channel .NET9中基于策略角色验证的包冲突 .NET9中使用Options Semantic Kernel:OpenAPI的Plugin Semantic Kernel:Phi-4试用 AI应用开发的浅见 Semantic Kernel:Process Semantic Kernel:新Agent代理 UnitsNet 库简介 .NET9里WinForm更新了什么 SemanticKernel系列,AI系列,SmartFill介绍视频系列 更流畅的asp.net api的错误返回 用.srt字幕文件生成.wav语音 自制实时翻译小工具
Semantic Kernel:接入本地deepseek-r1:1.5b
桂素伟 · 2025-03-02 · via 博客园 - 桂素伟

  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