This Flask application demonstrates how to integrate LangChain with the ChatGoogleGenerativeAI model to answer user queries based on content fetched from a URL. The app uses UnstructuredURLLoader to load content, processes the text using RecursiveCharacterTextSplitter, and generates responses with LLMChain.
- Fetch Content from URL: Retrieves and processes content from a given URL.
- Text Chunking: Divides content into manageable chunks using customizable separators.
- Generate Responses: Uses
ChatGoogleGenerativeAIto provide answers based on the processed content.
- Python 3.7 or later
- Flask
- LangChain
- Transformers library
langchain_google_genailibrary
-
Clone the Repository
git clone https://github.com/sarthakm402/URL-readerQA.git
-
Create a requirements.txt file with the following content:
- Flask
- LangChain
- Transformers
- API
-
Start the Flask Application
python app.py
-
Access the Application
Open your web browser and navigate to http://127.0.0.1:5000(local host).
-
Submit Your Query
URL: Enter the URL of the content you want to analyze. Text: Enter the query related to the content. Click "Submit" to get the generated response based on the content from the URL.
-
Initialization Errors: If there’s an issue initializing the ChatGoogleGenerativeAI model, an error message is returned.\
-
Response Generation Errors: If there’s an error during response generation, an error message is returned.
We welcome contributions to improve the project. To contribute:
-
Fork the repository.
-
Create a new branch for your changes.
-
Submit a pull request with a detailed description of your changes.