> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zapthinker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create RAG Bot

> Creates a new RAG bot with semantic search capabilities for the specified instance.



## OpenAPI

````yaml openapi-v2 POST /rag/set/{instance}
openapi: 3.0.3
info:
  title: ZapThinker API
  version: 2.1.1
servers:
  - url: https://api.zapthinker.com
security: []
paths:
  /rag/set/{instance}:
    post:
      tags:
        - RAG Controller
      summary: Create a new RAG bot
      description: >-
        Creates a new RAG bot with semantic search capabilities for the
        specified instance.
      operationId: createRagBot
      parameters:
        - name: instance
          in: path
          required: true
          description: Nome da instância
          schema:
            type: string
      requestBody:
        description: Configuração do bot RAG
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                enabled:
                  type: boolean
                description:
                  type: string
                triggerType:
                  type: string
                  enum:
                    - all
                    - keyword
                    - none
                    - advanced
                triggerOperator:
                  type: string
                  enum:
                    - equals
                    - contains
                    - startsWith
                    - endsWith
                    - regex
                triggerValue:
                  type: string
                expire:
                  type: integer
                keywordFinish:
                  type: string
                delayMessage:
                  type: integer
                unknownMessage:
                  type: string
                listeningFromMe:
                  type: boolean
                stopBotFromMe:
                  type: boolean
                keepOpen:
                  type: boolean
                debounceTime:
                  type: integer
                ignoreJids:
                  type: array
                  items:
                    type: string
                splitMessages:
                  type: boolean
                timePerChar:
                  type: integer
                maxResults:
                  type: integer
                  description: Número máximo de resultados da busca semântica
                similarityThreshold:
                  type: number
                  description: Limiar de similaridade (0 a 1)
                keyspace:
                  type: string
                  description: Keyspace do banco vetorial
                modelName:
                  type: string
                  description: 'Nome do modelo de IA (ex: gpt-4o-mini)'
                temperature:
                  type: number
                  description: Temperatura do modelo (0 a 2)
                aiCategory:
                  type: string
                  description: Categoria de IA para roteamento
                responsePrompt:
                  type: string
                  description: Prompt customizado para respostas
              required:
                - enabled
                - triggerType
                - maxResults
                - similarityThreshold
                - modelName
                - temperature
      responses:
        '201':
          description: Bot RAG criado com sucesso
          content:
            application/json:
              schema:
                type: object
        '400':
          description: Parâmetros inválidos
        '500':
          description: Erro interno do servidor
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: apikey
      description: Your authorization key header

````