ECOChat2 - Technical Documentation

Created by Sebastian David Garcia Saiz, Modified on Thu, 3 Apr at 12:45 PM by Sebastian David Garcia Saiz

Context and objective 

 

ECOChat is a versatile platform developed by Pangeanic to create, deploy and manage virtual assistants within an organization. The administration interface allows administrators to efficiently manage various aspects of the ECOChat system, ensuring smooth operation and optimal performance. 


  1. 1. Integrated architecture 

 

A 3-layer architecture is proposed, each of them scalable and functional including user and access control, a complete API for user access and administration actions. 

 

 

 

 

 

 

 

 

The Frontend (Admin ECOChat and Chatbot ECOChat) use the API (API-ECOCHAT). 

  • The ECOCHAT API Access Server controls user access, accesses the database and consumes the text-extractor, web-scraper and pipeline modules 
  • Administrators have access to an ECO-type interface that allows the creation of groups, users, the creation of new indexes from new documentation, the creation and definition of assistants. 
  • Users access a simple conversational interface, which allows them to configure conversation settings (essentially by choosing a wizard). 
  • It is also important to note that ECO Access Server has the ability to manage multiple RAG systems allowing for scaling. 

 

 

Functionally described: 


  1. Administrators and users use front-end applications that access the set of services through the ECOChat API. 
  2. The API-ECOCHAT access server manages actor requests, controls access and monitors usage, and finally routes requests to the Modules cluster, acting as an application balancer. 
  3. Make requests to a Module (extractor, scraping, pipeline) to reformulate, evaluate the relevance of the search and generate content. 

 

  1. 2. ECO-Pipeline: API for ECOChat 

Index: 

ECO-Pipeline uses several external modules for its operation. In the case of indexing, the text-extractor and web-scraper modules are used. 

 

This API is for internal use and is responsible for managing and processing data within our infrastructure. It is not exposed to end users. 

 

To test the indexing functionality, you must: 

Send a file or web to the corresponding module. 

 curl -X 'POST' 'https://api-priv.pangeanic.com/module/web-scraper/process' -H 'accept: application/json' -H 'Content-Type: application/json 

        -d '{ 

            "url": "https://pangeanic.com/", 

            "limit": 10, 

            "mode": "RECURSIVE", 

            "extract_documents": false, 

            "extract_multimedia": false, 

            "from_beginning": true 

        }' 

 

NOTE: It is important to copy the id returned by this module if you have not provided one. 

 

Then you must verify if the status of that file/web is in SUCCESS. 

 

    curl -X 'GET' 'https://api-priv.pangeanic.com/module/web-scraper/status/<ID>' -H 'accept: application/json' 

 

Finally send the file/web to index 

curl -X 'POST' 'http://192.168.100.65:8015/module/pipeline/index/' -H 'accept: application/json' -H 'Content-Type: application/json 

    -d '{ 

        "source_id": "<ID>", 

        "data_type": "TEXT", 

        "source_type": "WEB", 

        "collections": [ 

            "<COL_NAME>" 

        ], 

        "module_name": "WEB_SCRAPER", 

        "module_url": "https://api-priv.pangeanic.com/module/web-scraper", 

        "callback_url": "" 

    }' 

Q&A Pipeline 

For simplicity, we will only give an example with the Q&A Pipeline, but it happens in a similar way for the rest. 

 

curl -X 'POST' 'http://192.168.100.65:8015/module/pipeline/qa/' -H 'accept: application/json' -H 'Content-Type: application/json 

    -d '{ 

        "message": "Qué es Pangeanic?", 

        "filters": { 

            "collection_ids": [ 

            "<COL_NAME>" 

            ] 

        }, 

        "history": [], 

        "prompts": { 

            "rephrase_prompt": "", 

            "system_prompt": "", 

            "task_prompt": "" 

        }, 

        "config": { 

            "always_rephrase": true, 

            "include_datetime": true, 

            "include_citations": true, 

            "use_language_hint": false, 

            "language": "English" 

        }, 

        "retriever": { 

            "rerank": false, 

            "llm_chunk_filter": true, 

            "num_to_retrieve": 10, 

            "include_title": false, 

            "include_web_search": false, 

            "search_type": "HYBRID" 

        } 

    }' 

Index Operations. 

Index 

Endpoint: POST {{url}}/module/pipeline/index/ 

Description: This endpoint allows users to ask a question to a specific assistant. The request requires a JSON body with the question details. 

Request Body: 

{ 

  "source_id": "4040f89a-a406-43d6-8917-494be49a5db7", 

  "data_type": "TEXT", 

  "source_type": "FILE", 

  "collections": [ 

    "col-10" 

  ], 

  "module_name": "TEXT_EXTRACTOR", 

  "module_url": "https://api-priv.pangeanic.com/module/text-extractor", 

  "callback_url": "" 

} 

Response:  

{ 

  "success": true, 

  "message": "string", 

  "data": {} 

} 

 

 

Validation Error 

{ 

  "detail": [ 

    { 

      "loc": [ 

        "string", 

        0 

      ], 

      "msg": "string", 

      "type": "string" 

    } 

  ] 

} 

 

Delete 

Endpoint: DELETE {{url}} /module/pipeline/index/{id} 

Description: This endpoint deletes a document from the document database and its related chunks from the chunk database. Both deletions persist the changes to the database. 

Response:  

{ 

  "success": true, 

  "message": "string", 

  "data": {} 

} 

 

Validation Error 

{ 

  "detail": [ 

    { 

      "loc": [ 

        "string", 

        0 

      ], 

      "msg": "string", 

      "type": "string" 

    } 

  ] 

} 

Get Source 

Endpoint: GET {{url}}/module/pipeline/index/source/{id} 

Description: This endpoint fetches a document from the vector store using the provided semantic ID. If the document is not found, it raises an HTTPException with a 500 status code. 

Response:  

Dict: A  dictionary representing the retrieved document. 

Validation Error 

