{"id":23125711,"url":"https://github.com/codehiveofficial/codehive-genie","last_synced_at":"2025-09-04T09:43:38.865Z","repository":{"id":264202157,"uuid":"892679131","full_name":"codehiveofficial/codehive-genie","owner":"codehiveofficial","description":"Codehive Genie is an AI-powered coding assistant integrated into the Codehive platform, designed to simplify coding tasks such as code generation, bug fixing, and optimization. Powered by Llama 3.1 and deployed on Vercel, it supports multiple programming languages, including Python, C, Java, JavaScript, TypeScript, and C++.","archived":false,"fork":false,"pushed_at":"2025-03-06T05:55:25.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-06T06:32:23.974Z","etag":null,"topics":["ai-code-generation","code-assistant","developer-tools","flask","groq-cloud","llama3","python","vercel-deployment"],"latest_commit_sha":null,"homepage":"https://codehive-genie.vercel.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/codehiveofficial.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-22T15:10:54.000Z","updated_at":"2025-03-06T05:55:29.000Z","dependencies_parsed_at":"2024-11-22T16:22:45.760Z","dependency_job_id":"ae205dea-b3e1-496a-82bd-8642e2d2c376","html_url":"https://github.com/codehiveofficial/codehive-genie","commit_stats":null,"previous_names":["codehiveofficial/codehive-genie"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codehiveofficial%2Fcodehive-genie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codehiveofficial%2Fcodehive-genie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codehiveofficial%2Fcodehive-genie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codehiveofficial%2Fcodehive-genie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codehiveofficial","download_url":"https://codeload.github.com/codehiveofficial/codehive-genie/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247123108,"owners_count":20887261,"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":["ai-code-generation","code-assistant","developer-tools","flask","groq-cloud","llama3","python","vercel-deployment"],"created_at":"2024-12-17T08:14:43.601Z","updated_at":"2025-04-04T05:11:45.629Z","avatar_url":"https://github.com/codehiveofficial.png","language":"Python","readme":"# Codehive Genie 🧞‍♂️✨  \n**An AI-driven coding assistant integrated into the [Codehive](https://github.com/codehiveofficial/codehive) platform.**  \n\nCodehive Genie is a Python-based Flask API that leverages advanced Large Language Models (LLMs) to provide coding assistance within the Codehive collaborative platform. It specializes in generating, debugging, and optimizing code, designed to empower developers with seamless and accurate coding support.\n\n---\n\n## ✨ Features  \n\n### 🌟 Core Capabilities  \n- 🚀 **Code Assistance**: Generate, debug, and optimize code snippets.  \n- 🌐 **Supported Languages**: Python, C, JavaScript, Java, TypeScript, and C++ (CPP).  \n- 🔧 **High-Quality Output**: Delivers well-structured, production-ready code with inline comments and concise explanations.  \n- 🌀 **Streaming Responses**: Enables real-time responses to ensure minimal latency.  \n- ❌ **Strict Query Handling**: Ignores non-coding-related queries with polite and concise error messages.  \n\n### 🔒 Security Enhancements  \n- 🌍 **Language Detection**: Ensures input is in English for consistency and accuracy.  \n- 🛡️ **Authentication**: API access secured with an `Authorization` header.  \n- 📜 **Robust Logging**: Detailed query and response logging for improved monitoring and debugging.  \n\n### 🌐 Deployment  \n- 🖥️ **Hosted on Vercel**: Optimized deployment using Vercel's Flask template for high performance and scalability.  \n\n---\n\n## 💻 Tech Stack  \n\n### Backend  \n- 🐍 **Flask**: Lightweight and efficient framework for API development.  \n- 🤖 **Groq AI Cloud**: LLM parameterization using **Llama 3.3-70B Versatile**.  \n- 📚 **Python Libraries**:  \n  - 🔄 `flask-cors`: To handle cross-origin requests.  \n  - 🔐 `dotenv`: For secure environment variable management.  \n  - 🧩 `langdetect`: For detecting input language.  \n\n### Deployment  \n- 🚀 **Vercel**: Optimized and scalable deployment with Flask templates.  \n\n---\n\n## 🌐 API Overview  \n\n### 🌍 Base URL  \nDeployed on [Vercel](https://vercel.com/):  \n\n### 📜 Endpoints  \n\n#### 1. **Home Endpoint**  \n- **GET** `/`  \n- **Description**: Basic health check for the server.  \n- **Response**:  \n```text  \nHello, World!  \n```  \n\n#### 2. **Codehive Genie Endpoint**  \n- **POST** `/genie`  \n- **Description**: Processes user queries to provide AI-generated coding assistance.  \n\n- **Headers**:  \n  - 🔐 `Authorization`: The authorization secret key for secure access.  \n\n- **Request Body**:  \n  ```json  \n  {\n    \"query\": \"Write a Python function to reverse a string.\"\n  }  \n  ```  \n\n- **Response**:  \n  - ✅ **For Valid Queries** (Streamed Response):  \n    ```plaintext  \n    def reverse_string(s):  \n        # Return the string in reverse order  \n        return s[::-1]\n    ```  \n\n  - 🚫 **For Invalid Queries**:  \n    ```json  \n    {\n      \"error\": \"Invalid authorization secret.\"\n    }\n    ```  \n\n  - ⚠️ **For Non-Coding Queries**:  \n    ```plaintext  \n    Sorry, I am an AI assistant tuned for coding and programming purposes only. I cannot assist with this query.  \n    ```  \n\n---\n\n## 🛠️ Installation  \n\n### Prerequisites  \n- 🐍 **Python**: 3.8 or higher  \n- 🤖 **Groq API Key**: Available from [Groq Cloud Platform](https://groq.com/groqcloud/)  \n- 🌟 **Node.js** (optional for integration testing with Codehive)  \n\n### 🚀 Clone the Repository  \n```bash  \ngit clone https://github.com/codehiveofficial/codehive-genie.git  \ncd codehive-genie  \n```  \n\n### 🔐 Set Up Environment Variables  \nCreate a `.env` file in the root directory and add the following:  \n```env  \nAUTH_SECRET=\u003cyour_auth_secret\u003e  \nGROQ_API_KEY=\u003cyour_groq_api_key\u003e  \n```  \n\n### 📦 Install Dependencies  \n```bash  \npip install -r requirements.txt  \n```  \n\n---\n\n## 🚦 Usage  \n\n### ▶️ Start the Server Locally  \n```bash  \npython api/index.py  \n```  \n- The server will run locally on **http://127.0.0.1:5000/** by default.  \n- You can access the **home endpoint** at **http://127.0.0.1:5000/** to verify the server is running.  \n\n---  \n\nLet me know if you need further adjustments! 🚀\n\n### 🔄 Test the API  \n- Use tools like **Postman** or **cURL** to test the `/genie` endpoint.  \n- Include the required `Authorization` header and send a JSON body with your query.  \n\n---\n\n## 🤝 Integration with Codehive  \n\nCodehive Genie is integrated as the AI assistant within the **[Codehive](https://github.com/codehiveofficial/codehive)** platform. It powers the AI-driven **Codehive Genie** feature, enabling users to receive coding assistance directly within collaborative rooms.  \n\n---\n\n## 📜 License  \n\nCodehive Genie is licensed under the **[MIT License](https://github.com/codehiveofficial/codehive-genie/blob/main/LICENSE)**.  \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodehiveofficial%2Fcodehive-genie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodehiveofficial%2Fcodehive-genie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodehiveofficial%2Fcodehive-genie/lists"}