The MultiAiAgent project utilizes two different Language Model Models (LLMs) for distinct purposes:
Mistral is used for general-purpose querying and document parsing. It is employed to interact with users, answer questions about API documentation, and parse PDF documents into logical chunks. Mistral provides a versatile interface for querying the vector store index and retrieving relevant information.
CodeLLama, on the other hand, specializes in code generation. It is specifically designed to understand code-related queries and generate code snippets based on user prompts. CodeLLama is responsible for interpreting prompts related to code generation, such as requests to generate Python scripts or fetch data from APIs. It leverages its knowledge of programming languages and coding conventions to produce accurate and relevant code output.
Using these two distinct LLMs allows the MultiAiAgent project to handle a wide range of tasks efficiently. Mistral provides the foundation for general querying and document parsing, while CodeLLama specializes in code-related tasks, enhancing the project's versatility and effectiveness.
MultiAiAgent is a project designed to create a multi-functional AI agent capable of reading and understanding API documentation and generating code based on user prompts. This project utilizes various components including the Llama Index, Ollama models, Pydantic for output parsing, and more.
MultiAiAgent leverages advanced language models to interact with users and generate code based on API documentation and user prompts. The project is designed to facilitate efficient code generation and documentation parsing.
- Parses PDF documents and creates a vector store index for efficient querying.
- Uses local embedding models for vector embedding.
- Utilizes advanced language models (Ollama) for querying and code generation.
- Supports multiple retries for queries to ensure reliability.
- Cleans and formats the output using Pydantic and AST.
- Saves generated code to specified files.
- Python 3.7 or higher
- Git
-
Clone the repository
git clone https://github.com/siddharthprakash1/MultiAiAgent.git cd MultiAiAgent
-
Create a virtual environment and activate it
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the required packages
pip install -r requirements.txt
-
Set up environment variables
Create a
.env
file in the root directory and add any necessary environment variables.
-
Start the program
python main.py
-
Interact with the agent
Enter your prompts when prompted by the program. Type
q
to quit the interaction.
- "What are some of the routes in the API?"
- "Generate a Python script to fetch data from the API."
- main.py: Main script to run the project.
- code_reader.py: Module to read and interpret code.
- prompts.py: Contains prompt templates used by the agent.
- data/: Directory containing the PDF documents to be parsed.
- output/: Directory where the generated code files will be saved.
MultiAiAgent/ ├── data/ │ └── example.pdf ├── output/ │ └── generated_code.py ├── main.py ├── code_reader.py ├── prompts.py ├── requirements.txt └── README.md
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch.
- Make your changes.
- Submit a pull request.