Skip to content

Commit 23b70d3

Browse files
authored
Merge pull request #2 from oracle-samples/feedback
Addressing feedback before agenthub GA launch.
2 parents 6a81197 + 7adb4c5 commit 23b70d3

63 files changed

Lines changed: 131 additions & 112 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,14 @@ The **OCI GenAI Auth** Python library provides OCI request-signing helpers for t
77

88
## Table of Contents
99

10-
- [Before you start](#before-you-start)
1110
- [Using OCI IAM Auth](#using-oci-iam-auth)
1211
- [Using API Key Auth](#using-api-key-auth)
1312
- [Using AgentHub APIs (non-passthrough)](#using-agenthub-apis-non-passthrough)
1413
- [Using Partner APIs (passthrough)](#using-partner-apis-passthrough)
1514
- [Running the Examples](#running-the-examples)
16-
17-
## Before you start
18-
19-
**Important!**
20-
21-
Note that this package, as well as API keys package described below, only supports OpenAI, xAi Grok and Meta LLama models on OCI Generative AI.
22-
23-
Before you start using this package, determine if this is the right option for you.
24-
25-
If you are looking for a seamless way to port your code from an OpenAI compatible endpoint to OCI Generative AI endpoint, and you are currently using OpenAI-style API keys, you might want to use [OCI Generative AI API Keys](https://docs.oracle.com/en-us/iaas/Content/generative-ai/api-keys.htm) instead.
26-
27-
With OCI Generative AI API Keys, use the native `openai` SDK like before. Just update the `base_url`, create API keys in your OCI console, insure the policy granting the key access to generative AI services is present and you are good to go.
28-
29-
- Create an API key in Console: **Generative AI** -> **API Keys**
30-
- Create a security policy: **Identity & Security** -> **Policies**
31-
32-
To authorize a specific API Key
33-
```
34-
allow any-user to use generative-ai-family in compartment <compartment-name> where ALL { request.principal.type='generativeaiapikey', request.principal.id='ocid1.generativeaiapikey.oc1.us-chicago-1....' }
35-
```
36-
37-
To authorize any API Key
38-
```
39-
allow any-user to use generative-ai-family in compartment <compartment-name> where ALL { request.principal.type='generativeaiapikey' }
40-
```
15+
- [Contributing](#contributing)
16+
- [Security](#security)
17+
- [License](#license)
4118

4219
## Using OCI IAM Auth
4320

@@ -57,7 +34,7 @@ client = OpenAI(
5734

5835
## Using API Key Auth
5936

60-
Use OCI Generative AI API Keys if you want a direct API-key workflow with the OpenAI SDK.
37+
Use OCI Generative AI API Keys if you want a direct API-key workflow with the OpenAI SDK. In-order to create the OCI Generative AI API Keys, follow [this guide](https://docs.oracle.com/en-us/iaas/Content/generative-ai/api-keys.htm)
6138

6239
```python
6340
import os
@@ -115,3 +92,18 @@ client = OpenAI(
11592
3. Install optional dev dependencies: `pip install -e '.[dev]'`.
11693

11794
Run an example either by calling its `main()` method or from the command line.
95+
96+
## Contributing
97+
98+
*If your project has specific contribution requirements, update the CONTRIBUTING.md file to ensure those requirements are clearly explained*
99+
100+
This project welcomes contributions from the community. Before submitting a pull request, please [review our contribution guide](./CONTRIBUTING.md)
101+
102+
## Security
103+
104+
Please consult the [security guide](./SECURITY.md) for our responsible security vulnerability disclosure process
105+
106+
## License
107+
Copyright (c) 2026 Oracle and/or its affiliates.
108+
109+
Released under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl/.

examples/agenthub/openai/agents/basic_agents_example.py renamed to examples/agenthub/agents/basic_agents_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
from agents import Agent, Runner, set_default_openai_client, trace
1010

11-
from examples.agenthub.openai import common
11+
from examples.agenthub import common
1212

13-
MODEL = "openai.gpt-4o"
13+
MODEL = "xai.grok-4-1-fast-reasoning"
1414

1515
# Set the OCI OpenAI Client as the default client to use with OpenAI Agents
1616
set_default_openai_client(common.build_agenthub_async_client())
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,32 @@
1818
PROJECT_OCID = "<<ENTER_PROJECT_ID>>"
1919
REGION = "us-chicago-1"
2020

21-
AGENTHUB_OPENAI_URL = f"https://inference.generativeai.{REGION}.oci.oraclecloud.com/openai/v1"
22-
AGENTHUB_OPENAI_CP_URL = f"https://generativeai.{REGION}.oci.oraclecloud.com/20231130/openai/v1"
21+
AGENTHUB_URL = f"https://inference.generativeai.{REGION}.oci.oraclecloud.com/openai/v1"
22+
AGENTHUB_CP_URL = f"https://generativeai.{REGION}.oci.oraclecloud.com/20231130/openai/v1"
2323

2424

2525
def build_agenthub_client() -> OpenAI:
2626
return OpenAI(
27-
base_url=AGENTHUB_OPENAI_URL,
28-
api_key=os.getenv("OCI_GENAI_API_KEY", "not-used"),
27+
base_url=AGENTHUB_URL,
28+
api_key="not-used",
2929
project=os.getenv("OCI_GENAI_PROJECT_ID", PROJECT_OCID),
3030
http_client=httpx.Client(auth=OciSessionAuth(profile_name=PROFILE_NAME)),
3131
)
3232

3333

3434
def build_agenthub_async_client() -> AsyncOpenAI:
3535
return AsyncOpenAI(
36-
base_url=AGENTHUB_OPENAI_URL,
37-
api_key=os.getenv("OCI_GENAI_API_KEY", "not-used"),
36+
base_url=AGENTHUB_URL,
37+
api_key="not-used",
3838
project=os.getenv("OCI_GENAI_PROJECT_ID", PROJECT_OCID),
3939
http_client=httpx.AsyncClient(auth=OciSessionAuth(profile_name=PROFILE_NAME)),
4040
)
4141

4242

4343
def build_agenthub_cp_client() -> OpenAI:
4444
return OpenAI(
45-
base_url=AGENTHUB_OPENAI_CP_URL,
46-
api_key=os.getenv("OCI_GENAI_API_KEY", "not-used"),
45+
base_url=AGENTHUB_CP_URL,
46+
api_key="not-used",
4747
http_client=httpx.Client(auth=OciSessionAuth(profile_name=PROFILE_NAME)),
4848
project=os.getenv("OCI_GENAI_PROJECT_ID", PROJECT_OCID),
4949
default_headers={"opc-compartment-id": COMPARTMENT_ID},

examples/agenthub/openai/converstions/conversation_items_crud.py renamed to examples/agenthub/converstions/conversation_items_crud.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
"""Demonstrates CRUD operations for conversation items in AgentHub."""
55

6-
from examples.agenthub.openai import common
6+
from examples.agenthub import common
77

88

99
def main():

examples/agenthub/openai/converstions/conversations_crud.py renamed to examples/agenthub/converstions/conversations_crud.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
"""Demonstrates CRUD operations for conversations in AgentHub."""
55

6-
from examples.agenthub.openai import common
6+
from examples.agenthub import common
77

88

99
def main():

examples/agenthub/openai/files/files_crud.py renamed to examples/agenthub/files/files_crud.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from pathlib import Path
77

8-
from examples.agenthub.openai import common
8+
from examples.agenthub import common
99

1010

1111
def main():
File renamed without changes.

examples/agenthub/openai/function/create_response_fc_parallel_tool.py renamed to examples/agenthub/function/create_response_fc_parallel_tool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
from rich import print
77

8-
from examples.agenthub.openai import common
8+
from examples.agenthub import common
99
from examples.fc_tools import fc_tools
1010

11-
MODEL = "openai.gpt-4.1"
11+
MODEL = "xai.grok-4-1-fast-reasoning"
1212

1313

1414
def main():

examples/agenthub/openai/function/create_responses_fc.py renamed to examples/agenthub/function/create_responses_fc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
from openai.types.responses.response_input_param import FunctionCallOutput
1010
from rich import print
1111

12-
from examples.agenthub.openai import common
12+
from examples.agenthub import common
1313
from examples.fc_tools import execute_function_call, fc_tools
1414

15-
MODEL = "openai.gpt-4.1"
15+
MODEL = "xai.grok-4-1-fast-reasoning"
1616

1717

1818
def main():

0 commit comments

Comments
 (0)