gemini

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 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(apiKey, text string, images []string) (string, error)

Question is to send a message or image.

ex)

func QuestionStream

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

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

ex)

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

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

GetHistory returns the history of messages with images.

ex) history := chat.GetHistoryWithImages()

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(apiKey string) error

Start is start a chat.

ex) err := chat.Start(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