Crate secretary

Source
Expand description

§Secretary

Secretary is a Rust library that transforms natural language into structured data using large language models (LLMs). With its powerful derive macro system, you can extract structured information from unstructured text with minimal boilerplate code.

§Error Handling

The library uses a unified error type, SecretaryError, to report issues. A key variant is SecretaryError::FieldDeserializationError, which provides detailed context when the LLM’s output cannot be successfully parsed into your target struct. This error includes lists of both failed and successful fields, making it easier to debug extraction failures, especially in distributed generation mode.

Re-exports§

pub use traits::AsyncGenerateData;
pub use traits::GenerateData;
pub use traits::IsLLM;
pub use traits::Task;
pub use error::SecretaryError;

Modules§

constants
error
llm_providers
message
traits

Macros§

generate_from_tuples
Macro that generates an object by setting its fields from tuples of field names and values. This macro uses serde_json to deserialize field values from the LLM responses.

Derive Macros§

Task
TaskDerive