Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sheeiavellie/go-yandexgpt
Simple YandexGPT client for Go
https://github.com/sheeiavellie/go-yandexgpt
ai client go unofficial yandex yandex-api yandex-gpt yandexgpt
Last synced: 4 days ago
JSON representation
Simple YandexGPT client for Go
- Host: GitHub
- URL: https://github.com/sheeiavellie/go-yandexgpt
- Owner: sheeiavellie
- License: mit
- Created: 2024-03-07T04:37:09.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-10-24T13:39:34.000Z (21 days ago)
- Last Synced: 2024-10-25T16:18:02.545Z (20 days ago)
- Topics: ai, client, go, unofficial, yandex, yandex-api, yandex-gpt, yandexgpt
- Language: Go
- Homepage:
- Size: 26.4 KB
- Stars: 12
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ✨ Go YandexGPT ✨
[![Release CI](https://github.com/sheeiavellie/go-yandexgpt/actions/workflows/semantic-release.yml/badge.svg)](https://github.com/sheeiavellie/go-yandexgpt/actions/workflows/semantic-release.yml)
[![Go Reference](https://pkg.go.dev/badge/github.com/sheeiavellie/go-yandexgpt.svg)](https://pkg.go.dev/github.com/sheeiavellie/go-yandexgpt)
[![Go Report Card](https://goreportcard.com/badge/github.com/sashabaranov/go-openai)](https://goreportcard.com/report/github.com/sheeiavellie/go-yandexgpt)This library provides unofficial Go client for [YandexGPT API](https://cloud.yandex.ru/en/services/yandexgpt).
## Installation
```
go get github.com/sheeiavellie/go-yandexgpt@latest
```
Currently, go-yandexgpt requires Go version 1.22 or greater.## Usage
```go
package mainimport (
"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("Request error")
return
}fmt.Println(response.Result.Alternatives[0].Message.Text)
}```
### Getting an API Key/IAM token:
You can get all the necessary information from the [official documentation](https://cloud.yandex.ru/en/docs/yandexgpt/quickstart).
## Contributing
1. Create an issue
2. Fork the repository
3. Do your magik
4. Open a pull request (please, put the link to previously opened issue in it's title)## Thank you very much
This project was ***highly*** inspired by [go-openai](https://github.com/sashabaranov/go-openai) by [sashabaranov](https://github.com/sashabaranov)
*Made with 💖 and some wizardry 🧙🔮*