generators

package
v0.0.0-...-936fabe Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package generators provides JSON schema generation functions for PromptKit configuration types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(cfg *SchemaConfig) (interface{}, error)

Generate produces a JSON schema for the given SchemaConfig. It creates a reflector with standard settings, reflects the target type, sets the schema metadata (version, ID, title, description), adds the $schema property, and applies any custom modifications.

func GenerateArenaSchema

func GenerateArenaSchema() (interface{}, error)

GenerateArenaSchema generates the JSON Schema for Arena configuration

func GenerateAssertionsSchema

func GenerateAssertionsSchema() (interface{}, error)

GenerateAssertionsSchema generates the standalone schema for a single PromptArena assertion (arenaconfig.AssertionConfig). The `type` field is an open enum: PromptKit-known handler types are suggested, but any string is accepted so a different runtime's types are not rejected.

func GenerateEvalSchema

func GenerateEvalSchema() (interface{}, error)

GenerateEvalSchema generates the JSON Schema for Eval configuration

func GenerateLoggingSchema

func GenerateLoggingSchema() (interface{}, error)

GenerateLoggingSchema generates the JSON Schema for LoggingConfig configuration

func GenerateMediaSchema

func GenerateMediaSchema() (interface{}, error)

GenerateMediaSchema generates a placeholder for media schema

func GenerateMetadataSchema

func GenerateMetadataSchema() (interface{}, error)

GenerateMetadataSchema generates the JSON Schema for Kubernetes ObjectMeta

func GeneratePersonaSchema

func GeneratePersonaSchema() (interface{}, error)

GeneratePersonaSchema generates the JSON Schema for Persona configuration

func GeneratePromptConfigSchema

func GeneratePromptConfigSchema() (interface{}, error)

GeneratePromptConfigSchema generates the JSON Schema for PromptConfig configuration

func GenerateProviderSchema

func GenerateProviderSchema() (interface{}, error)

GenerateProviderSchema generates the JSON Schema for Provider configuration

func GenerateRuntimeConfigSchema

func GenerateRuntimeConfigSchema() (interface{}, error)

GenerateRuntimeConfigSchema generates the JSON Schema for RuntimeConfig.

func GenerateScenarioSchema

func GenerateScenarioSchema() (interface{}, error)

GenerateScenarioSchema generates the JSON Schema for Scenario configuration

func GenerateToolSchema

func GenerateToolSchema() (interface{}, error)

GenerateToolSchema generates the JSON Schema for Tool configuration

Types

type SchemaConfig

type SchemaConfig struct {
	// Target is the Go struct instance to reflect (e.g., &arenaconfig.ArenaConfig{}).
	Target interface{}
	// Filename is the schema output filename (e.g., "arena.json").
	Filename string
	// Title is the human-readable schema title.
	Title string
	// Description is the schema description.
	Description string
	// FieldNameTag overrides the struct tag used for field names.
	// Defaults to "yaml" if empty.
	FieldNameTag string
	// Customize is an optional callback to apply additional modifications
	// to the generated schema (e.g., adding examples or oneOf constraints).
	Customize func(*jsonschema.Schema)
}

SchemaConfig holds the configuration for generating a JSON schema from a Go type.

Jump to

Keyboard shortcuts

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