Skip to main content

Crate llm_repair

Crate llm_repair 

Source
Expand description

§llm-repair

Utilities for repairing malformed JSON output from LLMs and extracting tool calls from unstructured text.

It is designed to be robust against common failure modes of smaller models, such as truncation, invalid escapes (e.g. LaTeX), and “conversational” formatting.

Re-exports§

pub use extraction::extract_evaluations_from_markdown;
pub use extraction::extract_proposal_from_markdown;
pub use extraction::extract_python_tool_calls;
pub use extraction::extract_xml_tool_calls;
pub use extraction::heuristic_json_tool_calls;
pub use history::pair_orphan_tool_calls;
pub use history::stub_tool_response;
pub use repair::repair_aggressive_escapes;
pub use repair::repair_conversational_response;
pub use repair::repair_invalid_escapes;
pub use repair::repair_tool_calls;
pub use repair::repair_truncated_json;
pub use repair::sanitize_json_string_lossy;
pub use utils::clean_json_string;

Modules§

extraction
Functions for extracting structured tool calls from unstructured text.
history
Conversation-history hygiene.
repair
Functions for repairing broken or malformed JSON strings.
utils
Utility functions for string manipulation and cleanup.