You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs: make the homepage embedding example runnable - #944
The homepage example references np.ndarray without importing NumPy. It also describes the iterator returned by TextEmbedding.embed() as a list. Copying the example into a Python 3.13 script raises NameError once the model loads.
The example now converts the iterator to a list and prints the first vector's shape. A short note explains how to iterate directly for larger inputs, and the public method docstring describes the same return behavior.
Verification
Ran the original and revised homepage snippets on macOS arm64 with CPython 3.13.13 and the default BAAI/bge-small-en-v1.5 model. The original raised NameError. The revised example produced four (384,) vectors.
Passed 53 targeted tests covering model metadata, tokenization setup, and sparse-vector utilities.
Built the MkDocs site and checked that the rendered homepage contained the exact runnable snippet.
Passed Ruff lint and format checks and git diff --check.
Followed the contribution guidelines.
Checked for competing pull requests.
OpenAI Codex assisted with the change and validation.
No actionable comments were generated in the recent review.
Walkthrough
The embed() documentation now describes an iterable that yields one embedding per document. The usage example converts the results to a list before printing the first embedding’s shape. The documentation recommends iterating over results for large inputs to avoid retaining all embeddings in memory.
This change fixes the homepage embedding example so it runs, and it clarifies that embed() returns an iterable. It does not change runtime behavior and is safe to merge.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: the homepage embedding example is updated so it runs. The PR converts the TextEmbedding.embed() iterator to a list in the docs example, adds the missing context, and u…
Description check
The description matches the changeset. It explains the missing NumPy import and the iterator-versus-list mismatch, then describes the docs example change, the note on direct iteration, and the docstri…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: the homepage embedding example is updated so it runs. The PR converts the TextEmbedding.embed() iterator to a list in the docs example, adds the missing context, and updates the docstring. The title is specific and matches the changeset, so the check passes.
Full details: Description check
Explanation
The description matches the changeset. It explains the missing NumPy import and the iterator-versus-list mismatch, then describes the docs example change, the note on direct iteration, and the docstring update. It also lists verification steps. The check passes.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: b0a9d93f-3a27-4fa2-b58f-d085f9173267
Commits
Reviewing files that changed from the base of the PR and between ac9ab5c and fa10557.
Files selected for processing: 2
docs/index.md
fastembed/text/text_embedding.py
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
This branch has not been deployed
No deployments
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
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.
What changed
The homepage example references
np.ndarraywithout importing NumPy. It also describes the iterator returned byTextEmbedding.embed()as a list. Copying the example into a Python 3.13 script raisesNameErroronce the model loads.The example now converts the iterator to a list and prints the first vector's shape. A short note explains how to iterate directly for larger inputs, and the public method docstring describes the same return behavior.
Verification
Ran the original and revised homepage snippets on macOS arm64 with CPython 3.13.13 and the default BAAI/bge-small-en-v1.5 model. The original raised
NameError. The revised example produced four(384,)vectors.Passed 53 targeted tests covering model metadata, tokenization setup, and sparse-vector utilities.
Built the MkDocs site and checked that the rendered homepage contained the exact runnable snippet.
Passed Ruff lint and format checks and
git diff --check.Followed the contribution guidelines.
Checked for competing pull requests.
OpenAI Codex assisted with the change and validation.