diff --git a/README.md b/README.md index e2a8b91..adbcb01 100644 --- a/README.md +++ b/README.md @@ -7,37 +7,14 @@ The **OCI GenAI Auth** Python library provides OCI request-signing helpers for t ## Table of Contents -- [Before you start](#before-you-start) - [Using OCI IAM Auth](#using-oci-iam-auth) - [Using API Key Auth](#using-api-key-auth) - [Using AgentHub APIs (non-passthrough)](#using-agenthub-apis-non-passthrough) - [Using Partner APIs (passthrough)](#using-partner-apis-passthrough) - [Running the Examples](#running-the-examples) - -## Before you start - -**Important!** - -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. - -Before you start using this package, determine if this is the right option for you. - -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. - -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. - -- Create an API key in Console: **Generative AI** -> **API Keys** -- Create a security policy: **Identity & Security** -> **Policies** - -To authorize a specific API Key -``` -allow any-user to use generative-ai-family in compartment where ALL { request.principal.type='generativeaiapikey', request.principal.id='ocid1.generativeaiapikey.oc1.us-chicago-1....' } -``` - -To authorize any API Key -``` -allow any-user to use generative-ai-family in compartment where ALL { request.principal.type='generativeaiapikey' } -``` +- [Contributing](#contributing) +- [Security](#security) +- [License](#license) ## Using OCI IAM Auth @@ -57,7 +34,7 @@ client = OpenAI( ## Using API Key Auth -Use OCI Generative AI API Keys if you want a direct API-key workflow with the OpenAI SDK. +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) ```python import os @@ -115,3 +92,18 @@ client = OpenAI( 3. Install optional dev dependencies: `pip install -e '.[dev]'`. Run an example either by calling its `main()` method or from the command line. + +## Contributing + +*If your project has specific contribution requirements, update the CONTRIBUTING.md file to ensure those requirements are clearly explained* + +This project welcomes contributions from the community. Before submitting a pull request, please [review our contribution guide](./CONTRIBUTING.md) + +## Security + +Please consult the [security guide](./SECURITY.md) for our responsible security vulnerability disclosure process + +## License +Copyright (c) 2026 Oracle and/or its affiliates. + +Released under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl/. \ No newline at end of file diff --git a/examples/agenthub/openai/agents/basic_agents_example.py b/examples/agenthub/agents/basic_agents_example.py similarity index 92% rename from examples/agenthub/openai/agents/basic_agents_example.py rename to examples/agenthub/agents/basic_agents_example.py index 144389a..735bdae 100644 --- a/examples/agenthub/openai/agents/basic_agents_example.py +++ b/examples/agenthub/agents/basic_agents_example.py @@ -8,9 +8,9 @@ from agents import Agent, Runner, set_default_openai_client, trace -from examples.agenthub.openai import common +from examples.agenthub import common -MODEL = "openai.gpt-4o" +MODEL = "xai.grok-4-1-fast-reasoning" # Set the OCI OpenAI Client as the default client to use with OpenAI Agents set_default_openai_client(common.build_agenthub_async_client()) diff --git a/examples/agenthub/openai/common.py b/examples/agenthub/common.py similarity index 71% rename from examples/agenthub/openai/common.py rename to examples/agenthub/common.py index 67b18ea..c66f35c 100644 --- a/examples/agenthub/openai/common.py +++ b/examples/agenthub/common.py @@ -18,14 +18,14 @@ PROJECT_OCID = "<>" REGION = "us-chicago-1" -AGENTHUB_OPENAI_URL = f"https://inference.generativeai.{REGION}.oci.oraclecloud.com/openai/v1" -AGENTHUB_OPENAI_CP_URL = f"https://generativeai.{REGION}.oci.oraclecloud.com/20231130/openai/v1" +AGENTHUB_URL = f"https://inference.generativeai.{REGION}.oci.oraclecloud.com/openai/v1" +AGENTHUB_CP_URL = f"https://generativeai.{REGION}.oci.oraclecloud.com/20231130/openai/v1" def build_agenthub_client() -> OpenAI: return OpenAI( - base_url=AGENTHUB_OPENAI_URL, - api_key=os.getenv("OCI_GENAI_API_KEY", "not-used"), + base_url=AGENTHUB_URL, + api_key="not-used", project=os.getenv("OCI_GENAI_PROJECT_ID", PROJECT_OCID), http_client=httpx.Client(auth=OciSessionAuth(profile_name=PROFILE_NAME)), ) @@ -33,8 +33,8 @@ def build_agenthub_client() -> OpenAI: def build_agenthub_async_client() -> AsyncOpenAI: return AsyncOpenAI( - base_url=AGENTHUB_OPENAI_URL, - api_key=os.getenv("OCI_GENAI_API_KEY", "not-used"), + base_url=AGENTHUB_URL, + api_key="not-used", project=os.getenv("OCI_GENAI_PROJECT_ID", PROJECT_OCID), http_client=httpx.AsyncClient(auth=OciSessionAuth(profile_name=PROFILE_NAME)), ) @@ -42,8 +42,8 @@ def build_agenthub_async_client() -> AsyncOpenAI: def build_agenthub_cp_client() -> OpenAI: return OpenAI( - base_url=AGENTHUB_OPENAI_CP_URL, - api_key=os.getenv("OCI_GENAI_API_KEY", "not-used"), + base_url=AGENTHUB_CP_URL, + api_key="not-used", http_client=httpx.Client(auth=OciSessionAuth(profile_name=PROFILE_NAME)), project=os.getenv("OCI_GENAI_PROJECT_ID", PROJECT_OCID), default_headers={"opc-compartment-id": COMPARTMENT_ID}, diff --git a/examples/agenthub/openai/converstions/conversation_items_crud.py b/examples/agenthub/converstions/conversation_items_crud.py similarity index 97% rename from examples/agenthub/openai/converstions/conversation_items_crud.py rename to examples/agenthub/converstions/conversation_items_crud.py index 0b1e210..9d2cdb9 100644 --- a/examples/agenthub/openai/converstions/conversation_items_crud.py +++ b/examples/agenthub/converstions/conversation_items_crud.py @@ -3,7 +3,7 @@ """Demonstrates CRUD operations for conversation items in AgentHub.""" -from examples.agenthub.openai import common +from examples.agenthub import common def main(): diff --git a/examples/agenthub/openai/converstions/conversations_crud.py b/examples/agenthub/converstions/conversations_crud.py similarity index 96% rename from examples/agenthub/openai/converstions/conversations_crud.py rename to examples/agenthub/converstions/conversations_crud.py index 25065b3..e0c5b2e 100644 --- a/examples/agenthub/openai/converstions/conversations_crud.py +++ b/examples/agenthub/converstions/conversations_crud.py @@ -3,7 +3,7 @@ """Demonstrates CRUD operations for conversations in AgentHub.""" -from examples.agenthub.openai import common +from examples.agenthub import common def main(): diff --git a/examples/agenthub/openai/__init__.py b/examples/agenthub/files/__init__.py similarity index 100% rename from examples/agenthub/openai/__init__.py rename to examples/agenthub/files/__init__.py diff --git a/examples/agenthub/openai/files/files_crud.py b/examples/agenthub/files/files_crud.py similarity index 96% rename from examples/agenthub/openai/files/files_crud.py rename to examples/agenthub/files/files_crud.py index e0c97a7..4be8b30 100644 --- a/examples/agenthub/openai/files/files_crud.py +++ b/examples/agenthub/files/files_crud.py @@ -5,7 +5,7 @@ from pathlib import Path -from examples.agenthub.openai import common +from examples.agenthub import common def main(): diff --git a/examples/agenthub/openai/files/sample_doc.pdf b/examples/agenthub/files/sample_doc.pdf similarity index 100% rename from examples/agenthub/openai/files/sample_doc.pdf rename to examples/agenthub/files/sample_doc.pdf diff --git a/examples/agenthub/openai/function/create_response_fc_parallel_tool.py b/examples/agenthub/function/create_response_fc_parallel_tool.py similarity index 92% rename from examples/agenthub/openai/function/create_response_fc_parallel_tool.py rename to examples/agenthub/function/create_response_fc_parallel_tool.py index f5b3fae..5df7c80 100644 --- a/examples/agenthub/openai/function/create_response_fc_parallel_tool.py +++ b/examples/agenthub/function/create_response_fc_parallel_tool.py @@ -5,10 +5,10 @@ from rich import print -from examples.agenthub.openai import common +from examples.agenthub import common from examples.fc_tools import fc_tools -MODEL = "openai.gpt-4.1" +MODEL = "xai.grok-4-1-fast-reasoning" def main(): diff --git a/examples/agenthub/openai/function/create_responses_fc.py b/examples/agenthub/function/create_responses_fc.py similarity index 97% rename from examples/agenthub/openai/function/create_responses_fc.py rename to examples/agenthub/function/create_responses_fc.py index 5de83d3..eb4ed29 100644 --- a/examples/agenthub/openai/function/create_responses_fc.py +++ b/examples/agenthub/function/create_responses_fc.py @@ -9,10 +9,10 @@ from openai.types.responses.response_input_param import FunctionCallOutput from rich import print -from examples.agenthub.openai import common +from examples.agenthub import common from examples.fc_tools import execute_function_call, fc_tools -MODEL = "openai.gpt-4.1" +MODEL = "xai.grok-4-1-fast-reasoning" def main(): diff --git a/examples/agenthub/openai/mcp/create_response_approval_flow.py b/examples/agenthub/mcp/create_response_approval_flow.py similarity index 93% rename from examples/agenthub/openai/mcp/create_response_approval_flow.py rename to examples/agenthub/mcp/create_response_approval_flow.py index 4e248d4..0a71db0 100644 --- a/examples/agenthub/openai/mcp/create_response_approval_flow.py +++ b/examples/agenthub/mcp/create_response_approval_flow.py @@ -5,9 +5,9 @@ from rich import print -from examples.agenthub.openai import common +from examples.agenthub import common -MODEL = "openai.gpt-4.1" +MODEL = "xai.grok-4-1-fast-reasoning" def main(): diff --git a/examples/agenthub/openai/mcp/create_response_two_mcp.py b/examples/agenthub/mcp/create_response_two_mcp.py similarity index 93% rename from examples/agenthub/openai/mcp/create_response_two_mcp.py rename to examples/agenthub/mcp/create_response_two_mcp.py index 4564d53..b5f50b4 100644 --- a/examples/agenthub/openai/mcp/create_response_two_mcp.py +++ b/examples/agenthub/mcp/create_response_two_mcp.py @@ -5,9 +5,9 @@ from rich import print -from examples.agenthub.openai import common +from examples.agenthub import common -MODEL = "openai.gpt-4.1" +MODEL = "xai.grok-4-1-fast-reasoning" def main(): diff --git a/examples/agenthub/openai/mcp/create_responses_mcp.py b/examples/agenthub/mcp/create_responses_mcp.py similarity index 93% rename from examples/agenthub/openai/mcp/create_responses_mcp.py rename to examples/agenthub/mcp/create_responses_mcp.py index 469fcd6..6666674 100644 --- a/examples/agenthub/openai/mcp/create_responses_mcp.py +++ b/examples/agenthub/mcp/create_responses_mcp.py @@ -5,9 +5,9 @@ from rich import print -from examples.agenthub.openai import common +from examples.agenthub import common -MODEL = "openai.gpt-4.1" +MODEL = "xai.grok-4-1-fast-reasoning" def main(): diff --git a/examples/agenthub/openai/mcp/create_responses_mcp_auth.py b/examples/agenthub/mcp/create_responses_mcp_auth.py similarity index 91% rename from examples/agenthub/openai/mcp/create_responses_mcp_auth.py rename to examples/agenthub/mcp/create_responses_mcp_auth.py index 42b3a31..7b21173 100644 --- a/examples/agenthub/openai/mcp/create_responses_mcp_auth.py +++ b/examples/agenthub/mcp/create_responses_mcp_auth.py @@ -5,9 +5,9 @@ from rich import print -from examples.agenthub.openai import common +from examples.agenthub import common -MODEL = "openai.gpt-4.1" +MODEL = "xai.grok-4-1-fast-reasoning" def main(): diff --git a/examples/agenthub/openai/files/__init__.py b/examples/agenthub/memory/__init__.py similarity index 100% rename from examples/agenthub/openai/files/__init__.py rename to examples/agenthub/memory/__init__.py diff --git a/examples/agenthub/openai/memory/long_term_memory.py b/examples/agenthub/memory/long_term_memory.py similarity index 96% rename from examples/agenthub/openai/memory/long_term_memory.py rename to examples/agenthub/memory/long_term_memory.py index 82d63c1..e4307bb 100644 --- a/examples/agenthub/openai/memory/long_term_memory.py +++ b/examples/agenthub/memory/long_term_memory.py @@ -5,7 +5,7 @@ import time -from examples.agenthub.openai import common +from examples.agenthub import common MODEL = "xai.grok-4-1-fast-reasoning" diff --git a/examples/agenthub/openai/memory/long_term_memory_access_policy.py b/examples/agenthub/memory/long_term_memory_access_policy.py similarity index 94% rename from examples/agenthub/openai/memory/long_term_memory_access_policy.py rename to examples/agenthub/memory/long_term_memory_access_policy.py index 4f64c65..6583d73 100644 --- a/examples/agenthub/openai/memory/long_term_memory_access_policy.py +++ b/examples/agenthub/memory/long_term_memory_access_policy.py @@ -5,9 +5,9 @@ import time -from examples.agenthub.openai import common +from examples.agenthub import common -MODEL = "openai.gpt-5.1" +MODEL = "xai.grok-4-1-fast-reasoning" def main(): diff --git a/examples/agenthub/openai/memory/short_term_memory_optimization.py b/examples/agenthub/memory/short_term_memory_optimization.py similarity index 97% rename from examples/agenthub/openai/memory/short_term_memory_optimization.py rename to examples/agenthub/memory/short_term_memory_optimization.py index c201727..d71a018 100644 --- a/examples/agenthub/openai/memory/short_term_memory_optimization.py +++ b/examples/agenthub/memory/short_term_memory_optimization.py @@ -3,7 +3,7 @@ """Demonstrates short-term memory optimization in AgentHub.""" -from examples.agenthub.openai import common +from examples.agenthub import common MODEL = "xai.grok-4-1-fast-reasoning" diff --git a/examples/agenthub/openai/memory/__init__.py b/examples/agenthub/multiturn/__init__.py similarity index 100% rename from examples/agenthub/openai/memory/__init__.py rename to examples/agenthub/multiturn/__init__.py diff --git a/examples/agenthub/openai/multiturn/conversations_api.py b/examples/agenthub/multiturn/conversations_api.py similarity index 95% rename from examples/agenthub/openai/multiturn/conversations_api.py rename to examples/agenthub/multiturn/conversations_api.py index df9ea79..52baf46 100644 --- a/examples/agenthub/openai/multiturn/conversations_api.py +++ b/examples/agenthub/multiturn/conversations_api.py @@ -3,7 +3,7 @@ """Demonstrates a multi-turn flow using the Conversations API.""" -from examples.agenthub.openai import common +from examples.agenthub import common MODEL = "xai.grok-4-1-fast-reasoning" diff --git a/examples/agenthub/openai/multiturn/responses_chaining.py b/examples/agenthub/multiturn/responses_chaining.py similarity index 94% rename from examples/agenthub/openai/multiturn/responses_chaining.py rename to examples/agenthub/multiturn/responses_chaining.py index d78af26..3d52a8a 100644 --- a/examples/agenthub/openai/multiturn/responses_chaining.py +++ b/examples/agenthub/multiturn/responses_chaining.py @@ -3,7 +3,7 @@ """Demonstrates chaining responses across multiple turns.""" -from examples.agenthub.openai import common +from examples.agenthub import common model = "xai.grok-4-1-fast-reasoning" diff --git a/examples/agenthub/openai/vector_stores/__init__.py b/examples/agenthub/openai/vector_stores/__init__.py deleted file mode 100644 index b38e643..0000000 --- a/examples/agenthub/openai/vector_stores/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# Copyright (c) 2026 Oracle and/or its affiliates. -# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ diff --git a/examples/agenthub/openai/quickstart_responses_create_api_key.py b/examples/agenthub/quickstart_responses_create_api_key.py similarity index 94% rename from examples/agenthub/openai/quickstart_responses_create_api_key.py rename to examples/agenthub/quickstart_responses_create_api_key.py index 10c53f3..7c41172 100644 --- a/examples/agenthub/openai/quickstart_responses_create_api_key.py +++ b/examples/agenthub/quickstart_responses_create_api_key.py @@ -16,7 +16,7 @@ from openai import OpenAI -from examples.agenthub.openai.common import PROJECT_OCID +from examples.agenthub.common import PROJECT_OCID def main(): diff --git a/examples/agenthub/openai/quickstart_responses_create_oci_iam.py b/examples/agenthub/quickstart_responses_create_oci_iam.py similarity index 93% rename from examples/agenthub/openai/quickstart_responses_create_oci_iam.py rename to examples/agenthub/quickstart_responses_create_oci_iam.py index e3494a4..0851813 100644 --- a/examples/agenthub/openai/quickstart_responses_create_oci_iam.py +++ b/examples/agenthub/quickstart_responses_create_oci_iam.py @@ -11,7 +11,7 @@ 3. Run this script """ -from examples.agenthub.openai import common +from examples.agenthub import common def main(): diff --git a/examples/agenthub/openai/responses/Cat.jpg b/examples/agenthub/responses/Cat.jpg similarity index 100% rename from examples/agenthub/openai/responses/Cat.jpg rename to examples/agenthub/responses/Cat.jpg diff --git a/examples/agenthub/openai/multiturn/__init__.py b/examples/agenthub/responses/__init__.py similarity index 100% rename from examples/agenthub/openai/multiturn/__init__.py rename to examples/agenthub/responses/__init__.py diff --git a/examples/agenthub/openai/responses/create_response.py b/examples/agenthub/responses/create_response.py similarity index 91% rename from examples/agenthub/openai/responses/create_response.py rename to examples/agenthub/responses/create_response.py index c44bafc..6a0fed5 100644 --- a/examples/agenthub/openai/responses/create_response.py +++ b/examples/agenthub/responses/create_response.py @@ -3,7 +3,7 @@ """Demonstrates creating a response with the Responses API on AgentHub.""" -from examples.agenthub.openai import common +from examples.agenthub import common def main(): diff --git a/examples/agenthub/openai/responses/create_response_store_false.py b/examples/agenthub/responses/create_response_store_false.py similarity index 94% rename from examples/agenthub/openai/responses/create_response_store_false.py rename to examples/agenthub/responses/create_response_store_false.py index 0b10267..6beae61 100644 --- a/examples/agenthub/openai/responses/create_response_store_false.py +++ b/examples/agenthub/responses/create_response_store_false.py @@ -3,7 +3,7 @@ """Demonstrates creating a response with storage disabled using the Responses API.""" -from examples.agenthub.openai import common +from examples.agenthub import common def main(): diff --git a/examples/agenthub/openai/responses/delete_response.py b/examples/agenthub/responses/delete_response.py similarity index 93% rename from examples/agenthub/openai/responses/delete_response.py rename to examples/agenthub/responses/delete_response.py index d2d0553..59575b2 100644 --- a/examples/agenthub/openai/responses/delete_response.py +++ b/examples/agenthub/responses/delete_response.py @@ -3,7 +3,7 @@ """Demonstrates deleting a response from the Responses API.""" -from examples.agenthub.openai import common +from examples.agenthub import common def main(): diff --git a/examples/agenthub/openai/responses/file_input_with_file_id.py b/examples/agenthub/responses/file_input_with_file_id.py similarity index 96% rename from examples/agenthub/openai/responses/file_input_with_file_id.py rename to examples/agenthub/responses/file_input_with_file_id.py index 47da9dd..ef245ea 100644 --- a/examples/agenthub/openai/responses/file_input_with_file_id.py +++ b/examples/agenthub/responses/file_input_with_file_id.py @@ -3,7 +3,7 @@ """Demonstrates providing file input by file ID to the Responses API.""" -from examples.agenthub.openai import common +from examples.agenthub import common def main(): diff --git a/examples/agenthub/openai/responses/file_input_with_file_url.py b/examples/agenthub/responses/file_input_with_file_url.py similarity index 95% rename from examples/agenthub/openai/responses/file_input_with_file_url.py rename to examples/agenthub/responses/file_input_with_file_url.py index 7a00e79..131b504 100644 --- a/examples/agenthub/openai/responses/file_input_with_file_url.py +++ b/examples/agenthub/responses/file_input_with_file_url.py @@ -3,7 +3,7 @@ """Demonstrates providing file input by URL to the Responses API.""" -from examples.agenthub.openai import common +from examples.agenthub import common def main(): diff --git a/examples/agenthub/openai/responses/get_response.py b/examples/agenthub/responses/get_response.py similarity index 93% rename from examples/agenthub/openai/responses/get_response.py rename to examples/agenthub/responses/get_response.py index adde2a4..ca15b1c 100644 --- a/examples/agenthub/openai/responses/get_response.py +++ b/examples/agenthub/responses/get_response.py @@ -3,7 +3,7 @@ """Demonstrates retrieving a response from the Responses API.""" -from examples.agenthub.openai import common +from examples.agenthub import common def main(): diff --git a/examples/agenthub/openai/responses/image_input_with_base64.py b/examples/agenthub/responses/image_input_with_base64.py similarity index 96% rename from examples/agenthub/openai/responses/image_input_with_base64.py rename to examples/agenthub/responses/image_input_with_base64.py index e9be2b0..b26649c 100644 --- a/examples/agenthub/openai/responses/image_input_with_base64.py +++ b/examples/agenthub/responses/image_input_with_base64.py @@ -6,7 +6,7 @@ import base64 from pathlib import Path -from examples.agenthub.openai import common +from examples.agenthub import common def encode_image(image_path): diff --git a/examples/agenthub/openai/responses/image_input_with_url.py b/examples/agenthub/responses/image_input_with_url.py similarity index 95% rename from examples/agenthub/openai/responses/image_input_with_url.py rename to examples/agenthub/responses/image_input_with_url.py index 6207edc..980711d 100644 --- a/examples/agenthub/openai/responses/image_input_with_url.py +++ b/examples/agenthub/responses/image_input_with_url.py @@ -3,7 +3,7 @@ """Demonstrates providing image input via URL to the Responses API.""" -from examples.agenthub.openai import common +from examples.agenthub import common def main(): diff --git a/examples/agenthub/openai/responses/reasoning.py b/examples/agenthub/responses/reasoning.py similarity index 92% rename from examples/agenthub/openai/responses/reasoning.py rename to examples/agenthub/responses/reasoning.py index 7224283..1bff4f3 100644 --- a/examples/agenthub/openai/responses/reasoning.py +++ b/examples/agenthub/responses/reasoning.py @@ -3,8 +3,9 @@ """Demonstrates a reasoning-style Responses API request.""" -from examples.agenthub.openai import common +from examples.agenthub import common +MODEL="openai.gpt-oss-120b" def main(): client = common.build_agenthub_client() @@ -15,7 +16,7 @@ def main(): """ response = client.responses.create( - model="openai.gpt-oss-120b", + model=MODEL, input=prompt, reasoning={"effort": "medium", "summary": "detailed"}, stream=True, diff --git a/examples/agenthub/openai/responses/streaming_text_delta.py b/examples/agenthub/responses/streaming_text_delta.py similarity index 93% rename from examples/agenthub/openai/responses/streaming_text_delta.py rename to examples/agenthub/responses/streaming_text_delta.py index 5180be2..ab22562 100644 --- a/examples/agenthub/openai/responses/streaming_text_delta.py +++ b/examples/agenthub/responses/streaming_text_delta.py @@ -3,7 +3,7 @@ """Demonstrates streaming Responses API output and handling text deltas.""" -from examples.agenthub.openai import common +from examples.agenthub import common def main(): diff --git a/examples/agenthub/openai/responses/structured_output.py b/examples/agenthub/responses/structured_output.py similarity index 95% rename from examples/agenthub/openai/responses/structured_output.py rename to examples/agenthub/responses/structured_output.py index 0633ad2..43f9b33 100644 --- a/examples/agenthub/openai/responses/structured_output.py +++ b/examples/agenthub/responses/structured_output.py @@ -5,7 +5,7 @@ from pydantic import BaseModel -from examples.agenthub.openai import common +from examples.agenthub import common class CalendarEvent(BaseModel): diff --git a/examples/agenthub/responses/use_google_gemini_model.py b/examples/agenthub/responses/use_google_gemini_model.py new file mode 100644 index 0000000..ae1a569 --- /dev/null +++ b/examples/agenthub/responses/use_google_gemini_model.py @@ -0,0 +1,21 @@ +# Copyright (c) 2026 Oracle and/or its affiliates. +# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ + +"""Demonstrates using a GPT model with the Responses API.""" + +from examples.agenthub import common + +MODEL="google.gemini-2.5-pro" + +def main(): + client = common.build_agenthub_client() + + response = client.responses.create( + model=MODEL, + input="What is 2x2?", + ) + print(response.output_text) + + +if __name__ == "__main__": + main() diff --git a/examples/agenthub/openai/responses/use_gpt_model.py b/examples/agenthub/responses/use_gpt_model.py similarity index 84% rename from examples/agenthub/openai/responses/use_gpt_model.py rename to examples/agenthub/responses/use_gpt_model.py index fb76f1c..ba11ef0 100644 --- a/examples/agenthub/openai/responses/use_gpt_model.py +++ b/examples/agenthub/responses/use_gpt_model.py @@ -3,14 +3,15 @@ """Demonstrates using a GPT model with the Responses API.""" -from examples.agenthub.openai import common +from examples.agenthub import common +MODEL="openai.gpt-5.2" def main(): client = common.build_agenthub_client() response = client.responses.create( - model="openai.gpt-5.2", + model=MODEL, input="What is 2x2?", ) print(response.output_text) diff --git a/examples/agenthub/openai/responses/use_gptoss_model_dac.py b/examples/agenthub/responses/use_gptoss_model_dac.py similarity index 91% rename from examples/agenthub/openai/responses/use_gptoss_model_dac.py rename to examples/agenthub/responses/use_gptoss_model_dac.py index ed8764b..710c164 100644 --- a/examples/agenthub/openai/responses/use_gptoss_model_dac.py +++ b/examples/agenthub/responses/use_gptoss_model_dac.py @@ -3,7 +3,7 @@ """Demonstrates using a GPT OSS DAC model with the Responses API.""" -from examples.agenthub.openai import common +from examples.agenthub import common def main(): diff --git a/examples/agenthub/openai/responses/use_gptoss_model_ondemand.py b/examples/agenthub/responses/use_gptoss_model_ondemand.py similarity index 83% rename from examples/agenthub/openai/responses/use_gptoss_model_ondemand.py rename to examples/agenthub/responses/use_gptoss_model_ondemand.py index 25400d1..9680174 100644 --- a/examples/agenthub/openai/responses/use_gptoss_model_ondemand.py +++ b/examples/agenthub/responses/use_gptoss_model_ondemand.py @@ -3,14 +3,15 @@ """Demonstrates using a GPT OSS on-demand model with the Responses API.""" -from examples.agenthub.openai import common +from examples.agenthub import common +MODEL="openai.gpt-oss-120b" def main(): client = common.build_agenthub_client() response = client.responses.create( - model="openai.gpt-oss-120b", + model=MODEL, input="What is 2x2?", ) print(response.output_text) diff --git a/examples/agenthub/openai/responses/use_grok_model.py b/examples/agenthub/responses/use_grok_model.py similarity index 91% rename from examples/agenthub/openai/responses/use_grok_model.py rename to examples/agenthub/responses/use_grok_model.py index 9d2cab4..9d0332c 100644 --- a/examples/agenthub/openai/responses/use_grok_model.py +++ b/examples/agenthub/responses/use_grok_model.py @@ -3,7 +3,7 @@ """Demonstrates using a Grok model with the Responses API.""" -from examples.agenthub.openai import common +from examples.agenthub import common def main(): diff --git a/examples/agenthub/openai/responses/__init__.py b/examples/agenthub/tools/__init__.py similarity index 100% rename from examples/agenthub/openai/responses/__init__.py rename to examples/agenthub/tools/__init__.py diff --git a/examples/agenthub/openai/tools/code_interpreter.py b/examples/agenthub/tools/code_interpreter.py similarity index 94% rename from examples/agenthub/openai/tools/code_interpreter.py rename to examples/agenthub/tools/code_interpreter.py index e749d28..a619ffa 100644 --- a/examples/agenthub/openai/tools/code_interpreter.py +++ b/examples/agenthub/tools/code_interpreter.py @@ -3,7 +3,7 @@ """Demonstrates the code_interpreter tool in AgentHub.""" -from examples.agenthub.openai import common +from examples.agenthub import common def main(): diff --git a/examples/agenthub/openai/tools/file_search.py b/examples/agenthub/tools/file_search.py similarity index 93% rename from examples/agenthub/openai/tools/file_search.py rename to examples/agenthub/tools/file_search.py index 573a723..a52c580 100644 --- a/examples/agenthub/openai/tools/file_search.py +++ b/examples/agenthub/tools/file_search.py @@ -3,7 +3,7 @@ """Demonstrates the file_search tool in AgentHub.""" -from examples.agenthub.openai import common +from examples.agenthub import common VECTOR_STORE_ID = "<>" diff --git a/examples/agenthub/openai/tools/function_calling.py b/examples/agenthub/tools/function_calling.py similarity index 98% rename from examples/agenthub/openai/tools/function_calling.py rename to examples/agenthub/tools/function_calling.py index 22d50d9..be2268a 100644 --- a/examples/agenthub/openai/tools/function_calling.py +++ b/examples/agenthub/tools/function_calling.py @@ -8,7 +8,7 @@ from openai.types.responses import ResponseFunctionToolCall from openai.types.responses.response_input_param import FunctionCallOutput -from examples.agenthub.openai import common +from examples.agenthub import common model = "xai.grok-4-1-fast-reasoning" diff --git a/examples/agenthub/openai/tools/image_generation.py b/examples/agenthub/tools/image_generation.py similarity index 92% rename from examples/agenthub/openai/tools/image_generation.py rename to examples/agenthub/tools/image_generation.py index 49fa1c3..a8b36d9 100644 --- a/examples/agenthub/openai/tools/image_generation.py +++ b/examples/agenthub/tools/image_generation.py @@ -5,14 +5,15 @@ import base64 -from examples.agenthub.openai import common +from examples.agenthub import common +MODEL="openai.gpt-5.2" def main(): client = common.build_agenthub_client() response = client.responses.create( - model="openai.gpt-5.2", + model=MODEL, input="Generate an image of gray tabby cat hugging an otter with an orange scarf", tools=[{"type": "image_generation"}], store=False, diff --git a/examples/agenthub/openai/tools/multiple_tools.py b/examples/agenthub/tools/multiple_tools.py similarity index 94% rename from examples/agenthub/openai/tools/multiple_tools.py rename to examples/agenthub/tools/multiple_tools.py index 869b459..3d1e0e5 100644 --- a/examples/agenthub/openai/tools/multiple_tools.py +++ b/examples/agenthub/tools/multiple_tools.py @@ -3,14 +3,15 @@ """Demonstrates using multiple tools in a single request.""" -from examples.agenthub.openai import common +from examples.agenthub import common +MODEL="openai.gpt-5.2" def main(): client = common.build_agenthub_client() response_stream = client.responses.create( - model="openai.gpt-5.1", + model=MODEL, tools=[ {"type": "web_search"}, { diff --git a/examples/agenthub/openai/tools/remote_mcp.py b/examples/agenthub/tools/remote_mcp.py similarity index 95% rename from examples/agenthub/openai/tools/remote_mcp.py rename to examples/agenthub/tools/remote_mcp.py index 0b5bd66..643e69b 100644 --- a/examples/agenthub/openai/tools/remote_mcp.py +++ b/examples/agenthub/tools/remote_mcp.py @@ -3,7 +3,7 @@ """Demonstrates calling a remote MCP tool.""" -from examples.agenthub.openai import common +from examples.agenthub import common def main(): diff --git a/examples/agenthub/openai/tools/remote_mcp_approval_flow.py b/examples/agenthub/tools/remote_mcp_approval_flow.py similarity index 97% rename from examples/agenthub/openai/tools/remote_mcp_approval_flow.py rename to examples/agenthub/tools/remote_mcp_approval_flow.py index 2d2a5d8..bebe585 100644 --- a/examples/agenthub/openai/tools/remote_mcp_approval_flow.py +++ b/examples/agenthub/tools/remote_mcp_approval_flow.py @@ -3,7 +3,7 @@ """Demonstrates an approval flow for remote MCP tools.""" -from examples.agenthub.openai import common +from examples.agenthub import common def main(): diff --git a/examples/agenthub/openai/tools/web_search.py b/examples/agenthub/tools/web_search.py similarity index 85% rename from examples/agenthub/openai/tools/web_search.py rename to examples/agenthub/tools/web_search.py index dcd2fb8..fb48ad8 100644 --- a/examples/agenthub/openai/tools/web_search.py +++ b/examples/agenthub/tools/web_search.py @@ -3,14 +3,15 @@ """Demonstrates the web_search tool in AgentHub.""" -from examples.agenthub.openai import common +from examples.agenthub import common +MODEL="openai.gpt-5.2" def main(): client = common.build_agenthub_client() response = client.responses.create( - model="openai.gpt-5.1", + model=MODEL, tools=[{"type": "web_search"}], input="What was a positive news story on 2025-11-14?", ) diff --git a/examples/agenthub/openai/tools/web_search_streaming.py b/examples/agenthub/tools/web_search_streaming.py similarity index 76% rename from examples/agenthub/openai/tools/web_search_streaming.py rename to examples/agenthub/tools/web_search_streaming.py index 8234a08..fd3c996 100644 --- a/examples/agenthub/openai/tools/web_search_streaming.py +++ b/examples/agenthub/tools/web_search_streaming.py @@ -2,15 +2,17 @@ # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ """Demonstrates streaming results from the web_search tool.""" +from oci_genai_support.openai.oci_openai import OPC_COMPARTMENT_ID_HEADER -from examples.agenthub.openai import common +from examples.agenthub import common +MODEL="xai.grok-4-1-fast-reasoning" def main(): client = common.build_agenthub_client() response_stream = client.responses.create( - model="openai.gpt-5.1", + model=MODEL, tools=[{"type": "web_search"}], input="What was a positive news story on 2026-03-06?", stream=True, diff --git a/examples/agenthub/openai/tools/__init__.py b/examples/agenthub/vector_stores/__init__.py similarity index 100% rename from examples/agenthub/openai/tools/__init__.py rename to examples/agenthub/vector_stores/__init__.py diff --git a/examples/agenthub/openai/vector_stores/vector_store_file_batches_crud.py b/examples/agenthub/vector_stores/vector_store_file_batches_crud.py similarity index 97% rename from examples/agenthub/openai/vector_stores/vector_store_file_batches_crud.py rename to examples/agenthub/vector_stores/vector_store_file_batches_crud.py index 976dba4..23526d2 100644 --- a/examples/agenthub/openai/vector_stores/vector_store_file_batches_crud.py +++ b/examples/agenthub/vector_stores/vector_store_file_batches_crud.py @@ -3,7 +3,7 @@ """Demonstrates CRUD operations for vector store file batches.""" -from examples.agenthub.openai import common +from examples.agenthub import common VECTOR_STORE_ID = "<>" diff --git a/examples/agenthub/openai/vector_stores/vector_store_files_crud.py b/examples/agenthub/vector_stores/vector_store_files_crud.py similarity index 97% rename from examples/agenthub/openai/vector_stores/vector_store_files_crud.py rename to examples/agenthub/vector_stores/vector_store_files_crud.py index 0a39177..3b87f3d 100644 --- a/examples/agenthub/openai/vector_stores/vector_store_files_crud.py +++ b/examples/agenthub/vector_stores/vector_store_files_crud.py @@ -3,7 +3,7 @@ """Demonstrates CRUD operations for vector store files.""" -from examples.agenthub.openai import common +from examples.agenthub import common VECTOR_STORE_ID = "<>" diff --git a/examples/agenthub/openai/vector_stores/vector_stores_crud.py b/examples/agenthub/vector_stores/vector_stores_crud.py similarity index 97% rename from examples/agenthub/openai/vector_stores/vector_stores_crud.py rename to examples/agenthub/vector_stores/vector_stores_crud.py index 9f1343e..acf43c4 100644 --- a/examples/agenthub/openai/vector_stores/vector_stores_crud.py +++ b/examples/agenthub/vector_stores/vector_stores_crud.py @@ -3,7 +3,7 @@ """Vector Stores API examples - create, list, retrieve, update, search, and delete.""" -from examples.agenthub.openai import common +from examples.agenthub import common def main(): diff --git a/examples/agenthub/openai/vector_stores/vector_stores_search.py b/examples/agenthub/vector_stores/vector_stores_search.py similarity index 98% rename from examples/agenthub/openai/vector_stores/vector_stores_search.py rename to examples/agenthub/vector_stores/vector_stores_search.py index 19f548a..fc2b59a 100644 --- a/examples/agenthub/openai/vector_stores/vector_stores_search.py +++ b/examples/agenthub/vector_stores/vector_stores_search.py @@ -5,7 +5,7 @@ import time -from examples.agenthub.openai import common +from examples.agenthub import common def main(): diff --git a/examples/partner/openai/common.py b/examples/partner/common.py similarity index 100% rename from examples/partner/openai/common.py rename to examples/partner/common.py diff --git a/examples/partner/openai/basic_chat_completion.py b/examples/partner/openai/basic_chat_completion.py index da0e4a4..210b2d6 100644 --- a/examples/partner/openai/basic_chat_completion.py +++ b/examples/partner/openai/basic_chat_completion.py @@ -5,13 +5,13 @@ from rich import print -from examples.partner.openai import common +from examples.partner import common -MODEL = "openai.gpt-4.1" +MODEL = "openai.gpt-5.2" def main(): - openai_client = common.build_openai_pt_client() + openai_client = common.build_openai_client() completion = openai_client.chat.completions.create( model=MODEL, diff --git a/examples/partner/openai/basic_chat_completion_api_key.py b/examples/partner/openai/basic_chat_completion_api_key.py index 02f6fff..23fbbd8 100644 --- a/examples/partner/openai/basic_chat_completion_api_key.py +++ b/examples/partner/openai/basic_chat_completion_api_key.py @@ -7,7 +7,7 @@ from openai import OpenAI -MODEL = "openai.gpt-4.1" +MODEL = "openai.gpt-5.2" def main() -> None: diff --git a/examples/partner/openai/quickstart_openai_chat_completions.py b/examples/partner/openai/quickstart_openai_chat_completions.py index 8da3e94..8d1b6ff 100755 --- a/examples/partner/openai/quickstart_openai_chat_completions.py +++ b/examples/partner/openai/quickstart_openai_chat_completions.py @@ -5,17 +5,17 @@ import logging -from examples.partner.openai import common +from examples.partner import common logging.basicConfig(level=logging.DEBUG) +MODEL="openai.gpt-5.2" def main(): - client = common.build_openai_pt_client() - model = "meta.llama-4-scout-17b-16e-instruct" + client = common.build_openai_client() completion = client.chat.completions.create( - model="openai.gpt-4.1", + model=MODEL, messages=[ { "role": "user", @@ -29,7 +29,7 @@ def main(): print("=" * 80) print("Process in streaming mode") streaming = client.chat.completions.create( - model=model, + model=MODEL, messages=[ { "role": "user", diff --git a/examples/partner/openai/streaming_chat_completion.py b/examples/partner/openai/streaming_chat_completion.py index 8a3065b..3abd7e1 100644 --- a/examples/partner/openai/streaming_chat_completion.py +++ b/examples/partner/openai/streaming_chat_completion.py @@ -3,13 +3,13 @@ """Demonstrates streaming chat completion responses for the Partner (pass-through) endpoint.""" -from examples.partner.openai import common +from examples.partner import common -MODEL = "openai.gpt-4.1" +MODEL = "openai.gpt-5.2" def main(): - openai_client = common.build_openai_pt_client() + openai_client = common.build_openai_client() stream = openai_client.chat.completions.create( model=MODEL, diff --git a/examples/partner/openai/tool_call_chat_completion.py b/examples/partner/openai/tool_call_chat_completion.py index fab4cdb..8fe6ce9 100644 --- a/examples/partner/openai/tool_call_chat_completion.py +++ b/examples/partner/openai/tool_call_chat_completion.py @@ -6,9 +6,9 @@ import json from typing import Dict -from examples.partner.openai import common +from examples.partner import common -MODEL = "openai.gpt-4.1" +MODEL = "openai.gpt-5.2" def get_current_weather(location: str, unit: str = "fahrenheit") -> Dict[str, str]: @@ -22,7 +22,7 @@ def get_current_weather(location: str, unit: str = "fahrenheit") -> Dict[str, st def main(): - openai_client = common.build_openai_pt_client() + openai_client = common.build_openai_client() messages = [ {