gemini

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package gemini provides communication with Gemini.

Package gemini provides communication with Gemini.

Package gemini provides communication with Gemini.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Question

func Question(model, apiKey, text string, images []string) (string, error)

Question is to send a message or image.

ex) answer, err := gemini.Question("gemini-1.5-flash", API_KEY, "who are you?", nil)

func QuestionStream

func QuestionStream(model, apiKey, text string, images []string) (chan answerForStream, error)

QuestionStream is to send a message or image and receive it as a stream.

ex) channel, err := gemini.QuestionStream("gemini-1.5-flash", API_KEY, "please say something encouraging", nil)

Types

type Chat

type Chat struct {
	// contains filtered or unexported fields
}

Chat is a struct that provides chat.

func (*Chat) GetHistory

func (this *Chat) GetHistory() []chatHistory

GetHistory returns the history for messages without images.

ex) history := chat.GetHistory()

func (*Chat) SendMessage

func (this *Chat) SendMessage(text string, images []string) (string, error)

SendMessage is to send a message or image.

ex 1) answer, err := chat.SendMessage("who are you?", nil) ex 2) answer, err := chat.SendMessage("let me know your opinion", []string{"test/image-01.webp"})

func (*Chat) SendMessageStream

func (this *Chat) SendMessageStream(text string, images []string) (chan answerForStream, error)

SendMessageStream is to send a message or image and receive it as a stream.

ex) channel, err := chat.SendMessageStream("please say something encouraging", nil)

func (*Chat) Start

func (this *Chat) Start(model, apiKey string) error

Start is start a chat.

ex) err := chat.Start("gemini-1.5-flash", API_KEY)

func (*Chat) Stop

func (this *Chat) Stop()

Stop is stop a chat.

ex) chat.Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL