Skip to content

Conversation

@Soulter
Copy link
Member

@Soulter Soulter commented Jan 18, 2026

Modifications / 改动点

  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果


Checklist / 检查清单

  • 😊 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。/ If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
  • 👀 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。/ My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
  • 🤓 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到了 requirements.txtpyproject.toml 文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
  • 😮 我的更改没有引入恶意代码。/ My changes do not introduce malicious code.

Summary by Sourcery

确保所有 embedding 提供方在配置中始终返回整数类型的 embedding 维度。

Bug 修复:

  • 将 Gemini embeddings 中配置的 embedding_dimensions 强制转换为整数。
  • 将 OpenAI embeddings 中配置的 embedding_dimensions 强制转换为整数。
Original summary in English

Summary by Sourcery

Ensure embedding providers always return integer embedding dimensions from configuration.

Bug Fixes:

  • Coerce configured embedding_dimensions to integers for Gemini embeddings.
  • Coerce configured embedding_dimensions to integers for OpenAI embeddings.

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jan 18, 2026
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我在这里给出了一些总体反馈:

  • 如果配置值是非数字字符串,使用 int()embedding_dimensions 进行类型转换会抛出 ValueError;建议在加载配置时就对该设置进行规范化/校验,或者在转换时使用更安全的方式,并提供清晰的错误信息,以避免难以排查的崩溃。
给 AI Agent 的提示
请根据这次代码审查中的评论进行修改:

## 总体评论
- 如果配置值是非数字字符串,使用 `int()``embedding_dimensions` 进行类型转换会抛出 `ValueError`;建议在加载配置时就对该设置进行规范化/校验,或者在转换时使用更安全的方式,并提供清晰的错误信息,以避免难以排查的崩溃。

Sourcery 对开源项目免费——如果你觉得我们的审查有帮助,欢迎分享 ✨
帮我变得更有用!请对每条评论点 👍 或 👎,我会根据你的反馈来改进后续的审查。
Original comment in English

Hey - I've left some high level feedback:

  • Casting embedding_dimensions with int() will raise a ValueError if the config value is a non-numeric string; consider normalizing/validating this setting at config load time or adding a safer conversion with a clear error message to avoid hard-to-diagnose crashes.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Casting `embedding_dimensions` with `int()` will raise a `ValueError` if the config value is a non-numeric string; consider normalizing/validating this setting at config load time or adding a safer conversion with a clear error message to avoid hard-to-diagnose crashes.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Soulter Soulter merged commit cb3825b into master Jan 18, 2026
5 checks passed
@dosubot dosubot bot added the area:provider The bug / feature is about AI Provider, Models, LLM Agent, LLM Agent Runner. label Jan 18, 2026
@Soulter Soulter deleted the perf/embed-provider-dim branch January 18, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:provider The bug / feature is about AI Provider, Models, LLM Agent, LLM Agent Runner. size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants