gemini

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModelGemini15Flash = Model(llm.ModelGemini15Flash)
	ModelGemini15Pro   = Model(llm.ModelGemini15Pro)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Candidate

type Candidate struct {
	Content struct {
		Role  string `json:"role"`
		Parts []Part `json:"parts"`
	} `json:"content"`
	FinishReason  string         `json:"finishReason,omitempty"`
	SafetyRatings []SafetyRating `json:"safetyRatings,omitempty"`
}

type Content

type Content struct {
	Role  string `json:"role"`
	Parts []Part `json:"parts"`
}

type GenerationConfig

type GenerationConfig struct {
	Temperature     float64 `json:"temperature,omitempty"`
	TopP            float64 `json:"topP,omitempty"`
	TopK            int     `json:"topK,omitempty"`
	MaxOutputTokens int     `json:"maxOutputTokens,omitempty"`
}

type InlineData

type InlineData struct {
	MimeType string `json:"mimeType"`
	Data     string `json:"data"`
}

type Model

type Model llm.ServiceName

func (Model) PrettyStr

func (m Model) PrettyStr() string

func (Model) Prompt

func (m Model) Prompt(ctx context.Context, prompt rq.PromptV1, rsp *llm.StreamResponse) error

type Part

type Part struct {
	Text       string      `json:"text,omitempty"`
	InlineData *InlineData `json:"inlineData,omitempty"`
}

type Request

type Request struct {
	Contents          []Content        `json:"contents"`
	GenerationConfig  GenerationConfig `json:"generationConfig,omitempty"`
	SafetySettings    []SafetySetting  `json:"safetySettings,omitempty"`
	SystemInstruction *Content         `json:"systemInstruction,omitempty"`
}

type Response

type Response struct {
	Candidates    []Candidate `json:"candidates"`
	UsageMetadata struct {
		PromptTokenCount     int `json:"promptTokenCount"`
		CandidatesTokenCount int `json:"candidatesTokenCount"`
		TotalTokenCount      int `json:"totalTokenCount"`
	} `json:"usageMetadata,omitempty"`
	ModelVersion string `json:"modelVersion"`
}

type SafetyRating

type SafetyRating struct {
	Category         string  `json:"category"`
	Probability      string  `json:"probability"`
	ProbabilityScore float64 `json:"probabilityScore"`
	Severity         string  `json:"severity"`
	SeverityScore    float64 `json:"severityScore"`
}

type SafetySetting

type SafetySetting struct {
	Category  string `json:"category"`
	Threshold string `json:"threshold"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL