Documented compatible frameworks don't work out of the box

オープン
#13 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

  • #11 @fede-kamel による — マージされずにクローズ

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
python

調査の方向性

まず PR #11 と、ここで説明されている LangChain、PydanticAI、OpenAI Agents SDK の各統合に対応する既存の認証ヘルパーを確認してください。各フレームワークがカスタム httpx クライアントをどのように受け付けるかを確認し、そのうえで、提案された builder がサポート対象のフレームワークに対して OpenAI-Project ヘッダーと OCI 署名を処理できることを検証してください。完了条件は文書化された workaround と一致させ、追加のハックを必要とするフレームワークをサポートすると主張しないでください。

索引モデルが issue の本文から書いたものです。

説明

Problem

The OCI Enterprise AI Agents documentation states:

Compatible agent frameworks include: OpenAI Agents SDK, OpenAI Codex SDK, Microsoft Agent Framework, LangChain, LangGraph, CrewAI, AutoGen, LlamaIndex, Pydantic

None of these frameworks (besides the raw OpenAI SDK) work out of the box with the /openai/v1 endpoint. Two issues compound:

1. OpenAI-Project header is mandatory but non-standard

The /openai/v1 endpoint requires an OpenAI-Project header with the GenAI Project OCID on every request. The raw OpenAI SDK supports this via project=. But ChatOpenAI (LangChain), Agent (PydanticAI), LLM (CrewAI), etc. have no project parameter. There is no way to set this header through their public API without workarounds.

2. OCI IAM signing requires custom HTTP client

OCI IAM auth requires a custom httpx.Auth handler to sign requests. Only frameworks that accept a custom http_client= parameter can use it. Frameworks that create their own HTTP clients internally (CrewAI, AutoGen) cannot.

Impact

A developer following Oracle's docs will write:

from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
    model="openai.gpt-5.2",
    base_url="https://inference.generativeai.us-chicago-1.oci.oraclecloud.com/openai/v1",
    api_key=os.getenv("OCI_GENAI_API_KEY"),
    # project=PROJECT_OCID  ← doesn't exist in ChatOpenAI
)

This fails. Every other cloud provider's OpenAI-compatible endpoint (Together AI, Groq, Fireworks, Azure) works with these frameworks by just swapping base_url and api_key. OCI is the only one that requires workarounds.

Workaround

Pass a pre-configured httpx.Client with the OpenAI-Project header and OCI signing:

http_client = httpx.Client(
    auth=OciUserPrincipalAuth(profile_name="DEFAULT"),
    headers={"OpenAI-Project": PROJECT_OCID},
)
llm = ChatOpenAI(model=..., http_client=http_client, api_key="not-used", ...)

This works for LangChain, PydanticAI, and OpenAI Agents SDK (which accept http_client). CrewAI, AutoGen, and LlamaIndex require additional framework-specific hacks.

Proposal

Add builder functions to oci-genai-auth that encapsulate the workaround for each framework. PR #11 implements this for the frameworks that support it cleanly (LangChain, PydanticAI, OpenAI Agents SDK).

主要言語
Python
スター
5
フォーク
3
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

oracle-samples/oci-genai-auth-python のほかの issue

oracle-samples/oci-genai-auth-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。