{ 

  "detail": [ 

    { 

      "loc": [ 

        "string", 

        0 

      ], 

      "msg": "string", 

      "type": "string" 

    } 

  ] 

} 

 

Q&A v2 

Endpoint: POST {{url}} /module/pipeline/qa/ 

Description: This endpoint processes a user's query along with optional conversation history and retrieval configurations to generate an answer. It integrates retrieval-augmented generation (RAG) to combine relevant context from a vector database with generative AI capabilities. 

Request Body: 

{ 

  "message": "Quien es Obama?", 

  "filters": { 

    "collection_ids": [ 

      "col-10" 

    ] 

  }, 

  "history": [], 

  "prompts": {}, 

  "config": { 

    "always_rephrase": true, 

    "include_datetime": true, 

    "include_citations": true, 

    "use_language_hint": false, 

    "language": "English" 

  }, 

  "retriever": { 

    "rerank": false, 

    "llm_chunk_filter": true, 

    "num_to_retrieve": 10, 

    "include_title": false, 

    "include_web_search": false, 

    "search_type": "HYBRID" 

  } 

} 

 

Response:  

{ 

  "rephrase": { 

    "rephrased_query": [ 

      "string" 

    ] 

  }, 

  "answer": { 

    "answer": "string", 

    "citations": [ 

      { 

        "source_id": "string", 

        "source_metadata": {}, 

        "quote": "string", 

        "text": "string", 

        "summary": "string" 

      } 

    ] 

  }, 

  "token_usage": { 

    "net_input": 0, 

    "net_output": 0, 

    "gross_input": 0, 

    "gross_output": 0 

  } 

} 

Validation Error 

{ 

  "detail": [ 

    { 

      "loc": [ 

        "string", 

        0 

      ], 

      "msg": "string", 

      "type": "string" 

    } 

  ] 

} 

 

Chat Session Name 

Endpoint: POST {{url}} /module/pipeline/qa/session-name 

Description: This endpoint processes a user's query along with optional conversation history and retrieval configurations to generate an answer. It integrates retrieval-augmented generation (RAG) to combine relevant context from a vector database with generative AI capabilities. 

Request Body: 

{ 

  "history": [ 

    { 

      "message": "Hello!", 

      "message_type": "user" 

    }, 

    { 

      "message": "Hi, how can I help you?", 

      "message_type": "system" 

    } 

  ] 

} 

Response:  

"string" 

 

Validation Error 

{ 

  "detail": [ 

    { 

      "loc": [ 

        "string", 

        0 

      ], 

      "msg": "string", 

      "type": "string" 

    } 

  ] 

} 

 

Search 

Endpoint: POST {{url}} /module/pipeline/search/ 

Description: This endpoint processes the provided question through a search pipeline that includes rephrasing the query, retrieving relevant documents, and computing token usage information. 

Request Body: 

{ 

  "message": "Quien es Obama?", 

  "filters": { 

    "collection_ids": [ 

      "col-10" 

    ] 

  }, 

  "history": [], 

  "prompts": {}, 

  "config": { 

    "always_rephrase": true, 

    "include_datetime": true, 

    "include_citations": true, 

    "use_language_hint": false, 

    "language": "English" 

  }, 

  "retriever": { 

    "rerank": false, 

    "llm_chunk_filter": true, 

    "num_to_retrieve": 10, 

    "include_title": false, 

    "include_web_search": false, 

    "search_type": "HYBRID" 

  } 

} 

Response:  

{ 

  "rephrase": { 

    "rephrased_query": [ 

      "string" 

    ] 

  }, 

  "documents": [ 

    { 

      "id": "string", 

      "metadata": {}, 

      "page_content": "string", 

      "type": "Document", 

      "document_id": "string", 

      "chunk_id": 0, 

      "semantic_identifier": "string", 

      "collections": [], 

      "title": "string", 

      "content_summary": "string", 

      "source_type": "FILE", 

      "data_type": "TEXT", 

      "hidden": false, 

      "is_full": true, 

      "priority": 1, 

      "score": 0, 

      "created_at": "2024-11-26T13:44:43.285208", 

      "updated_at": "2024-11-26T13:44:43.285213" 

    } 

  ], 

  "token_usage": { 

    "net_input": 0, 

    "net_output": 0, 

    "gross_input": 0, 

    "gross_output": 0 

  } 

} 

Validation Error 

{ 

  "detail": [ 

    { 

      "loc": [ 

        "string", 

        0 

      ], 

      "msg": "string", 

      "type": "string" 

    } 

  ] 

} 

 

Generate 

Endpoint: POST {{url}} /module/pipeline/generate/ 

Description: This endpoint processes a user's query and returns a generated response based on the input query, conversation history, and retrieval configurations. 

Request Body: 

{ 

  "message": "Quien es Obama?", 

  "filters": { 

    "collection_ids": [ 

      "col-10" 

    ] 

  }, 

  "history": [], 

  "prompts": {}, 

  "config": { 

    "always_rephrase": true, 

    "include_datetime": true, 

    "include_citations": true, 

    "use_language_hint": false, 

    "language": "English" 

  }, 

  "retriever": { 

    "rerank": false, 

    "llm_chunk_filter": true, 

    "num_to_retrieve": 10, 

    "include_title": false, 

    "include_web_search": false, 

    "search_type": "HYBRID" 

  } 

} 

Response:  

{ 

  "rephrase": { 

    "rephrased_query": [ 

      "string" 

    ] 

  }, 

  "answer": { 

    "answer": "string", 

    "citations": [ 

      { 

        "source_id": "string", 

        "source_metadata": {}, 

        "quote": "string", 

        "text": "string", 

        "summary": "string" 

      } 

    ] 

  }, 

  "token_usage": { 

    "net_input": 0, 

    "net_output": 0, 

    "gross_input": 0, 

    "gross_output": 0 

  } 

} 

Validation Error 

