> For the complete documentation index, see [llms.txt](https://karini-ai.gitbook.io/karini-ai-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://karini-ai.gitbook.io/karini-ai-documentation/recipes/knowledgebase-recipe/create-recipe.md).

# Create Recipe

Karini AI's Recipe allows you to create your no-code generative AI application pipelines.&#x20;

## Creating a Recipe

To create a new recipe, go to the Recipe Page, click **Add New**, select **Karini** as the runtime option, provide a user-friendly name and detailed description and choose recipe type as **Knowledgebase**.

Configure the following elements by dragging them on to the recipe canvas.

### Source

Define your data source by configuring the associated data storage connector. Select appropriate data connector from a list of available connectors.

* [Amazon S3](/karini-ai-documentation/recipes/knowledgebase-recipe/data-storage-connectors.md#amazon-s3)
* [Azure Cloud Storage](/karini-ai-documentation/recipes/knowledgebase-recipe/data-storage-connectors.md#azure-cloud-storage)
* [Google Cloud Storage](/karini-ai-documentation/recipes/knowledgebase-recipe/data-storage-connectors.md#google-cloud-storage)
* &#x20;[Confluence](/karini-ai-documentation/recipes/knowledgebase-recipe/data-storage-connectors.md#confluence)
* &#x20;[Dropbox](/karini-ai-documentation/recipes/knowledgebase-recipe/data-storage-connectors.md#dropbox)
* &#x20;[Google Drive](/karini-ai-documentation/recipes/knowledgebase-recipe/data-storage-connectors.md#google-drive)
* &#x20;[Website](/karini-ai-documentation/recipes/knowledgebase-recipe/data-storage-connectors.md#website)
* [Manifest](/karini-ai-documentation/recipes/knowledgebase-recipe/data-storage-connectors.md#manifest)
* [Sharepoint](/karini-ai-documentation/recipes/knowledgebase-recipe/data-storage-connectors.md#sharepoint)
* [Sitecore](/karini-ai-documentation/recipes/knowledgebase-recipe/data-storage-connectors.md#sitecore)
* [Youtube](/karini-ai-documentation/recipes/knowledgebase-recipe/data-storage-connectors.md#youtube)

Configure the storage paths for the connector and apply  necessary filters to restrict the data being included in the source. Enable recursive search if needed to include data from nested directories or structures.&#x20;

You have option to test your data connector setup using the "Test" button.&#x20;

#### Table Configuration

When using **PostgreSQL** as a knowledge base, you can configure how your data tables are structured and mapped for vector storage and retrieval.

**Configuring Table Columns**

The Table Configuration feature allows you to define how columns in your PostgreSQL tables are mapped and processed:

1. After connecting your PostgreSQL knowledgebase, click **Configure Columns**
2. The platform will introspect your table and display available columns
3. For each column, configure:

   * **Data type** : Specify the column's data type (text, integer, date, etc.)
   * **Column mapping** :Map source columns to their roles in the vector store (content, metadata, embedding)

   <figure><img src="/files/OzfRvikIo6MtZ5Wq5WWx" alt=""><figcaption></figcaption></figure>
4. Optionally set up **concatenation rules** to combine multiple columns into a single field for embedding.&#x20;

**Column Mapping**

Column mapping allows users to define how table columns are used during Knowledge base ingestion and embedding generation.

Multiple columns can be combined into a single text field before embeddings are generated. This is useful when searchable content is distributed across multiple columns but should be treated as one unified document during retrieval.

To configure concatenation rules:

1. Click **Configure Columns** in the table configuration.

<figure><img src="/files/69oKAHLmwL2gdhX0yOZG" alt=""><figcaption></figcaption></figure>

2. Go to the **Concatenation** tab and configure the following for each column:

   **Data Type:** Select the appropriate data type for the column, such as text, integer, date, vector or other supported formats.

<figure><img src="/files/cfNXOWvgUYAcON5TNJMX" alt=""><figcaption></figcaption></figure>

3. Select the columns to combine.

<figure><img src="/files/79PBhOH0hLvCpwdLNm6p" alt=""><figcaption></figcaption></figure>

4. Define the output format, such as delimiter-separated text or a custom template.

<figure><img src="/files/h1oVXi1udXoX63jihtav" alt=""><figcaption></figcaption></figure>

5. Save the configuration using an appropriate name for the target column.

<figure><img src="/files/QsTzGsYDjeFvZnMPpxsL" alt=""><figcaption></figcaption></figure>

#### Viewing Column Configuration

After saving the configuration, click **View Columns** to review the applied settings.

<figure><img src="/files/UDJ67MnBxOsNMhXOvppP" alt=""><figcaption></figcaption></figure>

The view displays:

* Current column mappings and assigned data types.
* Sample table data to validate the mapping.
* Configured concatenation rules.

<figure><img src="/files/iQpRrS23OLBJ5ZrnerIF" alt=""><figcaption></figcaption></figure>

### Dataset

Dataset server as internal collection of dataset items which are pointers to the data source. For a recipe, you can choose to use an existing dataset which may have references to other data sources or create a new one, depending on your needs.

Karini AI provides various options for data preprocessing.&#x20;

#### Dataset types

When you create a dataset in the recipe , you can choose one of two dataset types:

#### 1. text

Used for **text-based workflows**, such as documents, extracted text, and OCR/PII processing.

Karini AI provides various options for data preprocessing for text datasets.

**OCR**:

For source data which contains files of types pdf or image, you can perform Optical Character Recognition (OCR) by selecting one of the following options:

* **Unstructured IO with Extract Images:** This method is used for extracting images from unstructured data sources. It processes unstructured documents, identifying and extracting images that can be further analyzed or used in different applications.
* **PyMuPDF with Fallback to Amazon Textract:** This approach utilizes PyMuPDF to extract text and images from PDF documents. If PyMuPDF fails or is insufficient, the process falls back to Amazon Textract, ensuring a comprehensive extraction by leveraging Amazon's advanced OCR capabilities.
* **Amazon Textract with Extract Table:** Amazon Textract is used to extract structured data, such as tables, from documents. This method specifically focuses on identifying and extracting tabular data, making it easier to analyze and use structured information from scanned documents or PDFs.

**PII**:

If you need to mask **Personally Identifiable Information (PII)** within your dataset, you can enable the PII Masking option. You can select from the list of entities that you want masked for data pre-processing. To learn more about the entities refer to this [documentation](https://docs.aws.amazon.com/comprehend/latest/dg/how-pii.html).

{% hint style="info" %}
Link your **Source** element to **Dataset** element in the recipe canvas to start creating your data ingestion pipeline.&#x20;
{% endhint %}

**Preprocess Data and Extract Custom&#x20;Metadata:**

1. **Custom preprocessor:** This option allows the user to apply custom logic or transformations to the OCR-generated text. OCR text often contains noise, inaccuracies, or irrelevant information, and preprocessing helps to clean and structure the text to better serve specific requirements.

   1. **Document Types**: The feature supports OCR extraction from various document formats, including PDFs, PNG images, and TXT files. It is versatile in handling different types of documents and outputs generated through OCR.
   2. **AWS Lambda Integration**: The feature allows users to configure a custom AWS Lambda function for preprocessing tasks. By providing the Lambda function’s **ARN (Amazon Resource Name)**, users can trigger the function, which executes the custom logic for processing the text. Lambda allows for highly scalable, serverless execution of functions with flexible integration, which is ideal for handling complex or computationally intensive tasks.
      * **Lambda ARN** : Enter the Amazon Resource Name (ARN) for the AWS Lambda function that will process and split the data.
      * **Input Test Payload:** Enter  test data to validate the Lambda function’s behavior before deployment.
      * **Test Button** : Allows you to execute a test run of the configured Lambda function for validation.
      * **Overwrite Credentials (Optional)** → Allows you to override existing authentication settings with new credentials.
   3. **Page Range Specification**: Users can specify which pages of the document should be processed. This is useful when only certain sections of a document need to be preprocessed or when processing large documents, allowing for efficient handling of specific pages or page ranges. For example, you can choose to process **pages 1–5** or **select all pages**.

2. **Metadata extractor:** This feature uses a prompt-driven approach to extract entities and map them to appropriate data types, ensuring compliance with search engine requirements. The output is a clean, valid JSON format, optimized for indexing, querying, and downstream analysis.&#x20;

{% hint style="info" %}
In order to use this option, you must have the **Custom metadata extraction model c**onfigured in  the [Organization](/karini-ai-documentation/organization.md) setting.
{% endhint %}

You can define **entities** along with their corresponding data types to enable targeted extraction. If no entities are specified, the system will automatically identify and extract relevant entities based on the input text.

&#x20;You can specify which pages of the document should be processed. This is useful when only certain sections of a document need to be preprocessed or when processing large documents, allowing for efficient handling of specific pages or page ranges. For example, you can choose to process **pages 1–5** or **select all pages**.

#### 2.Multimodal&#x20;

The Multimodal feature enables processing and understanding of multiple data types including images, videos, audio, and text. This feature leverages Vision Language Models (VLM) and various processing techniques to extract meaningful information from diverse media formats.

Supports ingestion of common multimedia and document formats, including:

* **Images**: JPEG (.jpg, .jpeg), PNG (.png), GIF (.gif), WebP (.webp)
* **Videos**: MP4, AVI, MOV, WebM
* **Audio**: MP3, WAV, M4A, FLAC
* **Documents**: PDF, DOCX, TXT

Karini AI provides various options for data preprocessing for multimodal datasets.

#### A. Image Understanding

Image Understanding uses Vision Language Models (VLMs) to interpret images and generate structured, prompt-driven outputs.

* **VLM-based analysis**: Produces semantic descriptions of image content (objects, scenes, relationships, and context) based on the configured prompt.
* The recipe uses the following default prompt template.

```
You are an expert image analyst. Your task is to provide a comprehensive, detailed description of the image you receive.

Analyze the image thoroughly and describe:
The main subject(s) and their characteristics
The setting, environment, or background
Colors, lighting, and visual composition
Any text, symbols, or notable details visible
The mood, tone, or atmosphere conveyed
Spatial relationships between elements
Any actions, activities, or implied narrative

Be specific and observational. Focus on what you can definitively see rather than speculation. Organize your thoughts coherently but present them as a single flowing description.

Output only the description as plain text without any formatting, headers, or additional commentary.
```

* **Customizable prompts**: Supports configurable VLM prompt templates for domain-specific extraction and standardized output formats.
* **Text extraction**: Extracts text from images and can combine it with contextual descriptions to improve search and interpretation.
* **Layout-aware processing**: Preserves document structure via intelligent chunking for multi-column pages, forms, and tables to improve extraction fidelity.

#### B. Video Understanding

Video Understanding processes video assets by combining time-based segmentation, VLM-driven visual analysis, and optional speech-to-text transcription to generate a comprehensive representation of the content.

* **Segmentation**: Splits videos into configurable time windows (5–30 seconds) to control analysis granularity and throughput.
* **VLM analysis**: Performs segment/frame-level interpretation using Vision Language Models to generate visual descriptions, detected events, and contextual summaries  based on the configured prompt.
* The recipe uses the following default prompt template.

```
You are an expert video analyst. Your task is to provide a comprehensive, detailed description of the video you receive.

Analyze the video thoroughly and describe:
The opening scene and how it progresses
Main subjects, characters, or objects and their actions throughout
The setting, environment, and any changes in location
Key events or moments in chronological order
Visual elements: colors, lighting, camera work, composition
Any audio elements if present (dialogue, music, sound effects)
Text, graphics, or overlays that appear
The pacing and flow of the content
The overall message, purpose, or narrative arc
The closing or final impression

Pay attention to temporal progression and how elements evolve across the 30 seconds. Be specific about what happens when, but maintain a coherent narrative flow.

Output only the description as plain text without any formatting, headers, or additional commentary.
```

* **Transcription**: Converts the video’s audio track into text to capture spoken content for indexing and downstream NLP/LLM workflows.
* **Dual processing**: Merges visual outputs with transcripts to improve completeness and retrieval accuracy .

#### C. Audio Processing

Audio Processing converts speech in audio files into text to support search, indexing, summarization, and downstream pipeline execution.

* **Speech-to-text**: Produces transcripts using supported transcription methods based on deployment and accuracy requirements.
* **Amazon Transcribe integration**: Enables AWS-managed transcription via Amazon Transcribe for scalable, production-grade speech recognition.
* **Custom model support**: Use custom speech-to-text model endpoints.

{% hint style="info" %}
In order to use this option, you must have the **Global VLM model c**onfigured in  the [Organization](/karini-ai-documentation/organization.md) setting.
{% endhint %}

### Knowledge base

The **Knowledge base provider** field defines the backend system used to store indexed content, manage embeddings, and perform semantic search.

During recipe execution, the selected provider retrieves the most relevant document chunks or records based on the user query and passes them to the next step in the workflow.

Supported providers include:

**OpenSearch**\
OpenSearch is the VectorDB provider for your knowledge base, responsible for managing and storing your vector data. It is used for vector-based search and scalable semantic retrieval, making it suitable for deployments that require fast search performance, distributed indexing, and dedicated search infrastructure.

**PostgreSQL**\
PostgreSQL is used to store and retrieve knowledge base data within a relational database environment. It is suitable when the knowledge base should remain close to existing application data or database-managed infrastructure.

For more detailed information, refer to the [**PostgreSQL**](/karini-ai-documentation/recipes/knowledgebase-recipe/postgresql.md) documentation.

Only one provider can be selected for a Knowledge base component. The selected provider affects how embeddings are stored, how search queries are executed, and which retrieval features are available, such as top-k results, reranking, access control, and query reconstruction.

Select the provider based on system architecture, performance needs, data storage preferences, and operational requirements.

The **View Custom Metadata button** is located in the Knowledgebase section. When accessed before recipe processing, it will not display any metadata. Upon completion of recipe processing, the button will display either the[ default metadata](/karini-ai-documentation/datasets.md#default-metadata-extraction-after-recipe-processing) or the [custom metadata](/karini-ai-documentation/datasets.md#custom-metadata-extraction-using-metadata-extractor-prompt) extracted through the metadata extractor prompt available on the dataset tile. For additional details, please refer to the provided links.

### Vector DB Prompt

These options provide several techniques to improve the relevance and quality of your vector search.

#### **Use embedding chunks:**&#x20;

Choosing this option conducts a semantic search to retrieve the top\_k most similar vector-embedded document chunks and uses these chunks to create a contextual prompt for the Large Language Model (LLM).

#### **Summarize chunks:**&#x20;

Choosing this option conducts a semantic search to retrieve the top\_k most similar vector-embedded document chunks and then summarizes these chunks to create a contextual prompt for the Large Language Model (LLM).

#### **Use the document text for matching embeddings:**&#x20;

Choosing this feature conducts a semantic search to retrieve the top\_k most similar vector-embedded document chunks and uses the corresponding text from the original document to create a contextual prompt for the Large Language Model (LLM). You can further restrict the context by selecting one of the following options:

* **Use entire document:** Use the text from the entire document to create context for the prompt.
* **Use matching page:** Use the text from matching page of the document to create context for the prompt.  You can optionally include previous and next page to ensure continuity and context preservation.&#x20;

#### **Top\_k:**&#x20;

Maximum number of top matching vectors to retrieve.

#### **Enable Reranker:**&#x20;

Re-ranking improves search relevance by reordering the result set based on the relevancy score. In order to enable reranker, you must have set the **reranker model** in the [Organization](/karini-ai-documentation/organization.md) setting.  You can configure following options for the reranker.

* **Top-N:** Maximum number of top-ranking vectors to retrieve. This number must be lesser than the top\_k parameter.
* **Reranker Threshold:** A threshold for relevancy score. The reranker model will select Top-N vectors that are over the set the threshold.&#x20;

#### **Advanced query reconstruction:**&#x20;

Query rewriting can involve modifying or augmenting user queries to enhance retrieval accuracy. In order to use this option, you must have the **Natural language assistant** **model** configured in the [Organization](/karini-ai-documentation/organization.md) setting.

* **Multi query rewrite:** Use this option when you want to break down complex or ambiguous queries into multiple distinct, simpler queries. You are provided with a sample prompt for this task, however you can update the prompt as required.&#x20;
* **Query expansion:** Use this option to expand the user queries by augmenting the query with a LLM generated information which can help answer the question. This technique is helpful for improving retrieval accuracy when user queries are short, abrupt and not specific. You are provided with a sample prompt for this task, however you can update the prompt as required.&#x20;

#### **Enable ACL restriction:**

Enable ACL restriction refers to filtering the knowledge base based on the user's **Access Control List (ACL)** permissions. Here's a explained how it works:

* **ACL-Based Filtering**: When this feature is enabled, the content that is retrieved from the knowledge base will first be filtered based on the permissions assigned to the user. This means only content that the user is allowed to access will be considered.
* **Semantic Retrieval**: After the ACL filter, the system performs semantic similarity-based retrieval to ensure that the content retrieved is relevant to the user's query.
* **Security Enhancement**: This feature enhances security by ensuring that users can only access content that is permissible according to their ACL. It prevents unauthorized access to sensitive or restricted information by filtering out content the user shouldn't be able to access.

#### **Enable dynamic metadata filtering:**

This feature utilizes a Large Language Model (LLM) to generate custom metadata filters. Here's how it works:

* **Automatic Metadata Filtering**: When enabled, the system analyzes metadata keys along with the user's input query. Based on this analysis, it generates dynamic metadata filters that narrow down the knowledge base.
* **Context-Aware**: The metadata filters are designed to be dynamic and context-aware. This means that the filters adjust based on the query and the context of the user's request, ensuring a more accurate retrieval process.
* **Semantic Retrieval**: Once the metadata filters are applied, the system performs retrieval based on semantic similarity. This allows for more focused and precise results.

#### Enable hybrid search

Hybrid Search enables the combination of vector-based semantic retrieval and keyword-based lexical matching within the Knowledge node. This approach improves retrieval accuracy by leveraging both deep semantic understanding and precise keyword alignment.

**Configuration**

Hybrid Search is activated by selecting the Enable Hybrid Search option. Once enabled, the system expects a Query Template in JSON format to control how results are retrieved and scored.

**Query Template Schema**

```
{
  "vector_weight": 0.6,
  "keyword_weight": 0.4,
  "fields": [
    "raw_chunk^2.0"
  ]
}
```

* `vector_weight:` Specifies the contribution of vector similarity to the final relevance score. Value must be between 0 and 1.
* `keyword_weight`: Specifies the contribution of keyword relevance. Must complement the vector\_weight to ensure balanced scoring
* `fields`: Field to which the defined scoring weight is applied during retrieval.

This configuration allows fine-grained control over hybrid ranking strategies, ensuring optimal relevance in document retrieval across varied datasets.

{% hint style="info" %}

> Hybrid Search is not supported for PostgreSQL knowledge base. This feature is available only for OpenSearch-based and Azure AI Search vector stores.
> {% endhint %}

#### Search data

**Search data** executes a live retrieval query against the connected dataset index (OpenSearch) and returns the highest-relevance matched content for verification before it is used downstream.

* **Run retrieval**
  * Submits the entered query to OpenSearch when the send button is clicked.
  * Retrieves the top-ranked matches based on the configured retrieval method.
* **Review returned content**
  * Returns a response with a unique `request_id` for traceability.
  * Displays matched items in `results`, including `page_content` (the exact text selected as context).
* **Validate and troubleshoot with Tracing Details**
  * Provides step-level visibility into the retrieval pipeline:
    * **Retrieve Context**
    * **Generate Embeddings**
    * **Search Vector Index**

<figure><img src="/files/6ApzLaEfgL9MfdwablZ8" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Link the **Dataset** element to the **Knowledge base** element in the  recipe canvas to link your data with the vector store.&#x20;
{% endhint %}

### Data Processing **Preferences**

When you link the **Dataset** element to the **Knowledge base** element, you can set the Data Processing Preferences that would define your vector embedding creation process. These preferences include:

#### **Embedding Model**:&#x20;

You can choose from a selection of  available embeddings models in the Karini AI [Model hub](/karini-ai-documentation/model-hub.md).&#x20;

#### **Chunking Type**:&#x20;

You can define a chunking strategy for your unstructured data

1. **Recursive**: This method divides data hierarchically or based on nested structures.
2. **Semantic**: This method segments data based on semantic boundaries or logical breaks in the content.
3. **Layout aware chunking:** This method divides data based on the layout and visual structure, preserving the spatial relationships within the content.

{% hint style="info" %}
Layout-aware Chunking is available only when the OCR option "Amazon Textract - Extract with Tables" is selected.
{% endhint %}

#### **Chunk Size**:&#x20;

Specify the size of each data segment processed by the embedding model.&#x20;

#### **Chunk Overlap**:&#x20;

Define the overlap between consecutive chunks of data segments. Overlapping helps ensure continuity and context preservation across chunks, especially in sequential or interconnected data.

## Saving a Recipe

You can save the recipe at any point during the creation. Saving the recipe preserves all configurations and connections made in the workflow for future reference or deployment.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://karini-ai.gitbook.io/karini-ai-documentation/recipes/knowledgebase-recipe/create-recipe.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
