Skip to content

[bot] Instrument FlagEmbedding (128,075 weekly downloads) #744

Description

@braintrust-bot

Summary

FlagEmbedding (BAAI's "BGE" retrieval toolkit) is a widely-used official embeddings/reranking execution library distinct from the already-instrumented local-inference libraries in this repo (sentence-transformers and huggingface_hub — per repo survey, only these two cover local/embedding execution today). FlagEmbedding ships its own model-loading and execution API (FlagModel, FlagReranker, FlagLLMReranker, FlagICLModel) that is not a thin layer over sentence-transformers or transformers.pipeline, and is not touched by either existing integration.

What needs to be instrumented

  • FlagModel.encode(sentences, ...) / FlagModel.encode_queries(...) / FlagModel.encode_corpus(...) — dense embedding execution
  • FlagReranker.compute_score(sentence_pairs, ...) — cross-encoder reranking execution
  • FlagLLMReranker.compute_score(...) and FlagICLModel.compute_score(...) — LLM-based reranker variants
  • Batch execution should log input count/shape and output as a compact span (per the embedding feature spec: one span per request, never log raw vectors), plus model name/checkpoint metadata

Weekly downloads

Weekly downloads: 128,075 (as of 2026-09-07; https://pypistats.org/packages/flagembedding)

Braintrust docs status

not_found — checked https://www.braintrust.dev/docs/integrations and https://www.braintrust.dev/docs/guides/tracing/integrations; neither lists FlagEmbedding/BAAI/BGE.

Upstream sources

Local repo files inspected

  • py/src/braintrust/integrations/ — no flagembedding/ directory (checked all 27 existing integration directories, including transformers/ and huggingface_hub/, neither of which reference FlagEmbedding)
  • py/pyproject.toml [tool.braintrust.matrix] — no flagembedding entry
  • py/noxfile.py — no test_flagembedding session
  • py/src/braintrust/integrations/versioning.py — no mention
  • Repo-wide case-insensitive grep for flagembedding under py/src/braintrust/ — zero matches

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions