This repository contains the code for building and deploying an AI Assistant using OpenAI’s API, which includes capabilities for processing and analyzing data with a powerful code interpreter. This AI Assistant is designed to interact with backend systems, providing data-driven insights and automated responses based on natural language queries.
https://github.com/mohamadawaisy/CodeInterpreter-Assistant
Features
- AI Assistant Initialization: Set up an AI assistant that can execute code, analyze data, and provide actionable insights.
- Data File Management: Upload and manage files directly through the OpenAI API, allowing the AI to work with specific datasets.
- Advanced Data Analysis: Use the code interpreter tool to process data queries and return results including diagrams, charts, and CSV files.
- Logging and Error Handling: Incorporate sophisticated logging for debugging and monitoring the assistant’s operations.
Getting Started
Prerequisites
- Python 3.8 or later
- OpenAI API key
Installation
-
Clone the repository:
git clone https://github.com/mohamadawaisy/CodeInterpreter-Assistant.git cd CodeInterpreter-Assistant
-
Install the required dependencies:
pip install -r requirements.txt
Configuration
-
Create a
config.json
file in the root directory with your OpenAI API key:{ "openai_api_key": "your_openai_api_key" }
Usage
-
Import the
DataAssistant
class:from data_assistant.assistant import DataAssistant
-
Initialize the
DataAssistant
:assistant = DataAssistant("path_to_your_data_file.csv")
-
Interact with the AI Assistant:
# Ask a question response = assistant.ask_question("What insights can you provide about recent sales data?") print(response) # Follow-up question follow_up_question = "Can you break down the sales by product category?" follow_up_response = assistant.follow_up_question(follow_up_question) print(follow_up_response) # Advanced Data Analysis analysis_result = assistant.ask_question("Generate a sales forecast for the next quarter.") print(analysis_result)
Contributing
Contributions are welcome! Fork the repository and submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contact
For any inquiries or support, please open an issue on the GitHub repository.
Project Link: https://github.com/mohamadawaisy/CodeInterpreter-Assistant
Linkedin: Muhamad Awaisy - Navan | LinkedIn