repository
0.0.0-20240611081027-5243e6c0bf0c
Repository: https://github.com/ilborsch/openai-go.git
Documentation: pkg.go.dev
# README
Go OpenAI API
Introduction
openai-go
is an API for Go language that provides intuitive and easy-to-understand interface to communicate with OpenAI API.
The library abstracts complexity of OpenAI REST API and provides user-friendly API to interact with instead.
Install
Run this command to install latest version of library:
go install github.com/ilborsch/openai-go-old@latest
Examples
See examples/ for a variety of examples.
As easy as:
package main
import (
"fmt"
"github.com/ilborsch/openai-go/openai"
)
func main() {
APIKey := "your-api-key"
// create a client
client := openai.New(APIKey)
// create a store for assistant files
vsID, err := client.CreateVectorStore("Crypto scam data storage")
if err != nil {
}
// create an assistant
assistantID, err := client.CreateAssistant(
"My New Assistant!", // name
"Be polite and friendly!", // instructions
vsID, // vector store ID
nil, // tools to use (file search is default)
)
if err != nil {
}
fmt.Println("My assistant ID: " + assistantID)
// Output: "My assistant ID: asst_jLkZWgH4uio1zM0HoW2MXbL"
}
Credits
- Sasha Draganov for inspiration and help
We'll be more than happy to see your contributions!