Git Product home page Git Product logo

faiss_searcher's Introduction

Document Query Chat Assistant Using OpenAI

This repository contains main.py, a Python script which interacts with the user, accepting a search query and optionally a chat query. The script retrieves documents most related to the search query from a pre-existing FAISS index (the process to create this index can be found at this repository), and uses these documents to inform an OpenAI chat model to generate a response. This application functions as a chat assistant, providing answers based on specific document sets.

Prerequisites

Please ensure that you have installed:

  • Python 3.6+
  • logging Python library.
  • openai Python library.
  • langchain Python library version 0.1+. This library provides FAISS vector store and OpenAIEmbeddings.

You can install these dependencies with the following pip command:

pip install logging openai langchain

Usage

To run the script, perform the following steps:

  1. Clone this repository to your local machine.

    git clone <repo_url>
  2. Replace 'YOUR_OPENAI_KEY' in the script with your OpenAI key. If you do not want to send data to OpenAI API, leave this as an empty string.

    openai.api_key = 'YOUR_OPENAI_KEY'
  3. Replace 'INDEX_FILE_NAME' with the name of your FAISS index file.

     faiss_index_filename = 'INDEX_FILE_NAME'
  4. Run the script.

    python main.py

The script interface prompts you to input a "search query" (core concept you're interested in) and optionally a "chat query" (the question to ask the OpenAI model). When a chat query is provided and an OpenAI key is set up, the script retrieves relevant documents from your FAISS index, uses them to inform the OpenAI chat model, and the response is then presented. When a chat query is not provided or an OpenAI key is not set up, the script provides a list of the relevant documents based on your search query.

Enter exit as either the search query or chat query to stop the script.

License

This project is released under the Unlicense, granting uncheckered freedom to use, modify, and distribute this project as you see fit.

faiss_searcher's People

Contributors

rmilejcz avatar

Watchers

Kostas Georgiou avatar  avatar

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.