LangChain

Use LangChain with Oracle AI Database to build retrieval-augmented generation, agentic search, semantic caching, chat history, and memory-augmented AI applications.

LangChain is an open source framework for building applications powered by large language models (LLMs). It provides standardized interfaces for connecting LLMs to data sources, tools, and memory systems.

Why LangChain with Oracle AI Database

Oracle AI Database combines relational, document, graph, and vector data in a single engine. When paired with LangChain, it eliminates the need for a separate vector database and provides a complete platform for AI application development.

Key capabilities of the integration:

Architecture

A typical LangChain + Oracle AI Database application follows this data flow:

  1. Ingest: Load documents with OracleDocLoader, chunk them with OracleTextSplitter.
  2. Embed: Generate vector embeddings with OracleEmbeddings (in-database ONNX model) or any LangChain-compatible embedding model.
  3. Store: Persist documents, metadata, and vectors in OracleVS (Oracle AI Vector Search).
  4. Index: Create HNSW or IVF indexes for fast approximate nearest-neighbor search.
  5. Retrieve: Query using semantic search, full-text search, or hybrid search depending on the use case.
  6. Cache: Use OracleSemanticCache to reuse responses for repeated or semantically similar prompts.
  7. Remember: Persist ordered chat turns with OracleChatMessageHistory.
  8. Generate: Pass retrieved context and conversation history to an LLM via LangChain chains or LangGraph agents.

Language Support

Oracle provides LangChain integration packages for multiple languages. Select a language below for the complete integration guide:

Language Package Status
Python langchain-oracledb Available
JavaScript @oracle/langchain-oracledb Available
Java dev.langchain4j:langchain4j-oracle Available

Resources