Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 3 additions & 28 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ This guide helps existing `oci-openai` users migrate to `oci-genai-auth`.
- Replace dependency `oci-openai` with `oci-genai-auth`.
- Continue using the `openai` Python SDK client.
- Use `OciSessionAuth` to sign requests with OCI IAM.
- Choose endpoint/config based on API mode.:
- AgentHub: `https://inference.generativeai.<region>.oci.oraclecloud.com/openai/v1` + `project`
- Partner : `https://inference.generativeai.<region>.oci.oraclecloud.com/20231130/actions/v1` + `opc-compartment-id`
- Use endpoint `https://inference.generativeai.<region>.oci.oraclecloud.com/openai/v1` with a `project` OCID.

## 1) Dependency Changes

Expand All @@ -30,8 +28,6 @@ from oci_openai import OciSessionAuth

## 3) Client Initialization Changes

### AgentHub

Use the OpenAI-compatible endpoint and provide project OCID:

```python
Expand All @@ -47,28 +43,7 @@ client = OpenAI(
)
```

### Partner APIs

Use `/v1` and include compartment header:

```python
import httpx
from openai import OpenAI
from oci_genai_auth import OciSessionAuth

client = OpenAI(
base_url="https://inference.generativeai.<region>.oci.oraclecloud.com/v1",
api_key="not-used",
default_headers={"opc-compartment-id": "<ocid1.compartment...>"},
http_client=httpx.Client(auth=OciSessionAuth(profile_name="DEFAULT")),
)
```

## 4) Endpoint and required parameters

- AgentHub:
- `base_url`: `https://inference.generativeai.<region>.oci.oraclecloud.com/openai/v1`
- required: `project=<PROJECT_OCID>`
- Partner:
- `base_url`: `https://inference.generativeai.<region>.oci.oraclecloud.com/v1`
- required header: `opc-compartment-id=<COMPARTMENT_OCID>`
- `base_url`: `https://inference.generativeai.<region>.oci.oraclecloud.com/openai/v1`
- required: `project=<PROJECT_OCID>`
30 changes: 2 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ The **OCI GenAI Auth** Python library provides OCI request-signing helpers for t
- [Using OCI IAM Auth](#using-oci-iam-auth)
- [Using API Key Auth](#using-api-key-auth)
- [Using AgentHub APIs](#using-agenthub-apis)
- [Using Partner APIs (passthrough)](#using-partner-apis-passthrough)
- [Running the Examples](#running-the-examples)
- [Examples](#examples)
- [Contributing](#contributing)
- [Security](#security)
- [License](#license)
Expand Down Expand Up @@ -86,33 +85,8 @@ client = OpenAI(
)
```

## Using Partner APIs (passthrough)

OCI also offers Partner API which passes through your calls to partners such as OpenAI. We will support more partners in the future.

You can leverage Partner API when you want to use OpenAI's API and GPT models, but with OCI auth and billing.

Note: Currently Partner API is only available to Oracle internal teams. Only features that meet partner's Zero Data Retention are available through Partner API.

If you want multi-provider model access and features unavailable under partner's Zero Data Retention (such as File Search), use the AgentHub APIs above.

```python
import httpx
from openai import OpenAI
from oci_genai_auth import OciSessionAuth

client = OpenAI(
base_url="https://inference.generativeai.us-chicago-1.oci.oraclecloud.com/20231130/actions/v1",
api_key="not-used",
default_headers={
"opc-compartment-id": "ocid1.compartment.oc1..aaaaaaaaexample",
},
http_client=httpx.Client(auth=OciSessionAuth(profile_name="DEFAULT")),
)
```

## Examples
Demo code and instructions on how to run them, for both agenthub and partner usecases can be found in ```examples``` folder.
Demo code and instructions on how to run them can be found in the ```examples``` folder.

## Contributing

Expand Down
29 changes: 0 additions & 29 deletions examples/partner/README.md

This file was deleted.

2 changes: 0 additions & 2 deletions examples/partner/__init__.py

This file was deleted.

39 changes: 0 additions & 39 deletions examples/partner/common.py

This file was deleted.

2 changes: 0 additions & 2 deletions examples/partner/openai/__init__.py

This file was deleted.

29 changes: 0 additions & 29 deletions examples/partner/openai/basic_chat_completion.py

This file was deleted.

37 changes: 0 additions & 37 deletions examples/partner/openai/basic_chat_completion_api_key.py

This file was deleted.

46 changes: 0 additions & 46 deletions examples/partner/openai/quickstart_openai_chat_completions.py

This file was deleted.

38 changes: 0 additions & 38 deletions examples/partner/openai/streaming_chat_completion.py

This file was deleted.

Loading
Loading