prompty 2.0.0-beta.1

Prompty is an asset class and format for LLM prompts
Documentation
// Code generated by Prompty emitter; DO NOT EDIT.

#![allow(
    unused_imports,
    dead_code,
    non_camel_case_types,
    unused_variables,
    clippy::all
)]

use super::super::conversation::message::Message;

use super::super::agent::prompty::Prompty;

/// Parses rendered prompt text into an array of structured messages with role markers.
#[async_trait::async_trait]
pub trait Parser: Send + Sync {
    /// Pre-process a template before rendering, returning modified template and context
    fn pre_render(&self, template: &String) -> Option<serde_json::Value> {
        None
    }
    /// Parse rendered text into a structured message array
    async fn parse(
        &self,
        agent: &Prompty,
        rendered: &String,
        context: &Option<serde_json::Value>,
    ) -> Result<Vec<Message>, Box<dyn std::error::Error + Send + Sync>>;
}