-
Notifications
You must be signed in to change notification settings - Fork 6
Feat reranker embeddinig #88
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
Conversation
实现 EmbedStringsExt 接口以支持返回完整的嵌入响应 添加相关领域模型定义和测试用例
重构嵌入响应结构,移除冗余的EmbeddingsOutput层级,直接使用Embeddings数组。同时更新相关文档和测试代码以反映这一变化。 - 将SparseEntry重命名为SparseEmbedding以保持命名一致性 - 更新测试用例和示例代码以使用新的响应结构 - 添加新的测试工具checkmodel用于模型验证 - 完善嵌入功能的使用文档
重构embedder模块,将EmbedderParam从ModelMetadata中分离为独立结构体 修复EmbeddingItem中Embedding字段的omitempty标签 优化bailian embedder的错误处理和响应解析 添加embedding和rerank模块的完整测试用例 更新文档,完善Embedding和Rerank的使用说明
更新README文件,简化描述并突出SDK功能。添加Chat.md文档,详细介绍Chat模型的使用方法、参数说明和示例代码。
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.
Pull request overview
This pull request adds embedding and reranker functionality to ModelKit, expanding the SDK to support three model types: Chat, Embedding, and Rerank. The implementation integrates with CloudWeGo Eino components and adds custom implementations for BaiLian (DashScope) API support.
Key Changes
- Added
GetEmbedder,GetReranker, andUseEmbedderfunctions to support embedding and reranking operations - Implemented BaiLian-specific embedder and reranker components with support for dense/sparse embeddings
- Refactored model checking logic to use the new unified embedder/reranker interfaces
- Added comprehensive test coverage for embedding and reranking functionality
- Updated documentation with new guides for Chat, Embedding, and Rerank features
Reviewed changes
Copilot reviewed 22 out of 24 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| usecase/modelkit.go | Added GetEmbedder, GetReranker, and UseEmbedder methods supporting multiple providers (OpenAI, BaiLian, Ollama, Volcengine, Azure) |
| usecase/helper.go | Refactored checkEmbeddingModel and checkRerankModel to use new embedder/reranker interfaces instead of raw HTTP calls |
| domain/embedder.go | Defined EmbeddingItem, SparseEmbedding, and EmbeddingsResponse types for extended embedding support |
| domain/reranker.go | Defined Reranker interface and related types (RerankRequest, RerankResponse, Result, Usage) |
| domain/model.go | Added EmbedderParam struct for embedding configuration (dimension, text type, output type, encoding format, instruct) |
| components/embedder/bailian/embedder.go | Implemented BaiLian embedder with support for dense/sparse embeddings and DashScope API |
| components/reranker/bailian/reranker.go | Implemented BaiLian reranker for qwen3-rerank model with BaiLian API format |
| components/reranker/baai/reranker.go | Implemented BAAI reranker for bge-reranker models with OpenAI-style API format |
| test/embedding_test.go | Comprehensive tests for embeddings covering BaiLian, OpenAI compatibility, and parameter combinations |
| test/rerank_test.go | Comprehensive tests for reranking covering BaiLian, BaiZhiCloud, and parameter combinations |
| test/checkmodel/main.go | Manual testing utility for embedding and rerank model validation |
| docs/Embedding.md | Documentation for embedding usage including dense, sparse, and combined embeddings |
| docs/Rerank.md | Documentation for reranker usage with examples |
| docs/Chat.md | Documentation for chat model usage |
| docs/ModelModal.md | Documentation for the model management UI component |
| README.md | Simplified main README with links to detailed documentation |
| go.mod | Updated dependencies including eino embedding components and samber/lo utility library |
| errcode/ | Removed unused error code localization package |
| Makefile | Added gofmt to lint target |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
refactor: 优化URL规范化逻辑,移除冗余条件判断 docs: 修正Embedding.md中的拼写错误和文档说明 test: 重构测试代码,增加组合测试用例并删除冗余文件
81de5cb to
cbe3264
Compare
No description provided.