摘要:LLM-Reasoner 是一个库,它让任何 LLM(大模型)都能像 OPENAI o1 和 DeepSeek R1 一样深入思考。
LLM-Reasoner 是一个库,它让任何 LLM(大模型)都能像 OPENAI o1 和 DeepSeek R1 一样深入思考。
✨主要特点
循序渐进的推理:不再有黑箱答案!准确了解 LLM 是如何思考的,类似于 O1 的系统方法
实时进度:通过流畅的动画观看推理的展开
多提供商支持:与 LiteLLM 支持的所有提供商兼容
精美的 UI:一个漂亮的 Streamlit 界面可供使用
️ 高级用户 CLI:无缝嵌入你的代码
信心跟踪:了解 LLM 对每个步骤的确定程度
首先安装:
pip install llm-reasonerexport OPENAI_API_KEY="sk-your-key"对于国内用户可以选择提供了与 OpenAI 接口兼容的模型或者是使用 llama_cpp_python 启动一个本地的 LLM 服务,这个服务接口与 OpenAI 接口兼容。
以下是一些简单的用法:
# 列当前所有可用模型llm-reasoner models# 生成一个推理链llm-reasoner reason "How do planes fly?" --min-steps 5#启动 UI 界面llm-reasoner ui或者直接在你的代码中使用:
from llm_reasoner import ReasonChainimport asyncioasync def main: # Create a chain with your preferred settings chain = ReasonChain( model="gpt-4", # Choose your model min_steps=3, # Minimum reasoning steps temperature=0.2, # Control creativity timeout=30.0 # Set your timeout ) # Watch it think step by step! async for step in chain.generate_with_metadata("Why is the sky blue?"): print(f"\nStep {step.number}: {step.title}") print(f"Thinking Time: {step.thinking_time:.2f}s") print(f"Confidence: {step.confidence:.2f}") print(step.content)asyncio.run(main)DeepSeek资料下载方式
本文,完。觉得本篇文章不错的,记得随手点个赞、收藏和转发三连,大家感兴趣的可以关注下,后续我再研究点新东西分享给大家⭐~
来源:AIGC研究社
免责声明:本站系转载,并不代表本网赞同其观点和对其真实性负责。如涉及作品内容、版权和其它问题,请在30日内与本站联系,我们将在第一时间删除内容!