Kevin, an adept AI software engineer, possesses the capability to understand human prompts, deconstruct them into actionable steps, conduct pertinent research, and generate code to accomplish specified goals. Leveraging expansive language models, strategic planning algorithms, and adept web browsing skills, Kevin adeptly crafts software solutions.
His mission is to transform software development practices by offering an AI programmer capable of tackling intricate coding challenges with minimal human intervention. Whether it's crafting new functionalities, rectifying bugs, or initiating projects from inception, Kevin stands ready to provide invaluable assistance.
NOTE: Keivn is a simpler version of the Cognition AI's Devin, partially trying to be an open-source alternative to it.
NOTE: Kevins' prompt templates and project structure are inspired by Devika; an actual try to clone Cognition's AI Devin.
To install Kevin locally:
- Clone the repository:
git clone https://github.com/MohammedAly22/Kevin.git
- Navigate to the kevin directory:
cd kevin
- Create a virtual environment:
python -m venv kevin
- Activate the virtual environment:
kevin/Scripts/activate
- Install the needed packages:
pip install -r requirements.txt
- Run this streamlit command to start the application:
streamlit run frontend/main.py
Kevin's workflow entails several steps. Firstly, the user selects a base model, currently limited to options such as Cohere
and Gemini-Pro
, and provides the corresponding API_KEY
. Subsequently, the user is directed to Kevin's workspace page where they input a prompt related to a code-assistance task. This prompt is then processed by Kevin's DecisionTaker
agent, which determines the appropriate course of action.
In scenarios involving ordinary conversation, Kevin responds to code-related queries with pertinent answers; otherwise, users are reminded that Kevin specializes in assisting with code-related inquiries as an AI software engineer.
For coding projects, Kevin initiates by generating a step-by-step plan using its Planner
agent, visually presented in the Kevin Planner tab. The prompt's keywords are extracted utilizing the KeywordExtractor
, then utilized by Kevin's Researcher
agent to formulate search queries, expanding its knowledge base. Subsequently, Kevin conducts internet searches based on these queries, presenting the retrieved results in JSON format within the Kevin Browser tab. The Coder
agent then utilizes the step-by-step plan and acquired information to write code in the Kevin Coder tab. Finally, Kevin's Project Creator
agent generates and executes Python code to create and organize project directories and files.
Kevin employs sophisticated AI planning to dissect overarching goals into manageable actions. The planning process comprises the following stages:
- Objective Comprehension: Kevin scrutinizes the provided goal or task description to grasp the user's intentions and needs.
- Step Formulation: Drawing from the objective and context, Kevin devises a series of broad steps to achieve the task.
- Implementation: Kevin carries out each step in the plan, utilizing diverse sub-components and modules as required.
To streamline focused research and data collection, Kevin utilizes keyword extraction methodologies. This process encompasses the following stages:
- Keyword Extraction: Kevin employs the BERT (Bidirectional Encoder Representations from Transformers) model to discern crucial keywords and phrases from the preprocessed text. BERT's extensive pre-training enables it to grasp semantic nuances and comprehend the significance of words within the given context.
- Utilizing keywords: the
KeyBert
model is used to extract the keywords and rank them based on their relevance to the user's prompt.
By pinpointing contextually significant keywords, Kevin can channel his research endeavors effectively, retrieving pertinent information to aid in task completion.
To generate helpful search queries, Kevin does the following:
- Utilize Contextual Keywords: Kevin considers contextual keywords previously generated from the user's prompt.
- Generate Search Queries: Based on the contextual keywords, Kevin creates helpful search queries that can be later used with the
googlesearch-python
library. - Retrieve Web Page Content: Kevin employs the
requests
module to fetch the web pages corresponding to the generated search queries. - Extract Content: Using the
beautifulsoup
library, Kevin extracts the content from the retrieved web pages for further processing.
Kevin's code generation module crafts code based on the outlined plan, research insights, and user specifications. This process encompasses the following stages:
- Code Structure Creation: Drawing from the plan and language-specific conventions, Kevin constructs the foundational structure of the code, encompassing classes, functions, and modules.
- Code Implementation: Kevin populates the code structure with pertinent logic, algorithms, and data manipulation instructions. It utilizes research findings, snippets from the knowledge repository, and its comprehension of programming principles to produce coherent code.
Kevin's proficiency in code generation empowers him to produce functional and optimized code across various programming languages, tailored to each project's specific demands and nuances.
- Script Generation: Following code generation, Kevin initiates the creation of a Python script utilizing the os module.
- Project File Organization: Kevin begins organizing the project files and folders generated previously during the coding phase of the project.
- Ensuring Completeness: Throughout the process, Kevin ensures the completeness of the project, aligning with its slogan: "from idea to code".