Skip to content

shar-sun/A1

Repository files navigation

INFO-5940 Assignment: Files Q&A with OpenAI

This application allows users to upload .txt and .pdf documents and ask questions about their content using a conversational AI interface. It efficiently handles large documents by chunking them into smaller pieces and retrieves contextually relevant information to answer user queries.


πŸš€ Features

  • πŸ“„ File Upload Functionality for .txt and .pdf Files
    Users can upload .txt and .pdf files for processing and analysis.

  • πŸ’¬ Conversational Interface with Document Content
    A chat interface that allows users to ask questions about the uploaded documents and receive relevant, context-aware responses.

  • πŸ“š Support for Multiple Documents
    Upload and interact with multiple documents simultaneously, with separate handling of each document's content.

  • πŸ“ Efficient Document Chunking
    Automatically breaks large documents into manageable chunks for faster processing and improved retrieval accuracy.

  • πŸ” Intelligent Information Retrieval
    Fetches accurate answers based on the specific context of the uploaded files using LangChain, Chroma, and AzureOpenAIEmbeddings.


πŸ› οΈ Prerequisites

  • Docker
  • Docker Compose
  • Visual Studio Code with the Remote - Containers extension
  • OpenAI API Key (for GPT-based querying)

βš™οΈ Running the Application

1. Clone the Repository

Clone the repository to your local machine:

git clone https://github.com/shar-sun/A1.git
cd A1

2. Open in VS Code

  • Open VS Code and navigate to the A1 folder.

3. Create a .env File

Create a .env file in the project folder with the following content:

OPENAI_API_KEY=your-api-key-here
OPENAI_BASE_URL=your-api-base-url-here
TZ=your-timezone-here

4. Open with Docker

  • Open the Command Palette:
    • Press Ctrl+Shift+P on Windows/Linux or Cmd+Shift+P on macOS.
  • Search for: Remote-Containers: Reopen in Container and select it.
  • VS Code will build and open the project inside the Docker container automatically.

5. Run the Application

Open a terminal in Visual Studio Code and run the following command:

streamlit run chat_with_pdf.py

6. Upload Files and Ask Questions

  • Open the URL provided by Streamlit in your browser (usually http://localhost:8501).
  • Upload .txt and .pdf files using the provided interface.
  • Interact with the chatbot by asking questions related to the content of the uploaded documents.

πŸ“ Notes

  • Ensure Docker and Docker Compose are installed and running on your machine.
  • The .env file must contain valid OpenAI API credentials for the application to function correctly.
  • Make sure that the Remote - Containers extension in VSCode is properly configured.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published