Documentation
¶
Index ¶
- func NewFallbackRetry[T, U any](encoder jpf.Encoder[T], parser jpf.Parser[U], models []jpf.Model, ...) jpf.Pipeline[T, U]
- func NewFeedbackRetry[T, U any](encoder jpf.Encoder[T], parser jpf.Parser[U], ...) jpf.Pipeline[T, U]
- func NewOneShot[T, U any](encoder jpf.Encoder[T], parser jpf.Parser[U], model jpf.Model, ...) jpf.Pipeline[T, U]
- type ConstructionKwargs
- type ConstructionOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFallbackRetry ¶
func NewFallbackRetry[T, U any]( encoder jpf.Encoder[T], parser jpf.Parser[U], models []jpf.Model, opts ...ConstructionOpt[T, U], ) jpf.Pipeline[T, U]
Creates a [Pipeline] that first tries to ask the first model, and if that produces an invalid format will try to ask the next models until a valid format is found. This is useful, for example, to try a second time with a model that overwrites the cache.
func NewFeedbackRetry ¶
func NewFeedbackRetry[T, U any]( encoder jpf.Encoder[T], parser jpf.Parser[U], feedbackGenerator jpf.FeedbackGenerator, model jpf.Model, maxRetries int, opts ...ConstructionOpt[T, U], ) jpf.Pipeline[T, U]
NewFeedbackRetry creates a [Pipeline] that first runs the encoder, then the model, finally parsing the response with the decoder. However, it adds feedback to the conversation when errors are detected. It will only add to the conversation if the error returned from the parser is an [ErrInvalidResponse] (using errors.Is).
Types ¶
type ConstructionKwargs ¶
func GetConstructionKwargs ¶
func GetConstructionKwargs[T, U any](opts ...ConstructionOpt[T, U]) ConstructionKwargs[T, U]
type ConstructionOpt ¶
type ConstructionOpt[T, U any] func(*ConstructionKwargs[T, U])
func WithDefualtOutputFormat ¶
func WithDefualtOutputFormat[T, U any]() ConstructionOpt[T, U]
func WithOutputFormat ¶
func WithOutputFormat[T, U any](obj any) ConstructionOpt[T, U]
func WithValidator ¶
func WithValidator[T, U any](validator jpf.Validator[T, U]) ConstructionOpt[T, U]
Click to show internal directories.
Click to hide internal directories.