Documentation
¶
Overview ¶
Package utils provides general-purpose utilities for JSON handling and panic recovery.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrRecoveredPanic is returned when a panic is recovered and converted to an error. ErrRecoveredPanic = errors.New("recovered panic") // ErrCouldNotRepairJSON is returned when malformed JSON cannot be automatically fixed. ErrCouldNotRepairJSON = errors.New("malformed JSON could not be repaired") )
Functions ¶
func JSONFromMarkdown ¶
JSONFromMarkdown extracts JSON content from a given Markdown string. If a JSON block is found, it returns the JSON content as a string. If no JSON block is found, it returns the original content.
func NoPanic ¶
NoPanic executes the provided function and recovers from any panic by converting it to error if that occurs.
func RepairTextJSON ¶
RepairTextJSON attempts to repair common issues with plain-text JSON generated by LLMs. If the input is already valid JSON, it is returned as-is.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.