{"id":20282399,"url":"https://github.com/redisai/chatbotdemo","last_synced_at":"2025-04-11T08:00:16.652Z","repository":{"id":40545943,"uuid":"203340550","full_name":"RedisAI/ChatBotDemo","owner":"RedisAI","description":"An example that showcases the benefit of running AI inside Redis","archived":false,"fork":false,"pushed_at":"2022-05-03T11:57:10.000Z","size":166207,"stargazers_count":22,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T05:36:34.734Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RedisAI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-20T09:09:47.000Z","updated_at":"2025-02-25T17:26:00.000Z","dependencies_parsed_at":"2022-08-09T22:50:28.814Z","dependency_job_id":null,"html_url":"https://github.com/RedisAI/ChatBotDemo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedisAI%2FChatBotDemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedisAI%2FChatBotDemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedisAI%2FChatBotDemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedisAI%2FChatBotDemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RedisAI","download_url":"https://codeload.github.com/RedisAI/ChatBotDemo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248360154,"owners_count":21090657,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T14:09:14.072Z","updated_at":"2025-04-11T08:00:16.630Z","avatar_url":"https://github.com/RedisAI.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ChatBot Demo\nAn example that showcases the benefit of running AI inside Redis.\n\nThis repository contains the backend web app built with Flask, front end built with Angular (compiled to native JS) and the model files required for the chatbot to work. Follow below steps to bring the chatbot up.\n\n## Architecture\nWhen the flask application starts, [it will set an initial](https://github.com/RedisAI/ChatBotDemo/blob/master/redis_db.py#L23) `hidden` tensor.  This `hidden` tensor represents the intermediate state of the conversation.  On each new message received, an `sentence` tensor and the `hidden` tensor are passed through the model, which in turn produces an `output` and overrides the `hidden` tensor with the new intermediate state.\n\n![ChatBot Flow](static/sequence-diagram.png)\n\n(Note this diagram is simplified, the full flow can be followed [here](https://github.com/RedisAI/ChatBotDemo/blob/master/redis_db.py))\n\n## Requirements\n* Docker\n* Docker-compose\n\n## Running the demo\n\n```\n$ git clone git@github.com:RedisAI/ChatBotDemo.git\n$ cd ChatBotDemo\n$ docker-compose up\n```\n\n### API\nTry out the API (we have only one API endpoint -\u003e `/chat` which accepts `message` as the JSON key with your message as value) using `curl` as shown below.\n\n```\ncurl http://localhost:5000/chat -H \"Content-Type: application/json\" -d '{\"message\": \"I am crazy\"}'\n```\n\n### CLI\nOpen a second terminal and inspect the keys:\n\n```\n$ redis-cli\n127.0.0.1:6379\u003e keys *\n1) \"d_output\"\n2) \"decoder\"\n3) \"hidden\"\n4) \"encoder\"\n5) \"e_output\"\n6) \"d_input\"\n7) \"sentence\"\n127.0.0.1:6379\u003e type hidden\nAI_TENSOR\n```\n\n### UI\nOpen a browser and point it to `http://localhost:5000`.\n\n![RedisAI chatbot demo with pytorch](static/screenshot.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredisai%2Fchatbotdemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredisai%2Fchatbotdemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredisai%2Fchatbotdemo/lists"}