Documentation ¶
Index ¶
- Constants
- type ChatGenerationRequest
- type ChatGenerationResponse
- type ChatMessage
- type ChatPrediction
- type Client
- type Embedding
- type EmbeddingStats
- type Example
- type Predictions
- type SafetyAttributes
- type TextCandidate
- type TextEmbeddingRequest
- type TextEmbeddingResponse
- type TextGenerationRequest
- type TextGenerationResponse
Constants ¶
const ( TextBison string = "text-bison" TextBison001 string = "text-bison@001" CodeBison001 string = "code-bison@001" // Code Generation CodeGecko001 string = "code-gecko@001" // Code Completion )
standard models supported by TextGeneration endpoint
const ( ChatBison string = "chat-bison" ChatBison001 string = "chat-bison@001" CodeChatBison001 string = "codechat-bison@001" // Code Generation )
standard models supported by ChatGeneration endpoint
const (
TextEmbeddingGecko001 string = "textembedding-gecko@001"
)
standard models supported by TextEmbedding endpoint
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatGenerationRequest ¶
type ChatGenerationRequest struct { ProjectID string EndpointID string Context string ChatMessages []ChatMessage Examples []Example Temperature *float64 MaxDecodeSteps *int TopK *int TopP *float64 }
ChatGenerationRequest is the request for the ChatGeneration method
type ChatGenerationResponse ¶
type ChatGenerationResponse struct { ChatPredictions []ChatPrediction `json:"predictions"` DeployedModelID string `json:"deployedModelId"` Model string `json:"model"` ModelDisplayName string `json:"modelDisplayName"` ModelVersionID string `json:"modelVersionId"` }
ChatGenerationResponse is the response for the ChatGeneration method
type ChatMessage ¶
ChatMessage is a chat prompt
type ChatPrediction ¶
type ChatPrediction struct { ChatMessages []ChatMessage `json:"candidates"` SafetyAttributes []SafetyAttributes `json:"safetyAttributes"` }
ChatPrediction is the generated response
type Client ¶
type Client interface { TextGeneration(ctx context.Context, req TextGenerationRequest) (*TextGenerationResponse, error) ChatGeneration(ctx context.Context, req ChatGenerationRequest) (*ChatGenerationResponse, error) TextEmbedding(ctx context.Context, req TextEmbeddingRequest) (*TextEmbeddingResponse, error) }
Client is the interface for the Vertex AI client for PaLM
type Embedding ¶
type Embedding struct { Values []float64 `json:"values"` Statistics EmbeddingStats `json:"statistics"` }
Embedding is the embedding for text
type EmbeddingStats ¶
type EmbeddingStats struct { TokenCount int `json:"token_count"` Truncated bool `json:"truncated"` }
EmbeddingStats define the statistics for a text embedding
type Example ¶
type Example struct { Input ChatMessage `json:"input"` Output ChatMessage `json:"output"` }
Example represents a example passed for few shot learning in multi turn chat conversations
type Predictions ¶
type Predictions struct {
Embedding Embedding `json:"embeddings"`
}
Predictions is the generated response
type SafetyAttributes ¶
type SafetyAttributes struct { Blocked bool `json:"blocked"` Scores []float64 `json:"scores"` Categories []string `json:"categories"` }
SafetyAttributes is the safety attributes for a prediction
type TextCandidate ¶
type TextCandidate struct { Content string `json:"content"` SafetyAttributes SafetyAttributes `json:"safetyAttributes"` }
TextCandidate is the generated response
type TextEmbeddingRequest ¶
type TextEmbeddingRequest struct { ProjectID string EndpointID string /* Content is Deprecated. Use Inputs instead */ Content string Inputs []string }
TextEmbeddingRequest is the request for the TextEmbedding method
type TextEmbeddingResponse ¶
type TextEmbeddingResponse struct {
Predictions []Predictions `json:"predictions"`
}
TextEmbeddingResponse is the response for the TextEmbedding method
type TextGenerationRequest ¶
type TextGenerationRequest struct { ProjectID string EndpointID string Content string Temperature *float64 MaxDecodeSteps *int TopK *int TopP *float64 }
TextGenerationRequest is the request for the TextGeneration method
type TextGenerationResponse ¶
type TextGenerationResponse struct { Candidates []TextCandidate `json:"predictions"` DeployedModelID string `json:"deployedModelId"` Model string `json:"model"` ModelDisplayName string `json:"modelDisplayName"` ModelVersionID string `json:"modelVersionId"` }
TextGenerationResponse is the response for the TextGeneration method