prompt

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FewShotExample

type FewShotExample struct {
	Query       string
	Thought     string
	Action      string
	ActionInput map[string]any
	Observation string
	FinalAnswer string
}

FewShotExample represents a few-shot learning example

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

Message represents a conversation message

type ModelConfig

type ModelConfig struct {
	Name           string
	MaxContextSize int
	Temperature    float32
	TopP           float32
	TopK           int
	RepeatPenalty  float32
	StopSequences  []string
	SystemPrompt   string
}

ModelConfig contains model-specific configurations

func GetModelConfig

func GetModelConfig(modelName string) *ModelConfig

GetModelConfig returns optimized configuration for specific models

type OutputFormat

type OutputFormat struct {
	ThoughtPrefix     string
	ActionPrefix      string
	ActionInputPrefix string
	ObservationPrefix string
	FinalAnswerPrefix string
	JSONDelimiters    bool
	StrictFormatting  bool
}

OutputFormat defines the expected output structure

type ReActTemplate

type ReActTemplate struct {
	ModelName       string
	SystemPrompt    string
	FewShotExamples []FewShotExample
	OutputFormat    OutputFormat
}

ReActTemplate defines a ReAct prompt template

func GetReActTemplate

func GetReActTemplate(modelName string) *ReActTemplate

GetReActTemplate returns an optimized ReAct template for the model

func (*ReActTemplate) BuildPrompt

func (t *ReActTemplate) BuildPrompt(tools []Tool, messages []Message) string

BuildPrompt constructs the full ReAct prompt with tools

type Tool

type Tool struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Schema      map[string]any `json:"schema,omitempty"`
}

Tool represents a tool schema

Jump to

Keyboard shortcuts

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