Pipelines API
High-level orchestrators for AI workflows.
RAG Pipeline
maticlib.pipelines.rag_pipeline.RAGPipeline
RAGPipeline(
llm_client,
vector_index,
prompt_name="rag_qa",
use_hybrid=False,
use_query_transform=False,
)
End-to-end RAG pipeline coordinating retrieval and generation.
Initializes the RAGPipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
llm_client
|
Any
|
Any LLM Client from maticlib. |
required |
vector_index
|
BaseVectorIndex
|
A vector store index matching BaseVectorIndex. |
required |
prompt_name
|
str
|
Name of prompt in the PromptRegistry. Default is 'rag_qa'. |
'rag_qa'
|
use_hybrid
|
bool
|
Whether to perform hybrid retrieval. |
False
|
use_query_transform
|
bool
|
Whether to expand the input question using the LLM. |
False
|
Source code in maticlib/pipelines/rag_pipeline.py
generate
Executes the RAG pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
question
|
str
|
The natural language question to answer. |
required |
k
|
int
|
Number of contexts to retrieve. |
4
|
keywords
|
Optional[List[str]]
|
Optional list of keywords for filtering. |
None
|
trace
|
Optional[PipelineTrace]
|
An optional trace container for observability. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The generated text answer string. |
Source code in maticlib/pipelines/rag_pipeline.py
Text2SQL Pipeline
maticlib.pipelines.text2sql_pipeline.Text2SQLPipeline
End-to-end Text2SQL pipeline.
Initializes the Text2SQLPipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
llm_client
|
Any
|
Any LLM client from maticlib. |
required |
schema_loader
|
BaseSchemaLoader
|
A schema loader matching BaseSchemaLoader. |
required |
executor
|
BaseExecutor
|
A DB executor matching BaseExecutor. |
required |
connection_string
|
str
|
String URI for DB connection. |
required |
dialect
|
str
|
The SQL dialect (e.g. 'sqlite', 'postgresql'). |
'sqlite'
|
Source code in maticlib/pipelines/text2sql_pipeline.py
execute
Translates a question to SQL, validates it, and executes it. Returns columns and rows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
question
|
str
|
The natural language question to translate to SQL. |
required |
trace
|
Optional[PipelineTrace]
|
Optional trace container for observability. |
None
|
Returns:
| Type | Description |
|---|---|
Tuple[List[str], List[Tuple]]
|
A tuple of column names (List[str]) and row tuples (List[Tuple]). |