{"id":20553564,"url":"https://github.com/mrtj/openai-knowledgebase-chat","last_synced_at":"2025-03-06T06:19:25.182Z","repository":{"id":171297360,"uuid":"610346054","full_name":"mrtj/openai-knowledgebase-chat","owner":"mrtj","description":"Chatbot that answers questions based on a custom knowledge base, powered by OpenAI","archived":false,"fork":false,"pushed_at":"2023-03-09T16:18:52.000Z","size":10539,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-16T17:30:28.584Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrtj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-06T15:34:10.000Z","updated_at":"2023-03-06T15:35:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"6c87b0ea-171c-46fe-9a96-b1880e3d1b21","html_url":"https://github.com/mrtj/openai-knowledgebase-chat","commit_stats":null,"previous_names":["mrtj/openai-knowledgebase-chat"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtj%2Fopenai-knowledgebase-chat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtj%2Fopenai-knowledgebase-chat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtj%2Fopenai-knowledgebase-chat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtj%2Fopenai-knowledgebase-chat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrtj","download_url":"https://codeload.github.com/mrtj/openai-knowledgebase-chat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242157368,"owners_count":20081051,"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-16T02:42:25.137Z","updated_at":"2025-03-06T06:19:25.154Z","avatar_url":"https://github.com/mrtj.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Virtual assistant chatbot proof-of-concept\n\nThis is a proof-of-concept of a virtual assistant that answers questions based on a predefined knowledge base.\n\n## Installation\n\nInstall the python dependencies in your virtual environment from requirements.txt:\n\n```shell\npip install -r requirements.txt\n```\n\n## Usage - CLI\n\nYou can try the chatbot with the command line interface provided:\n\n```text\nusage: chatbot.py [-h] -kb KNOWLEDGE_BASE\n\nVirtual assistant chatbot\n\noptions:\n  -h, --help            show this help message and exit\n  -kb KNOWLEDGE_BASE, --knowledge_base KNOWLEDGE_BASE\n                        knowledge base (./data subfolder)\n```\n\nThe knowledge base parameter should be the name of one of the subdirectory of the `data` directory.\n\nHave ready your OpenAI API key, the CLI will ask for it.\n\n## Usage - Streamlit\n\nThere is also a streamlit interface so you can interact with the agent from a web window. Have ready your OpenAI API key, the web application will ask for it.\n\nYou can launch the streamlit app with:\n\n```bash\nstreamlit run chatlit.py\n```\n\nIf it starts, open http://localhost:8501 to interact with the agent.\n\n## Adding a new knowledge base\n\n1. Create a subdirectory of the `data` directory with the name of your knowledge base. We will refer to this directory as \"working directory\" in the following points.\n2. Create a text file named `lang.txt` in the working directory, and place the language code of the knowledge base in it. Currently \"it\" (Italian) and \"en\" (English) are supported.\n3. Create a text file named `identity.txt` in the working directory. Shortly describe the its identity to the bot in the language of the knowledge base.\n4. Create a comma-separated-value (CSV) file in the working directory, called `qa.csv`. The table in this file should contain two columns, \"question\" and \"answer\". Write the FAQ or Q\u0026A of your knowledge base in this file. The question column can be a question, a short summary of the argument, or a list of keywords. It should be as much as relevant to the topic as possible The answer should discuss the argument in question in maximum 500 words.\n\nThe first time you start the bot with a new knowledge base, the embeddings of the kb will be created. This can take up to several minutes, be patient.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrtj%2Fopenai-knowledgebase-chat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrtj%2Fopenai-knowledgebase-chat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrtj%2Fopenai-knowledgebase-chat/lists"}