Skip to content
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

🐳 feat: Deepseek Reasoning UI #5440

Merged
merged 1 commit into from
Jan 24, 2025
Merged

Conversation

danny-avila
Copy link
Owner

Summary

Adds simple reasoning UI for LLMs that clearly distinguish reasoning tokens from standard generation tokens (only deepseek-reasoner for now)

Once migrated to new agent framework, will include more metadata such as time elapsed thinking, dynamic thinking status, etc.

chrome_5XzmS9djv9

Change Type

  • New feature (non-breaking change which adds functionality)

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes
  • Any changes dependent on mine have been merged and published in downstream modules.
  • A pull request for updating the documentation has been submitted.

@danny-avila danny-avila merged commit 7818ae5 into main Jan 24, 2025
4 checks passed
@danny-avila danny-avila deleted the feat/deepseek-reasoning-ui branch January 24, 2025 15:52
@christiaangoossens
Copy link

Is this compatible with the deepseek-r1 ollama output as well? It uses <think> </think> as markers (even if that's not standard yet).

@michnovka
Copy link

Do we need to enable sth special to see the collapsible UI?

image

@danny-avila
Copy link
Owner Author

looks like your frontend is cached, you need to clear cache/localStorage

@danny-avila
Copy link
Owner Author

Is this compatible with the deepseek-r1 ollama output as well? It uses <think> </think> as markers (even if that's not standard yet).

no, didn't know it did this. I can add that soon

@danny-avila
Copy link
Owner Author

@christiaangoossens Which model/tag are you using with Ollama?

@peterhoang
Copy link

peterhoang commented Jan 24, 2025

looks like your frontend is cached, you need to clear cache/localStorage

I'm getting the same issue. I've tried clearing the cache/localStorage in my Chrome browser (Version 131.0.6778.265).

In the meantime, is there a flag or configuration we can set to force the UI to use this new feature?

@danny-avila
Copy link
Owner Author

Hi @peterhoang I see the issue now, I'll be patching it shortly

@christiaangoossens
Copy link

@christiaangoossens Which model/tag are you using with Ollama?

https://ollama.com/library/deepseek-r1, afaik all of them use <think> syntax.

@danny-avila
Copy link
Owner Author

danny-avila commented Jan 24, 2025

Got it the mentioned issues are now resolved here: #5456

@xhejtman
Copy link

Screenshot 2025-01-25 at 1 06 01 we are almost there with ollama deepseek-r1 (via preset)

@danny-avila
Copy link
Owner Author

@xhejtman I recommend using a different title model, since you'll get thoughts in those title generations. I can maybe think of a way to remove them, though

@xhejtman
Copy link

@xhejtman I recommend using a different title model, since you'll get thoughts in those title generations. I can maybe think of a way to remove them, though

thanks. However, as of the latest commit, DS R1 with ollama (no openrouter), it does not display thoughts in the main chat window at all, only in sidebar as you noticed.

@danny-avila
Copy link
Owner Author

@xhejtman it could be no thoughts were generated, I've noticed this is the case when you just say "hi."

Either this or you need to update Ollama (I thought the same thing until I got the latest version)

chrome_auDHDzh6LO

@xhejtman
Copy link

yes, you are right sorry, it is ok, I was confused by tag in the left sidebar supposing that it actualy returned as it is displayed.

@matthewknill
Copy link

matthewknill commented Jan 28, 2025

All the other models seem to work fine for me except for the deepseek-reasoner model:
image

Here are the relevant logs:

2025-01-28T00:10:12.183Z debug: [AskController]
{
  text: "What is 500 * 655",
  conversationId: "CONVERSATION_ID_1",
  endpoint: "Deepseek",
  endpointType: "custom",
  resendFiles: true,
  modelOptions.model: "deepseek-reasoner",
  modelsConfig: "exists",
}
2025-01-28T00:10:12.186Z debug: [BaseClient] Loading history:
{
  conversationId: "CONVERSATION_ID_1",
  parentMessageId: "PARENT_MESSAGE_ID_1",
}
2025-01-28T00:10:12.190Z debug: [BaseClient] Context Count (1/2)
{
  remainingContextTokens: 62986,
  maxContextTokens: 63000,
}
2025-01-28T00:10:12.190Z debug: [BaseClient] Context Count (2/2)
{
  remainingContextTokens: 62986,
  maxContextTokens: 63000,
}
2025-01-28T00:10:12.190Z debug: [BaseClient] tokenCountMap:
{
  MESSAGE_ID_1: 11,
}
2025-01-28T00:10:12.190Z debug: [BaseClient]
{
  promptTokens: 14,
  remainingContextTokens: 62986,
  payloadSize: 1,
  maxContextTokens: 63000,
}
2025-01-28T00:10:12.191Z debug: [BaseClient] tokenCountMap
{
  MESSAGE_ID_1: 11,
  instructions: undefined,
}
2025-01-28T00:10:12.191Z debug: [BaseClient] userMessage
{
  messageId: "MESSAGE_ID_1",
  parentMessageId: "PARENT_MESSAGE_ID_1",
  conversationId: "CONVERSATION_ID_1",
  sender: "User",
  text: "What is 500 * 655",
  isCreatedByUser: true,
  tokenCount: 11,
}
2025-01-28T00:10:12.191Z debug: [OpenAIClient] chatCompletion
{
  baseURL: "https://api.deepseek.com/v1",
  modelOptions.model: "deepseek-reasoner",
  modelOptions.user: "USER_ID_1",
  modelOptions.stream: true,
  // 1 message(s)
  modelOptions.messages: [{"role":"user","content":"What is 500 * 655"}],
}
2025-01-28T00:10:12.194Z debug: Making request to https://api.deepseek.com/v1/chat/completions
2025-01-28T00:10:12.200Z debug: [saveConvo] api/app/clients/BaseClient.js - saveMessageToDatabase #saveConvo
2025-01-28T00:11:12.223Z debug: [AskController] Request closed
2025-01-28T00:11:12.224Z debug: [AskController] Request aborted on close

@armikhael
Copy link

@michnovka Hi, it gives me the same error. It's not creating the Thinking component. Do I need to do something? I have a fork of the project and pulled the change, but it's not rendering for me.
Captura de pantalla 2025-01-28 a la(s) 3 07 33 p  m

@danny-avila
Copy link
Owner Author

@armikhael looking at your screenshot, it’s clear you don’t have the latest commits

@walbercardoso
Copy link
Contributor

Reference in new is

Same here...

@danny-avila does it work with any model? I tried with o1 and o1-mini... but it's not rendering...

@ErykCh
Copy link

ErykCh commented Jan 30, 2025

o1 and o1-mini they don't return their reasoning

@ErykCh
Copy link

ErykCh commented Jan 30, 2025

The functionality works great for me.

The only thing that could be changed is to automatically close the reasoning section once you start writing the actual answer.

justinmdickey pushed a commit to e-gineering/LibreChat that referenced this pull request Jan 30, 2025
justinmdickey pushed a commit to e-gineering/LibreChat that referenced this pull request Feb 7, 2025
@nikolaypavlov
Copy link

Hey @danny-avila Great feature. Thank you. It looks much better now. For whatever reason this feature doesn't work for the "Chat with Files" flow. Is this possible to fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants