A full-stack application for semantic code search over a local Python codebase, combining natural-language query understanding, Oracle VecDB retrieval, and interactive file exploration.
Oracle VecDB acts as the retrieval layer of the application. Parsed code snippets are embedded with a code-aware Jina model, stored as dense vectors together with metadata, and queried at runtime using natural-language search to return relevant functions, classes, and code context.

jinaai/jina-embeddings-v2-base-code for semantic code understandingCODE_DIR.ast and split into meaningful snippets such as functions, classes, and control-flow blocks.
Semantic code search architecture with AST-based snippet extraction, Jina embeddings, Oracle VecDB retrieval, and interactive code exploration.
This sample uses Oracle VecDB as the retrieval backbone for semantic code search. Code snippets are embedded and stored as dense vectors together with metadata, enabling natural-language retrieval over local source files while preserving useful developer context such as file paths, snippet types, and line numbers.
Before indexing a codebase, make sure you have a local Python repository available. You can use the LangChain repository as an example, or any other repository of your choice that contains Python files.
git clone https://github.com/langchain-ai/langchain.git
Oracle VecDB connection details live in config.py and are loaded from environment variables.
backend/.env.example to backend/.env.VECDB_REST_URL, VECDB_USERNAME, and VECDB_PASSWORD values with your actual VecDB endpoint and credentials.backend/.env out of source control.config.py reads these values automatically:
from dotenv import load_dotenv
load_dotenv(override=True)
ORACLE_VECDB_REST_URL = os.getenv("VECDB_REST_URL")
ORACLE_VECDB_USERNAME = os.getenv("VECDB_USERNAME")
ORACLE_VECDB_PASSWORD = os.getenv("VECDB_PASSWORD")
ORACLE_VECDB_ACCESS_TOKEN = os.getenv("VECDB_ACCESS_TOKEN")
You can still override other settings via environment variables, such as ORACLE_TABLE_NAME.
Requirement: Ensure you have Python 3.10+ installed on your machine.
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Before running the backend, do the following:
libs/core/langchain_core directory inside the cloned repository:cd langchain/libs/core/langchain_core
langchain_core folder.CODE_DIR path in your .env file:Create or edit the .env file in the backend folder of your project and add the following line:
CODE_DIR=/absolute/path/to/langchain/libs/core/langchain_core
Replace with the path that you copied.
python-dotenv installed (already included in the backend requirements).load_chunks.py to chunk and upsert the codebase into Oracle VecDB. NOTE: This may take a few minutes to complete and requires access to the configured Oracle VecDB endpoint.cd frontend
npm install
uvicorn main:app --host 0.0.0.0 --port 8000
Ensure that the Oracle VecDB connection values are correctly set in your environment variables or in config.py.
VITE_API_BASE=http://<vm_ip_addrs>:8000 npm run dev -- --host 0.0.0.0 --port 5178
The frontend will run at: http://<vm_ip_addrs>:5178
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python load_chunks.py
uvicorn main:app --host 0.0.0.0 --port 8000
semantic_code_search/
βββ backend/
β βββ .env.example
β βββ config.py
β βββ load_chunks.py
β βββ main.py
β βββ requirements.txt
βββ frontend/
β βββ src/
β β βββ components/
β β βββ App.tsx
β β βββ SearchInterface.tsx
β β βββ CodeViewer.tsx
β β βββ VectorDBInfo.tsx
β βββ package.json
βββ images/
β βββ screenshot.png
βββ README.md
LANGCHAIN_CODE_SEARCH768Each indexed code snippet stores metadata such as:
context_snippet_typecontext_namecontext_file_namecontext_file_pathline_fromline_toThis metadata allows the frontend to present search results together with file locations and surrounding code context.
jinaai/jina-embeddings-v2-base-code
transformers library.oracle-vecdb SDK.query_vectors endpoint.snippets_output-new.jsonlcontext_code: The extracted code snippetcontext_file_name: File name from which the snippet was extractedcontext_file_path: Relative file path of the snippetcontext_name: Name of the function/class/structure (or <anonymous>)context_snippet_type: AST node type (FunctionDef, ClassDef, If, etc.)line_from: Starting line number of the snippetline_to: Ending line number of the snippetid: Unique identifier.py files.ast and extract semantically meaningful code snippets (functions, classes, if-blocks, etc.)..jsonl file.jinaai/jina-embeddings-v2-base-code model.oracle_vecdb SDK.
Semantic code search UI with natural-language query input, top-k retrieval, vector DB info, and interactive file browsing.
CODE_DIRThis sample is designed to demonstrate how Oracle VecDB can support semantic retrieval over source code, combining code embeddings, metadata-aware indexing, and natural-language developer search workflows in an end-to-end application.