{"id":22852103,"url":"https://github.com/uznetdev/chat-bot-api","last_synced_at":"2025-03-31T06:46:26.626Z","repository":{"id":266847353,"uuid":"896450430","full_name":"UznetDev/Chat-Bot-API","owner":"UznetDev","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-06T13:56:33.000Z","size":2413,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-06T11:35:54.944Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://chatbot.codernet.uz/docs","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/UznetDev.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-11-30T11:55:11.000Z","updated_at":"2024-12-06T13:56:37.000Z","dependencies_parsed_at":"2024-12-06T14:35:01.443Z","dependency_job_id":"c26604cf-31af-4aa4-8825-bd701b5f0941","html_url":"https://github.com/UznetDev/Chat-Bot-API","commit_stats":null,"previous_names":["uznetdev/chat-bot-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UznetDev%2FChat-Bot-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UznetDev%2FChat-Bot-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UznetDev%2FChat-Bot-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UznetDev%2FChat-Bot-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UznetDev","download_url":"https://codeload.github.com/UznetDev/Chat-Bot-API/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246429447,"owners_count":20775806,"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-12-13T06:07:12.335Z","updated_at":"2025-03-31T06:46:26.597Z","avatar_url":"https://github.com/UznetDev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chat-Bot-API Documentation\n\n## Overview\nChat-Bot-API is a robust **FastAPI-based chatbot service** designed to provide users with an interactive AI-powered chat experience. This project integrates **Retrieval-Augmented Generation (RAG)** with OpenAI models, allowing seamless interactions with documents and custom models. Additionally, the project incorporates the free-to-use **LLAMA model**, making advanced AI technology accessible to all.\n\nThe service is modular, scalable, and open source, aiming to deliver efficient AI-driven solutions to users while ensuring flexibility and extensibility.\n\n---\n\n## What is the Focus?\nThe primary goal of Chat-Bot-API is to:\n- **Simplify AI model interaction**: By integrating document retrieval and conversational AI.\n- **Enhance user engagement**: With personalized chatbots for every user.\n- **Democratize AI access**: Through open-source implementation and free-to-use models.\n- **Promote collaboration**: By offering a customizable and modular codebase for contributors.\n\n---\n\n## Features\n1. **User Authentication**:\n   - Token-based secure login and registration.\n   - Persistent session management.\n\n2. **Chatbot Interaction**:\n   - Personalized chat experiences for users.\n   - Support for both OpenAI models and free LLAMA models.\n   - Integration of document-based queries via RAG.\n\n3. **Model Management**:\n   - Upload custom models with metadata and visibility options.\n   - Delete and manage existing models.\n\n4. **Dynamic Chat History**:\n   - Save, retrieve, and manage chat messages.\n   - Efficient handling of large conversations.\n\n5. **CORS Middleware**:\n   - Configured for cross-origin resource sharing to enable broader API usage.\n\n6. **Open Source**:\n   - Fully transparent and modifiable for developers and organizations.\n\n---\n\n## Installation\n\n### Prerequisites\n1. **Python**: Ensure you have Python 3.10 or above installed.\n2. **MySQL**: Set up a MySQL database.\n3. **Git**: Clone the repository.\n\n### Steps\n1. **Clone the Repository**:\n   ```bash\n   git clone https://github.com/UznetDev/Chat-Bot-API.git\n   cd Chat-Bot-API\n   ```\n\n2. **Set Up a Virtual Environment**:\n   ```bash\n   python -m venv env\n   source env/bin/activate  # For Linux/Mac\n   env\\Scripts\\activate     # For Windows\n   ```\n\n3. **Install Dependencies**:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n4. **Configure the Environment Variables**:\n   - Create a `.env` file in the `data` directory and add:\n     ```env\n     MYSQL_HOST=\u003cYour MySQL Host\u003e\n     MYSQL_USER=\u003cYour MySQL User\u003e\n     MYSQL_PASSWORD=\u003cYour MySQL Password\u003e\n     MYSQL_DATABASE=\u003cYour Database Name\u003e\n     REPLECATE_API=\u003cYour Replicate API Key\u003e\n     ```\n\n5. **Run the Application**:\n   ```bash\n   fastapi dev main.py\n   ```\n\n6. **Access the API**:\n   Open `http://127.0.0.1:8000/docs` in your browser for interactive API documentation.\n\n---\n\n## How It Works\n1. **User Workflow**:\n   - Users authenticate using tokens.\n   - They can interact with chatbots linked to their accounts.\n   - Chatbots process user queries and retrieve AI-generated answers.\n\n2. **Model Integration**:\n   - OpenAI models and LLAMA models are used for RAG and general conversational tasks.\n   - Users can upload custom models for tailored experiences.\n\n3. **Database Management**:\n   - Stores user data, chat history, and model metadata in MySQL.\n\n4. **CORS Middleware**:\n   - Enables seamless API access from different domains.\n\n---\n\n## Project Structure\n```\nChat-Bot-API/\n│\n├── data/               # Configuration and environment files\n│   ├── config.py\n│\n├── db/                 # Database connection and utility scripts\n│   ├── database.py\n│\n├── models/             # Language model handling\n│   ├── llm.py\n│\n├── routes/             # FastAPI route definitions\n│   ├── auth.py\n│   ├── promts.py\n│   ├── user_page.py\n│\n├── functions/          # Utility functions\n│   ├── functions.py\n│\n├── main.py             # Entry point of the application\n├── loader.py           # Initialization of core components\n├── requirements.txt    # Python dependencies\n├── README.md           # Documentation (this file)\n│\n└── .env                # Environment configuration file\n```\n\n---\n\n## Project Motivation\nChat-Bot-API was developed to address the need for a flexible, scalable, and open-source chatbot service. By integrating RAG and open AI models, it provides users with a robust system for interacting with documents and conversational models. It aims to democratize AI technology by offering free-to-use models and enabling collaboration in the open-source community.\n\n---\n\n## Contributing\nContributions are welcome! Follow these steps to contribute:\n1. Fork the repository.\n2. Create a new branch:\n   ```bash\n   git checkout -b feature-name\n   ```\n3. Make changes and commit:\n   ```bash\n   git commit -m \"Added a new feature\"\n   ```\n4. Push to your fork:\n   ```bash\n   git push origin feature-name\n   ```\n5. Create a pull request to the `main` branch.\n\n---\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n---\n\n## Contacts\n\nIf you have any questions or suggestions, please contact:\n- Email: uznetdev@gmail.com\n- GitHub Issues: [Issues section](https://github.com/UznetDev/Diabetes-Prediction/issues)\n- GitHub Profile: [UznetDev](https://github.com/UznetDev/)\n- Telegram: [UZNet_Dev](https://t.me/UZNet_Dev)\n- Linkedin: [Abdurakhmon Niyozaliev](https://www.linkedin.com/in/uznetdev/)\n\n\n### \u003ci\u003eThank you for your interest in the project!\u003c/i\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuznetdev%2Fchat-bot-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuznetdev%2Fchat-bot-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuznetdev%2Fchat-bot-api/lists"}