random2345t6 / postman_collection 2.json
SakibAhmed's picture
Upload 37 files
25435eb verified
raw
history blame
11.5 kB
{
"info": {
"_postman_id": "a9e8c1b2-f3d4-4e5f-b6a7-c8d9e0f1a2b3",
"name": "NOW GE Web-Chat-Bot 2",
"description": "A comprehensive Postman collection for the Hybrid RAG Chatbot API. It includes endpoints for chat sessions, administrative controls, reporting, and general utilities.\n\n**Setup:**\n1. Import the collection.\n2. Go to the collection's 'Variables' tab.\n3. Ensure `baseUrl` points to your running Flask application (default: http://localhost:5000).\n4. Ensure the credential variables match your `.env` file.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Core Chat Flow",
"description": "Contains the primary endpoints for a user's chat session.",
"item": [
{
"name": "1. Create Session",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200 OK\", () => {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Response body is valid JSON\", () => {",
" pm.response.to.be.json;",
"});",
"",
"pm.test(\"Session ID is received and set as a collection variable\", () => {",
" const jsonData = pm.response.json();",
" pm.expect(jsonData.session_id).to.be.a('string').and.to.not.be.empty;",
" pm.collectionVariables.set(\"sessionId\", jsonData.session_id);",
" console.log(`Session ID set to: ${jsonData.session_id}`);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/create-session",
"host": [
"{{baseUrl}}"
],
"path": [
"create-session"
]
},
"description": "Initializes a new chat session on the server and returns a unique `session_id`. This ID is required for all subsequent requests in the chat flow and is automatically stored as a collection variable."
},
"response": []
},
{
"name": "2. Send Chat Message",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200 OK\", () => {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Response body is valid JSON\", () => {",
" pm.response.to.be.json;",
"});",
"",
"pm.test(\"Response contains an 'answer' and a 'source'\", () => {",
" const jsonData = pm.response.json();",
" pm.expect(jsonData.answer).to.be.a('string');",
" pm.expect(jsonData.source).to.be.a('string');",
" pm.expect(jsonData.related_questions).to.be.an('array');",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n // The user's question to the chatbot.\n \"query\": \"what is a class k fire?\",\n\n // (Optional) The ID of the user, used for retrieving personalized answers.\n \"user_id\": \"user_postman_007\",\n\n // The session ID obtained from the 'Create Session' request.\n \"session_id\": \"{{sessionId}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/chat-bot",
"host": [
"{{baseUrl}}"
],
"path": [
"chat-bot"
]
},
"description": "The main endpoint for interacting with the chatbot. It sends the user's query and the current session ID to get a response from the hybrid RAG system."
},
"response": []
},
{
"name": "3. Clear Session History",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200 OK\", () => {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Response confirms history was cleared\", () => {",
" const jsonData = pm.response.json();",
" pm.expect(jsonData.message).to.equal(\"History cleared\");",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"session_id\": \"{{sessionId}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/clear-history",
"host": [
"{{baseUrl}}"
],
"path": [
"clear-history"
]
},
"description": "Clears the conversation history for the current session on the server side. This allows for a fresh conversation context without needing to create a new session."
},
"response": []
}
]
},
{
"name": "Admin Endpoints",
"description": "Administrative endpoints for monitoring and managing the application's backend systems. All requests in this folder require Admin Basic Auth.",
"item": [
{
"name": "Get FAISS RAG Status",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/faiss_rag_status",
"host": [
"{{baseUrl}}"
],
"path": [
"admin",
"faiss_rag_status"
]
},
"description": "Retrieves the current status of the FAISS RAG system, including the embedding model, LLM model, number of indexed vectors, and list of processed source files."
},
"response": []
},
{
"name": "Rebuild FAISS RAG Index",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/admin/rebuild_faiss_index",
"host": [
"{{baseUrl}}"
],
"path": [
"admin",
"rebuild_faiss_index"
]
},
"description": "Triggers a full, two-step rebuild of the FAISS knowledge base.\n\n1. **Chunking:** Runs `chunker.py` to extract text from all documents in the `/sources` folder and saves the raw text and chunked JSON.\n2. **Indexing:** Deletes the old FAISS index and builds a new one from the freshly chunked data.\n\n**Note:** This can be a long-running and resource-intensive process, depending on the number and size of source documents."
},
"response": []
},
{
"name": "Get Personal DB Status",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/db/status",
"host": [
"{{baseUrl}}"
],
"path": [
"db",
"status"
]
},
"description": "Checks the status of the `DatabaseMonitor`, which watches the `database.csv` file for real-time changes to provide personalized answers."
},
"response": []
}
],
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "{{adminPassword}}",
"type": "string"
},
{
"key": "username",
"value": "{{adminUsername}}",
"type": "string"
}
]
}
},
{
"name": "Reporting",
"description": "Endpoints for generating and downloading reports. Requires special report credentials.",
"item": [
{
"name": "Download Chat History Report",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200 (OK) or 404 (Not Found)\", () => {",
" pm.expect(pm.response.code).to.be.oneOf([200, 404]);",
"});",
"",
"if (pm.response.code === 200) {",
" pm.test(\"Content-Type header is text/csv\", () => {",
" pm.response.to.have.header(\"Content-Type\", \"text/csv\");",
" });",
" pm.test(\"Content-Disposition header suggests a download\", () => {",
" pm.expect(pm.response.headers.get('Content-Disposition')).to.include('attachment;');",
" });",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/report",
"host": [
"{{baseUrl}}"
],
"path": [
"report"
]
},
"description": "Downloads the complete chat history log (`chat_history.csv`) as a CSV file. This endpoint is protected by a different password than the other admin endpoints."
},
"response": []
}
],
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "{{reportPassword}}",
"type": "string"
},
{
"key": "username",
"value": "{{adminUsername}}",
"type": "string"
}
]
}
},
{
"name": "Utility",
"description": "General application utility endpoints.",
"item": [
{
"name": "Get Version",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200 OK\", () => {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Response contains a 'version' string\", () => {",
" const jsonData = pm.response.json();",
" pm.expect(jsonData.version).to.be.a('string').and.to.not.be.empty;",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/version",
"host": [
"{{baseUrl}}"
],
"path": [
"version"
]
},
"description": "Retrieves the current version string of the running application."
},
"response": []
},
{
"name": "Load Chat Interface (Index)",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/",
"host": [
"{{baseUrl}}"
],
"path": [
""
]
},
"description": "Accesses the root URL to load the `chat-bot.html` front-end interface, if it exists in the `templates` folder."
},
"response": []
}
]
}
],
"variable": [
{
"key": "baseUrl",
"value": "http://localhost:5000",
"description": "The base URL of the running Flask application. Change the port if necessary."
},
{
"key": "sessionId",
"value": "",
"description": "This variable is automatically populated by the '1. Create Session' request. Do not edit manually."
},
{
"key": "adminUsername",
"value": "fleetblox",
"description": "The username for accessing administrative endpoints."
},
{
"key": "adminPassword",
"value": "fleetblox",
"description": "The password for accessing administrative endpoints."
},
{
"key": "reportPassword",
"value": "e$$!@2213r423er31",
"description": "The specific password required for downloading the chat history report."
}
]
}