Documentation ¶
Index ¶
- Constants
- func GenerateText(model string, params PromptConfig) (string, error)
- type ChatConfig
- type ChatResponse
- type CitationMetadata
- type CitationSource
- type Client
- type ClientConfig
- type ContentFilter
- type Embedding
- type Example
- type Message
- type MessageConfig
- type MessagePrompt
- type Model
- type PromptConfig
- type ResponseChat
- type ResponseEmbed
- type ResponseMessage
- type ResponseText
- type SafetyFeedback
- type SafetyRating
- type SafetySetting
- type TextCompletion
- type TextPrompt
Constants ¶
View Source
const API_BASE_URL string = "https://generativelanguage.googleapis.com/v1beta2"
View Source
const CHAT_MODEL string = "models/chat-bison-001"
View Source
const EMBED_MODEL string = "models/embed-gecko-001"
View Source
const TEXT_MODEL string = "models/text-bison-001"
Variables ¶
This section is empty.
Functions ¶
func GenerateText ¶
func GenerateText(model string, params PromptConfig) (string, error)
Types ¶
type ChatConfig ¶
type ChatConfig struct { Model string `json:"model;omitempty"` Context string `json:"context;omitempty"` Examples []Example `json:"examples,omitempty"` Messages []Message `json:"messages;omitempty"` Temperature float64 `json:"temperature;omitempty"` CandidateCount int `json:"candidateCount;omitempty"` TopP float64 `json:"topP;omitempty"` TopK int `json:"topK;omitempty"` Prompt TextPrompt `json:"prompt"` }
type ChatResponse ¶
type ChatResponse struct { Candidates []Message `json:"candidates"` Filters []ContentFilter `json:"filters"` Messages []Message `json:"messages"` Model string `json:"model"` Context string `json:"context"` Examples []Example `json:"examples"` Temperature float64 `json:"temperature"` CandidateCount int `json:"candidate_count"` TopK int `json:"top_k"` TopP float64 `json:"top_p"` Last string `json:"last"` }
func Chat ¶
func Chat(config ChatConfig) (ChatResponse, error)
func ChatPrompt ¶
func ChatPrompt(prompt string) (ChatResponse, error)
func (*ChatResponse) GetLast ¶
func (c *ChatResponse) GetLast() string
func (*ChatResponse) Reply ¶
func (c *ChatResponse) Reply(msg string)
type CitationMetadata ¶
type CitationMetadata struct {
CitationSource []CitationSource `json:"citationSource,omitempty"`
}
type CitationSource ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ChatPrompt ¶
func (c *Client) ChatPrompt(prompt string) (ResponseText, error)
type ClientConfig ¶
type ContentFilter ¶
type Message ¶
type Message struct { Author string `json:"author"` Content string `json:"content"` CitationMetadata CitationMetadata `json:"citationMetadata,omitempty"` }
type MessageConfig ¶
type MessageConfig struct { Prompt MessagePrompt `json:"prompt"` Temperature float64 `json:"temperature"` CandidateCount int `json:"candidateCount"` TopP float64 `json:"topP"` TopK int `json:"topK"` }
type MessagePrompt ¶
type Model ¶
type Model struct { Name string `json:"name"` BaseModelId string `json:"baseModelId"` Version string `json:"version"` DisplayName string `json:"displayName"` Description string `json:"description"` InputTokenLimit int `json:"inputTokenLimit"` OutputTokenLimit int `json:"outputTokenLimit"` SupportedMethods []string `json:"supportedGenerationMethods"` Temperature float64 `json:"temperature"` TopP float64 `json:"topP"` TopK int `json:"topK"` }
func ListModels ¶
ListModels returns a list of all models from the Palm API
type PromptConfig ¶
type PromptConfig struct { Prompt TextPrompt `json:"prompt"` SafetySettings []SafetySetting `json:"safetySettings"` StopSequences []string `json:"stopSequences"` Temperature float64 `json:"temperature"` CandidateCount int `json:"candidateCount"` MaxOutputTokens int `json:"maxOutputTokens"` TopP float64 `json:"topP"` TopK int `json:"topK"` }
type ResponseChat ¶
type ResponseChat struct { Candidates []TextCompletion `json:"candidates"` Filters []ContentFilter `json:"filters"` SafetyFeedback []SafetyFeedback `json:"safetyFeedback"` }
type ResponseEmbed ¶
type ResponseEmbed struct {
Embedding Embedding `json:"embedding"`
}
func EmbedText ¶
func EmbedText(text string) (ResponseEmbed, error)
type ResponseMessage ¶
type ResponseMessage struct { Candidates []Message `json:"candidates"` Messages []Message `json:"messages"` Filters []ContentFilter `json:"filters"` }
func GenerateMessage ¶
func GenerateMessage(messageConfig MessageConfig) (*ResponseMessage, error)
type ResponseText ¶
type ResponseText struct {
Candidates []TextCompletion `json:"candidates"`
}
type SafetyFeedback ¶
type SafetyFeedback struct { Rating SafetyRating `json:"rating"` Setting SafetySetting `json:"setting"` }
type SafetyRating ¶
type SafetySetting ¶
type SafetySetting struct {
StopSequence string `json:"stopSequence"`
}
type TextCompletion ¶
type TextCompletion struct { Output string `json:"output"` SafetyRatings []SafetyRating `json:"safetyRatings"` CitationMetadata CitationMetadata `json:"citationMetadata,omitempty"` }
type TextPrompt ¶
type TextPrompt struct {
Text string `json:"text"`
}
Click to show internal directories.
Click to hide internal directories.