ai

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AIClient

type AIClient interface {
	StartSession(ctx context.Context) (string, error)
	SendMessage(ctx context.Context, message string, history []Message) (Response, error)
}

AIClient interface for AI communication

type GeminiAIClient

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

GeminiAIClient implements the AIClient interface for Gemini API

func NewGeminiAIClient

func NewGeminiAIClient(apiKey string) (*GeminiAIClient, error)

NewGeminiAIClient creates a new GeminiAIClient with the provided API key

func (*GeminiAIClient) SendMessage

func (g *GeminiAIClient) SendMessage(ctx context.Context, message string, history []Message) (Response, error)

func (*GeminiAIClient) StartSession

func (g *GeminiAIClient) StartSession(ctx context.Context) (string, error)

type Message

type Message struct {
	Role    string
	Content string
	Time    time.Time
}

Message represents a chat message

type Response

type Response struct {
	XMLName xml.Name `xml:"response"` // The root element is now <response>

	// Think contains the detailed reasoning and thought process,
	// typically formatted in Markdown.
	// will be shown in chat history
	Think string `xml:"think"`

	// Summary provides a concise yet comprehensive overview of the request,
	// context, and what has been accomplished, in plain text.
	// Will also be shown in chat history
	Summary string `xml:"summary"`

	// Content holds the complete, detailed answer or solution,
	// formatted in Markdown, which can include code blocks.
	// Renamed from 'Response' to 'Content' to match the new structure.
	// Will also be shown in preview
	Content string `xml:"content"`
}

AIResponseStructure represents the structured output format. It uses <response> as the root element, containing <think>, <summary>, and <content>.

Jump to

Keyboard shortcuts

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