General Concepts
Core Objects
The Foundation4.ai API server consists of RAG pipelines leveraging OpenAI-compatible LLMs and LangChain objects. An LLM refers to any server providing endpoints following the Chat Completion API outlined in the OpenAI Chat Completion Documentation.
An Embedding Provider is a thin layer on top of LanChain Embeddings. Any LangChain Embeddings class can be used in the Foundation4.ai API server, but support must be added directly to the codebase in order to automate downloading of any external files required by each Embeddings class.
An Embedding Model is a particular instance of an Embedding Provider, which specifies the exact model and any parameters being used.
Akin to the Embedding Providers, a Text Splitter specifies a particular instantiation of a LangChain TextSplitter with set parameters.
A Pipeline is a combination of:
- Vector Store (a Pipeline functions as the vector store orchestrator)
- An Embedding Model
- A Text Splitter
- Allowed Document Classifications
A Document is a text message belonging to a Pipeline. Documents can also include metadata that may be used for filtering and narrowing queries.
Document Classifications
Every document in the Foundation4.ai API system must specify a document classification that is a known classification of the Pipeline it belongs to. The classification system within a pipeline is a hierarchical grouping of levels specifying access to that document. For example, we could have a pipeline with the following diagram
graph LR
A[Top-Secret] --> B[Secret 1];
A[Top-Secret] --> C[Secret 2];
B --> D[Classified 1];
B --> E[Classified 2];
C --> E[Classified 2];
E --> F[General];
D --> F[General];
In the case above, all documents tagged with a General classification will be used for any query to the pipeline. Queries tagged as Secret 1 will use documents tagged as Secret 1, Classified 1, Classified 2, and General. Top Secret queries will use all the documents in the pipeline.
Agents
Agents are sets of instructions that interact with LLMs and the vector stores. Namely, they consist of
- A prompt
- (not implemented yet) Tools the LLM may call during execution
To execute queries against Agents, it is necessary to specify
- An LLM endpoint
- A Pipeline (which includes a Vector Store)
Not that Agents do not maintain a history of answers or any other state besides the documents that were loaded to the pipeline store.
Contexts
Contexts represent a chronological sequence of messages akin to a conversation or thread. Contexts have an associated maximum document classification, which ensures that any message added to a context cannot must don't contain information exceeding the secrecy level specified on the context.