This open-source project is an integral part of the Tenacity Learn website and app, designed to provide a personalized learning experience for coding enthusiasts. In this README, you'll find detailed information about the project, how it works, and how you can contribute to this exciting community.
At Tenacity Learn, our mission is to empower learners of all levels with tools and guidance to enhance their coding skills. We believe in the power of personalized learning, and this project is a key component of our platform.
Our AI Code Suggestions feature leverages the capabilities of Azure OpenAI to analyze the code written by users and provide live suggestions to improve their code. The AI system does not simply provide answers but rather offers hints and suggestions, helping users understand and rectify their mistakes. This collaborative learning approach is designed to foster a deeper understanding of coding concepts.
The core of this project is the model.py file, which serves as the interface between our Tenacity Learn platform and Azure OpenAI. Let's take a closer look at the key components of this file:
To ensure the security of our Azure OpenAI integration, we use environment variables to store sensitive information, such as the API key and endpoint. These variables include:
AZURE_OAI_KEY: Your Azure OpenAI API key.AZURE_OAI_ENDPOINT: The endpoint for the Azure OpenAI service.AZURE_OAI_MODEL: The specific Azure OpenAI model to be used.PROMPT: The initial prompt to be provided to the AI system.
The code example in the code variable serves as the input for the AI system. Users can replace this code with their own, and the AI will provide suggestions based on the input provided.
We set up the OpenAI configuration by specifying the API type, base URL, version, and API key. This ensures that the AI requests are directed to the appropriate Azure OpenAI model.
We send a request to the Azure OpenAI model with the user's code and initial prompt. The response from the AI system is then displayed to the user, providing suggestions and feedback on the code.
To get started with this project, you'll need to have the necessary environment variables set up. Make sure to create a .env file and store your Azure OpenAI API key, endpoint, model, and prompt as mentioned in the model.py file.
The usage of this project is straightforward. Users can replace the example code in the code variable with their own code. When they run the model.py script, it sends a request to Azure OpenAI, and the AI system provides suggestions based on the code provided.
Here's a brief overview of the steps:
- Set up your environment variables in the
.envfile. - Replace the
codevariable with your code. - Run the
model.pyscript. - Review the AI-generated suggestions for your code.
We welcome contributions from the open-source community, especially as part of Hacktoberfest. If you're interested in improving and expanding this project, please follow these steps:
- Fork this repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them with clear and concise messages.
- Submit a pull request to the
mainbranch of this repository.
We value contributions that enhance the functionality, usability, and documentation of the project. Your involvement is greatly appreciated!
This project is licensed under the MIT License. You can find more details in the LICENSE file.
We hope you find this project interesting and useful. If you have any questions, feedback, or suggestions, please feel free to reach out to us. Happy coding with Tenacity Learn! 🚀
