CodeStral-Code-Assistant is a chatbot designed to assist users with code-related questions. It provides code solutions, including descriptions, programming language details, imports, functional code blocks, and sample input/output.
Developed with the software and tools below.
In the upcoming update, I am implementing a self-correcting code agent. This feature will allow the agent to self-execute and evaluate the code before presenting it to the user, ensuring higher accuracy and reliability.
I am also planning to update the Streamlit frontend to improve user experience and add new interactive features.
Code-Bot is an interactive chatbot designed to assist users with programming-related queries. By leveraging the Codestral API, Code-Bot provides comprehensive code solutions that include:
- Descriptions of the code solutions.
- Programming language specifics.
- Necessary import statements.
- Fully functional code blocks.
- Sample input and output for the provided code.
The application is built using Streamlit for the web interface and integrates seamlessly with external APIs to generate accurate and executable code snippets. Whether you need help with sorting algorithms, API calls, or any other programming task, Code-Bot is here to help streamline your coding process.
To use Code-Bot, you need to obtain an API key from Codestral. Follow these steps to get your API key:
-
Visit the Codestral Official Website:
- Go to Codestral official website.
-
Login or Sign Up:
- If you already have an account, log in.
- If you are new to Codestral, sign up for a new account.
-
Request Access:
- Once logged in, click on the Request Access button.
-
Verify Your Phone Number:
- You will be prompted to verify your phone number. Follow the instructions to complete the verification process.
-
Wait for Approval:
- After verifying your phone number, you will receive a request granted email. (In my case, it took 2 hours)
-
Generate Your API Key:
- Once you receive the approval email, return to the Codestral official website.
- Follow the instructions to generate your API key.
Note: The Codestral API is free to use until August 1st, 2024.
By following these steps, you will be able to obtain and set up your Codestral API key to start using Code-Bot.
Code-Bot comes with a variety of features designed to make it a robust and versatile tool for programmers:
- Comprehensive Descriptions: Provides detailed explanations of the code solutions to help users understand the logic and implementation.
- Multi-Language Support: Capable of generating code in multiple programming languages based on user queries.
- Automatic Import Detection: Identifies and includes necessary import statements for the generated code, ensuring it runs without additional configuration.
- Executable Code: Generates fully functional code snippets that can be executed directly, saving users time on debugging and syntax errors.
- Formatted Output: Ensures the generated code is well-formatted and readable, using appropriate indentation and line breaks.
- Example Scenarios: Provides sample input and output for the generated code, helping users test and understand the code better.
- Codestral API: Integrates with the Codestral API to leverage powerful code generation capabilities.
- Real-Time Responses: Fetches and returns code solutions in real-time, providing quick assistance to user queries.
- Streamlit Integration: Built using Streamlit to provide an intuitive and interactive web interface, making it easy for users to input their queries and receive responses.
- Customizable: Allows users to configure the API key and other settings to suit their specific needs.
These features make Code-Bot a comprehensive tool for programmers, whether they are beginners seeking guidance or experienced developers looking for quick code snippets.
└── CodeStral-Code-Assistant/
├── README.md
└── app.py
Requirements
Ensure you have the following dependencies installed on your system:
pip install requests
pip install streamlit
- Clone the CodeStral-Code-Assistant repository:
git clone https://github.com/rahul2002m/CodeStral-Code-Assistant
- Change to the project directory:
cd CodeStral-Code-Assistant
- Install the dependencies:
pip install -r requirements.txt
Before running the application, you need to set up your Mistral Codestral API key.
- Open the app.py file
- Replace the placeholder in the following line with your actual API key:
os.environ["MISTRAL_API_KEY"] = "your_api_key_here"
Use the following command to run CodeStral-Code-Assistant:
streamlit run app.py
- Submit Pull Requests: Review open PRs, and submit your own PRs.
- Join the Discussions: Share your insights, provide feedback, or ask questions.
- Report Issues: Submit bugs found or log feature requests for Code-assistant.
- Fork the Repository: Start by forking the project repository to your GitHub account.
- Clone Locally: Clone the forked repository to your local machine using a Git client.
git clone https://github.com/rahul2002m/CodeStral-Code-Assistant
- Create a New Branch: Always work on a new branch, giving it a descriptive name.
git checkout -b new-feature-x
- Make Your Changes: Develop and test your changes locally.
- Commit Your Changes: Commit with a clear message describing your updates.
git commit -m 'Implemented new feature x.'
- Push to GitHub: Push the changes to your forked repository.
git push origin new-feature-x
- Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
Once your PR is reviewed and approved, it will be merged into the main branch.