Documentation
¶
Overview ¶
Package google implements stream.Stream for Google.
Index ¶
- Variables
- type Candidate
- type Client
- type CompletionMessageResponse
- type Config
- type Content
- type ErrorAccumulator
- type GenerationConfig
- type HTTPRequestBuilder
- type JSONMarshaller
- type JSONUnmarshaler
- type Marshaller
- type MessageCompletionRequest
- type Part
- type RequestBuilder
- type Stream
- type ThinkingConfig
- type Unmarshaler
Constants ¶
This section is empty.
Variables ¶
var ErrTooManyEmptyStreamMessages = errors.New("stream has sent too many empty messages")
ErrTooManyEmptyStreamMessages represents an error when a stream has sent too many empty messages.
Functions ¶
This section is empty.
Types ¶
type Candidate ¶
type Candidate struct {
Content Content `json:"content,omitempty"`
FinishReason string `json:"finishReason,omitempty"`
TokenCount uint `json:"tokenCount,omitempty"`
Index uint `json:"index,omitempty"`
}
Candidate represents a response candidate generated from the model.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for the Google API.
type CompletionMessageResponse ¶
type CompletionMessageResponse struct {
Candidates []Candidate `json:"candidates,omitempty"`
}
CompletionMessageResponse represents a response to an Google completion message.
type Config ¶
Config represents the configuration for the Google API client.
func DefaultConfig ¶
DefaultConfig returns the default configuration for the Google API client.
type ErrorAccumulator ¶
ErrorAccumulator is an interface for accumulating errors.
type GenerationConfig ¶
type GenerationConfig struct {
StopSequences []string `json:"stopSequences,omitempty"`
ResponseMimeType string `json:"responseMimeType,omitempty"`
CandidateCount uint `json:"candidateCount,omitempty"`
MaxOutputTokens uint `json:"maxOutputTokens,omitempty"`
Temperature float64 `json:"temperature,omitempty"`
TopP float64 `json:"topP,omitempty"`
TopK int64 `json:"topK,omitempty"`
ThinkingConfig *ThinkingConfig `json:"thinkingConfig,omitempty"`
}
GenerationConfig are the options for model generation and outputs. Not all parameters are configurable for every model.
type HTTPRequestBuilder ¶
type HTTPRequestBuilder struct {
// contains filtered or unexported fields
}
HTTPRequestBuilder is an implementation of OllamaRequestBuilder that builds HTTP requests.
func NewRequestBuilder ¶
func NewRequestBuilder() *HTTPRequestBuilder
NewRequestBuilder creates a new HTTPRequestBuilder.
type JSONMarshaller ¶
type JSONMarshaller struct{}
JSONMarshaller is a marshaller that marshals values to JSON.
type JSONUnmarshaler ¶
type JSONUnmarshaler struct{}
JSONUnmarshaler is an unmarshaler that unmarshals JSON data.
type Marshaller ¶
Marshaller is an interface for marshalling values to bytes.
type MessageCompletionRequest ¶
type MessageCompletionRequest struct {
Contents []Content `json:"contents,omitempty"`
GenerationConfig GenerationConfig `json:"generationConfig,omitempty"`
}
MessageCompletionRequest represents the valid parameters and value options for the request.
type Part ¶
type Part struct {
Text string `json:"text,omitempty"`
}
Part is a datatype containing media that is part of a multi-part Content message.
type RequestBuilder ¶
type RequestBuilder interface {
Build(ctx context.Context, method, url string, body any, header http.Header) (*http.Request, error)
}
RequestBuilder is an interface for building HTTP requests for the Google API.
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream struct represents a stream of messages from the Google API.
func (*Stream) CallTools ¶
func (s *Stream) CallTools() []proto.ToolCallStatus
CallTools implements stream.Stream.
type ThinkingConfig ¶
type ThinkingConfig struct {
ThinkingBudget int `json:"thinkingBudget,omitempty"`
}
ThinkingConfig - for more details see https://ai.google.dev/gemini-api/docs/thinking#rest .
type Unmarshaler ¶
Unmarshaler is an interface for unmarshalling bytes.