{ 

  "detail": [ 

    { 

      "loc": [ 

        "string", 

        0 

      ], 

      "msg": "string", 

      "type": "string" 

    } 

  ] 

} 

 

Summarize 

Endpoint: POST {{url}} /module/pipeline/sumarize/ 

Description: This endpoint processes the provided query through a summarization pipeline, where the content is retrieved, rephrased, and summarized, returning the summarized text along with relevant token usage and rephrased queries. 

Request Body: 

{ 

  "message": "Quien es Obama?", 

  "filters": { 

    "collection_ids": [ 

      "col-10" 

    ] 

  }, 

  "history": [], 

  "prompts": {}, 

  "config": { 

    "always_rephrase": true, 

    "include_datetime": true, 

    "include_citations": true, 

    "use_language_hint": false, 

    "language": "English" 

  }, 

  "retriever": { 

    "rerank": false, 

    "llm_chunk_filter": true, 

    "num_to_retrieve": 10, 

    "include_title": false, 

    "include_web_search": false, 

    "search_type": "HYBRID" 

  } 

} 

Response:  

{ 

  "rephrase": { 

    "rephrased_query": [ 

      "string" 

    ] 

  }, 

  "answer": { 

    "answer": "string", 

    "citations": [ 

      { 

        "source_id": "string", 

        "source_metadata": {}, 

        "quote": "string", 

        "text": "string", 

        "summary": "string" 

      } 

    ] 

  }, 

  "token_usage": { 

    "net_input": 0, 

    "net_output": 0, 

    "gross_input": 0, 

    "gross_output": 0 

  } 

} 

Validation Error 

{ 

  "detail": [ 

    { 

      "loc": [ 

        "string", 

        0 

      ], 

      "msg": "string", 

      "type": "string" 

    } 

  ] 

} 

 

Social 

Endpoint: POST {{url}} /module/pipeline/social/ 

Description: This endpoint processes the provided query. 

Request Body: 

{ 

  "message": "string" 

} 

Response:  

{ 

  "rephrase": { 

    "rephrased_query": [ 

      "string" 

    ] 

  }, 

  "answer": { 

    "answer": "string", 

    "citations": [ 

      { 

        "source_id": "string", 

        "source_metadata": {}, 

        "quote": "string", 

        "text": "string", 

        "summary": "string" 

      } 

    ] 

  }, 

  "token_usage": { 

    "net_input": 0, 

    "net_output": 0, 

    "gross_input": 0, 

    "gross_output": 0 

  } 

} 

Validation Error 

{ 

  "detail": [ 

    { 

      "loc": [ 

        "string", 

        0 

      ], 

      "msg": "string", 

      "type": "string" 

    } 

  ] 

} 

 

 

 

Get 

Endpoint: GET {{url}} /module/pipeline/collection/{id} 

Description: Retrieve details about a collection. 

Response:  

"string" 

Validation Error 

{ 

  "detail": [ 

    { 

      "loc": [ 

        "string", 

        0 

      ], 

      "msg": "string", 

      "type": "string" 

    } 

  ] 

} 

 

Delete 

Endpoint: DELETE {{url}} /module/pipeline/collection/{id} 

Description: Delete a collection and remove it from all related documents and chunks. 

Response:  

{ 

  "success": true, 

  "message": "string", 

  "data": {} 

} 

Validation Error 

{ 

  "detail": [ 

    { 

      "loc": [ 

        "string", 

        0 

      ], 

      "msg": "string", 

      "type": "string" 

    } 

  ] 

} 

 

Add Collection Source 

Endpoint: POST {{url}} /module/pipeline/collection/add-source 

Description: Add documents and chunks to a collection. 

Body: 

{ 

  "collection_id": "col-10", 

  "document_ids": [ 

    "4040f89a-a406-43d6-8917-494be49a5db7" 

  ] 

} 

 

Response:  

{ 

  "rephrase": { 

    "rephrased_query": [ 

      "string" 

    ] 

  }, 

  "answer": { 

    "answer": "string", 

    "citations": [ 

      { 

        "source_id": "string", 

        "source_metadata": {}, 

        "quote": "string", 

        "text": "string", 

        "summary": "string" 

      } 

    ] 

  }, 

  "token_usage": { 

    "net_input": 0, 

    "net_output": 0, 

    "gross_input": 0, 

    "gross_output": 0 

  } 

}  

Validation Error 

{ 

  "detail": [ 

    { 

      "loc": [ 

        "string", 

        0 

      ], 

      "msg": "string", 

      "type": "string" 

    } 

  ] 

} 

 

Delete Collection Source 

Endpoint: POST {{url}} /module/pipeline/collection/add-source 

Description: Remove documents and chunks from a collection. 

Body: 

{ 

  "collection_id": "col-10", 

  "document_ids": [ 

    "4040f89a-a406-43d6-8917-494be49a5db7" 

  ] 

} 

 

Response:  

{ 

  "success": true, 

  "message": "string", 

  "data": {} 

}  

Validation Error 

{ 

  "detail": [ 

    { 

      "loc": [ 

        "string", 

        0 

      ], 

      "msg": "string", 

      "type": "string" 

    } 

  ] 

} 

 

Endpoint: POST {{url}} /module/pipeline/router/ 

Description: This endpoint processes the provided message and routes it based on the pipeline logic. It returns the destination determined by the pipeline along with token usage statistics related to the message. 

Body: 

{ 

  "message": "string" 

} 

Response:  

{ 

  "destination": "string", 

  "token_usage": { 

    "net_input": 0, 

    "net_output": 0, 

    "gross_input": 0, 

    "gross_output": 0 

  } 

} 

Validation Error 

{ 

  "detail": [ 

    { 

      "loc": [ 

        "string", 

        0 

      ], 

      "msg": "string", 

      "type": "string" 

    } 

  ] 

} 

 

 

Healthcheck 

Endpoint: GET {{url}} /module/pipeline/healthcheck 

Description: Check the API status.  

