[bot] Add AI21 Labs Python SDK integration for chat completions and embeddings instrumentation (54,424 weekly downloads)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- python
調査の方向性
まず py/src/braintrust/integrations/ 配下にある OpenAI または Mistral の統合パターンを比較し、次に py/noxfile.py と、issue に記載されている統合の登録およびバージョニング用ファイルを確認します。文書化されているメタデータを含め、同期および非同期の chat completions、ストリーミング、embeddings をカバーする実装を行い、統合のテスト、登録、バージョンエントリ、依存関係マトリックスのエントリを追加します。
索引モデルが issue の本文から書いたものです。
説明
Summary
The AI21 Python SDK (ai21) is the official Python client for AI21 Labs' inference platform, which provides the Jamba model family — hybrid SSM-Transformer models optimized for long-context tasks and high throughput. Its AI21Client and AsyncAI21Client expose client.chat.completions.create() and client.embed.create() APIs. This repository has zero instrumentation for any AI21 SDK surface — no integration directory, no wrapper, no patcher, no auto_instrument() support.
AI21's Python SDK uses its own client class (ai21.AI21Client), which is not a subclass of openai.OpenAI, so wrap_openai() cannot be used with it. The pattern is the same as Groq, Mistral, and OpenRouter — OpenAI-compatible endpoint but a distinct Python client requiring a dedicated integration. Users who follow AI21's official documentation and pip install ai21 get zero Braintrust tracing.
What needs to be instrumented
The ai21 package exposes these execution surfaces via AI21Client and AsyncAI21Client, none of which are instrumented:
Chat completions (highest priority)
| SDK Method | Description | Streaming | Return type |
|---|---|---|---|
client.chat.completions.create() |
Chat completions with tool calling, structured output, and document grounding | stream=True returns Stream[ChatCompletionChunk] |
ChatCompletion |
Response shape is OpenAI-compatible: ChatCompletion has choices, usage (prompt_tokens, completion_tokens, total_tokens), model, id — standard span metrics extraction follows the OpenAI pattern.
Streaming: stream=True returns a Stream[ChatCompletionChunk] iterator. The integration must handle the streaming span lifecycle.
Embeddings
| SDK Method | Description | Return type |
|---|---|---|
client.embed.create() |
Text embeddings generation for semantic search and RAG | EmbedResponse |
Both sync (AI21Client) and async (AsyncAI21Client) clients exist with identical method signatures.
Implementation notes
Stainless-generated SDK (v3.x): The ai21 v3.x package (current major version) is generated by Stainless (same toolchain as OpenAI, Groq, Mistral). The client structure mirrors the OpenAI SDK, so the patcher/wrapper pattern from the OpenAI or Mistral integration can serve as a close structural reference.
chat.completions.create() parameters relevant for span metadata: model, temperature, max_tokens, top_p, frequency_penalty, presence_penalty, n, stop, tools, tool_choice, response_format, documents (AI21-specific grounding feature).
Document grounding: The documents parameter is AI21-specific and allows grounding responses in provided documents. This should be captured in span input metadata when present.
Model family: Jamba 1.6 Large and Jamba 1.6 Mini are the primary models. Response model field should be captured in span metadata.
No coverage in any instrumentation layer
- No integration directory (
py/src/braintrust/integrations/ai21/) - No wrapper function (e.g.
wrap_ai21()) - No patcher in any existing integration
- No nox test session (
test_ai21) - No version entry in
py/src/braintrust/integrations/versioning.py - No mention in
py/src/braintrust/integrations/__init__.py - No entry in
[tool.braintrust.matrix]inpy/pyproject.toml
A grep for ai21 across py/src/braintrust/ returns zero matches.
Braintrust docs status
not_found — AI21 is not listed on the Braintrust integrations directory or the tracing guide.
Upstream references
- AI21 Python SDK on PyPI: https://pypi.org/project/ai21/
- AI21 Python SDK on GitHub: https://github.com/AI21Labs/ai21-python
- AI21 API reference: https://docs.ai21.com/reference/
- AI21 Chat Completions docs: https://docs.ai21.com/reference/jamba-15-api-ref
- AI21 Embeddings docs: https://docs.ai21.com/reference/embeddings-ref
- AI21 SDK quickstart: https://docs.ai21.com/docs/quickstart
Local repo files inspected
py/src/braintrust/integrations/— noai21/directory exists onmainpy/src/braintrust/wrappers/— no AI21 wrapperpy/noxfile.py— notest_ai21sessionpy/src/braintrust/integrations/__init__.py— AI21 not listed in integration registrypy/src/braintrust/integrations/versioning.py— no AI21 version matrixpy/pyproject.toml— no AI21 entries in[tool.braintrust.matrix]- Full repo grep for "ai21" across
py/src/braintrust/— zero matches
- 主要言語
- Python
- スター
- 21
- フォーク
- 23
- 平均マージ
- 21時間 8分
- マージ済み PR(30日)
- 81
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
braintrustdata/braintrust-sdk-python のほかの issue
-
[bot] Anthropic: MCP connector tool calls (`mcp_tool_use`/`mcp_tool_result`) are silently dropped from tool spans対応中かも @March-7 が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
braintrustdata/braintrust-sdk-python#797 ·
メンテナーはふだん 1 日以内に返信
-
[bot] Google GenAI: streaming responses drop `url_context_metadata` that non-streaming responses preserve対応中かも @Kayvan-Zahiri が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
braintrustdata/braintrust-sdk-python#774 ·
メンテナーはふだん 1 日以内に返信
-
Migrate legacy HTTPConnection callers to the policy-aware Transport incrementally対応中かも @AbhiPrasad が 3 日前に担当しました。 オープンpython
braintrustdata/braintrust-sdk-python#839 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
new-integration
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
braintrustdata/braintrust-sdk-python#808 ·
メンテナーはふだん 1 日以内に返信
-
new-integration
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
braintrustdata/braintrust-sdk-python#807 ·
メンテナーはふだん 1 日以内に返信
braintrustdata/braintrust-sdk-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Qiskit/qiskit-ibm-runtime#3431 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Lesson] A compatibility-gate rejection is a verdict, not something to overwrite with --accept-riskオープンlesson-submission needs-ac pending-review
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
Ikalus1988/MisakaNet#2870 ·
メンテナーはふだん 1 日以内に返信
-
feature:LinkChecker
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
digitalfabrik/integreat-cms#4594 ·
メンテナーはふだん 5 日以内に返信