Giter Site home page Giter Site logo

zainraza2000 / assistantsapi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from theailifestyle/assistantsapi

0.0 0.0 0.0 9 KB

This project is a Streamlit-based web application that leverages OpenAI's Assistants API to provide a ChatGPT-like experience. Users can have real-time conversations with the AI, upload documents to be used as context, and even scrape and convert website content to PDFs to enrich the AI's knowledge base.

Python 100.00%

assistantsapi's Introduction

ChatGPT-like Chat App Using Assistants API

This project is a Streamlit-based web application that leverages OpenAI's Assistants API to provide a ChatGPT-like experience. Users can have real-time conversations with the AI, upload documents to be used as context, and even scrape and convert website content to PDFs to enrich the AI's knowledge base.

OpenAI Assistants API - https://platform.openai.com/docs/assistants/overview

Features

  • Real-time AI Chat: Engage in conversations with the AI using OpenAI's GPT models, with the ability to reference uploaded documents.
  • Web Scraping: Extract text from provided URLs to gather information.
  • PDF Conversion: Convert scraped text content or any textual data into PDF files.
  • File Upload and Management: Upload and manage PDF files within the app, which the AI can use as context for the conversations.
  • Contextual Responses: The AI uses the content of uploaded files to provide informed responses.
  • Citations and References: The AI includes citations and references to the uploaded documents in its responses, enhancing the reliability of the information provided.

OpenAI's Assistants API

The Assistants API from OpenAI is a powerful tool that allows developers to integrate conversational AI into their applications. In this app, the Assistants API is used to:

  • Generate Conversations: Create interactive dialogues with the AI based on the user's prompts.
  • Contextual Understanding: Utilize the content of uploaded PDFs as context to inform the AI's responses, ensuring that the conversation is relevant and informed by the provided material.
  • File Handling: Upload and associate files with the AI assistant to be used during conversations.
  • Citations: Automatically generate citations from the uploaded files when referenced in the AI's responses, allowing for clear sourcing of information.

Requirements

  • Python 3.6 or higher
  • Streamlit
  • OpenAI Python package
  • Requests library
  • BeautifulSoup library (for web scraping)
  • PDFKit library (for PDF conversion)
  • wkhtmltopdf (PDFKit dependency)

Setup Instructions

  1. Install Dependencies:

    pip install streamlit openai requests beautifulsoup4 pdfkit
  2. API Key Configuration:

    Securely input your OpenAI API key into the Streamlit app's sidebar to authenticate your API requests.

  3. wkhtmltopdf Installation:

    Ensure that wkhtmltopdf is installed and accessible in your system's PATH. This is necessary for PDF conversion with pdfkit.

Usage Guide

  1. Run the Streamlit app:

    streamlit run app.py
  2. Input your OpenAI API key in the provided sidebar field.

  3. Optionally, scrape web content and convert it to a PDF for the AI to use as context.

  4. Upload any documents you want the AI to reference during the conversation.

  5. Initiate the chat by clicking "Start Chat" and begin your conversation with the AI.

Application Notes

  • Always ensure you have the right to scrape content from websites and to use any uploaded documents.
  • The chat interface activates after the "Start Chat" button is clicked, and the uploaded files are processed.

Contributing

If you'd like to contribute to the project, please fork the repository and issue a pull request with your suggested changes.

License

This project is licensed under the MIT License.


The inline comments in the source code provide further details and can guide you through the application's functionality and structure.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.