A database organizes data so applications can store, retrieve, and reuse it. In AI-assisted financial analysis, it can hold reusable prompts, tags, transcripts, filings, and other context that an LLM cannot access directly. section 9.2.1 section 9.3.2
A prompt repository can start with two relational tables: one identifies each prompt and stores its text; another connects prompts with searchable tags. This simple design supports refinement and reuse across companies, industries, and analytical scenarios. section 9.2.1
A database supports an AI retrieval workflow by:
- Separating data loading from prompt submission: one process fetches information from files, APIs, web sources, or databases, while another retrieves context for the LLM. section 9.3.2
- Keeping recent or restricted information available, including earnings-call transcripts and company filings that may not appear in model training data. section 9.3.2
- Supporting retrieval after documents are loaded, chunked, and added to an in-memory vector database for similarity search. section 9.3.2
Prompt repository schema
A minimal repository defines a prompt table with an ID and required prompt text, then adds a tag table containing tag names and prompt IDs. A prompt such as a BCG Framework question can use a {company} placeholder, which Python later fills with a specific company. section 9.2.1
Listing 9.1 DDL Scripts for creating a prompt repository
create table prompt
(
id TEXT primary key,
prompt TEXT not null
);
create table main.tag
(
tag_name TEXT not null,
prompt_id TEXT not null
);
Inspect the DDL for the prompt repository, including its primary key, required prompt field, and tag relationship. section 9.2.1
Listing 9.9 Adding all text in an in-memory vector database
from langchain_openai import OpenAIEmbeddings embeddings = OpenAIEmbeddings(model="text-embedding-3-large") from langchain_core.vectorstores import InMemoryVectorStore vector_store = InMemoryVectorStore(embeddings) document_ids = vector_store.add_documents(documents=all_splits)
Inspect the Python construction of an in-memory vector database that stores embedded document chunks for similarity search. section 9.3.2























