{"id":15063710,"url":"https://github.com/shoaib-33/smart-assistant-chatbot","last_synced_at":"2026-02-22T23:33:55.216Z","repository":{"id":257294644,"uuid":"857840544","full_name":"Shoaib-33/Smart-Assistant-Chatbot","owner":"Shoaib-33","description":"Chatbot to book Birthday party","archived":false,"fork":false,"pushed_at":"2024-09-15T20:17:29.000Z","size":1917,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T08:37:25.808Z","etag":null,"topics":["chatbot","huggingface","llm","mistral-7b","nlp","rag","streamlit"],"latest_commit_sha":null,"homepage":"https://smart-assistant-chatbot-7iihjhguukrodaxq3back2.streamlit.app/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Shoaib-33.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-15T18:36:07.000Z","updated_at":"2024-09-15T20:17:32.000Z","dependencies_parsed_at":"2024-09-15T20:03:39.019Z","dependency_job_id":"8e4f8597-2776-47b8-be54-0e62f8b3e3f2","html_url":"https://github.com/Shoaib-33/Smart-Assistant-Chatbot","commit_stats":null,"previous_names":["shoaib-33/smart-assistant-chatbot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shoaib-33%2FSmart-Assistant-Chatbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shoaib-33%2FSmart-Assistant-Chatbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shoaib-33%2FSmart-Assistant-Chatbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shoaib-33%2FSmart-Assistant-Chatbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shoaib-33","download_url":"https://codeload.github.com/Shoaib-33/Smart-Assistant-Chatbot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243779045,"owners_count":20346651,"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":["chatbot","huggingface","llm","mistral-7b","nlp","rag","streamlit"],"created_at":"2024-09-25T00:06:23.578Z","updated_at":"2025-10-30T10:38:09.539Z","avatar_url":"https://github.com/Shoaib-33.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smart-Assistant-Chatbot\n\nThis project leverages LangChain, Streamlit, and HuggingFace's state-of-the-art language models to create an intelligent assistant that helps users plan birthday parties. The assistant recommends venues, caterers, and entertainment options based on user inputs. It is powered by a custom prompt and retrieves data from a CSV file to provide relevant suggestions and confirm bookings.\n\n\u003cimg src = \"chatbot.png\" width=\"500\" height=\"300\"\u003e  \n\n\n# Technical Specifications\n\n### Environment and Dependencies: \nThe project utilizes several key technologies to create an interactive and efficient birthday party planning assistant. Streamlit is employed to develop the web interface, providing a user-friendly platform for interaction. LangChain is integrated to bridge conversational AI with data retrieval capabilities, enabling the assistant to fetch relevant information based on user queries. HuggingFace provides pre-trained language models and embeddings; specifically, HuggingFaceHub is used to load the language model, while HuggingFaceEmbeddings is utilized to encode the dataset. FAISS is used for managing and retrieving dense vector representations of the data, facilitating quick and accurate responses.\n\n### Data Management: \nThe dataset utilized in this project is a synthetically generated CSV file named Party.csv, which was created using GPT-4.0(Free version). This dataset contains 1,000 rows and five columns: venue, caterers, entertainment, date, and time. To integrate this data into the system, CSVLoader from LangChain is used to load the data, converting it into a format suitable for embedding and retrieval.\n\n### Embedding: \nTextual data from the CSV file is converted into dense vector representations using HuggingFaceEmbeddings. The specific model used for this task is `sentence-transformers/all-MiniLM-L6-v2`. This model generates high-quality embeddings that capture semantic meanings of the text, which are crucial for performing efficient similarity searches. The embeddings are computed on the CPU, as indicated by the parameter model_kwargs={'device': 'cpu'}, ensuring compatibility and eliminating the need for a GPU.\n\n### Model Loading:\nThe core language model is `Mistral Mixtral-8x7B-Instruct-v0.1`, loaded through the HuggingFaceHub API. This model is configured with parameters such as temperature set to 0.1, which controls the randomness of the generated responses, and top_k set to 50, limiting the number of candidate tokens considered for each step. An API token is required for authenticating with HuggingFace Hub, ensuring secure access to the model.\n\n## Conversational Retrieval Chain:\nThe project employs a `ConversationalRetrievalChain` that combines the language model and the FAISS retriever. This setup integrates the language generation capabilities with the efficient data retrieval system provided by FAISS. The chain uses the language model (llm) to generate responses based on queries and the retriever to fetch relevant information from the embedded dataset.\n\n### Custom Prompt Handling:\nA custom prompt function is designed to format user queries in a way that guides the assistant's responses. The prompt ensures that the assistant only uses information available from the dataset, avoids generating unsupported information, and maintains a formal, helpful tone. It also includes instructions for booking confirmations and suggesting alternative dates if necessary.\n\n### User Interaction and Chat Management:\nThe user interface is created using Streamlit, where users can input queries and receive responses. The chat interface includes a title and instructions to guide user interactions. The conversation history is maintained in `st.session_state`, which keeps track of both user inputs and assistant responses. The streamlit_chat library is used to display these interactions with distinct avatars for better user experience.\n\n### Session State Management:\nThe project manages session state using Streamlit’s st.session_state to handle conversation history. This includes variables such as history for storing past interactions, generated for the assistant's responses, and past for tracking user queries. This state management ensures continuity and coherence in the dialogue.\n\n### Deployment and Usage:\nThe project is designed to be run locally using Streamlit. Users can clone the repository, install the required dependencies, and launch the app to interact with the assistant. The deployment process involves setting up the environment, configuring the app, and running it to provide users with real-time party planning assistance.The Streamlit link is [here](https://smart-assistant-chatbot-7iihjhguukrodaxq3back2.streamlit.app/)\n\n# Working Principal of Chatbot\n\nThe project operates as an intelligent assistant that interacts with users through a chat interface built using Streamlit. Its core functionality is to help users plan birthday parties by recommending and booking venues, caterers, and entertainment options. The system uses a ConversationalRetrievalChain from LangChain, combining language generation with data retrieval from a pre-embedded CSV file containing relevant service details.The steps by step approach is given below: \n ### 1.Data Handling:\n The dataset (Party.csv) containing information on venues, caterers, and entertainment options is loaded and embedded using HuggingFaceEmbeddings for efficient retrieval.\n The embedded data is stored in FAISS, allowing fast searches based on user queries.\n\n ### 2.Language Model Integration:\nThe project uses a pre-trained Mistral Mixtral-8x7B-Instruct-v0.1 model from HuggingFace, loaded through the HuggingFaceHub API.\nThe assistant is guided by a custom prompt, ensuring that responses are directly based on the available data and that it avoids generating unsupported or fictional information.\n\n ### 3.Conversational Chain:\nA ConversationalRetrievalChain is set up to integrate the language model with the vectorized data. When a user submits a query, the assistant retrieves relevant information from the CSV and responds accordingly.\nThe conversation flow is managed in Streamlit, with session history maintained to ensure a coherent dialogue.\n\n ### 4.User Interaction:\nUsers can enter queries into a chat interface, such as asking for available venues or confirming bookings.\nWThe assistant follows up with relevant recommendations, provides booking confirmations, and offers alternative dates when necessary.\n\n\n# Setup\nTo install chatbot clone this repository using the following command: \n\n```git clone https://github.com/your-repo/birthday-planning-assistant.git```\n\nThen create a directory and move to the directory using:\n\n```cd birthday-planning-assistant```\n\nInstall the necessary dependencies using:\n\n```pip install -r requirements.txt```\n\nThen run the streamlit using command:\n\n```streamlit run app.py```\n\n\n # Technical Difficulties\n \nThe project presented several challenges primarily due to the use of a free model, which generally has limitations in handling contextual data effectively. One significant issue was the model's performance with the CSV dataset. Although the data was well-structured for retrieval, the free model struggled to deliver accurate and contextually relevant responses.\n\nAnother major challenge involved the development of the conversational bot. Unlike OpenAI models, which provide built-in history restoration features, the free model required manual management of conversational context. This led to difficulties in maintaining coherent interactions, with the model sometimes generating unusual or irrelevant data, and repeating context erroneously.\n\nHandling custom prompts was also problematic. The free model occasionally included parts of the custom prompt in its responses, making it challenging to extract useful information. The lack of a clear method to isolate and strip out the relevant parts from the prompt text added to the complexity.\n\nFrequent adjustments to the custom prompt were necessary to achieve acceptable results, which proved to be time-consuming. Additionally, the model exhibited occasional irrelevant behavior in responses, a problem that could potentially be addressed with more advanced paid models such as OpenAI's GPT-3.5 or higher.\n\nOverall, while the free model provided a foundational capability, its limitations in context handling and response accuracy were significant hurdles. More advanced paid models would likely offer improved performance and more efficient handling of conversational nuances.\n\n# Improvement Scope\n\nHowever, there is substantial potential for improvement in this project. Utilizing advanced models such as GPT-3.5 or other paid alternatives could significantly enhance the model's ability to grasp context more effectively. Additionally, fine-tuning these models could further improve contextual accuracy, particularly when applied to a large dataset. Enhancing the dataset to be more comprehensive and well-structured would also contribute to better contextual understanding. Furthermore, considerable advancements can be made in the user interface and user experience (UI/UX) of the chatbot, which would improve overall user interaction and satisfaction.\n\n\n## Streamlit link is [here](https://smart-assistant-chatbot-7iihjhguukrodaxq3back2.streamlit.app/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshoaib-33%2Fsmart-assistant-chatbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshoaib-33%2Fsmart-assistant-chatbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshoaib-33%2Fsmart-assistant-chatbot/lists"}