Documentation
¶
Index ¶
- func ParseArguments(arguments Arguments, args map[string]any, data map[string]map[string]any) (parameters.ParamValues, error)
- func Register(kind string, factory PromptConfigFactory) bool
- type ArgMcpManifest
- type Argument
- type Arguments
- type Manifest
- type McpManifest
- type Message
- type Prompt
- type PromptConfig
- type PromptConfigFactory
- type Promptset
- type PromptsetConfig
- type PromptsetManifest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseArguments ¶
func ParseArguments(arguments Arguments, args map[string]any, data map[string]map[string]any) (parameters.ParamValues, error)
ParseArguments validates and processes the user-provided arguments against the prompt's requirements.
func Register ¶
func Register(kind string, factory PromptConfigFactory) bool
Register allows individual prompt packages to register their configuration factory function. This is typically called from an init() function in the prompt's package. It associates a 'kind' string with a function that can produce the specific PromptConfig type. It returns true if the registration was successful, and false if a prompt with the same kind was already registered.
Types ¶
type ArgMcpManifest ¶
type ArgMcpManifest struct {
Name string `json:"name"`
Description string `json:"description"`
Required bool `json:"required"`
}
ArgMcpManifest is the simplified manifest structure for an argument required for prompts.
type Argument ¶
type Argument struct {
parameters.Parameter
}
Argument is a wrapper around a parameters.Parameter that provides prompt-specific functionality. If the 'type' field is not specified in a YAML definition, it defaults to 'string'.
func (Argument) McpManifest ¶
func (a Argument) McpManifest() ArgMcpManifest
McpManifest returns the simplified manifest structure required for prompts.
type Manifest ¶
type Manifest struct {
Description string `json:"description"`
Arguments []parameters.ParameterManifest `json:"arguments"`
}
Manifest is the representation of prompts sent to Client SDKs.
func GetManifest ¶
type McpManifest ¶
type McpManifest struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Arguments []ArgMcpManifest `json:"arguments,omitempty"`
}
McpManifest is the definition for a prompt the MCP client can get.
func GetMcpManifest ¶
func GetMcpManifest(name, desc string, args Arguments) McpManifest
type Message ¶
Message represents a single message in a prompt, with a role and content.
func SubstituteMessages ¶
func SubstituteMessages(messages []Message, arguments Arguments, argValues parameters.ParamValues) ([]Message, error)
SubstituteMessages takes a slice of Messages and a set of parameter values, and returns a new slice with all template variables resolved.
func (*Message) UnmarshalYAML ¶
type Prompt ¶
type Prompt interface {
SubstituteParams(parameters.ParamValues) (any, error)
ParseArgs(map[string]any, map[string]map[string]any) (parameters.ParamValues, error)
Manifest() Manifest
McpManifest() McpManifest
}
type PromptConfig ¶
func DecodeConfig ¶
func DecodeConfig(ctx context.Context, kind, name string, decoder *yaml.Decoder) (PromptConfig, error)
DecodeConfig looks up the registered factory for the given kind and uses it to decode the prompt configuration.
type PromptConfigFactory ¶
type PromptConfigFactory func(ctx context.Context, name string, decoder *yaml.Decoder) (PromptConfig, error)
PromptConfigFactory defines the signature for a function that creates and decodes a specific prompt's configuration.
type Promptset ¶
type Promptset struct {
Name string `yaml:"name"`
Prompts []*Prompt `yaml:",inline"`
Manifest PromptsetManifest `yaml:",inline"`
McpManifest []McpManifest `yaml:",inline"`
}