This repository contains a collection of Python scripts that implement various AI functionalities, including a chatbot powered by Wikipedia and DuckDuckGo search, a code generation and testing AI, image processing with caption generation, and an image retrieval system. The project utilizes the Langchain framework, Hugging Face models, and various APIs for information retrieval and image processing.
-
Chatbot Application (
chatBot.py
):- An interactive AI tutor that answers questions by searching Wikipedia and DuckDuckGo.
- Integrates real-time text generation using Hugging Face models.
-
Code Generation and Testing (
coder.py
):- An AI agent that can generate Python code based on user prompts.
- Includes functionality to create test functions for the generated code and run tests to check correctness.
-
Image Processing and Captioning (
imageProcessing.py
):- Generates detailed captions for input images using Google's Gemini API.
- Downloads images from the web based on user queries.
-
Image Retrieval (
imageRetriever.py
):- A simple image downloader that retrieves images from Bing based on specified keywords.
-
Vector Store and Retrieval (
vectorStore.py
):- Implements a vector store to manage and retrieve documents using embeddings from Hugging Face.
- Supports question-answering functionality over the stored documents.
-
Agents for Information Retrieval (
tavilyDdg.py
,wikiDdgAgent.py
):- Define agents that utilize Tavily and DuckDuckGo or Wikipedia for answering questions.
- These agents are designed to assist users in retrieving high-quality information.
To set up the project, follow these steps:
-
Clone the repository:
git clone https://github.com/hamza-amin-4365/Langchain-Series.git cd Langchain-Series
-
Install the required packages: Ensure you have Python installed (preferably Python 3.7 or higher). You can create a virtual environment and install dependencies using pip:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate` pip install -r requirements.txt
-
Set up environment variables: Create a
.env
file in the root directory of the project and add the following variables:huggingfacehub_api_token=YOUR_HUGGINGFACE_API_TOKEN Gemin_api_key=YOUR_GOOGLE_GENERATIVE_AI_API_KEY TAVILY_API_KEY=YOUR_TAVILY_API_KEY
-
Run the applications:
- For the Chatbot:
streamlit run chatBot.py
- For the Code Generator:
python coder.py
- For Image Processing:
python usage.py # Adjust the usage as necessary based on your needs
- For Image Retrieval:
python imageRetriever.py
- For the Chatbot:
- Chatbot: Ask questions related to various subjects, and the AI will respond with a combination of Wikipedia and DuckDuckGo results.
- Code Generation: Provide a description of what you want to achieve, and the AI will generate the corresponding Python code.
- Image Processing: Supply an image, and the AI will generate a descriptive caption for it.
- Image Retrieval: Enter a keyword to download related images from Bing.
Contributions are welcome! If you have suggestions or improvements, please feel free to submit a pull request. Make sure to follow the coding standards and include tests for your changes.
This project is licensed under the MIT License. See the LICENSE file for more details.
This README provides an overview of the capabilities and functionality of the AI Assistant repository. For further details about each script, please refer to the respective source files.