-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.Net: New Feature: deepseek connector #10293
Comments
A connector would be great. I may use this on a project. Thankyou. |
I think you can already connect to deepSeek with the OpenAI Connector of Semantic Kernel. Check out this sample, where you can change the BaseUrl : |
A connector to deepseek will be a big plus. |
I checked this. |
@RogerBarreto do we have a .Net equivalent to this sample, where you can change the BaseUrl : |
@markwallace-microsoft I think this could be the right example for dotnet : https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Concepts/ChatCompletion/AzureOpenAI_CustomClient.cs But better @RogerBarreto verifies this, I am more in the Python SK Universe. |
I've tested it with the OpenAI connector, and it works fine for the deepseek-chat model 🚀 . Just like:
However, with the reasoning model deepseek-reasoner, it does not work. After ~1 minute I'm getting:
|
Also my first reasoning model, I too am getting the exact same error message. |
@roldengarm @DavidWynnII Thanks for the examples using the OpenAI Connector, I will be looking further how we can have a working example with the reasoner. |
I'm suspicious this is an error in the API for the moment, even querying it with Postman, I'm getting empty response after 60 seconds, might be related. Suggest waiting for the API to get back into a stable state. My result: 200 OK, without any content after exactly 60 seconds. |
I recommend prioritizing API resiliency as the primary focus for the new DeepSeek connector, given the current unreliability of the deepseek services. |
Ok, managed to test it against the API. As I could check the OpenAI connector was enough to work against the DeepSeek API. Important DeepSeek documentation makes use as well of the openai library in Your First API Call with Python If you want to capture the additional reasoning information from the message follow the guidance below with an extra breaking glass approach to capture the thinking (reasoning): Setup (Reasoner)var kernel = Kernel.CreateBuilder()
.AddOpenAIChatCompletion("deepseek-reasoner", new Uri("https://api.deepseek.com"), "sk-...")
.Build();
// Retrieve your chatService from the kernel
var service = kernel.GetRequiredService<IChatCompletionService>();
var chatHistory = new ChatHistory("You are a librarian, expert about books");
chatHistory.AddUserMessage("Hi, I'm looking for book suggestions"); Non-Streaming// Get the reply from deep seek
var reply = await chatService.GetChatMessageContentAsync(chatHistory);
// Getting the reasoning
var jsonContent = JsonNode.Parse(ModelReaderWriter.Write(reply.InnerContent!));
var reasoning = jsonContent!["choices"]![0]!["message"]!["reasoning_content"]; Streamingawait foreach (var update in chatService.GetStreamingChatMessageContentsAsync(chatHistory))
{
var jsonContent = JsonNode.Parse(ModelReaderWriter.Write(update.InnerContent!));
var reasoningUpdate = jsonContent!["choices"]![0]!["delta"]!["reasoning_content"];
Console.Write(update.Content);
Console.WriteLine(reasoningUpdate);
} As the OpenAI Connector is sufficient to retrieve the information initially the above approach may unblock you. We will discuss internally the need to add a connector or keep this as our recommendation. Also keep in mind that DeepSeek can run locally with the Ollama Connector (OllamaSharp). |
name: add deepseek connector
about: Deepseek is a great new service that has just been launched. Its prices are lower than openai. The R1 model even outperforms the O1 model.
site: https://www.deepseek.com/
api: https://api-docs.deepseek.com/
The text was updated successfully, but these errors were encountered: