This repository provides Python tools and examples for Oracle Cloud Infrastructure (OCI) Generative AI, including OpenAI-compatible integrations.[page:0][attached_file:1] It simplifies building LLM applications with OCI-hosted models.[web:1][page:0]
OCI Generative AI enables access to models like Cohere Command and Llama variants via REST APIs or SDKs.[web:1] A key feature is the OpenAI-compatible layer, allowing use of familiar OpenAI SDKs with OCI authentication.[page:0][attached_file:1]
The repo supports the oci-openai Python package, which adds OCI authentication to OpenAI-compatible SDKs for Chat Completions API.[page:0][attached_file:1] Install via pip install oci-openai and use OCI credentials (API keys, compartment ID).[page:0]
Supported regions include US Midwest (Chicago), US East (Ashburn), and others like Germany Central (Frankfurt).[page:0][attached_file:1] See full docs: OCI OpenAI-Compatible SDKs.[page:0]
This integration supports specific OCI-hosted models for Chat Completions, available in on-demand or dedicated modes (e.g., Cohere, Llama, xAI Grok via external tenancy).[page:0][attached_file:1] Check model cards for exact availability per region; only compatible with listed APIs to avoid 404 errors.[page:0]
- OpenAI SDK compatibility with OCI GenAI endpoints.[page:0]
- Embeddings and text generation using models like cohere.command.[web:1]
- Potential RAG setups with vector stores.[web:1]
- OCI account with Generative AI enabled.[web:1]
- Python 3.10+,
oci,oci-openai,langchain-community.[page:0][web:1] - Configured OCI CLI or environment variables.[web:1]
- Clone:
git clone https://github.com/valter-araujo/oci-genai.git. - Install:
pip install oci-openai langchain-community. - Example with OpenAI-compatible:
from openai import OpenAI import oci_openai client = OpenAI(api_key="oci://your-oci-config", base_url="https://inference.generativeai.us-midwest-1.oci.oraclecloud.com/20240501") response = client.chat.completions.create(model="meta.llama-3.2-90b-instruct", messages=[{"role": "user", "content": "Hello!"}]) print(response.choices.message.content) ```[page:0]
- Run repo scripts with your compartment ID and endpoint.[web:1]
Set OCI details: tenancy OCID, user OCID, region (e.g., us-midwest-1), compartment ID.[page:0][web:1]
Fork, branch, PR with tests.
MIT (assumed; verify repo files).[web:1]