Documentation
¶
Index ¶
- type CacheKey
- type CacheStats
- type ContentGenerator
- type Generator
- type Provider
- type Registry
- func (r *Registry) ClearCache()
- func (r *Registry) Close() error
- func (r *Registry) GetAvailableProviders() []string
- func (r *Registry) GetAvailableRoles() []string
- func (r *Registry) GetCacheStats() CacheStats
- func (r *Registry) GetContentGenerator(role, personaID string) (Generator, error)
- func (r *Registry) IsValidRole(role string) bool
- func (r *Registry) PrewarmCache(rolePairs []CacheKey) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheStats ¶
type CacheStats struct {
Size int // Number of cached entries
Hits int // Number of cache hits
Misses int // Number of cache misses
HitRate float64 // Cache hit rate (0.0 to 1.0)
CachedPairs []CacheKey
}
CacheStats provides observability into cache performance
type ContentGenerator ¶
type ContentGenerator struct {
// contains filtered or unexported fields
}
ContentGenerator generates user messages using an LLM
func NewContentGenerator ¶
func NewContentGenerator(provider providers.Provider, persona *config.UserPersonaPack) *ContentGenerator
NewContentGenerator creates a new content generator with a specific provider and persona
func (*ContentGenerator) NextUserTurn ¶
func (cg *ContentGenerator) NextUserTurn( ctx context.Context, history []types.Message, scenarioID string, ) (*pipeline.ExecutionResult, error)
NextUserTurn generates a user message using the LLM through a pipeline
type Generator ¶
type Generator interface {
NextUserTurn(ctx context.Context, history []types.Message, scenarioID string) (*pipeline.ExecutionResult, error)
}
Generator generates user messages for self-play scenarios. Each generator is configured with a specific persona and LLM provider, and produces user turns based on conversation history. Returns the full pipeline ExecutionResult which includes trace data, costs, and metadata.
type Provider ¶
Provider provides access to content generators for self-play scenarios. This is the main interface that the engine and turn executors use to obtain content generators based on role and persona.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages self-play providers, personas, and user generator creation
func NewRegistry ¶
func NewRegistry( providerRegistry *providers.Registry, providerMap map[string]string, personas map[string]*config.UserPersonaPack, roles []config.SelfPlayRoleGroup, ) *Registry
NewRegistry creates a new self-play registry
func (*Registry) ClearCache ¶
func (r *Registry) ClearCache()
ClearCache clears all cached user generators and resets statistics
func (*Registry) GetAvailableProviders ¶
GetAvailableProviders returns a list of available providers
func (*Registry) GetAvailableRoles ¶
GetAvailableRoles returns a list of available self-play roles
func (*Registry) GetCacheStats ¶
func (r *Registry) GetCacheStats() CacheStats
GetCacheStats returns current cache statistics
func (*Registry) GetContentGenerator ¶
GetContentGenerator implements Provider interface Returns a Generator for the given role and persona (cached for efficiency)
func (*Registry) IsValidRole ¶
IsValidRole checks if a role is configured for self-play
func (*Registry) PrewarmCache ¶
PrewarmCache creates and caches ContentGenerators for common role+persona combinations This can improve performance by avoiding cold starts during actual execution