Documentation ¶
Index ¶
- Constants
- func ListModels() []string
- type Answer
- type Bard
- func (b *Bard) CreateConversation(ctx context.Context, name string) (llm.Conversation, error)
- func (b *Bard) CreateMessage(ctx context.Context, conversationId string, req llm.ChatCompletionRequest) (llm.Message, error)
- func (b *Bard) CreateMessageStream(ctx context.Context, conversationId string, req llm.ChatCompletionRequest, ...)
- type Choice
- type Client
- func (c *Client) Ask(prompt, conversationID, responseID, choiceID string, reqID int) (*Answer, error)
- func (c *Client) CreateChatCompletion(ctx context.Context, req llm.ChatCompletionRequest) (llm.ChatCompletionResponse, error)
- func (c *Client) CreateChatCompletionStream(ctx context.Context, req llm.ChatCompletionRequest, ...)
- func (c *Client) FirstAsk(prompt string) (*Answer, error)
- func (c *Client) ListModels() []string
- type ClientOption
Constants ¶
View Source
const ModelBard = "bard"
Variables ¶
This section is empty.
Functions ¶
func ListModels ¶
func ListModels() []string
Types ¶
type Answer ¶
type Answer struct { Content string ConversationID string ResponseID string FactualityQueries []any TextQuery string Choices []Choice Links []string Images []any ProgramLang string Code string StatusCode int }
Answer represents the response from the Bard AI service. It contains the generated text content, conversation ID, response ID, factuality queries, original text query, and any choices provided.
func (*Answer) ToChatCompletionResponse ¶
func (a *Answer) ToChatCompletionResponse() llm.ChatCompletionResponse
func (*Answer) ToChatCompletionStreamResponse ¶
func (a *Answer) ToChatCompletionStreamResponse() llm.ChatCompletionStreamResponse
type Bard ¶
func (*Bard) CreateConversation ¶
func (*Bard) CreateMessage ¶
func (*Bard) CreateMessageStream ¶
func (b *Bard) CreateMessageStream(ctx context.Context, conversationId string, req llm.ChatCompletionRequest, respChan chan llm.ChatCompletionStreamResponse, errChan chan error)
type Choice ¶
type Choice struct { // ID is a unique identifier for the choice. ID string // Content is the text content of the choice. Content string }
Choice represents an alternative response option provided by Bard.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreateChatCompletion ¶
func (c *Client) CreateChatCompletion(ctx context.Context, req llm.ChatCompletionRequest) (llm.ChatCompletionResponse, error)
func (*Client) CreateChatCompletionStream ¶
func (c *Client) CreateChatCompletionStream(ctx context.Context, req llm.ChatCompletionRequest, dataChan chan llm.ChatCompletionStreamResponse, errChan chan error)
func (*Client) ListModels ¶
type ClientOption ¶
type ClientOption func(*Client)
func WithCookies ¶
func WithCookies(cookies map[string]string) ClientOption
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
Click to show internal directories.
Click to hide internal directories.