Documentation
¶
Index ¶
- type FileStore
- func (s *FileStore) Delete(ctx context.Context, id string, version string) error
- func (s *FileStore) Get(ctx context.Context, id string, version string) (*Template, error)
- func (s *FileStore) List(ctx context.Context, filter map[string]interface{}) ([]*Template, error)
- func (s *FileStore) Save(ctx context.Context, tmpl *Template) error
- type Manager
- func (m *Manager) Delete(ctx context.Context, id string, version string) error
- func (m *Manager) Get(ctx context.Context, id string, version string) (*Template, error)
- func (m *Manager) GetLatest(ctx context.Context, id string) (*Template, error)
- func (m *Manager) List(ctx context.Context, filter map[string]interface{}) ([]*Template, error)
- func (m *Manager) Render(ctx context.Context, id string, version string, data map[string]interface{}) (string, error)
- func (m *Manager) RenderLatest(ctx context.Context, id string, data map[string]interface{}) (string, error)
- func (m *Manager) Save(ctx context.Context, tmpl *Template) error
- type Template
- type TemplateFormat
- type TemplateOption
- type TemplateStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileStore ¶
type FileStore struct {
// contains filtered or unexported fields
}
FileStore implements TemplateStore using the local file system
func NewFileStore ¶
NewFileStore creates a new file store
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages prompt templates
func NewManager ¶
func NewManager(store TemplateStore) *Manager
NewManager creates a new template manager
func (*Manager) Render ¶
func (m *Manager) Render(ctx context.Context, id string, version string, data map[string]interface{}) (string, error)
Render renders a template with the given data
type Template ¶
type Template struct {
ID string
Name string
Description string
Content string
Version string
Format TemplateFormat
CreatedAt time.Time
UpdatedAt time.Time
Tags []string
Metadata map[string]interface{}
// contains filtered or unexported fields
}
Template represents a prompt template
type TemplateFormat ¶
type TemplateFormat string
TemplateFormat represents the format of a template
const ( // GoTemplate uses Go's text/template package GoTemplate TemplateFormat = "go_template" // HandlebarsTemplate uses handlebars-style templates HandlebarsTemplate TemplateFormat = "handlebars" )
type TemplateOption ¶
type TemplateOption func(*Template)
TemplateOption is a function that configures a template
func WithDescription ¶
func WithDescription(description string) TemplateOption
WithDescription sets the template description
func WithFormat ¶
func WithFormat(format TemplateFormat) TemplateOption
WithFormat sets the template format
func WithMetadata ¶
func WithMetadata(metadata map[string]interface{}) TemplateOption
WithMetadata sets the template metadata
func WithVersion ¶
func WithVersion(version string) TemplateOption
WithVersion sets the template version
type TemplateStore ¶
type TemplateStore interface {
// Get retrieves a template by ID and version
Get(ctx context.Context, id string, version string) (*Template, error)
// List returns all templates matching the given filter
List(ctx context.Context, filter map[string]interface{}) ([]*Template, error)
// Save stores a template
Save(ctx context.Context, tmpl *Template) error
// Delete removes a template
Delete(ctx context.Context, id string, version string) error
}
TemplateStore is an interface for storing and retrieving templates
Click to show internal directories.
Click to hide internal directories.