gemini

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCombinedToolDefinitions

func GetCombinedToolDefinitions(mcpTools []api.GeminiFunctionDeclaration) []api.GeminiToolConfig

GetCombinedToolDefinitions は組み込みツール + MCPツールの定義を返す

func GetGeminiToolDefinitions

func GetGeminiToolDefinitions() []api.GeminiToolConfig

GetGeminiToolDefinitions returns all tool definitions for Function Calling API ToolRegistry から自動生成

func GetToolDefinitionNames

func GetToolDefinitionNames() []string

GetToolDefinitionNames returns all defined tool names for testing

Types

type GeminiCandidate

type GeminiCandidate struct {
	Content GeminiContent `json:"content"`
}

GeminiCandidate はレスポンスの候補

type GeminiContent

type GeminiContent struct {
	Parts []GeminiPart `json:"parts"`
	Role  string       `json:"role,omitempty"` // "user" or "model"
}

GeminiContent はGeminiの contents 構造

type GeminiFunctionCandidate

type GeminiFunctionCandidate struct {
	Content GeminiFunctionContent `json:"content"`
}

GeminiFunctionCandidate はFunction Calling対応の候補

type GeminiFunctionContent

type GeminiFunctionContent struct {
	Parts []GeminiFunctionPart `json:"parts"`
	Role  string               `json:"role,omitempty"`
}

GeminiFunctionContent はFunction Calling対応のコンテンツ

type GeminiFunctionPart

type GeminiFunctionPart struct {
	Text         string                  `json:"text,omitempty"`
	FunctionCall *api.GeminiFunctionCall `json:"functionCall,omitempty"`
}

GeminiFunctionPart はtext または functionCall を含むパート

type GeminiFunctionResponse

type GeminiFunctionResponse struct {
	Candidates []GeminiFunctionCandidate `json:"candidates"`
}

GeminiFunctionResponse はFunction Calling対応のレスポンス

type GeminiGenerationConfig

type GeminiGenerationConfig struct {
	ThinkingConfig *GeminiThinkingConfig `json:"thinkingConfig,omitempty"`
}

GeminiGenerationConfig は生成設定

type GeminiInlineData

type GeminiInlineData struct {
	MimeType string `json:"mime_type"` // "image/png", "image/jpeg" etc
	Data     string `json:"data"`      // Base64エンコードされたデータ
}

GeminiInlineData は画像データ

type GeminiMultimodalContent

type GeminiMultimodalContent struct {
	Parts []GeminiMultimodalPart `json:"parts"`
	Role  string                 `json:"role,omitempty"` // "user" or "model"
}

GeminiMultimodalContent はマルチモーダル対応のcontents構造

type GeminiMultimodalPart

type GeminiMultimodalPart struct {
	Text       string            `json:"text,omitempty"`
	InlineData *GeminiInlineData `json:"inline_data,omitempty"`
}

GeminiMultimodalPart はマルチモーダル対応のparts構造

type GeminiMultimodalRequest

type GeminiMultimodalRequest struct {
	Contents []interface{} `json:"contents"` // GeminiContent or GeminiMultimodalContent
}

GeminiMultimodalRequest はマルチモーダルAPIリクエスト

type GeminiPart

type GeminiPart struct {
	Text string `json:"text"`
}

GeminiPart はGeminiの parts 構造(テキストのみ)

type GeminiRequest

type GeminiRequest struct {
	Contents []GeminiContent `json:"contents"`
}

GeminiRequest はGemini APIリクエスト

type GeminiRequestWithTools

type GeminiRequestWithTools struct {
	Contents         []interface{}           `json:"contents"`
	Tools            []api.GeminiToolConfig  `json:"tools,omitempty"`
	GenerationConfig *GeminiGenerationConfig `json:"generationConfig,omitempty"`
}

GeminiRequestWithTools はtools を含むリクエスト

type GeminiResponse

type GeminiResponse struct {
	Candidates []GeminiCandidate `json:"candidates"`
}

GeminiResponse はGeminiレスポンス

type GeminiThinkingConfig

type GeminiThinkingConfig struct {
	ThinkingBudget int `json:"thinkingBudget,omitempty"`
}

GeminiThinkingConfig は Extended Thinking の設定

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider はGemini APIのプロバイダー実装

func New

func New(apiKey string) *Provider

New は新しいGeminiProviderを作成

func (*Provider) ChatWithImage

func (p *Provider) ChatWithImage(ctx context.Context, systemPrompt string, history []api.Message, userMessage string, image *api.ImageData, model string) (string, error)

ChatWithImage は画像付きメッセージで会話を行う

func (*Provider) ChatWithTools

func (p *Provider) ChatWithTools(ctx context.Context, systemPrompt string, history []api.Message, model string) (string, error)

ChatWithTools は Provider interface の実装(context対応) GEMINI_FUNCTION_CALLING=0の場合のみテキストモードを使用 MCPツールもFunction Calling経由で呼び出される

func (*Provider) Name

func (p *Provider) Name() string

Name はプロバイダー名を返す

func (*Provider) SetMCPEnabled

func (p *Provider) SetMCPEnabled(enabled bool)

SetMCPEnabled はMCPが有効かどうかを設定する レガシー: 現在はMCPツールもFunction Calling経由で呼び出すため、この設定は無視される 互換性のために残している

func (*Provider) SetMCPTools

func (p *Provider) SetMCPTools(tools []api.GeminiFunctionDeclaration)

SetMCPTools はMCPツールの定義を設定する MCPツールはFunction Calling APIで組み込みツールと一緒に送信される

func (*Provider) SupportsImages

func (p *Provider) SupportsImages() bool

SupportsImages は画像入力対応を返す

Jump to

Keyboard shortcuts

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