Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thalesfsp/openai-assistant
OpenAI Assistant Integration in Golang and Python
https://github.com/thalesfsp/openai-assistant
api assistant chatbot cli demo demonstration golang openai python
Last synced: 8 days ago
JSON representation
OpenAI Assistant Integration in Golang and Python
- Host: GitHub
- URL: https://github.com/thalesfsp/openai-assistant
- Owner: thalesfsp
- License: mit
- Created: 2024-01-16T14:54:42.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-01-16T15:11:52.000Z (10 months ago)
- Last Synced: 2024-03-26T03:56:39.654Z (8 months ago)
- Topics: api, assistant, chatbot, cli, demo, demonstration, golang, openai, python
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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:
```bash
git clone
cd
```Install the Go dependencies:
```
go mod download
```Set up the Python environment:
```Bash
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:
```Bash
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