# Chatbots

Every product built on Synthesise AI can deploy its own intelligent chatbot—trained on the specific charter, audience, and monetization logic of the digital product it’s attached to. These bots act as always-on assistants for sales, onboarding, support, and conversion optimization.

***

#### 1. Capabilities

* **Context-Aware Responses**\
  Chatbots are initialized with the product's UVZ, feature set, and audience pain points. They handle follow-up questions, clarifications, and custom queries.
* **Multi-Mode Support**\
  Bots can operate in:
  * FAQ mode
  * Objection handling mode
  * Content guidance mode
  * Post-purchase interaction mode
* **Dynamic Memory**\
  Short-term session memory is held in Redis, allowing continuity across multi-turn conversations. Context resets after session timeout or upon completion trigger.

***

#### 2. Training & Deployment Pipeline

**2.1 Data Ingestion**

Each chatbot is trained on:

* Product Charter content
* Module breakdowns
* FAQ JSON (auto-generated from flows)
* Monetization triggers

**2.2 Compilation Process**

```rust
struct KnowledgeBase {
    product_id: String,
    items: Vec<String>,
}

impl KnowledgeBase {
    fn compile(&self) -> String {
        self.items.join(" || ")
    }
}
```

**2.3 Embedding**

```html
<script src="https://cdn.synthai.chat/embed.js"></script>
<div id="synth-chatbot" data-product-id="abc123"></div>
```

***

#### 3. Runtime Architecture

**3.1 Chatbot Core Engine**

```rust
struct ChatbotSession {
    id: String,
    memory: Vec<String>,
}

impl ChatbotSession {
    fn receive(&mut self, input: &str) -> String {
        self.memory.push(input.to_string());
        format!("Responding to: {}", input)
    }
}
```

**3.2 Session Control**

* Memory auto-prunes after 5 turns or 15 minutes of inactivity
* LLM call is parameterized with product ID + session stack

***

#### 4. Security & Sandbox Layer

* All LLM output is filtered via prompt validators before being returned to user
* Chatbot memory is sandboxed per user and never shared across sessions

```rust
fn sanitize_input(input: &str) -> String {
    input.replace("prompt injection", "[blocked]")
}
```

***

#### 5. Use Cases by Product Type

| Product Type | Chatbot Use Case                         |
| ------------ | ---------------------------------------- |
| Courses      | Lesson unlock guidance, quiz help        |
| SaaS Flows   | Pricing negotiation, feature explainers  |
| Templates    | Personalization suggestions              |
| Coaching     | Schedule follow-ups, overcome objections |


---

# 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://synthesise-ai.gitbook.io/synthesise-ai/core-modules/chatbots.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.
