Skip to content

jerome-white/openai-file-chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenAI File Chat

This code implements a wrapper around OpenAI file search. It is convenient if you find the OpenAI interface clunky, or need to export its functionality without providing deep access to your OpenAI account.

Setup

Bash environment

Create the following environment variables:

$> ROOT=`git rev-parse --show-toplevel`
$> export PYTHONPATH=$ROOT
$> export PYTHONLOGLEVEL=info

Python environment

$> python -m venv venv
$> source venv/bin/activate
$> pip install -r requirements.txt

Configuration

Generate a configuration JSON. The structure is as follows:

{
  "gradio": {         dict # key-value pairs passed to Gradio.Blocks.launch
  },
  "openai": {
    "api_key":        str  # your OpenAI API key
    "model":          str  # OpenAI model to use
    "assistant_name": str  # Naming convention to give assistants
  },
  "chat": {
    "prefix":         str  # Vector store name prefix
    "system_prompt":  str  # Path to system prompt (static/system-prompt.txt)
    "retries":        int  # Number of prompt retry attempts
  }
}

Save this somewhere convenient, outside of this repository's directory structure.

Run the app

FILE_CHAT_CONFIG=/path/to/configuration.json gradio $ROOT/app.py

Navigate to the URL specified by Gradio, then open the accordion at the top of the page for usage instructions.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages