Skip to content

docs: make the homepage embedding example runnable - #944

Open
Yin123-ybh wants to merge 1 commit into
qdrant:mainfrom
Yin123-ybh:docs/fix-homepage-embedding-example
Open

Yin123-ybh wants to merge 1 commit into
qdrant:mainfrom
Yin123-ybh:docs/fix-homepage-embedding-example

Conversation

@Yin123-ybh

Copy link
Copy Markdown

What changed

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.

@Yin123-ybh
Yin123-ybh requested a review from joein as a code owner December 5, 2026 06:55
@coderabbitai

coderabbitai Bot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

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.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Suggested reviewers: hh-space-invader

Merge Risk: Minimal · up to fa105

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant