# Langchain Oracledb Helper

Scaffold a langchain-oracledb store layer, multi-collection OracleVS wrapper...

- Repository: https://github.com/oracle-devrel/oracle-ai-developer-hub (4464 stars)
- Category: Engineering
- License: see repository
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add oracle-devrel/oracle-ai-developer-hub --skill langchain-oracledb-helper -g -a claude-code -y`
Codex: `npx skills add oracle-devrel/oracle-ai-developer-hub --skill langchain-oracledb-helper -g -a codex -y`
Cursor: `npx skills add oracle-devrel/oracle-ai-developer-hub --skill langchain-oracledb-helper -g -a cursor -y`
Gemini CLI: `npx skills add oracle-devrel/oracle-ai-developer-hub --skill langchain-oracledb-helper -g -a gemini-cli -y`

## Description

Scaffold a langchain-oracledb store layer, multi-collection OracleVS wrapper, metadata-as-string monkeypatch, embedder-dim assertion, OracleChatHistory subclass (langchain-oracledb does not ship one). Use when a project needs Oracle as its LangChain vector store and chat-history backend.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

You write the Oracle data-layer modules. You do not write app code, chains, or UI.

## Step 0, References (mandatory)

- `shared/references/langchain-oracledb.md`, load-bearing.
- `shared/snippets/metadata_monkeypatch.py`, copy verbatim into `_monkeypatch.py`.
- `shared/snippets/oracle_chat_history.py`, copy verbatim into `history.py` (includes the `init_table()` helper running an idempotent PL/SQL DDL block, Oracle does NOT support `CREATE TABLE IF NOT EXISTS`).
- `shared/snippets/in_db_embeddings.py`, copy verbatim into `store.py` when `embedder == "in-db-onnx"` (this is THE `InDBEmbeddings` subclass referenced everywhere; it lives here so the helper actually ships it instead of asking the user to invent it).
- `shared/references/onnx-in-db-embeddings.md`, only if `embedder == "in-db-onnx"`.

## Step 1, Validate inputs

- `target_dir/.env` exists and has `DB_DSN`, `DB_USER`, `DB_PASSWORD`. The `DB_USER` MUST be the app user that `oracle-aidb-docker-setup` Step 6 created (NOT `SYSTEM`, `SYSTEM`'s tablespace can't hold JSON columns; you'll get ORA-43853). If not, stop, tell the user to run `oracle-aidb-docker-setup` first.
- `package_slug` matches `[a-z][a-z0-9_]*`. Reject otherwise.
- `collections` non-empty. Naming: `<PROJECT_PREFIX>_<KIND>` enforced, e.g. for slug `pdf_chat` and kind `DOCUMENTS`, the actual table name is `PDF_CHAT_DOCUMENTS`. Document this in the file's docstring.
- For `embedder == "in-db-onnx"`, confirm the user has a registered ONNX model name. If not, stop, point them at `shared/references/onnx-in-db-embeddings.md` step 3 (the `onnx2oracle` recipe).

## Step 2, Pick embedding dim

The rest: https://github.com/oracle-devrel/oracle-ai-developer-hub/blob/HEAD/build-paths/skills/langchain-oracledb-helper/SKILL.md
