Documented compatible frameworks don't work out of the box

Đang mở
#13 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

  • #11 của @fede-kamel — đã đóng, không merge

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python

Hướng nghiên cứu

Bắt đầu bằng việc xem xét PR #11 và các helper xác thực hiện có cho các tích hợp LangChain, PydanticAI và OpenAI Agents SDK được mô tả ở đây. Kiểm tra cách mỗi framework chấp nhận một httpx client tùy chỉnh, sau đó xác minh rằng các builder được đề xuất xử lý header OpenAI-Project và việc ký OCI cho các framework được hỗ trợ; phần hoàn thành phải khớp với workaround đã được ghi nhận, không tuyên bố hỗ trợ cho các framework cần thêm hack.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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).

Ngôn ngữ chính
Python
Star
5
Fork
3
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của oracle-samples/oci-genai-auth-python

Tất cả issue của oracle-samples/oci-genai-auth-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.