Skip to main content
This page covers all LangChain integrations with Oracle Cloud Infrastructure (OCI).

Installation and Setup

Authentication

Initializing ChatOCIGenAI is resource-intensive. For optimal performance, it is recommended to treat this client as a singleton and reuse the instance across your application.
Four authentication methods are supported for OCI services. All methods follow the standard OCI SDK authentication.

API Key (Default)

Uses credentials from ~/.oci/config:

Security Token

For session-based authentication:

Instance Principal

For applications running on OCI compute instances:

Resource Principal

For OCI Functions and other resources:

OCI Generative AI

Oracle Cloud Infrastructure (OCI) Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases, and which are available through a single API. Using the OCI Generative AI service you can access ready-to-use pretrained models, or create and host your own fine-tuned custom models based on your own data on dedicated AI clusters.

Chat Models

ChatOCIGenAI

Main chat model for OCI Generative AI service with full LangChain feature support. See usage example.
Supported Features:
  • ✅ Tool calling (including parallel tools with Llama 4+)
  • ✅ Structured output (Pydantic, JSON mode)
  • ✅ Vision & multimodal (13+ models support images)
  • ✅ Streaming (sync and async)
  • ✅ Async operations (ainvoke, astream, abatch)
  • ✅ PDF, video, audio processing (Gemini models)

ChatOCIOpenAI

OpenAI Responses API compatibility for OCI commercial OpenAI models.
Features:
  • OpenAI-compatible interface
  • Conversation store support for persistent memory
  • Access to GPT-4, GPT-5, o1, o3 models (where available)

Embedding Models

OCIGenAIEmbeddings

Text and image embedding models. See usage example.
Available Models:
  • cohere.embed-english-v3.0 (1024 dimensions)
  • cohere.embed-multilingual-v3.0 (1024 dimensions)
  • cohere.embed-v4.0 (text + image, 256-1536 dimensions)

Vision & Multimodal

13+ vision-capable models across Meta Llama, Google Gemini, xAI Grok, and Cohere:
Gemini Multimodal (PDF, video, audio):

AI Agents

Create LangGraph-powered ReAct agents with OCI models:

Provider Coverage

Note: Model availability varies by region. See the OCI Generative AI documentation for the current model catalog.

OCI Data Science Model Deployments

OCI Data Science is a fully managed and serverless platform for data science teams. Deploy custom models as endpoints using the OCI Data Science Model Deployment Service.

ChatOCIModelDeployment

Chat model for OCI Data Science Model Deployments. See the ChatOCIModelDeployment integration guide.

ChatOCIModelDeploymentVLLM

Optimized for vLLM-based deployments with streaming support:

ChatOCIModelDeploymentTGI

For Text Generation Inference (TGI) deployments:

Samples

For comprehensive guides covering all features, see the langchain-oci samples:

Additional Resources