Skip to content

valter-araujo/oci-genai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OCI GenAI Repository

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]

Overview

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]

OpenAI Compatibility

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]

LLMs Supported by OpenAI Compatible

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]

Features

  • 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]

Prerequisites

  • 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]

Quick Start

  1. Clone: git clone https://github.com/valter-araujo/oci-genai.git.
  2. Install: pip install oci-openai langchain-community.
  3. 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]
  4. Run repo scripts with your compartment ID and endpoint.[web:1]

Configuration

Set OCI details: tenancy OCID, user OCID, region (e.g., us-midwest-1), compartment ID.[page:0][web:1]

Contributing

Fork, branch, PR with tests.

License

MIT (assumed; verify repo files).[web:1]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published