This is the official repository for the LangChain integrations with Oracle Cloud Infrastructure (OCI) and Oracle Database. It provides native LangChain and LangGraph components — in Python and JavaScript/TypeScript — for OCI Generative AI, OCI Data Science, and Oracle AI Vector Search.
| Package | Version | Install | What it provides |
|---|---|---|---|
langchain-oci |
pip install -U langchain-oci |
OCI Generative AI & Data Science. Chat models (ChatOCIGenAI, ChatOCIOpenAI, ChatOCIModelDeployment), embeddings (OCIGenAIEmbeddings), agents (create_oci_agent, create_deepagents_agent), guardrails (OCIGuardrails), and multimodal (vision, PDF, video, audio) support across Cohere, Google, Meta, OpenAI, and xAI models on OCI. |
|
langchain-oracledb |
pip install -U langchain-oracledb |
Oracle AI Vector Search. Vector store (OracleVS), hybrid & text-search retrievers, document loaders (OracleDocLoader), text splitter, in-database embeddings and summaries, semantic cache, and chat message history — all powered by Oracle Database. |
|
langgraph-oracledb |
pip install -U langgraph-oracledb |
LangGraph persistence on Oracle Database. Checkpointers (OracleSaver, AsyncOracleSaver) for durable graph state and a key/value store (OracleStore, AsyncOracleStore) with optional vector search for long-term agent memory. |
|
@oracle/langchain-oracledb |
npm install @oracle/langchain-oracledb |
LangChain.js for Oracle Database. TypeScript/JavaScript counterparts of the Vector Search components: OracleVS, OracleDocLoader, OracleEmbeddings, OracleSummary, and OracleTextSplitter. |
Note
This project merges and replaces the earlier OCI and Oracle AI Vector Search integrations from langchain-community. All packages assume you have credentials configured for the OCI and/or Oracle Database services you use.
from langchain_oci import ChatOCIGenAI
llm = ChatOCIGenAI(
model_id="meta.llama-3.3-70b-instruct",
service_endpoint="https://inference.generativeai.us-chicago-1.oci.oraclecloud.com",
compartment_id="ocid1.compartment.oc1..xxxxx",
)
print(llm.invoke("Sing a ballad of LangChain.").content)ChatOCIGenAI supports streaming, tool calling, structured output, and multimodal inputs. See the langchain-oci README for on-demand vs. dedicated AI cluster models, authentication options, and OCI Data Science model deployments.
import oracledb
from langchain_oci import OCIGenAIEmbeddings
from langchain_oracledb.vectorstores import OracleVS, DistanceStrategy
conn = oracledb.connect(user="user", password="password", dsn="dsn")
embeddings = OCIGenAIEmbeddings(
model_id="cohere.embed-v4.0",
service_endpoint="https://inference.generativeai.us-chicago-1.oci.oraclecloud.com",
compartment_id="ocid1.compartment.oc1..xxxxx",
)
vector_store = OracleVS(conn, embeddings, "my_docs", DistanceStrategy.COSINE)
vector_store.add_texts(["Oracle AI Vector Search is built into Oracle Database."])
results = vector_store.similarity_search("What is AI Vector Search?", k=1)from langgraph_oracledb.checkpoint.oracle import OracleSaver
with OracleSaver.from_conn_string("user/password@localhost:1521/FREEPDB1") as checkpointer:
checkpointer.setup() # create tables & apply migrations once
graph = builder.compile(checkpointer=checkpointer)
graph.invoke({"messages": [...]}, config={"configurable": {"thread_id": "1"}})The samples/ directory is a numbered, hands-on learning path — start at 01 and work up, or jump straight to the topic you need. Every track has its own README and runnable code; these same samples are featured on the official LangChain OCI integration page.
| Sample | Level | Topics |
|---|---|---|
| 01: Getting Started | Beginner | Authentication, basic chat, providers |
| 02: Vision & Multimodal | Beginner | Image analysis, PDF, video, audio |
| 03: Building AI Agents | Intermediate | ReAct agents, tools, memory |
| 04: Tool Calling Mastery | Intermediate | Parallel tools, workflows |
| 05: Structured Output | Intermediate | Pydantic schemas, JSON modes |
| 07: Async for Production | Advanced | ainvoke, astream, FastAPI |
| 09: Provider Deep Dive | Specialized | Meta, Gemini, Cohere, xAI specifics |
| 10: Embeddings | Specialized | Text & image embeddings, RAG |
| 11: Deepagents | Specialized | Deep agents with Autonomous Database & OpenSearch datastores |
Official LangChain integration pages
- OCI provider page — installation, authentication, chat models, embeddings, model deployments, and the samples above
ChatOCIGenAIandOCIGenAIEmbeddingscomponent guides- Oracle AI Vector Search provider page — document loaders, text splitter, embeddings, summaries, and the vector store
- Oracle AI Vector Search end-to-end RAG demo
In this repository
libs/oci/README.md— fulllangchain-ociguide: on-demand and dedicated AI cluster models, multimodal content, structured output, tool calling, deepagents with datastores, and OCI Data Science deploymentslibs/oracledb/README.md— fulllangchain-oracledbguide: connecting withpython-oracledb,OracleVSwith chunking and indexing, loaders, splitter, embeddings, and summarieslibs/langgraph-oracledb/README.md— checkpointer and store quickstarts (sync and async), plus vector-search store configurationlibs/js/langchain-oracledb/README.md— LangChain.js usage for every component, with build and test instructionssamples/README.md— the learning path index, feature coverage matrix, and prerequisites
This project welcomes contributions from the community. Contributors must sign the Oracle Contributor Agreement and sign off each commit (git commit -s). See the contribution guide for the full workflow.
Please report security vulnerabilities privately to Oracle following the security guide — not through public GitHub issues.
Copyright (c) 2025 Oracle and/or its affiliates.
Released under the Universal Permissive License v1.0. See LICENSE.txt and THIRD_PARTY_LICENSES.txt for details.