-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Fix/openrouter embeddings #286
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
base: main
Are you sure you want to change the base?
Conversation
…tegration, and add new documentation and tests.
Summary of ChangesHello @00make, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求为 TradingAgents 框架引入了对 DeepSeek API 的支持,并提供了全面的部署和使用文档。它通过在检测到 DeepSeek 或 OpenRouter API 配置时智能地禁用嵌入功能来解决这些 LLM 提供商不提供嵌入服务的问题,从而确保核心代理逻辑能够正常运行。 Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
本次代码变更主要是为了兼容 OpenRouter 和 DeepSeek 等不提供 embedding 接口的 LLM 服务。核心改动是在 memory.py 中增加了逻辑,当检测到使用这类服务时,禁用 embedding 功能并返回一个虚拟的 embedding 向量,从而避免了程序崩溃。
此外,本次变更还新增了大量的中文文档,包括:
deploy.md: 详细的部署工作流。DEEPSEEK_CONFIG.md: DeepSeek API 的专项配置指南。DEPLOYMENT_SUCCESS.md: 一份部署成功报告模板或示例。QUICK_START.md: 帮助用户快速上手的指南。test_simple.py: 一个用于快速验证核心功能的简化测试脚本。
整体来看,这些变更为项目增加了灵活性,并极大地改善了新用户的上手体验。代码修改方向正确,文档也非常详尽。我提出了一些关于文档清晰度和代码可维护性的小建议,以供参考。
|
|
||
| ### 2. 创建 Conda 虚拟环境 | ||
|
|
||
| // turbo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 复制示例环境文件: | ||
| python -m cli.main | ||
| ``` | ||
| 这将启动一个交互式界面,你可以选择: | ||
| - 股票代码(ticker) | ||
| - 日期 | ||
| - LLM 模型 | ||
| - 研究深度等参数 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| 运行以下命令验证环境配置正确: | ||
|
|
||
| // turbo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| config["deep_think_llm"] = "o1-mini" | ||
| config["quick_think_llm"] = "gpt-4o-mini" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if "deepseek" in config["backend_url"].lower() or "openrouter" in config["backend_url"].lower(): | ||
| self.use_embeddings = False | ||
| print(f"⚠️ API (DeepSeek/OpenRouter) 不支持 embeddings,{name} 记忆功能已禁用") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| """Get OpenAI embedding for a text""" | ||
| if not self.use_embeddings: | ||
| # Return a dummy embedding if embeddings are disabled | ||
| return [0.0] * 1536 # Standard embedding size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.