openai-assistant

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2024 License: MIT Imports: 7 Imported by: 0

README

OpenAI Assistant Integration

This project demonstrates the integration of the OpenAI Assistant feature and API in both Golang (CLI) and Python (API).

Installation

Clone the repository and navigate to the project directory:

git clone <repository-url>
cd <project-directory>

Install the Go dependencies:

go mod download

Set up the Python environment:

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Usage

Golang CLI

You can run the Golang CLI project with the following commands:

go run main.go "Some question"
go run main.go "Some question" "thread_123"
go run main.go "Some question" "thread_123" "msg_AZS"
Python API

To run the Python API project:

python3 main.py

In another terminal, you can send requests to the API:

QUESTION="Some question" curl --location 'http://localhost:38234/api/v1/message' \
    --header 'Content-Type: application/json' \
    --data '{
    "question": "$QUESTION",
}'

QUESTION="Some question" curl --location 'http://localhost:38234/api/v1/message' \
    --header 'Content-Type: application/json' \
    --data '{
    "question": "$QUESTION",
    "thread_id": "thread_123",
}'

QUESTION="Some question" curl --location 'http://localhost:38234/api/v1/message' \
    --header 'Content-Type: application/json' \
    --data '{
    "question": "$QUESTION",
    "thread_id": "thread_123",
    "after_message_id": "msg_AZS"
}'

Contributing

Contributions are welcome. Please make sure to update tests as appropriate.

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL