Repository navigation
feat(embedding): return token limit details in the error - #21
Merged
Merged
Conversation
🟢 Tier S · Ready to mergeText-over-limit errors now retain the offending text index, token count, and limit, and the HTTP endpoint returns those details in a typed error object. Other error responses continue to use the existing string-valued
📂 Walkthrough · 5
Reviewed |
Memory benchmarkBase Model
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #20.
What changed
Text over the token limit still returns
400, anderroris now an object so callers can tell it apart from other400s and find the text:{"error":{"type":"text_too_long","message":"text at index 1 has 20002 tokens, the limit for nomic-embed-text is 2048","index":1,"tokens":20002,"limit":2048}}Other errors keep the
{"error":"message"}shape.Testing
cargo fmt,cargo clippy, 26 unit tests and 10 ignored e2e tests pass. The response was also checked through Appwrite'sPOST /v1/embeddings/textrunning against this build.