This library provides unofficial Go client for YandexGPT API.
go get github.com/sheeiavellie/go-yandexgpt
Currently, go-openai requires Go version 1.22 or greater.
package main
import (
"context"
"fmt"
"github.com/sheeiavellie/go-yandexgpt"
)
func main() {
client := yandexgpt.NewYandexGPTClientWithAPIKey("apiKey")
request := yandexgpt.YandexGPTRequest{
ModelURI: yandexgpt.MakeModelURI("catalogID", yandexgpt.YandexGPTModelLite),
CompletionOptions: yandexgpt.YandexGPTCompletionOptions{
Stream: false,
Temperature: 0.7,
MaxTokens: 2000,
},
Messages: []yandexgpt.YandexGPTMessage{
{
Role: yandexgpt.YandexGPTMessageRoleSystem,
Text: "Every time you get ONE you answer just TWO",
},
{
Role: yandexgpt.YandexGPTMessageRoleUser,
Text: "ONE",
},
},
}
response, err := client.CreateRequest(context.Background(), request)
if err != nil {
fmt.Println("Error")
return
}
fmt.Println(response.Result.Alternatives[0].Message.Text)
}
You can get all the necessary information from the official documentation.
- Create an issue
- Fork the repository
- Do your magik
- Open a pull request (please, put the link to previously opened issue in it's title)
This project was highly inspired by go-openai by sashabaranov
Made with 💖 and some wizardry 🧙🔮