Giter Site home page Giter Site logo

go-yandexgpt's Introduction

✨ Go YandexGPT ✨

Go Reference Go Report Card

This library provides unofficial Go client for YandexGPT API.

Installation

go get github.com/sheeiavellie/go-yandexgpt

Currently, go-openai requires Go version 1.22 or greater.

Usage

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)
}

Getting an API Key/IAM token:

You can get all the necessary information from the official documentation.

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 by sashabaranov

Made with 💖 and some wizardry 🧙🔮

go-yandexgpt's People

Contributors

sheeiavellie avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.