Response: 

{ 

  "message": "string" 

} 

Retriever Check 

Endpoint: GET {{url}} /module/pipeline/retriever-check 

Description: Check the API status.  

Response: 

{ 

  "message": "string" 

} 

Llm Check 

Endpoint: GET {{url}} /module/pipeline/llm-check 

Description: Check the API status.  

Response: 

{ 

  "message": "string" 

} 

Module Check 

Endpoint: POST {{url}} /module/pipeline/module-check 

Description: Check the API status. 

Body: 

{ 

  "source_id": "4040f89a-a406-43d6-8917-494be49a5db7", 

  "module_url": "https://api-priv.pangeanic.com/module/text-extractor" 

 

Response: 

{ 

  "message": "string" 

} 

 

 

 

 

 

 

  1. DATABASE 

 

Detailed description of the structure and attributes of the tables that make up the database. Each table is described with its respective fields, data types, constraints and relationships. This information is essential for developers and database administrators who need to understand and manage the database efficiently. 

 Table apikeys 

  • id: Unique identifier, type int, not null, auto-increment. 
  • key: API key, type varchar(255), not null. 
  • userId: User identifier, type varchar(255), not null. 
  • expiresAt: Expiration date, type datetime, nullable. 

Table assistant_collection 

  • id: Unique identifier, type int, not null, auto-increment. 
  • assistantId: Assistant identifier, type varchar(255), not null. 
  • collectionId: Collection identifier, type varchar(255), not null. 
  • accessMode: Access mode, type varchar(255), not null. 
  • created_at: Creation date, type datetime, not null. 

Table assistant_prompt 

  • id: Unique identifier, type int, not null, auto-increment. 
  • assistantId: Assistant identifier, type varchar(255), not null. 
  • promptId: Prompt identifier, type varchar(255), not null. 
  • created_at: Creation date, type datetime, not null. 

Table assistant_skills 

  • id: Unique identifier, type int, not null, auto-increment. 
  • assistantId: Assistant identifier, type varchar(255), not null. 
  • skillId: Skill identifier, type int, not null. 
  • created_at: Creation date, type datetime, not null. 

Table assistants 

  • id: Unique identifier, type char(36), not null. 
  • name: Assistant name, type varchar(255), not null. 
  • description: Assistant description, type text, not null. 
  • access_type: Access type, type varchar(255), not null. 
  • type: Assistant type, type varchar(255), not null. 
  • chunks: Number of chunks, type int, nullable, default 0. 
  • llm_relevance_filter: LLM relevance filter, type int, nullable, default 0. 
  • llm_filter_extraction: LLM filter extraction, type int, nullable, default 0. 
  • starter_message: Starter message, type varchar(255), nullable. 
  • poor_answer_message: Poor answer message, type varchar(255), nullable. 
  • instanceId: Instance identifier, type varchar(255), not null. 
  • created_at: Creation date, type datetime, not null. 

Table collection_source 

  • id: Unique identifier, type int, not null, auto-increment. 
  • collectionId: Collection identifier, type varchar(255), not null. 
  • sourceId: Source identifier, type varchar(255), not null. 
  • created_at: Creation date, type datetime, not null. 

Table collections 

  • id: Unique identifier, type char(36), not null. 
  • name: Collection name, type varchar(255), not null. 
  • description: Collection description, type text, not null. 
  • score: Score, type int, not null, default 100. 
  • instanceId: Instance identifier, type varchar(255), not null. 
  • created_at: Creation date, type datetime, not null. 

Table documents 

  • id: Unique identifier, type char(36), not null. 
  • url: URL, type varchar(255), not null. 
  • new_name: New name, type varchar(255), nullable. 
  • old_name: Old name, type varchar(255), nullable. 
  • state: State, type varchar(255), nullable, default pending. 
  • sourceId: Source identifier, type char(36), not null. 
  • created_at: Creation date, type datetime, not null. 

Table groups 

  • id: Unique identifier, type char(36), not null. 
  • name: Group name, type varchar(255), not null. 
  • description: Group description, type text, not null. 
  • instanceId: Instance identifier, type varchar(255), not null. 
  • created_at: Creation date, type datetime, not null. 

Table instance_user 

  • id: Unique identifier, type int, not null, auto-increment. 
  • user_id: User identifier, type varchar(255), not null. 
  • instance_id: Instance identifier, type varchar(255), not null. 
  • role: Role, type varchar(255), nullable, default USER. 
  • created_at: Creation date, type datetime, not null. 

Table instances 

  • id: Unique identifier, type char(36), not null. 
  • name: Instance name, type varchar(255), not null. 
  • client_name: Client name, type varchar(255), not null. 
  • base_url: Base URL, type varchar(255), nullable. 
  • logo: Logo, type varchar(255)nullable. 
  • description: Instance description, type text, not null. 
  • type: Instance type, type text, not null. 
  • lang: Language, type text, not null. 
  • controlts: Control timestamp, type bigint, nullable. 
  • controlperiod: Control period, type varchar(255), nullable. 
  • limits: Limits, type varchar(255), nullable. 
  • counters: Counters, type varchar(255), nullable. 
  • lastqueryts: Last query timestamp, type datetime, nullable. 
  • usestatus: Use status, type int, not null, default 0. 
  • prodstatus: Production status, type int, not null, default 0. 
  • active: Active, type tinyint(1), nullable, default 1. 
  • removed: Removed, type int, nullable. 
  • created_at: Creation date, type datetime, not null. 

 

Table permissions 

  • id: Unique identifier, type char(36), not null. 
  • name: Name of the permission, type varchar(255), not null. 
  • skill: Skill associated with the permission, type varchar(255), not null. 
  • resource: Resource associated with the permission, type varchar(255), not null. 
  • accessMode: Access mode, type varchar(255), not null. 
  • groupId: Group identifier, type varchar(255), not null. 
  • collectionId: Collection identifier, type varchar(255), can be null. 
  • assistantId: Assistant identifier, type int, can be null. 
  • instanceId: Instance identifier, type varchar(255), can be null. 
  • created_at: Creation date, type datetime, not null. 

Table profiles 

  • id: Unique identifier, type int, not null, auto-increment. 
  • name: First name, type varchar(255), not null. 
  • last_name: Last name, type varchar(255), not null. 
  • phone: Phone number, type varchar(255), nullable. 
  • language: Language, type varchar(255), not null. 
  • userId: User ID, type varchar(255), not null. 
  • removed: Removed, type int, nullable. 

Table prompts 

  • id: Unique identifier, type char(36), not null. 
  • name: Prompt name, type varchar(255), not null. 
  • description: Prompt description, type text, not null. 
  • prompt: Prompt content, type text, nullable. 
  • lang: Language, type varchar(255), not null. 
  • type: Type, type varchar(255), not null. 
  • skill: Skill, type varchar(255), not null. 
  • shared: Shared, type int, nullable. 
  • instanceId: Instance ID, type varchar(255), not null. 
  • created_at: Creation date, type datetime, not null. 

Table querys 

  • id: Unique identifier, type char(36), not null. 
  • message_in: Incoming message, type text, can be null. 
  • message_out: Outgoing message, type text, can be null. 
  • feedback: Feedback, type int, can be null. 
  • feedback_message: Feedback message, type text, can be null. 
  • refs: References, type text, can be null. 
  • ts_in: Timestamp in, type varchar(255), can be null. 
  • ts_out: Timestamp out, type varchar(255), can be null. 
  • tokens_in: Tokens in, type int, can be null. 
  • tokens_out: Tokens out, type int, can be null. 
  • task_prompt: Task prompt, type int, can be null. 
  • skill: Skill, type text, can be null. 
  • sessionId: Session identifier, type varchar(255), not null. 
  • assistantId: Assistant identifier, type varchar(255), not null. 
  • instanceId: Instance identifier, type varchar(255), not null. 
  • created_at: Creation date, type datetime, not null. 

Table sequelizemeta 

  • name: Unique name, type varchar(255), not null. 

Table sessions 

  • id: Unique identifier, type char(36), not null. 
  • name: Session name, type varchar(255), can be null. 
  • assistantId: Assistant identifier, type varchar(255), not null. 
  • userId: User identifier, type varchar(255), not null. 
  • created_at: Creation date, type datetime, not null. 

Table skills 

  • id: Unique identifier, type int, not null, auto-increment. 
  • name: Skill name, type varchar(255), can be null. 
  • description: Skill description, type varchar(255), not null. 
  • created_at: Creation date, type datetime, not null. 

Table sources 

  • id: Unique identifier, type char(36), not null. 
  • name: Source name, type varchar(255), not null. 
  • description: Source description, type text, not null. 
  • sourcetype: Source type, type varchar(255), not null. 
  • reference: Reference, type text, can be null. 
  • web_connector_type: Web connector type, type varchar(255), can be null. 
  • pages: Number of pages, type int, not null, default 0. 
  • score: Score, type int, not null, default 100. 
  • indextsreq: Index request timestamp, type bigint, not null, default 0. 
  • indextsend: Index end timestamp, type bigint, not null, default 0. 
  • enabled: Enabled status, type int, not null, default 0. 
  • indexstatus: Index status, type int, not null, default 0. 
  • instanceId: Instance identifier, type varchar(255), not null. 
  • created_at: Creation date, type datetime, not null. 

Table user_group 

  • id: Unique identifier, type int, not null, auto-increment. 
  • user_id: User identifier, type varchar(255), not null. 
  • group_id: Group identifier, type varchar(255), not null. 
  • created_at: Creation date, type datetime, not null. 

Table users 

  • id: Unique identifier, type char(36), not null. 
  • email: Email address, type varchar(255), not null. 
  • password: Password, type varchar(255), not null. 
  • recovery_token: Recovery token, type varchar(255), can be null. 
  • role: User role, type varchar(255), not null, default CUSTOMER. 
  • create_at: Creation date, type datetime, not null. 

 

  1. API ECOCHAT 

This API is designed to interact directly with end users. It allows customers to access our features and services efficiently and securely. 

 

Complete and detailed documentation can be found in Swagger (https://api.pangeanic.com/service/ecochat/docs/), which describes all available operations and how to use them. 

Auth Endpoints 

Login  

EndpointPOST {{url}}/auth/login 

Description: Authenticates a user using their email and password. 

Request Body 

{ 

  "email": "user@example.com", 

  "password": "password123" 

} 

Verify Token 

EndpointPOST  {{url}}/auth/verify_token 

Description: Verifies the validity of an API token. 

Request Body:  

{ 

  "api_token": "your_api_token_here" 

} 

Instance Endpoints 

Create Instance 

EndpointPOST {{url}}/instances 

Description: Creates a new instance with the specified details. 

Request Body 

{ 

  "name": "InstanceName", 

  "client_name": "ClientName", 

  "baseUrl": "http://example.com", 

  "description": "Instance description", 

  "type": "BASIC", // Options: BASIC, STANDARD, PROFESSIONAL 

  "lang": "EN", // Options: ES, EN, JA 

  "logo": null 

} 

Get Instances 

Endpoint: GET {{url}}/instances 

Description: Retrieves a list of all instances. 

Get All Instances 

Endpoint: GET {{url}}/instances/all 

Description: Retrieves detailed information about all instances. 

Get One Instance 

EndpointGET {{url}}/instances/{{instance}} 

Description: Retrieves details of a specific instance identified by {{instance}}. 

Update Instance 

EndpointPATCH {{url}}/instances 

Description: Updates the details of an existing instance. 

Request Body 

{ 

  "id": 4, 

  "name": "UpdatedInstanceName", 

  "client_name": "UpdatedClientName", 

  "baseUrl": "http://example.com", 

  "description": "Updated description", 

  "type": "BASIC", 

  "lang": "EN", 

  "logo": null 

} 

Assistant Endpoints 

Create Assistant 

EndpointPOST {{url}}/instances/2/assistants 

Description: Creates a new assistant for a specific instance. 

Request Body:  

{ 

  "name": "AssistantName", 

  "description": "Assistant description", 

  "type": "CHATBOT", // Options: CHATBOT 

  "access_type": "PUBLIC" // Options: PUBLIC, INTERNAL, RESTRICTED 

} 

Get Assistants 

EndpointGET {{url}}/instances/{{instance}}/assistants 

Description: Retrieves a list of assistants for a specific instance. 

Get Public Assistants 

Endpoint: GET {{url}}/instances/{{instance}}/assistants/public 

Description: Retrieves a list of public assistants for a specific instance. 

 

Get One Assistant 

Endpoint: GET {{url}}/instances/{{instance}}/assistants/{{assistantId}} 

Description: This endpoint retrieves the details of a specific assistant identified by the {{assistantId}} variable.Shape 

Update Assistant 

Endpoint: PATCH {{url}}/instances/{{instance}}/assistants/{{assistantId}} 

Description: This endpoint updates the details of a specific assistant. 

Request Body: 

{ 

  "name": "Updated Assistant Name", 

  "description": "Updated Assistant Description", 

  "type": "CHATBOT", 

  "access_type": "PUBLIC" 

} 

Response: The response will confirm the update of the assistant and provide its updated details. 

Shape 

Create Assistant Message 

Endpoint: POST {{url}}/instances/{{instance}}/assistantmessages 

Description: This endpoint creates a new message for a specific assistant. 

Request Body: 

{ 

  "message": "Contact us at 900 123 456", 

  "type": "POOR", 

  "lang": "ES", 

  "assistantId": "ccd8af31-e2fa-42af-b81b-65bc5caabef9" 

} 

Response: The response will confirm the creation of the message and provide its details. 

 

Prompt Endpoints 

Create Prompt 

Endpoint: POST {{url}}/instances/{{instance}}/prompts 

Description: This endpoint creates a new prompt for a specific instance. 

Request Body: 

{ 

  "name": "Prompt Name", 

  "description": "Prompt Description", 

  "prompt": "You are a Q&A chatbot", 

  "type": "TASK", 

  "skill": "QA", 

  "lang": "ES", 

  "shared": "0" 

} 

Response: The response will confirm the creation of the prompt and provide its details. 

 

Get Prompts 

Endpoint: GET {{url}}/instances/{{instance}}/prompts 

Description: This endpoint retrieves a list of prompts associated with a specific instance identified by the {{instance}} variable. The request does not require any headers or body content. 

Response: The response will contain a list of prompts, including details such as their names, descriptions, types, and other relevant information. 

Shape 

Get One Prompt 

Endpoint: GET {{url}}/instances/{{instance}}/prompts/{{promptId}} 

Description: This endpoint retrieves the details of a specific prompt identified by the {{promptId}} variable. The request does not require any headers or body content. 

Response: The response will contain the details of the specified prompt, including its name, description, type, and other relevant information. 

 

Update Prompt 

Endpoint: PATCH {{url}}/instances/{{instance}}/prompts/{{promptId}} 

Description: This endpoint updates the details of a specific prompt identified by the {{promptId}} variable. The request requires a JSON body with the updated prompt's details. 

Request Body: 

{ 

  "id": 1, 

  "name": "Updated Prompt Name", 

  "description": "Updated Prompt Description", 

  "lang": "ES", 

  "shared": 0, 

  "include_citacions": 0, 

  "datetime_aware": "2024-10-02T13:29:20.000Z", 

  "system_prompt": "System prompt", 

  "task_prompt": "Task prompt" 

} 

 

Collection Endpoints 

Create Collection 

Endpoint: POST {{url}}/instances/{{instance}}/collections 

Description: This endpoint creates a new collection for a specific instance identified by the {{instance}} variable. The request requires a JSON body with the collection's details. 

Request Body: 

{ 

  "name": "Collection Name", 

  "description": "Collection Description" 

} 

Response: The response will confirm the creation of the collection and provide its details. 

Shape 

Get Collections 

Endpoint: GET {{url}}/instances/{{instance}}/collections 

Description: This endpoint retrieves a list of collections associated with a specific instance identified by the {{instance}} variable. The request does not require any headers or body content. 

Response: The response will contain a list of collections, including details such as their names, descriptions, and other relevant information. 

 

Get One Collection 

Endpoint: GET {{url}}/instances/{{instance}}/collections/{{collectionId}} 

Description: This endpoint retrieves the details of a specific collection identified by the {{collectionId}} variable. The request does not require any headers or body content. 

Response: The response will contain the details of the specified collection, including its name, description 

 

Session Endpoints 

Create Session 

Endpoint: POST {{url}}/sessions 

Description: This endpoint creates a new session for a specific assistant. The request requires a JSON body with the session's details. 

Request Body: 

{ 

  "name": "New session", 

  "assistantId": "ccd8af31-e2fa-42af-b81b-65bc5caabef9" 

} 

Response: The response will confirm the creation of the session and provide its details. 

Shape 

Get Sessions 

Endpoint: GET {{url}}/sessions 

Description: This endpoint retrieves a list of all sessions. The request does not require any headers or body content. 

Response: The response will contain a list of sessions, including details such as their names, associated assistants, and other relevant information. 

Shape 

Get Sessions by Assistant 

Endpoint: GET {{url}}/sessions/assistant/{{Assistant}} 

Description: This endpoint retrieves a list of sessions associated with a specific assistant identified by the {{Assistant}} variable. The request does not require any headers or body content. 

Response: The response will contain a list of sessions associated with the specified assistant, including details such as their names and other relevant information. 

Shape 

Get Queries by Session 

Endpoint: GET {{url}}/instances/{{instance}}/sessions/{{sessionId}}/query 

Description: This endpoint retrieves a list of queries associated with a specific session identified by the {{sessionId}} variable. The request does not require any headers or body content. 

Response: The response will contain a list of queries associated with the specified session, including details such as the query text, timestamps, and other relevant information. 

Source Endpoints 

Create Source Web 

Endpoint: POST {{url}}/instances/{{instance}}/sources/web 

Description: This endpoint creates a new web source for a specific instance identified by the {{instance}} variable. The request requires a JSON body with the source's details. 

Request Body: 

{ 

  "name": "Source Name", 

  "description": "Source Description", 

  "sourcetype": "WEB", 

  "reference": "http://example.com", 

  "web_connector_type": "SINGLE_PAGE" 

} 

Response: The response will confirm the creation of the web source and provide its details. 

Shape 

Create Source File 

Endpoint: POST {{url}}/instances/{{instance}}/sources/file 

Description: This endpoint creates a new file source for a specific instance identified by the {{instance}} variable. The request requires form-data with the source's details and the file to be uploaded. 

Request Body (form-data): 

name: The name of the source. 

description: The description of the source. 

files: The file to be uploaded. 

Response: The response will confirm the creation of the file source and provide its details. 

Shape 

Get Sources 

Endpoint: GET {{url}}/instances/{{instance}}/sources 

Description: This endpoint retrieves a list of sources associated with a specific instance identified by the {{instance}} variable. The request does not require any headers or body content. 

Response: The response will contain a list of sources, including details such as their names, descriptions, types, and other relevant information. 

Shape 

Get One Source 

Endpoint: GET {{url}}/instances/{{instance}}/sources/{{sourceId}} 

Description: This endpoint retrieves the details of a specific source identified by the {{sourceId}} variable. The request does not require any headers or body content. 

Response: The response will contain the details of the specified source, including its name, description, type, and other relevant information. 

Shape 

Update Source 

Endpoint: PATCH {{url}}/instances/{{instance}}/sources/{{sourceId}} 

Description: This endpoint updates the details of a specific source identified by the {{sourceId}} variable. The request requires a JSON body with the updated source's details. 

Request Body: 

{ 

  "id": 1, 

  "name": "Updated Source Name", 

  "description": "Updated Source Description" 

} 

Response: The response will confirm the update of the source and provide its updated details. 

 

User Endpoints 

Register 

Endpoint: POST {{url}}/register 

Description: This endpoint registers a new user by providing their details. The request requires a JSON body with the user's information. 

Request Body: 

{ 

  "name": "First Name", 

  "lastName": "Last Name", 

  "language": "es", 

  "user": { 

    "email": "user@example.com", 

    "password": "password123" 

  } 

} 

Response: The response will confirm the registration of the user and provide their details. 

Shape 

Create User 

Endpoint: POST {{url}}/instances/{{instance}}/users 

Description: This endpoint creates a new user for a specific instance identified by the {{instance}} variable. The request requires a JSON body with the user's details. 

Request Body: 

{ 

  "email": "user@example.com", 

  "password": "password123", 

  "name": "First Name", 

  "lastName": "Last Name", 

  "language": "es", 

  "role": "ADMINECO" 

} 

Response: The response will confirm the creation of the user and provide their details. 

Shape 

Get Users 

Endpoint: GET {{url}}/instances/{{instance}}/users 

Description: This endpoint retrieves a list of users associated with a specific instance identified by the {{instance}} variable. The request does not require any headers or body content. 

Response: The response will contain a list of users, including details such as their names, email addresses, roles, and other relevant information. 

 

Question Endpoints 

Ask a Question 

Endpoint: POST {{url}}/questions/public 

Description: This endpoint allows users to ask a question to a specific assistant. The request requires a JSON body with the question details. 

Request Body: 

{ 

  "sessionId": "ef97f608-43d5-41e9-a487-4fd4a8b2e5e9", 

  "assistantId": "ccd8af31-e2fa-42af-b81b-65bc5caabef9", 

  "question": "What is the capital of France?" 

} 

Response: The response will contain the answer to the question provided by the assistant. 

Shape 

Pipeline Q&A 

Endpoint: POST {{url}}/module/pipeline/qa 

Description: This endpoint processes a question through a Q&A pipeline, applying various filters and configurations. The request requires a JSON body with the question details and pipeline configuration. 

Request Body: 

{ 

  "message": "Find the document about Obama", 

  "filters": { 

    "document_ids": [], 

    "collection_ids": ["bd828a15-ae3e-4f5b-8306-5686db85ae93"] 

  }, 

  "history": [], 

  "prompts": { 

    "system_prompt": "", 

    "task_prompt": "", 

    "rephrase_prompt": "" 

  }, 

  "config": { 

    "always_rephrase": true, 

    "include_datetime": true, 

    "include_citations": true, 

    "use_language_hint": true, 

    "language": "Spanish" 

  }, 

  "retriever": { 

    "rerank": false, 

    "llm_chunk_filter": true, 

    "num_to_retrieve": 10, 

    "include_title": false, 

    "include_web_search": false, 

    "search_type": "HYBRID" 

  } 

} 

Response: The response will contain the processed answer to the question, including any relevant documents or information retrieved by the pipeline. 

 

Queries Endpoints 

Get Queries by Instance 

Endpoint: GET {{url}}/instances/{{instance}}/queries 

Description: This endpoint retrieves a list of queries associated with a specific instance identified by the {{instance}} variable. The request does not require any headers or body content. 

Response: The response will contain a list of queries, including details such as the query text, timestamps, and other relevant information. 

 

Update Queries by Instance 

Endpoint: PATCH {{url}}/instances/{{instance}}/queries 

Description: This endpoint updates a query associated with a specific instance identified by the {{instance}} variable. 

 

Request Body: 

{ 

  "id": "ef97f608-43d5-41e9-a487-4fd4a8b2e5e9", 

  " feedback": 0, 

  " feedback_message": “message” 

} 

 

Response:  {"id": "ef97f608-43d5-41e9-a487-4fd4a8b2e5e9"} 

 

  1. ECOCHAT ADMIN 

 

Our web interface is designed to provide users with an intuitive and seamless experience. It offers a range of features and functionalities that cater to both novice and advanced users, ensuring efficient navigation and interaction. 

 

Login 

 

Menu User 

 

 

Instances 

 

 

 

The "Instance" selection feature allows users to choose and manage different instances within the ECOChat platform. Each instance represents a separate environment or configuration, enabling users to organize and control their virtual assistants and data sources effectively. 

 

Dashboard 

This dashboard allows administrators to have a clear and quick view of the status and configuration of their instance, making it easier to manage and monitor available resources. 

 

 

 

Dashboard: The main dashboard where an overview of key metrics and statistics is displayed. Here you can get a quick view of the application's performance and status. 

 

Sources: In this section you can manage data sources. Allows you to add, edit and delete sources that feed the application with information. 

 

Collections: Here you can organize and manage data collections. It is useful for grouping related data and making it easier to access and analyze. 

 

Prompts: This section is dedicated to managing prompts or indications that are used in the application. You can create, edit and delete prompts according to the needs of the system. 

 

Assistants: In this section you can manage virtual assistants or bots. Allows you to configure and customize wizards to improve interaction with users. 

 

Permissions: Here you can manage access permissions. Allows you to define who has access to which parts of the application and what actions they can perform. 

 

Queries: This section allows you to manage and execute queries on the data. It is useful for obtaining specific information and performing detailed analysis. 

 

ChatsHere you can interact with the assistants through an example chat. 

 

 

Sources 

Source management allows you to control and organize the various data sources that virtual assistants use to generate accurate and relevant responses. 

 

 

Collections 

A collection groups together multiple data sources, which the assistant can query to answer questions. 

Collections allow you to efficiently organize and manage the data that the assistant will use, ensuring that the answers are accurate and relevant 

 

 

 

Prompts 

Prompts are predefined text that is added to user queries to provide additional context and improve the accuracy of responses generated by the wizard. 

 

 

Assistants 

Assistants are virtual agents designed to interact with users, answer questions and provide relevant information, they are of public, internal or restricted types. 

 

 

For a virtual assistant to respond effectively, it is essential that it has access to a collection containing at least one data source. 

 

A virtual assistant needs accurate and relevant information to be able to provide useful answers to user queries. To achieve this, the wizard must be linked to a collection that contains at least one data source. 

 

The quality and accuracy of the assistant's responses depend directly on the quality of the data sources. A well-organized collection with reliable sources ensures that the assistant can provide accurate and relevant answers. 

 

  

Permision 

Skills allow administrators to control access to different assistant capabilities, ensuring that only authorized users can use certain advanced features. 

User  

This section allows you to view and manage all users registered in the application. It contains the following information and functionalities: 

 

Name: The user's name. 

Last Name: The user's last name. 

Email: The user's email address. 

Role: The role assigned to the user within the application. 

Settings: Facilitates the creation of new groups and the elimination of groups that are no longer necessary, as well as whether or not they belong to the user.. 

Remove: A button that allows you to remove the user from the list and revoke their access to the application. 

 

 

 

 

Groups 

This section allows you to manage the different groups within the application. It contains the following functionalities: 

 

Displays a list of all existing groups. 

Name: The name of the group. 

Description: A brief description of the group, indicating its purpose or function. 

Edit: A button that allows you to edit the group details, such as the name and description. 

Settings: A button that allows access to group-specific settings, where permissions and other details can be adjusted. 

Remove: A button that allows you to remove the group from the list. 

 

This section is essential to maintain a clear and efficient organization of groups within the application, allowing easy and quick management of their details and permissions. 

 

 

 

 

List Permissions: This section allows you to manage access permissions to different resources within the application. It contains the following functionalities: 

 

Add Permission: A button that allows you to add a new permission to the list. 

Skill: 

  • Q&A: Skill related to questions and answers 
  • SEARCH: Skill related to searching for information 
  • GENERATION: Skill related to content generation 
  • SUMMARIZATION: Skill related to summarizing information 

Resource 

  • Assistantapply to the created assistants 
  • Collectionapply to the created collections 

Access 

  • restricted: Option indicating restricted access 
  • denied: Option indicating access denied 

 

Assigning permissions is crucial to ensuring that users have adequate access to the necessary skills and resources, while maintaining security and control within the application. 

 

 

 

Queries 

Queries Log is a tool that allows administrators to view and manage the history of questions and answers that users have asked the virtual assistant. 

 

 

 

Query Table: This user interface component displays a table with several columns containing information about the queries performed. Each column has a heading that describes the type of information contained in that column. Here are the descriptions of each column: 

Message In: This column shows the incoming message, that is, the original query or request made by the user. 

Message Out: This column shows the output message, that is, the response generated by the system in response to the user's query. 

Skill: This column indicates the skill used to process the query. 

Feedback: This column shows whether feedback has been provided on the response generated. 

Feedback Message: This column contains the feedback message provided by the user, if any. 

Time in: This column shows the time the query was received. 

Time out: This column shows the time the response was generated. 

 

Each column has a header that can be sorted to facilitate data organization and analysis. Headers are designed to be accessible and easy to interact with, with options to sort and filter information as needed. 

 

 

 

  1. ECOCHAT Chatbot 

Chatbots are designed to answer frequently asked questions and provide immediate assistance to customers, improving efficiency and reducing wait times. 

 

Login 

 

User authentication and chat access through public assistants, if the users log in, they access the assistants and history  

Chat Assistants Public 

To access chat assistants which are public, the user does NOT need to be logged in. 

 

 

 

Chat logged 

For any other type of assistant, the user must be logged in to access. 

 

 

Send Feedback  

A text field has been provided for the user to be able to share any feedback. 

 


Feel free to download the PDF version of this guide:

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article