pub mod ir;
pub mod schema;
pub mod renderer;
pub mod client;
pub mod parser;
pub mod runtime;
pub mod registry;
pub mod partial_parser;
pub mod streaming_value;
pub use ir::{BamlSchema, BamlValue, Class, Enum, Field, FieldType, Function, IR, TaggedEnum, TaggedVariant};
pub use client::{DynLLMClient, LLMClient, LLMClientTrait, MockLLMClient, ProviderPreferences};
pub use runtime::{BamlRuntime, RuntimeBuilder, generate_prompt_from_ir, parse_llm_response_with_ir, try_parse_partial_response, update_streaming_response};
pub use registry::BamlSchemaRegistry;
pub use partial_parser::try_parse_partial_json;
pub use streaming_value::{StreamingBamlValue, CompletionState};
pub use simplify_baml_macros::{BamlSchema as DeriveBamlSchema, BamlClient as DeriveBamlClient, baml_function};
#[cfg(test)]
mod tests {
use super::*;
use std::collections::HashMap;
#[test]
fn test_simple_ir_construction() {
let mut ir = IR::new();
ir.classes.push(Class {
name: "Person".to_string(),
description: None,
fields: vec![
Field {
name: "name".to_string(),
field_type: FieldType::String,
optional: false,
description: None,
},
],
});
assert!(ir.find_class("Person").is_some());
}
#[test]
fn test_baml_value_conversions() {
let value = BamlValue::String("test".to_string());
assert_eq!(value.as_string(), Some("test"));
let value = BamlValue::Int(42);
assert_eq!(value.as_int(), Some(42));
let mut map = HashMap::new();
map.insert("key".to_string(), BamlValue::String("value".to_string()));
let value = BamlValue::Map(map);
assert!(value.as_map().is_some());
}
}