GenericAI is a versatile AI assistant developed using the ReAct (Reasoning and Acting) framework. It leverages LangChain for coordinating language model interactions and Gradio for an intuitive interface. With a variety of integrated tools, GenericAI is capable of reasoning through complex queries and executing actions to deliver accurate and well-rounded responses.
- ReAct Framework: Uses reasoning and acting to address complex queries.
- Integrated Tools: Includes Python REPL, Terminal, Weather API, Web Browsing, PDF Summarization, Image Description, and more.
- Chat History Management: Tracks conversations with MongoDB for contextual responses.
- User-Friendly Interface: Built with Gradio for easy interaction.
- Extensible Architecture: Add or modify tools with minimal effort.
Run the application locally to experience GenericAI in action. Submit questions, provide files, and see how it intelligently uses tools to respond.
- Python 3.12: Install from python.org.
- MongoDB: Use MongoDB Atlas for cloud or install locally.
- Git: Required to clone the repository.
-
Clone the Repository
git clone https://github.com/shaswata56/GenericAI.git cd GenericAI
-
Create a Virtual Environment
Use a virtual environment to manage dependencies.
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies
pip install --upgrade pip pip install -r requirements.txt
-
Environment Variables
This repository includes a pre-configured
.env
file. However, when you use it, ensure that you add.env
to your.gitignore
to avoid exposing sensitive information. Below is the default content of the.env
file:OPENROUTER_API_KEY="your-api-key" TOGETHER_API_KEY="your-api-key" OPENWEATHERMAP_API_KEY="your-api-key" TAVILY_API_KEY="your-api-key" MONGODB_URL="mongodb://localhost:27017/" LLM_PROVIDER="ollama" LLM_MODEL="llava:13b" VLM_PROVIDER="ollama" VLM_MODEL="llava:13b"
Update the values in the
.env
file with your actual API keys and configuration as needed. -
API Keys
Obtain API keys for tools like OpenWeatherMap, Tavily, and PubMed, and update the
.env
file accordingly.
Activate the virtual environment if it isn't active:
source venv/bin/activate # On Windows: venv\Scripts\activate
Start the application:
python GenericAI.py
The Gradio interface will provide a local URL (e.g., http://127.0.0.1:8080
). Open the URL in your browser to interact with GenericAI.
- Ask a Question: Enter your query in the text box.
- Upload a File (Optional): Upload a file (e.g., PDF, image) for processing.
- View Response: The response will appear in the markdown output area.
Example Queries:
- "Summarize the attached PDF."
- "What is the weather like in New York?"
- "Describe the image in the uploaded file."
- "Count the number of vowels in the word 'OpenAI'."
GenericAI includes various tools for enhanced functionality:
- Python REPL: Execute Python commands.
- Terminal: Run shell commands.
- Weather: Fetch weather data using OpenWeatherMap.
- Search: Perform web searches.
- Calculator: Solve math problems.
- Wikipedia: Access general knowledge.
- YouTube: Retrieve YouTube video links.
- Arxiv: Search for scientific articles on arXiv.
- DateTimeNow: Display the current date and time.
- LetterInWordCounter: Count occurrences of a letter in a word.
- WebpageBrowser: Summarize webpage content.
- PubMed: Query medical information.
- RecallMemory: Retrieve past conversations.
- VowelCounter: Count vowels in a string.
- TotalLetterCounter: Count letters in a string.
- PdfSummarizer: Summarize PDF files.
- ImgDesc: Describe images.
- ImgDescOnline: Describe online images.
- TxtFileReader: Read text files.
- TxtFileWriter: Overwrite text files.
- TxtFileAppender: Append to text files.
- PdfReader: Read PDF files.
- PdfReaderOnline: Read online PDFs.
- Notepad: Simple notepad functionality.
Define new tools and register them in the get_tools
function in GenericAI.py
. Ensure each tool adheres to input-output standards for smooth integration.
Contributions are welcome! Follow these steps to contribute:
-
Fork the Repository
Click the "Fork" button at the top right of this page.
-
Clone the Forked Repository
git clone https://github.com/shaswata56/GenericAI.git cd GenericAI
-
Create a Feature Branch
git checkout -b feature/YourFeatureName
-
Commit Your Changes
git commit -m "Add Your Feature"
-
Push to the Branch
git push origin feature/YourFeatureName
-
Open a Pull Request
Navigate to your forked repository on GitHub and click "Compare & pull request".
This project is licensed under the MIT License.
- ReAct: Synergizing Reasoning and Acting in Language Models for enabling step-by-step reasoning and acting to solve complex problems.
- LangChain for its powerful framework for language model applications.
- Gradio for its user-friendly interface creation tools.
- MongoDB for scalable storage of chat histories.