{"id":31767635,"url":"https://github.com/mrspecks/365-qna-chatbot","last_synced_at":"2026-04-18T17:35:26.365Z","repository":{"id":318653683,"uuid":"1072170675","full_name":"MrSpecks/365-QnA-Chatbot","owner":"MrSpecks","description":"General Question and Answer Chatbot using langChain","archived":false,"fork":false,"pushed_at":"2025-10-08T11:44:02.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-08T13:31:26.894Z","etag":null,"topics":["chromadb","context-awareness","document-processing","dynamic-configuration","interactive-chatbot","langchain","multi-provider-platform","openai","rag-chatbot","rag-pipeline","streaming-response"],"latest_commit_sha":null,"homepage":"https://365-qna-chatbot.streamlit.app/","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/MrSpecks.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-08T11:02:03.000Z","updated_at":"2025-10-08T11:54:30.000Z","dependencies_parsed_at":"2025-10-08T13:31:31.663Z","dependency_job_id":"210ce8d0-9c20-4f6f-80b8-e4badf9b768c","html_url":"https://github.com/MrSpecks/365-QnA-Chatbot","commit_stats":null,"previous_names":["mrspecks/365-qna-chatbot"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/MrSpecks/365-QnA-Chatbot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrSpecks%2F365-QnA-Chatbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrSpecks%2F365-QnA-Chatbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrSpecks%2F365-QnA-Chatbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrSpecks%2F365-QnA-Chatbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MrSpecks","download_url":"https://codeload.github.com/MrSpecks/365-QnA-Chatbot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrSpecks%2F365-QnA-Chatbot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002398,"owners_count":26083373,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["chromadb","context-awareness","document-processing","dynamic-configuration","interactive-chatbot","langchain","multi-provider-platform","openai","rag-chatbot","rag-pipeline","streaming-response"],"created_at":"2025-10-10T01:18:24.519Z","updated_at":"2025-10-10T01:18:29.228Z","avatar_url":"https://github.com/MrSpecks.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 365 Q\u0026A Chatbot\n\nA Streamlit application that enables users to upload a PDF document and chat with an AI assistant that answers questions using only the content from that PDF. This project implements a Retrieval-Augmented Generation (RAG) pipeline using LangChain and ChromaDB.\n\n## Features\n\n- **PDF Upload**: Upload any PDF document to build a knowledge base\n- **Multi-Provider Support**: Choose between OpenAI and OpenRouter for LLM access\n- **Multiple Models**: Access to various models including:\n  - **OpenAI**: GPT-4o, GPT-4o-mini, GPT-3.5-turbo\n  - **OpenRouter**: Google Gemini 2.5 Flash, Llama 3.2, Mixtral 8x7B, and more\n- **RAG Pipeline**: Uses LangChain with OpenAI embeddings and ChromaDB vector store\n- **Interactive Chat**: Ask questions about your PDF content with a conversational interface\n- **Context-Aware**: AI responses are based solely on the uploaded PDF content\n- **Streaming Responses**: Real-time response streaming for better user experience\n- **Dynamic Configuration**: Automatically configures API endpoints and models based on provider selection\n\n## Tech Stack\n\n- **Frontend**: Streamlit\n- **LLM Providers**: OpenAI, OpenRouter (supporting Google Gemini, Llama, Mixtral, etc.)\n- **Embeddings**: OpenAI text-embedding-3-small\n- **Vector Store**: ChromaDB\n- **Document Processing**: LangChain, PyPDF\n\n## Prerequisites\n\n⚠️ **Important**: You need a PDF file and at least one API key (OpenAI or OpenRouter) to use this application.\n\n### Required Environment Variables\n\n- `OPENAI_API_KEY`: Your OpenAI API key (for direct OpenAI models)\n- `OPENROUTER_API_KEY`: Your OpenRouter API key (for multi-model access including Google Gemini, Llama, Mixtral, etc.)\n\n**Note**: You only need one API key depending on which provider you choose to use.\n\n## Setup Instructions\n\n### 1. Clone the Repository\n\n```bash\ngit clone \u003cyour-repository-url\u003e\ncd 365-QnA-Chatbot\n```\n\n### 2. Install Dependencies\n\n```bash\npip install -r requirements.txt\n```\n\n### 3. Configure Secrets\n\nCreate a `.streamlit/secrets.toml` file in your project root:\n\n```toml\n# OpenAI API Key (for direct OpenAI models)\nOPENAI_API_KEY = \"sk-your-openai-api-key-here\"\n\n# OpenRouter API Key (for multi-model access)\nOPENROUTER_API_KEY = \"sk-your-openrouter-api-key-here\"\n```\n\n**Note**: Copy the `.streamlit/secrets.toml.example` file and replace the placeholders with your actual API keys. You only need one API key depending on which provider you choose to use.\n\n### 4. Test Your Installation (Optional but Recommended)\n\nBefore running the app, test that all imports work correctly:\n\n```bash\npython test_imports.py\n```\n\nThis will verify that all required packages are properly installed.\n\n### 5. Run the Application\n\n```bash\nstreamlit run streamlit_app.py\n```\n\nThe application will open in your default web browser at `http://localhost:8501`.\n\n## Usage\n\n1. **Select Provider**: Choose between OpenAI or OpenRouter in the sidebar\n2. **Enter API Key**: Provide your API key for the selected provider (or configure in secrets.toml)\n3. **Select Model**: Choose from available models for your selected provider\n4. **Upload PDF**: Use the file uploader to select a PDF document\n5. **Process PDF**: Click \"Process PDF\" to build the knowledge base\n6. **Start Chatting**: Once processing is complete, ask questions about your PDF content\n7. **View History**: Your conversation history is maintained throughout the session\n\n## How It Works\n\n1. **Document Loading**: PDF is loaded using PyPDFLoader from LangChain\n2. **Text Splitting**: Documents are split into chunks using TokenTextSplitter (1000 tokens per chunk, 100 token overlap)\n3. **Embedding Creation**: Text chunks are converted to embeddings using OpenAI's text-embedding-3-small model\n4. **Vector Store**: Embeddings are stored in ChromaDB for efficient similarity search\n5. **Provider Configuration**: Based on your selection, the app configures the appropriate API endpoint and model\n6. **Retrieval**: When you ask a question, relevant chunks are retrieved from the vector store\n7. **Generation**: Retrieved context is passed to your selected model (GPT, Gemini, Llama, Mixtral, etc.) to generate responses\n\n## Deployment\n\n### Streamlit Community Cloud\n\n1. Fork this repository\n2. Go to [Streamlit Community Cloud](https://share.streamlit.io/)\n3. Connect your GitHub account and select your forked repository\n4. Add your API keys (`OPENAI_API_KEY` and/or `OPENROUTER_API_KEY`) in the secrets section\n5. Deploy!\n\n### Local Deployment\n\nFor production deployment, consider using:\n- Docker containers\n- Cloud platforms (AWS, GCP, Azure)\n- VPS with proper security configurations\n\n## File Structure\n\n```\n365-QnA-Chatbot/\n├── streamlit_app.py               # Main Streamlit application\n├── test_imports.py                # Import testing script\n├── requirements.txt                # Python dependencies\n├── README.md                      # This file\n├── .gitignore                     # Git ignore rules\n├── .streamlit/\n│   └── secrets.toml.example       # Secrets template\n└── temp_vectorstore/              # Generated vector store (auto-created)\n```\n\n## Troubleshooting\n\n### Common Issues\n\n1. **Import Errors**: If you get `ModuleNotFoundError` during deployment:\n   - Run `python test_imports.py` locally to test imports\n   - Check that your `requirements.txt` has the correct package versions\n   - Ensure all LangChain packages are properly installed\n\n2. **API Key Error**: Ensure your API key is correctly set in `.streamlit/secrets.toml` or entered in the sidebar\n3. **Provider Selection**: Make sure you've selected the correct provider (OpenAI or OpenRouter) that matches your API key\n4. **Model Availability**: Some models may not be available on OpenRouter; try a different model if you encounter errors\n5. **PDF Processing Error**: Make sure the uploaded file is a valid PDF\n6. **Memory Issues**: Large PDFs may require more memory; consider reducing chunk size\n7. **Rate Limiting**: API providers have rate limits; consider upgrading your plan for heavy usage\n\n### Performance Tips\n\n- Use smaller chunk sizes for faster processing\n- Consider using GPU-accelerated embeddings for large documents\n- Implement caching for frequently accessed documents\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Test thoroughly\n5. Submit a pull request\n\n## License\n\nThis project is open source and available under the [MIT License](LICENSE).\n\n## Support\n\nIf you encounter any issues or have questions, please:\n1. Check the troubleshooting section above\n2. Search existing GitHub issues\n3. Create a new issue with detailed information about your problem\n\n---\n\n**Happy Chatting! 🤖📚**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrspecks%2F365-qna-chatbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrspecks%2F365-qna-chatbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrspecks%2F365-qna-chatbot/lists"}