Repository navigation
Go: implement Embed (embeddings) in Novita driver - #14895
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds Novita embedding URL/model config and implements ChangesNovita Embeddings Implementation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @Magicbook1108, gentle ping for review when you have a moment. This follows the same OpenAI-compatible |
Haruko386
left a comment
There was a problem hiding this comment.
Hi @pandadev66, please refer novita API reference for right url_suffix
|
Thanks for the review @Haruko386. Addressed in 2c59bae:
Could you re-run the test against Thanks again for catching the wrong path. |
Haruko386
left a comment
There was a problem hiding this comment.
@pandadev66 thank you for your contribution.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14895 +/- ##
=======================================
Coverage 94.16% 94.16%
=======================================
Files 10 10
Lines 703 703
Branches 112 112
=======================================
Hits 662 662
Misses 25 25
Partials 16 16 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
### What problem does this PR solve? Fixes #15012 The Novita Go driver landed in #14850 and shipped a stub `Rerank` method that returned `"novita, no such method"`, so Novita could not be used as a rerank provider in RAGFlow. This PR fills that gap, in the same way #14895 filled the Embed gap on the same driver. Novita exposes a public rerank endpoint at `POST https://api.novita.ai/openai/v1/rerank` that accepts the Cohere-compatible request shape (`{model, query, documents, top_n}`) with `Authorization: Bearer <api_key>`. `baai/bge-reranker-v2-m3` is documented in Novita's model library with a 1024-token limit.
What problem does this PR solve?
Fixes #14893
The Novita Go driver landed in #14850 and shipped a stub
Embedmethod that returned"novita, no such method", so Novita could not be used as an embedding provider in RAGFlow. This PR fills that gap.Novita exposes a public embeddings endpoint at
POST https://api.novita.ai/v3/embeddingsthat accepts the standard OpenAI-compatible request shape ({model, input}) withAuthorization: Bearer <api_key>. Two embedding models are documented in Novita's model library:baai/bge-m3(multilingual, 8192 tokens) andbaai/bge-large-en-v1.5.Changes
internal/entity/models/novita.go: implementNovitaModel.Embed.baseURLForRegionhelper.URLSuffix.Embedding(the embeddings path lives under/v3/, separate from the chat path under/openai/v1/).{model, input}POST body, adddimensionswhenembeddingConfig.Dimension > 0(matches the pattern in Go CLI: embed and rerank #14735).{data: [{embedding, index}]}and reorder byindex, rejecting out-of-range indices, duplicates, and missing entries so the output always lines up with the input. Same shape as the merged Mistral and Upstage Embed implementations.conf/models/novita.json:"embedding": "v3/embeddings"tourl_suffix.baai/bge-m3andbaai/bge-large-en-v1.5so they appear in the model picker.Type of change