{"id":26896904,"url":"https://github.com/GrayXu/openwebui-hybrid-thinking","last_synced_at":"2025-04-01T04:02:24.011Z","repository":{"id":282701034,"uuid":"948072926","full_name":"GrayXu/openwebui-hybrid-thinking","owner":"GrayXu","description":"hybrid thinking in openwebui","archived":false,"fork":false,"pushed_at":"2025-03-16T16:49:56.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T17:26:29.529Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GrayXu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-13T17:48:16.000Z","updated_at":"2025-03-16T16:50:00.000Z","dependencies_parsed_at":"2025-03-16T17:26:56.176Z","dependency_job_id":null,"html_url":"https://github.com/GrayXu/openwebui-hybrid-thinking","commit_stats":null,"previous_names":["grayxu/openwebui-hybrid-thinking-func","grayxu/openwebui-hybrid-thinking"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrayXu%2Fopenwebui-hybrid-thinking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrayXu%2Fopenwebui-hybrid-thinking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrayXu%2Fopenwebui-hybrid-thinking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrayXu%2Fopenwebui-hybrid-thinking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GrayXu","download_url":"https://codeload.github.com/GrayXu/openwebui-hybrid-thinking/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246580468,"owners_count":20800111,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-01T04:02:22.577Z","updated_at":"2025-04-01T04:02:24.002Z","avatar_url":"https://github.com/GrayXu.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# openwebui-hybrid-thinking\n\nA **Pipe** and **Filter** for [open-webui](https://github.com/open-webui/open-webui) to do ***hybrid-thinking***: you can use `DeepSeek R1` or `QwQ 32B` for cheap and fast thinking, and use stronger and more expensive models like `claude-3.7-Sonnet` for final summarization output, to achieve a better balance between inference cost and performance.\n\n[Aider LLM Leaderboards](https://aider.chat/docs/leaderboards/) and [DeepClaude](https://github.com/getAsterisk/deepclaude) shows the efficiency of hybrid thinking: `deepseek-r1` + `claude-3.5-sonnet` can achieve results very close to `claude-3.7-sonnet-thinking` at 1/3 of the cost.\n\nYou can install those scripts by importing:\n- **Pipe** (recommended): https://openwebui.com/f/grayxu/hybrid_thinking_pipe\n- **Filter**: https://openwebui.com/f/grayxu/hybrid_thinking\n\nThe filter version can be used with multiple derived models, but it doesn't support streaming the thought process (because filter doesn't support multiple stream requests?).   \nThe pipe version configures a pipe function corresponding to a hybrid thinking model, but it can support streaming all data.\n\nYou can set two booleans, `REASONING_CONTENT_AS_CONTEXT` and `CONTENT_AS_CONTEXT`, to control whether the reasoning and actual output are passed as context to the output model:\n- The default behavior is consistent with Deep Claude, where only the reasoning content is used as context. However, be aware that this might [confuse the output model](https://aider.chat/2025/01/24/r1-sonnet.html#thinking-output).\n- In practice, Aider only uses the final output of the reasoning model as context for the output model. If you want the same approach, set `REASONING_CONTENT_AS_CONTEXT=False` and `CONTENT_AS_CONTEXT=True`.\n\n---\n\n一个为 [open-webui](https://github.com/open-webui/open-webui) 提供的 **管道 (Pipe)** 和 **过滤器 (Filter)**，用于实现 ***混合思考 (hybrid-thinking)***：你可以使用 `DeepSeek R1` 或 `QwQ 32B` 进行廉价且快速的思考，然后使用更强大、更昂贵的模型（如 `claude-3.7-Sonnet`）进行最终的总结输出，从而在推理成本和性能之间取得更好的平衡。\n\n[Aider LLM 排行榜](https://aider.chat/docs/leaderboards/) 和 [DeepClaude](https://github.com/getAsterisk/deepclaude) 展示了混合思维的效率：`deepseek-r1` + `claude-3.5-sonnet` 可以以 1/3 的成本实现非常接近 `claude-3.7-sonnet-thinking` 的结果。\n\n你可以通过导入以下脚本来安装它们：\n- **管道 (Pipe)** (推荐): https://openwebui.com/f/grayxu/hybrid_thinking_pipe\n- **过滤器 (Filter)**: https://openwebui.com/f/grayxu/hybrid_thinking\n\n过滤器版本可以与多个派生模型一起使用，但它不支持流式传输思考过程（因为过滤器不支持多个流请求？）。\n管道版本配置一个与混合思维模型对应的管道函数，但它可以支持流式传输所有数据。\n\n你可以设置两个布尔值 `REASONING_CONTENT_AS_CONTEXT` 和 `CONTENT_AS_CONTEXT`，来控制是否将推理内容和实际输出作为上下文传递给输出模型：\n- 默认行为与 DeepClaude 一致，仅将推理内容用作上下文。但是，请注意这可能会让[输出模型混乱](https://aider.chat/2025/01/24/r1-sonnet.html#thinking-output)。\n- 在实践中，Aider 仅使用推理模型的最终输出作为输出模型的上下文。如果你想要相同的方法，请设置 `REASONING_CONTENT_AS_CONTEXT=False` 和 `CONTENT_AS_CONTEXT=True`。\n\n\n---\n\nref:\n- part of pipe codes from [charleskanp](https://openwebui.com/f/charleskanp/deepclaude_2)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGrayXu%2Fopenwebui-hybrid-thinking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGrayXu%2Fopenwebui-hybrid-thinking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGrayXu%2Fopenwebui-hybrid-thinking/lists"}