# Knowledge Base

**Create the Knowledge Base for Your Assistant:**

* By uploading training data in **JSON format**, or
* By manually adding **key/value pairs**

<div align="center"><figure><img src="/files/tiDviGXfu5igKpkXFACf" alt="" width="375"><figcaption></figcaption></figure></div>

## What is a vector database?

This is a special type of database that stores information in the form of **lists of numbers (vectors)**. Each object—whether it’s a word, image, text, or something else—is converted into an array of numbers.

In our example, the image above shows **300 dimensions**, which means each object is represented by 300 numbers:\
`[0.34, 2.35, 8.34, ...]` – this is a vector of 300 numbers.

**Semantic (meaning-based) similarity**\
This represents the similarity in meaning between objects in the database.

**Left side (similar objects):**

* Wolf, Dog, Cat – these are close to each other because they are all animals.
* Chicken – stands separately but is still nearby, as it has a meaningful connection between animal and bird.
* Kitten – is closest to Cat in meaning, so if a query is related to the word “kitten,” the database will search for all words and sentences semantically related to animals, names, or other meaning-bearing concepts and return the best response.

**Right side (technology companies):**

* 🍌 Banana
* 🍎 Apple – Apple the company
* G – Google
* Apple – similar to Apple Inc.

## How does it work?

1. **Embedding:** The AI model converts words/images into numbers.
2. **Placement in Space:** Objects with similar meanings are placed close to each other.
3. **Search:** When you search for something, the system finds the nearest vectors.

## What is RAG?

**RAG (Retrieval-Augmented Generation)** is a technique that combines search and AI generation. It is a way for AI to answer questions based on your specific knowledge base.

**The 3 main steps of RAG:**

1️⃣ **Retrieval (Search)**

* The user asks a question
* The system converts the question into a vector
* It searches the vector database for the most relevant information
* Finds the 3–5 most similar documents/fragments

2️⃣ **Augmentation**

* The retrieved documents are added to the question as context
* The AI receives both your question and the relevant information

3️⃣ **Generation**

* The AI model analyzes the context
* Generates an answer based on the specific documents
* The answer is accurate and well-founded

**Practical Example:**

**Traditional AI:**

* Question: “What is our company’s vacation policy?”
* Answer: “I don’t know your specific company policy...”

**With RAG:**

* Question: “What is our company’s vacation policy?”
* Retrieval: The system finds relevant sections about vacation in the company’s HR documents
* Augmentation: This information is provided to the AI
* Generation: “According to your company policy, employees have 20 days of paid vacation per year, plus 10 additional days for medical leave…”

{% hint style="info" %}
**Question → \[Vectorization] → Vector Search → Relevant Documents**\
↓\
**AI Model ← \[Context] ←**\
↓\
**Answer**
{% endhint %}

**Use Cases:**\
📚 **Documentation** – Company internal knowledge base\
🏥 **Healthcare** – Analysis of medical records\
⚖️ **Legal** – Search through legal documents\
🛍️ **E-commerce** – Intelligent product recommendations\
📞 **Customer Service** – Automated support


---

# Agent Instructions: 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:

```
GET https://docs.livecaller.io/livecaller/services/ai-assistant/knowledge-base.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
