diff --git a/engine/baml-lib/baml-core/src/ir/ir_helpers/mod.rs b/engine/baml-lib/baml-core/src/ir/ir_helpers/mod.rs index 50907b5d7..0cc9cf79c 100644 --- a/engine/baml-lib/baml-core/src/ir/ir_helpers/mod.rs +++ b/engine/baml-lib/baml-core/src/ir/ir_helpers/mod.rs @@ -14,8 +14,8 @@ use crate::{ }; use anyhow::Result; use baml_types::{ - BamlMap, BamlValue, BamlValueWithMeta, Constraint, ConstraintLevel, FieldType, LiteralValue, - TypeValue, + BamlMap, BamlMapKey, BamlValue, BamlValueWithMeta, Constraint, ConstraintLevel, FieldType, + LiteralValue, TypeValue, }; pub use to_baml_arg::ArgCoercer; @@ -186,7 +186,7 @@ impl IRHelper for IntermediateRepr { if let Ok(baml_arg) = coerce_settings.coerce_arg(self, param_type, param_value, &mut scope) { - baml_arg_map.insert(param_name.to_string(), baml_arg); + baml_arg_map.insert(BamlMapKey::string(param_name), baml_arg); } } else { // Check if the parameter is optional. @@ -291,14 +291,15 @@ impl IRHelper for IntermediateRepr { if !map_type.is_subtype_of(&field_type) { anyhow::bail!("Could not unify {:?} with {:?}", map_type, field_type); } else { - let mapped_fields: BamlMap> = - pairs + let mapped_fields: BamlMap> = + pairs .into_iter() .map(|(key, val)| { - let sub_value = self.distribute_type(val, item_type.clone())?; + let sub_value = + self.distribute_type(val, item_type.clone())?; Ok((key, sub_value)) }) - .collect::>>>()?; + .collect::>()?; Ok(BamlValueWithMeta::Map(mapped_fields, field_type)) } } @@ -515,7 +516,11 @@ mod tests { } fn mk_map_1() -> BamlValue { - BamlValue::Map(vec![("a".to_string(), mk_int(1))].into_iter().collect()) + BamlValue::Map( + vec![(BamlMapKey::string("a"), mk_int(1))] + .into_iter() + .collect(), + ) } fn mk_ir() -> IntermediateRepr { @@ -557,7 +562,7 @@ mod tests { #[test] fn infer_map_map() { let my_map_map = BamlValue::Map( - vec![("map_a".to_string(), mk_map_1())] + vec![(BamlMapKey::string("map_a"), mk_map_1())] .into_iter() .collect(), ); @@ -629,12 +634,12 @@ mod tests { let map_1 = BamlValue::Map( vec![ ( - "1_string".to_string(), + BamlMapKey::string("1_string"), BamlValue::String("1_string_value".to_string()), ), - ("1_int".to_string(), mk_int(1)), + (BamlMapKey::string("1_int"), mk_int(1)), ( - "1_foo".to_string(), + BamlMapKey::string("1_foo"), BamlValue::Class( "Foo".to_string(), vec![ @@ -719,9 +724,9 @@ mod tests { // The compound value we want to test. let map = BamlValue::Map( vec![ - ("a".to_string(), list_1.clone()), - ("b".to_string(), list_1), - ("c".to_string(), list_2), + (BamlMapKey::string("a"), list_1.clone()), + (BamlMapKey::string("b"), list_1), + (BamlMapKey::string("c"), list_2), ] .into_iter() .collect(), diff --git a/engine/baml-lib/baml-core/src/ir/ir_helpers/to_baml_arg.rs b/engine/baml-lib/baml-core/src/ir/ir_helpers/to_baml_arg.rs index 65128b65e..70bd52cc2 100644 --- a/engine/baml-lib/baml-core/src/ir/ir_helpers/to_baml_arg.rs +++ b/engine/baml-lib/baml-core/src/ir/ir_helpers/to_baml_arg.rs @@ -1,9 +1,9 @@ use baml_types::{ - BamlMap, BamlValue, BamlValueWithMeta, Constraint, ConstraintLevel, FieldType, LiteralValue, - TypeValue, + BamlMap, BamlMapKey, BamlValue, BamlValueWithMeta, Constraint, ConstraintLevel, FieldType, + LiteralValue, TypeValue, }; use core::result::Result; -use std::path::PathBuf; +use std::{collections::VecDeque, path::PathBuf}; use crate::ir::IntermediateRepr; @@ -84,7 +84,10 @@ impl ArgCoercer { }; for key in kv.keys() { - if !vec!["file", "media_type"].contains(&key.as_str()) { + if !["file", "media_type"] + .map(BamlMapKey::string) + .contains(&key) + { scope.push_error(format!( "Invalid property `{}` on file {}: `media_type` is the only supported property", key, @@ -118,7 +121,7 @@ impl ArgCoercer { None => None, }; for key in kv.keys() { - if !vec!["url", "media_type"].contains(&key.as_str()) { + if !["url", "media_type"].map(BamlMapKey::string).contains(&key) { scope.push_error(format!( "Invalid property `{}` on url {}: `media_type` is the only supported property", key, @@ -143,7 +146,10 @@ impl ArgCoercer { None => None, }; for key in kv.keys() { - if !vec!["base64", "media_type"].contains(&key.as_str()) { + if !["base64", "media_type"] + .map(BamlMapKey::string) + .contains(&key) + { scope.push_error(format!( "Invalid property `{}` on base64 {}: `media_type` is the only supported property", key, @@ -215,7 +221,7 @@ impl ArgCoercer { }), (FieldType::Class(name), _) => match value { BamlValue::Class(n, _) if n == name => Ok(value.clone()), - BamlValue::Class(_, obj) | BamlValue::Map(obj) => match ir.find_class(name) { + BamlValue::Class(_, obj) /*BamlValue::Map(obj)*/ => match ir.find_class(name) { Ok(c) => { let mut fields = BamlMap::new(); @@ -285,12 +291,57 @@ impl ArgCoercer { (FieldType::Map(k, v), _) => { if let BamlValue::Map(kv) = value { let mut map = BamlMap::new(); + let mut failed_parsing_int_err = None; + + let mut is_union_of_literal_ints = false; + + // TODO: Can we avoid this loop here? Won't hit performance + // by a lot unless the user defines a giant union. + if let FieldType::Union(items) = k.as_ref() { + let mut found_types_other_than_literal_ints = false; + let mut queue = VecDeque::from_iter(items.iter()); + while let Some(item) = queue.pop_front() { + match item { + FieldType::Literal(LiteralValue::Int(_)) => continue, + FieldType::Union(nested) => queue.extend(nested.iter()), + _ => { + found_types_other_than_literal_ints = true; + break; + } + } + } + if !found_types_other_than_literal_ints { + is_union_of_literal_ints = true; + } + } + for (key, value) in kv { scope.push("".to_string()); - let k = self.coerce_arg(ir, k, &BamlValue::String(key.clone()), scope); + + let target_baml_key = if matches!(**k, FieldType::Primitive(TypeValue::Int)) + || is_union_of_literal_ints + { + let BamlMapKey::String(str_int) = key else { + todo!(); + }; + + match str_int.parse::() { + Ok(i) => BamlValue::Int(i), + Err(e) => { + failed_parsing_int_err = Some(key); + // Stop here and let the code below return + // the error. + break; + } + } + } else { + BamlValue::String(key.to_string()) + }; + + let coerced_key = self.coerce_arg(ir, k, &target_baml_key, scope); scope.pop(false); - if k.is_ok() { + if coerced_key.is_ok() { scope.push(key.to_string()); if let Ok(v) = self.coerce_arg(ir, v, value, scope) { map.insert(key.clone(), v); @@ -298,7 +349,15 @@ impl ArgCoercer { scope.pop(false); } } - Ok(BamlValue::Map(map)) + + if let Some(failed_int) = failed_parsing_int_err { + scope.push_error(format!( + "Expected int for map with int keys, got `{failed_int}`" + )); + Err(()) + } else { + Ok(BamlValue::Map(map)) + } } else { scope.push_error(format!("Expected map, got `{}`", value)); Err(()) diff --git a/engine/baml-lib/baml-core/src/ir/walker.rs b/engine/baml-lib/baml-core/src/ir/walker.rs index 034bf2e3a..248b4c7b6 100644 --- a/engine/baml-lib/baml-core/src/ir/walker.rs +++ b/engine/baml-lib/baml-core/src/ir/walker.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use baml_types::BamlValue; +use baml_types::{BamlMapKey, BamlValue}; use indexmap::IndexMap; use internal_baml_parser_database::RetryPolicyStrategy; @@ -237,7 +237,10 @@ impl Expression { Expression::Map(m) => { let mut map = baml_types::BamlMap::new(); for (k, v) in m { - map.insert(k.as_string_value(env_values)?, v.normalize(env_values)?); + map.insert( + BamlMapKey::String(k.as_string_value(env_values)?), + v.normalize(env_values)?, + ); } Ok(BamlValue::Map(map)) } diff --git a/engine/baml-lib/baml-core/src/validate/validation_pipeline/validations/types.rs b/engine/baml-lib/baml-core/src/validate/validation_pipeline/validations/types.rs index 4422fcb41..75384a5b7 100644 --- a/engine/baml-lib/baml-core/src/validate/validation_pipeline/validations/types.rs +++ b/engine/baml-lib/baml-core/src/validate/validation_pipeline/validations/types.rs @@ -74,10 +74,24 @@ fn validate_type_allowed(ctx: &mut Context<'_>, field_type: &FieldType) { // Literal string key. FieldType::Literal(FieldArity::Required, LiteralValue::String(_), ..) => {} - // Literal string union. + // Literal int key. + FieldType::Literal(FieldArity::Required, LiteralValue::Int(_), ..) => {} + + // Literal union. FieldType::Union(FieldArity::Required, items, ..) => { let mut queue = VecDeque::from_iter(items.iter()); + // Little hack to keep track of data types in the union with + // a single pass and no allocations. Unions that contain + // literals of different types are not allowed as map keys. + // + // TODO: Same code is used at `coerce_map` function in + // baml-lib/jsonish/src/deserializer/coercer/coerce_map.rs + // + // Should figure out how to reuse this. + let mut literal_types_found = [0, 0, 0]; + let [strings, ints, bools] = &mut literal_types_found; + while let Some(item) = queue.pop_front() { match item { // Ok, literal string. @@ -85,7 +99,17 @@ fn validate_type_allowed(ctx: &mut Context<'_>, field_type: &FieldType) { FieldArity::Required, LiteralValue::String(_), .., - ) => {} + ) => *strings += 1, + + // Ok, literal int. + FieldType::Literal(FieldArity::Required, LiteralValue::Int(_), ..) => { + *ints += 1 + } + + // Ok, literal bool. + FieldType::Literal(FieldArity::Required, LiteralValue::Bool(_), ..) => { + *bools += 1 + } // Nested union, "recurse" but it's iterative. FieldType::Union(FieldArity::Required, nested, ..) => { @@ -101,6 +125,13 @@ fn validate_type_allowed(ctx: &mut Context<'_>, field_type: &FieldType) { } } } + + if literal_types_found.iter().filter(|&&t| t > 0).count() > 1 { + ctx.push_error(DatamodelError::new_validation_error( + "Unions in map keys may only contain literals of the same type.", + kv_types.0.span().clone(), + )); + } } other => { diff --git a/engine/baml-lib/baml-types/src/baml_value.rs b/engine/baml-lib/baml-types/src/baml_value.rs index d33eddf25..e3dddc536 100644 --- a/engine/baml-lib/baml-types/src/baml_value.rs +++ b/engine/baml-lib/baml-types/src/baml_value.rs @@ -1,22 +1,57 @@ use std::collections::HashMap; +use std::fmt::Display; use std::{ collections::{HashSet, VecDeque}, fmt, }; +use indexmap::Equivalent; use serde::ser::SerializeMap; use serde::{de::Visitor, Deserialize, Deserializer, Serialize, Serializer}; use crate::media::BamlMediaType; use crate::{BamlMap, BamlMedia, ResponseCheck}; +/// Supported map keys. +/// +/// We only support strings and integers as map keys. +#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum BamlMapKey { + String(String), + Int(i64), +} + +impl BamlMapKey { + pub fn string(s: &str) -> Self { + Self::String(s.into()) + } +} + +impl Display for BamlMapKey { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + BamlMapKey::String(s) => write!(f, "{s}"), + BamlMapKey::Int(i) => write!(f, "{i}"), + } + } +} + +impl Equivalent for str { + fn equivalent(&self, key: &BamlMapKey) -> bool { + match key { + BamlMapKey::String(s) => self == s, + _ => false, + } + } +} + #[derive(Clone, Debug, PartialEq)] pub enum BamlValue { String(String), Int(i64), Float(f64), Bool(bool), - Map(BamlMap), + Map(BamlMap), List(Vec), Media(BamlMedia), Enum(String, String), @@ -134,13 +169,13 @@ impl BamlValue { matches!(self, BamlValue::Map(_)) } - pub fn as_map(&self) -> Option<&BamlMap> { + pub fn as_map(&self) -> Option<&BamlMap> { match self { BamlValue::Map(m) => Some(m), _ => None, } } - pub fn as_map_owned(self) -> Option> { + pub fn as_map_owned(self) -> Option> { match self { BamlValue::Map(m) => Some(m), _ => None, @@ -360,7 +395,7 @@ pub enum BamlValueWithMeta { Int(i64, T), Float(f64, T), Bool(bool, T), - Map(BamlMap>, T), + Map(BamlMap>, T), List(Vec>, T), Media(BamlMedia, T), Enum(String, String, T), @@ -457,7 +492,7 @@ impl BamlValueWithMeta { BamlValue::Class(_, items) => Map( items .iter() - .map(|(k, v)| (k.clone(), Self::with_default_meta(v))) + .map(|(k, v)| (BamlMapKey::String(k.clone()), Self::with_default_meta(v))) .collect(), T::default(), ), @@ -638,7 +673,7 @@ impl Serialize for BamlValueWithMeta> { add_checks(&mut checked_value, cr)?; checked_value.end() } - }, + } BamlValueWithMeta::Null(cr) => serialize_with_checks(&(), cr, serializer), } } @@ -717,21 +752,23 @@ mod tests { #[test] fn test_serialize_class_checks() { - let baml_value: BamlValueWithMeta> = - BamlValueWithMeta::Class( - "Foo".to_string(), - vec![ - ("foo".to_string(), BamlValueWithMeta::Int(1, vec![])), - ("bar".to_string(), BamlValueWithMeta::String("hi".to_string(), vec![])), - ].into_iter().collect(), - vec![ - ResponseCheck { - name: "bar_len_lt_foo".to_string(), - expression: "this.bar|length < this.foo".to_string(), - status: "failed".to_string() - } - ] - ); + let baml_value: BamlValueWithMeta> = BamlValueWithMeta::Class( + "Foo".to_string(), + vec![ + ("foo".to_string(), BamlValueWithMeta::Int(1, vec![])), + ( + "bar".to_string(), + BamlValueWithMeta::String("hi".to_string(), vec![]), + ), + ] + .into_iter() + .collect(), + vec![ResponseCheck { + name: "bar_len_lt_foo".to_string(), + expression: "this.bar|length < this.foo".to_string(), + status: "failed".to_string(), + }], + ); let expected = serde_json::json!({ "value": {"foo": 1, "bar": "hi"}, "checks": { @@ -748,29 +785,30 @@ mod tests { #[test] fn test_serialize_nested_class_checks() { - // Prepare an object for wrapping. - let foo: BamlValueWithMeta> = - BamlValueWithMeta::Class( - "Foo".to_string(), - vec![ - ("foo".to_string(), BamlValueWithMeta::Int(1, vec![])), - ("bar".to_string(), BamlValueWithMeta::String("hi".to_string(), vec![])), - ].into_iter().collect(), - vec![ - ResponseCheck { - name: "bar_len_lt_foo".to_string(), - expression: "this.bar|length < this.foo".to_string(), - status: "failed".to_string() - } - ] - ); + let foo: BamlValueWithMeta> = BamlValueWithMeta::Class( + "Foo".to_string(), + vec![ + ("foo".to_string(), BamlValueWithMeta::Int(1, vec![])), + ( + "bar".to_string(), + BamlValueWithMeta::String("hi".to_string(), vec![]), + ), + ] + .into_iter() + .collect(), + vec![ResponseCheck { + name: "bar_len_lt_foo".to_string(), + expression: "this.bar|length < this.foo".to_string(), + status: "failed".to_string(), + }], + ); // Prepare the top-level value. let baml_value = BamlValueWithMeta::Class( "FooWrapper".to_string(), vec![("foo".to_string(), foo)].into_iter().collect(), - vec![] + vec![], ); let expected = serde_json::json!({ "foo": { @@ -787,5 +825,4 @@ mod tests { let json = serde_json::to_value(baml_value).unwrap(); assert_eq!(json, expected); } - } diff --git a/engine/baml-lib/baml-types/src/lib.rs b/engine/baml-lib/baml-types/src/lib.rs index fb721ff8d..20ace3081 100644 --- a/engine/baml-lib/baml-types/src/lib.rs +++ b/engine/baml-lib/baml-types/src/lib.rs @@ -7,7 +7,7 @@ mod baml_value; mod field_type; mod generator; -pub use baml_value::{BamlValue, BamlValueWithMeta}; +pub use baml_value::{BamlMapKey, BamlValue, BamlValueWithMeta}; pub use constraint::*; pub use field_type::{FieldType, LiteralValue, TypeValue}; pub use generator::{GeneratorDefaultClientMode, GeneratorOutputType}; diff --git a/engine/baml-lib/baml-types/src/minijinja.rs b/engine/baml-lib/baml-types/src/minijinja.rs index 36aa7a5a4..4c34e497f 100644 --- a/engine/baml-lib/baml-types/src/minijinja.rs +++ b/engine/baml-lib/baml-types/src/minijinja.rs @@ -1,5 +1,5 @@ +use crate::{baml_value::BamlMapKey, BamlMedia, BamlValue}; use std::fmt; -use crate::{BamlMedia, BamlValue}; /// A wrapper around a jinja expression. The inner `String` should not contain /// the interpolation brackets `{{ }}`; it should be a bare expression like @@ -7,7 +7,6 @@ use crate::{BamlMedia, BamlValue}; #[derive(Clone, Debug, PartialEq, serde::Serialize)] pub struct JinjaExpression(pub String); - impl fmt::Display for JinjaExpression { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(&self.0, f) @@ -56,6 +55,15 @@ impl From for minijinja::Value { } } +impl From for minijinja::Value { + fn from(key: BamlMapKey) -> Self { + match key { + BamlMapKey::String(s) => minijinja::Value::from(s), + BamlMapKey::Int(n) => minijinja::Value::from(n), + } + } +} + const MAGIC_MEDIA_DELIMITER: &'static str = "BAML_MEDIA_MAGIC_STRING_DELIMITER"; impl std::fmt::Display for MinijinjaBamlMedia { diff --git a/engine/baml-lib/baml/tests/validation_files/class/map_enum_and_literal_keys.baml b/engine/baml-lib/baml/tests/validation_files/class/map_enum_and_literal_keys.baml new file mode 100644 index 000000000..41ed08bb4 --- /dev/null +++ b/engine/baml-lib/baml/tests/validation_files/class/map_enum_and_literal_keys.baml @@ -0,0 +1,23 @@ +enum MapKey { + A + B + C +} + +class Fields { + e map + l1 map<"literal", string> + l2 map<5, string> + l3 map<"one" | "two" | ("three" | "four"), string> + l4 map<1 | 2 | (3 | 4), string> + + // This one should fail. + mixed_types map<1 | "one", string> +} + +// error: Error validating: Unions in map keys may only contain literals of the same type. +// --> class/map_enum_and_literal_keys.baml:15 +// | +// 14 | // This one should fail. +// 15 | mixed_types map<1 | "one", string> +// | diff --git a/engine/baml-lib/baml/tests/validation_files/functions_v2/enums_and_literals_as_map_keys.baml b/engine/baml-lib/baml/tests/validation_files/functions_v2/enums_and_literals_as_map_keys.baml new file mode 100644 index 000000000..4ba19ecf8 --- /dev/null +++ b/engine/baml-lib/baml/tests/validation_files/functions_v2/enums_and_literals_as_map_keys.baml @@ -0,0 +1,46 @@ +enum MapKey { + A + B + C +} + +function InOutEnumMapKey(i1: map, i2: map) -> map { + client "openai/gpt-4o" + prompt #" + Merge these: {{i1}} {{i2}} + + {{ ctx.output_format }} + "# +} + +function InOutLiteralStringMapKey( + i1: map<"one" | "two" | ("three" | "four"), string>, + i2: map<"one" | "two" | ("three" | "four"), string> +) -> map<"one" | "two" | ("three" | "four"), string> { + client "openai/gpt-4o" + prompt #" + Merge these: + + {{i1}} + + {{i2}} + + {{ ctx.output_format }} + "# +} + +function InOutLiteralIntMapKey( + i1: map<1 | 2 | (3 | 4), string>, + i2: map<1 | 2 | (3 | 4), string> +) -> map<1 | 2 | (3 | 4), string> { + client "openai/gpt-4o" + prompt #" + Merge these: + + {{i1}} + + {{i2}} + + {{ ctx.output_format }} + "# +} diff --git a/engine/baml-lib/jinja-runtime/src/baml_value_to_jinja_value.rs b/engine/baml-lib/jinja-runtime/src/baml_value_to_jinja_value.rs index 286b3b173..65de200ff 100644 --- a/engine/baml-lib/jinja-runtime/src/baml_value_to_jinja_value.rs +++ b/engine/baml-lib/jinja-runtime/src/baml_value_to_jinja_value.rs @@ -28,7 +28,7 @@ impl IntoMiniJinjaValue for BamlValue { BamlValue::Map(m) => { let map = m .into_iter() - .map(|(k, v)| (k.as_str(), v.into_minijinja_value(ir, env_vars))); + .map(|(k, v)| (k.to_string(), v.into_minijinja_value(ir, env_vars))); minijinja::Value::from_iter(map) } BamlValue::List(l) => { diff --git a/engine/baml-lib/jinja-runtime/src/lib.rs b/engine/baml-lib/jinja-runtime/src/lib.rs index 3d1b89b19..bb376d2e0 100644 --- a/engine/baml-lib/jinja-runtime/src/lib.rs +++ b/engine/baml-lib/jinja-runtime/src/lib.rs @@ -441,7 +441,7 @@ mod render_tests { use super::*; - use baml_types::{BamlMap, BamlMediaType}; + use baml_types::{BamlMap, BamlMapKey, BamlMediaType}; use env_logger; use indexmap::IndexMap; use std::sync::Once; @@ -1022,7 +1022,7 @@ mod render_tests { setup_logging(); let args: BamlValue = BamlValue::Map(BamlMap::from([( - "haiku_subject".to_string(), + BamlMapKey::string("haiku_subject"), BamlValue::String("sakura".to_string()), )])); @@ -1105,7 +1105,7 @@ mod render_tests { setup_logging(); let args: BamlValue = BamlValue::Map(BamlMap::from([( - "haiku_subject".to_string(), + BamlMapKey::string("haiku_subject"), BamlValue::String("sakura".to_string()), )])); @@ -1165,7 +1165,7 @@ mod render_tests { fn render_malformed_jinja() -> anyhow::Result<()> { setup_logging(); let args: BamlValue = BamlValue::Map(BamlMap::from([( - "name".to_string(), + BamlMapKey::string("name"), BamlValue::String("world".to_string()), )])); @@ -1212,7 +1212,7 @@ mod render_tests { setup_logging(); let args: BamlValue = BamlValue::Map(BamlMap::from([( - "class_arg".to_string(), + BamlMapKey::string("class_arg"), // class args are not aliased yet when passed in to jinja BamlValue::Class( "C".to_string(), @@ -1259,7 +1259,7 @@ mod render_tests { setup_logging(); let args: BamlValue = BamlValue::Map(BamlMap::from([( - "class_arg".to_string(), + BamlMapKey::string("class_arg"), BamlValue::Class( "C".to_string(), BamlMap::from([("prop1".to_string(), BamlValue::String("value".to_string()))]), @@ -1320,7 +1320,7 @@ mod render_tests { setup_logging(); let args: BamlValue = BamlValue::Map(BamlMap::from([( - "class_arg".to_string(), + BamlMapKey::string("class_arg"), BamlValue::Class( "C".to_string(), BamlMap::from([("prop1".to_string(), BamlValue::Int(4))]), @@ -1381,7 +1381,7 @@ mod render_tests { setup_logging(); let args: BamlValue = BamlValue::Map(BamlMap::from([( - "class_arg".to_string(), + BamlMapKey::string("class_arg"), BamlValue::Class( "C".to_string(), BamlMap::from([("prop1".to_string(), BamlValue::Int(13))]), @@ -1424,7 +1424,7 @@ mod render_tests { setup_logging(); let args: BamlValue = BamlValue::Map(BamlMap::from([( - "class_arg".to_string(), + BamlMapKey::string("class_arg"), BamlValue::Class( "A".to_string(), IndexMap::from([ @@ -1500,7 +1500,7 @@ mod render_tests { setup_logging(); let args: BamlValue = BamlValue::Map(BamlMap::from([( - "class_arg".to_string(), + BamlMapKey::string("class_arg"), BamlValue::Class( "A".to_string(), IndexMap::from([ @@ -1593,7 +1593,7 @@ mod render_tests { setup_logging(); let args: BamlValue = BamlValue::Map(BamlMap::from([( - "class_arg".to_string(), + BamlMapKey::string("class_arg"), BamlValue::List(vec![ BamlValue::Class( "A".to_string(), @@ -1698,7 +1698,7 @@ mod render_tests { setup_logging(); let args: BamlValue = BamlValue::Map(BamlMap::from([( - "class_arg".to_string(), + BamlMapKey::string("class_arg"), BamlValue::List(vec![BamlValue::Class( "A".to_string(), IndexMap::from([ @@ -1773,7 +1773,7 @@ mod render_tests { setup_logging(); let args: BamlValue = BamlValue::Map(BamlMap::from([( - "class_arg".to_string(), + BamlMapKey::string("class_arg"), BamlValue::Class( "A".to_string(), IndexMap::from([ @@ -1892,7 +1892,7 @@ mod render_tests { setup_logging(); let args = BamlValue::Map(BamlMap::from([( - "enum_arg".to_string(), + BamlMapKey::string("enum_arg"), BamlValue::Enum("MyEnum".to_string(), "VALUE_A".to_string()), )])); diff --git a/engine/baml-lib/jsonish/src/deserializer/coercer/coerce_map.rs b/engine/baml-lib/jsonish/src/deserializer/coercer/coerce_map.rs index 48d4d10ec..281515468 100644 --- a/engine/baml-lib/jsonish/src/deserializer/coercer/coerce_map.rs +++ b/engine/baml-lib/jsonish/src/deserializer/coercer/coerce_map.rs @@ -39,21 +39,38 @@ pub(super) fn coerce_map( // If we can determine that the type is always valid then we can get rid of // this logic and skip the loops & allocs in the the union branch. match key_type.as_ref() { - // String, enum or just one literal string, OK. + // String, int, enum or just one literal string or int, OK. FieldType::Primitive(TypeValue::String) + | FieldType::Primitive(TypeValue::Int) | FieldType::Enum(_) - | FieldType::Literal(LiteralValue::String(_)) => {} + | FieldType::Literal(LiteralValue::String(_)) + | FieldType::Literal(LiteralValue::Int(_)) => {} - // For unions we need to check if all the items are literal strings. + // For unions we need to check if all the items are literals of the same + // type. FieldType::Union(items) => { let mut queue = VecDeque::from_iter(items.iter()); + + // Same trick used in `validate_type_allowed` at + // baml-lib/baml-core/src/validate/validation_pipeline/validations/types.rs + // + // TODO: Figure out how to reuse this. + let mut literal_types_found = [0, 0, 0]; + let [strings, ints, bools] = &mut literal_types_found; + while let Some(item) = queue.pop_front() { match item { - FieldType::Literal(LiteralValue::String(_)) => continue, + FieldType::Literal(LiteralValue::String(_)) => *strings += 1, + FieldType::Literal(LiteralValue::Int(_)) => *ints += 1, + FieldType::Literal(LiteralValue::Bool(_)) => *bools += 1, FieldType::Union(nested) => queue.extend(nested.iter()), other => return Err(ctx.error_map_must_have_supported_key(other)), } } + + if literal_types_found.iter().filter(|&&t| t > 0).count() > 1 { + return Err(ctx.error_map_must_have_only_one_type_in_key_union(key_type)); + } } // Key type not allowed. diff --git a/engine/baml-lib/jsonish/src/deserializer/coercer/mod.rs b/engine/baml-lib/jsonish/src/deserializer/coercer/mod.rs index a4ed76707..e56ed9114 100644 --- a/engine/baml-lib/jsonish/src/deserializer/coercer/mod.rs +++ b/engine/baml-lib/jsonish/src/deserializer/coercer/mod.rs @@ -142,7 +142,20 @@ impl ParsingContext<'_> { pub(crate) fn error_map_must_have_supported_key(&self, key_type: &FieldType) -> ParsingError { ParsingError { reason: format!( - "Maps may only have strings, enums or literal strings for keys, but got {key_type}" + "Maps may only have strings, enums or literals as keys, but got {key_type}" + ), + scope: self.scope.clone(), + causes: vec![], + } + } + + pub(crate) fn error_map_must_have_only_one_type_in_key_union( + &self, + key_type: &FieldType, + ) -> ParsingError { + ParsingError { + reason: format!( + "Unions in map keys may only contain literals of the same type, but got {key_type}" ), scope: self.scope.clone(), causes: vec![], diff --git a/engine/baml-lib/jsonish/src/deserializer/types.rs b/engine/baml-lib/jsonish/src/deserializer/types.rs index c522a01bb..fe094fe28 100644 --- a/engine/baml-lib/jsonish/src/deserializer/types.rs +++ b/engine/baml-lib/jsonish/src/deserializer/types.rs @@ -1,6 +1,8 @@ use std::collections::HashSet; -use baml_types::{BamlMap, BamlMedia, BamlValue, BamlValueWithMeta, Constraint, JinjaExpression}; +use baml_types::{ + BamlMap, BamlMapKey, BamlMedia, BamlValue, BamlValueWithMeta, Constraint, JinjaExpression, +}; use serde_json::json; use strsim::jaro; @@ -284,9 +286,11 @@ impl From for BamlValue { BamlValueWithFlags::List(_, v) => { BamlValue::List(v.into_iter().map(|x| x.into()).collect()) } - BamlValueWithFlags::Map(_, m) => { - BamlValue::Map(m.into_iter().map(|(k, (_, v))| (k, v.into())).collect()) - } + BamlValueWithFlags::Map(_, m) => BamlValue::Map( + m.into_iter() + .map(|(k, (_, v))| (BamlMapKey::String(k), v.into())) + .collect(), + ), BamlValueWithFlags::Enum(s, v) => BamlValue::Enum(s, v.value), BamlValueWithFlags::Class(s, _, m) => { BamlValue::Class(s, m.into_iter().map(|(k, v)| (k, v.into())).collect()) @@ -309,7 +313,7 @@ impl From<&BamlValueWithFlags> for BamlValue { } BamlValueWithFlags::Map(_, m) => BamlValue::Map( m.into_iter() - .map(|(k, (_, v))| (k.clone(), v.into())) + .map(|(k, (_, v))| (BamlMapKey::string(k), v.into())) .collect(), ), BamlValueWithFlags::Enum(s, v) => BamlValue::Enum(s.clone(), v.value.clone()), @@ -451,7 +455,10 @@ impl From for BamlValueWithMeta BamlValueWithMeta::Float(value, c), Bool(ValueWithFlags { value, .. }) => BamlValueWithMeta::Bool(value, c), Map(_, values) => BamlValueWithMeta::Map( - values.into_iter().map(|(k, v)| (k, v.1.into())).collect(), + values + .into_iter() + .map(|(k, v)| (BamlMapKey::String(k), v.1.into())) + .collect(), c, ), // TODO: (Greg) I discard the DeserializerConditions tupled up with the value of the BamlMap. I'm not sure why BamlMap value is (DeserializerContitions, BamlValueWithFlags) in the first place. List(_, values) => { diff --git a/engine/language_client_python/src/parse_py_type.rs b/engine/language_client_python/src/parse_py_type.rs index 7a1f5ee45..84aeeb2d6 100644 --- a/engine/language_client_python/src/parse_py_type.rs +++ b/engine/language_client_python/src/parse_py_type.rs @@ -295,6 +295,10 @@ pub fn parse_py_type( Ok(MappedPyType::List(items)) } else if let Ok(kv) = any.extract::>(py) { Ok(MappedPyType::Map(kv)) + } else if let Ok(kv) = any.extract::>(py) { + Ok(MappedPyType::Map( + kv.into_iter().map(|(k, v)| (k.to_string(), v)).collect(), + )) } else if let Ok(b) = any.downcast_bound::(py) { Ok(MappedPyType::Bool(b.is_true())) } else if let Ok(i) = any.extract::(py) { diff --git a/integ-tests/baml_src/test-files/functions/output/map-literal-union-key.baml b/integ-tests/baml_src/test-files/functions/output/map-literal-union-key.baml index c52f074a9..6e2941510 100644 --- a/integ-tests/baml_src/test-files/functions/output/map-literal-union-key.baml +++ b/integ-tests/baml_src/test-files/functions/output/map-literal-union-key.baml @@ -24,3 +24,19 @@ function InOutSingleLiteralStringMapKey(m: map<"key", string>) -> map<"key", str {{ ctx.output_format }} "# } + +function InOutLiteralIntMapKey( + i1: map<1 | 2 | (3 | 4), string>, + i2: map<1 | 2 | (3 | 4), string> +) -> map<1 | 2 | (3 | 4), string> { + client "openai/gpt-4o" + prompt #" + Merge these: + + {{i1}} + + {{i2}} + + {{ ctx.output_format }} + "# +} diff --git a/integ-tests/python/baml_client/async_client.py b/integ-tests/python/baml_client/async_client.py index d49f1ebd7..eac7e79ba 100644 --- a/integ-tests/python/baml_client/async_client.py +++ b/integ-tests/python/baml_client/async_client.py @@ -1315,7 +1315,34 @@ async def InOutEnumMapKey( ) return cast(Dict[types.MapKey, str], raw.cast_to(types, types)) +<<<<<<< HEAD + async def InOutLiteralIntMapKey( + self, + i1: Dict[Union[Literal[1], Literal[2], Union[Literal[3], Literal[4]]], str],i2: Dict[Union[Literal[1], Literal[2], Union[Literal[3], Literal[4]]], str], + baml_options: BamlCallOptions = {}, + ) -> Dict[Union[Literal[1], Literal[2], Union[Literal[3], Literal[4]]], str]: + __tb__ = baml_options.get("tb", None) + if __tb__ is not None: + tb = __tb__._tb # type: ignore (we know how to use this private attribute) + else: + tb = None + __cr__ = baml_options.get("client_registry", None) + + raw = await self.__runtime.call_function( + "InOutLiteralIntMapKey", + { + "i1": i1,"i2": i2, + }, + self.__ctx_manager.get(), + tb, + __cr__, + ) + return cast(Dict[Union[Literal[1], Literal[2], Union[Literal[3], Literal[4]]], str], raw.cast_to(types, types)) + + async def InOutLiteralStringMapKey( +======= async def InOutLiteralStringUnionMapKey( +>>>>>>> canary self, i1: Dict[Union[Literal["one"], Literal["two"], Union[Literal["three"], Literal["four"]]], str],i2: Dict[Union[Literal["one"], Literal["two"], Union[Literal["three"], Literal["four"]]], str], baml_options: BamlCallOptions = {}, @@ -1328,7 +1355,11 @@ async def InOutLiteralStringUnionMapKey( __cr__ = baml_options.get("client_registry", None) raw = await self.__runtime.call_function( +<<<<<<< HEAD + "InOutLiteralStringMapKey", +======= "InOutLiteralStringUnionMapKey", +>>>>>>> canary { "i1": i1,"i2": i2, }, @@ -1338,6 +1369,8 @@ async def InOutLiteralStringUnionMapKey( ) return cast(Dict[Union[Literal["one"], Literal["two"], Union[Literal["three"], Literal["four"]]], str], raw.cast_to(types, types)) +<<<<<<< HEAD +======= async def InOutSingleLiteralStringMapKey( self, m: Dict[Literal["key"], str], @@ -1361,6 +1394,7 @@ async def InOutSingleLiteralStringMapKey( ) return cast(Dict[Literal["key"], str], raw.cast_to(types, types)) +>>>>>>> canary async def LiteralUnionsTest( self, input: str, @@ -4437,6 +4471,8 @@ def InOutLiteralStringUnionMapKey( self.__ctx_manager.get(), ) +<<<<<<< HEAD +======= def InOutSingleLiteralStringMapKey( self, m: Dict[Literal["key"], str], @@ -4467,6 +4503,7 @@ def InOutSingleLiteralStringMapKey( self.__ctx_manager.get(), ) +>>>>>>> canary def LiteralUnionsTest( self, input: str, diff --git a/integ-tests/python/baml_client/inlinedbaml.py b/integ-tests/python/baml_client/inlinedbaml.py index 4f7d1acb2..59663ffba 100644 --- a/integ-tests/python/baml_client/inlinedbaml.py +++ b/integ-tests/python/baml_client/inlinedbaml.py @@ -75,7 +75,7 @@ "test-files/functions/output/literal-string.baml": "function FnOutputLiteralString(input: string) -> \"example output\" {\n client GPT35\n prompt #\"\n Return a string: {{ ctx.output_format}}\n \"#\n}\n\ntest FnOutputLiteralString {\n functions [FnOutputLiteralString]\n args {\n input \"example input\"\n }\n}\n", "test-files/functions/output/literal-unions.baml": "function LiteralUnionsTest(input: string) -> 1 | true | \"string output\" {\n client GPT35\n prompt #\"\n Return one of these values: \n {{ctx.output_format}}\n \"#\n}\n\ntest LiteralUnionsTest {\n functions [LiteralUnionsTest]\n args {\n input \"example input\"\n }\n}\n", "test-files/functions/output/map-enum-key.baml": "enum MapKey {\n A\n B\n C\n}\n\nfunction InOutEnumMapKey(i1: map, i2: map) -> map {\n client \"openai/gpt-4o\"\n prompt #\"\n Merge these: {{i1}} {{i2}}\n\n {{ ctx.output_format }}\n \"#\n}\n", - "test-files/functions/output/map-literal-union-key.baml": "function InOutLiteralStringUnionMapKey(\n i1: map<\"one\" | \"two\" | (\"three\" | \"four\"), string>, \n i2: map<\"one\" | \"two\" | (\"three\" | \"four\"), string>\n) -> map<\"one\" | \"two\" | (\"three\" | \"four\"), string> {\n client \"openai/gpt-4o\"\n prompt #\"\n Merge these:\n \n {{i1}}\n \n {{i2}}\n\n {{ ctx.output_format }}\n \"#\n}\n\nfunction InOutSingleLiteralStringMapKey(m: map<\"key\", string>) -> map<\"key\", string> {\n client \"openai/gpt-4o\"\n prompt #\"\n Return the same map you were given:\n \n {{m}}\n\n {{ ctx.output_format }}\n \"#\n}\n", + "test-files/functions/output/map-literal-union-key.baml": "function InOutLiteralStringMapKey(\n i1: map<\"one\" | \"two\" | (\"three\" | \"four\"), string>, \n i2: map<\"one\" | \"two\" | (\"three\" | \"four\"), string>\n) -> map<\"one\" | \"two\" | (\"three\" | \"four\"), string> {\n client \"openai/gpt-4o\"\n prompt #\"\n Merge these:\n \n {{i1}}\n \n {{i2}}\n\n {{ ctx.output_format }}\n \"#\n}\n\nfunction InOutLiteralIntMapKey(\n i1: map<1 | 2 | (3 | 4), string>, \n i2: map<1 | 2 | (3 | 4), string>\n) -> map<1 | 2 | (3 | 4), string> {\n client \"openai/gpt-4o\"\n prompt #\"\n Merge these:\n \n {{i1}}\n \n {{i2}}\n\n {{ ctx.output_format }}\n \"#\n}\n", "test-files/functions/output/mutually-recursive-classes.baml": "class Tree {\n data int\n children Forest\n}\n\nclass Forest {\n trees Tree[]\n}\n\nclass BinaryNode {\n data int\n left BinaryNode?\n right BinaryNode?\n}\n\nfunction BuildTree(input: BinaryNode) -> Tree {\n client GPT35\n prompt #\"\n Given the input binary tree, transform it into a generic tree using the given schema.\n\n INPUT:\n {{ input }}\n\n {{ ctx.output_format }} \n \"#\n}\n\ntest TestTree {\n functions [BuildTree]\n args {\n input {\n data 2\n left {\n data 1\n left null\n right null\n }\n right {\n data 3\n left null\n right null\n }\n }\n }\n}", "test-files/functions/output/optional-class.baml": "class ClassOptionalOutput {\n prop1 string\n prop2 string\n}\n\nfunction FnClassOptionalOutput(input: string) -> ClassOptionalOutput? {\n client GPT35\n prompt #\"\n Return a json blob for the following input:\n {{input}}\n\n {{ctx.output_format}}\n\n JSON:\n \"#\n}\n\n\nclass Blah {\n prop4 string?\n}\n\nclass ClassOptionalOutput2 {\n prop1 string?\n prop2 string?\n prop3 Blah?\n}\n\nfunction FnClassOptionalOutput2(input: string) -> ClassOptionalOutput2? {\n client GPT35\n prompt #\"\n Return a json blob for the following input:\n {{input}}\n\n {{ctx.output_format}}\n\n JSON:\n \"#\n}\n\ntest FnClassOptionalOutput2 {\n functions [FnClassOptionalOutput2, FnClassOptionalOutput]\n args {\n input \"example input\"\n }\n}\n", "test-files/functions/output/optional.baml": "class OptionalTest_Prop1 {\n omega_a string\n omega_b int\n}\n\nenum OptionalTest_CategoryType {\n Aleph\n Beta\n Gamma\n}\n \nclass OptionalTest_ReturnType {\n omega_1 OptionalTest_Prop1?\n omega_2 string?\n omega_3 (OptionalTest_CategoryType?)[]\n} \n \nfunction OptionalTest_Function(input: string) -> (OptionalTest_ReturnType?)[]\n{ \n client GPT35\n prompt #\"\n Return a JSON blob with this schema: \n {{ctx.output_format}}\n\n JSON:\n \"#\n}\n\ntest OptionalTest_Function {\n functions [OptionalTest_Function]\n args {\n input \"example input\"\n }\n}\n", diff --git a/integ-tests/python/baml_client/sync_client.py b/integ-tests/python/baml_client/sync_client.py index 107be357c..1ecca8b88 100644 --- a/integ-tests/python/baml_client/sync_client.py +++ b/integ-tests/python/baml_client/sync_client.py @@ -1312,7 +1312,30 @@ def InOutEnumMapKey( ) return cast(Dict[types.MapKey, str], raw.cast_to(types, types)) - def InOutLiteralStringUnionMapKey( + def InOutLiteralIntMapKey( + self, + i1: Dict[Union[Literal[1], Literal[2], Union[Literal[3], Literal[4]]], str],i2: Dict[Union[Literal[1], Literal[2], Union[Literal[3], Literal[4]]], str], + baml_options: BamlCallOptions = {}, + ) -> Dict[Union[Literal[1], Literal[2], Union[Literal[3], Literal[4]]], str]: + __tb__ = baml_options.get("tb", None) + if __tb__ is not None: + tb = __tb__._tb # type: ignore (we know how to use this private attribute) + else: + tb = None + __cr__ = baml_options.get("client_registry", None) + + raw = self.__runtime.call_function_sync( + "InOutLiteralIntMapKey", + { + "i1": i1,"i2": i2, + }, + self.__ctx_manager.get(), + tb, + __cr__, + ) + return cast(Dict[Union[Literal[1], Literal[2], Union[Literal[3], Literal[4]]], str], raw.cast_to(types, types)) + + def InOutLiteralStringMapKey( self, i1: Dict[Union[Literal["one"], Literal["two"], Union[Literal["three"], Literal["four"]]], str],i2: Dict[Union[Literal["one"], Literal["two"], Union[Literal["three"], Literal["four"]]], str], baml_options: BamlCallOptions = {}, @@ -1325,7 +1348,11 @@ def InOutLiteralStringUnionMapKey( __cr__ = baml_options.get("client_registry", None) raw = self.__runtime.call_function_sync( +<<<<<<< HEAD + "InOutLiteralStringMapKey", +======= "InOutLiteralStringUnionMapKey", +>>>>>>> canary { "i1": i1,"i2": i2, }, @@ -1335,6 +1362,8 @@ def InOutLiteralStringUnionMapKey( ) return cast(Dict[Union[Literal["one"], Literal["two"], Union[Literal["three"], Literal["four"]]], str], raw.cast_to(types, types)) +<<<<<<< HEAD +======= def InOutSingleLiteralStringMapKey( self, m: Dict[Literal["key"], str], @@ -1358,6 +1387,7 @@ def InOutSingleLiteralStringMapKey( ) return cast(Dict[Literal["key"], str], raw.cast_to(types, types)) +>>>>>>> canary def LiteralUnionsTest( self, input: str, @@ -4404,7 +4434,38 @@ def InOutEnumMapKey( self.__ctx_manager.get(), ) - def InOutLiteralStringUnionMapKey( + def InOutLiteralIntMapKey( + self, + i1: Dict[Union[Literal[1], Literal[2], Union[Literal[3], Literal[4]]], str],i2: Dict[Union[Literal[1], Literal[2], Union[Literal[3], Literal[4]]], str], + baml_options: BamlCallOptions = {}, + ) -> baml_py.BamlSyncStream[Dict[Union[Literal[1], Literal[2], Union[Literal[3], Literal[4]]], Optional[str]], Dict[Union[Literal[1], Literal[2], Union[Literal[3], Literal[4]]], str]]: + __tb__ = baml_options.get("tb", None) + if __tb__ is not None: + tb = __tb__._tb # type: ignore (we know how to use this private attribute) + else: + tb = None + __cr__ = baml_options.get("client_registry", None) + + raw = self.__runtime.stream_function_sync( + "InOutLiteralIntMapKey", + { + "i1": i1, + "i2": i2, + }, + None, + self.__ctx_manager.get(), + tb, + __cr__, + ) + + return baml_py.BamlSyncStream[Dict[Union[Literal[1], Literal[2], Union[Literal[3], Literal[4]]], Optional[str]], Dict[Union[Literal[1], Literal[2], Union[Literal[3], Literal[4]]], str]]( + raw, + lambda x: cast(Dict[Union[Literal[1], Literal[2], Union[Literal[3], Literal[4]]], Optional[str]], x.cast_to(types, partial_types)), + lambda x: cast(Dict[Union[Literal[1], Literal[2], Union[Literal[3], Literal[4]]], str], x.cast_to(types, types)), + self.__ctx_manager.get(), + ) + + def InOutLiteralStringMapKey( self, i1: Dict[Union[Literal["one"], Literal["two"], Union[Literal["three"], Literal["four"]]], str],i2: Dict[Union[Literal["one"], Literal["two"], Union[Literal["three"], Literal["four"]]], str], baml_options: BamlCallOptions = {}, @@ -4417,7 +4478,7 @@ def InOutLiteralStringUnionMapKey( __cr__ = baml_options.get("client_registry", None) raw = self.__runtime.stream_function_sync( - "InOutLiteralStringUnionMapKey", + "InOutLiteralStringMapKey", { "i1": i1, "i2": i2, @@ -4435,6 +4496,8 @@ def InOutLiteralStringUnionMapKey( self.__ctx_manager.get(), ) +<<<<<<< HEAD +======= def InOutSingleLiteralStringMapKey( self, m: Dict[Literal["key"], str], @@ -4465,6 +4528,7 @@ def InOutSingleLiteralStringMapKey( self.__ctx_manager.get(), ) +>>>>>>> canary def LiteralUnionsTest( self, input: str, diff --git a/integ-tests/python/tests/test_functions.py b/integ-tests/python/tests/test_functions.py index d4fd427f2..a38edc52c 100644 --- a/integ-tests/python/tests/test_functions.py +++ b/integ-tests/python/tests/test_functions.py @@ -248,6 +248,12 @@ async def test_single_literal_string_key_in_map(self): res = await b.InOutSingleLiteralStringMapKey({"key": "1"}) assert res["key"] == "1" + @pytest.mark.asyncio + async def test_literal_int_key_in_map(self): + res = await b.InOutLiteralIntMapKey({1: "one"}, {2: "two"}) + assert res[1] == "one" + assert res[2] == "two" + class MyCustomClass(NamedArgsSingleClass): date: datetime.datetime diff --git a/integ-tests/ruby/baml_client/client.rb b/integ-tests/ruby/baml_client/client.rb index 49a987d31..738036ca0 100644 --- a/integ-tests/ruby/baml_client/client.rb +++ b/integ-tests/ruby/baml_client/client.rb @@ -1817,21 +1817,33 @@ def InOutEnumMapKey( baml_options: T::Hash[Symbol, T.any(Baml::TypeBuilder, Baml::ClientRegistry)] ).returns(T::Hash[String, String]) } +<<<<<<< HEAD + def InOutLiteralIntMapKey( +======= def InOutLiteralStringUnionMapKey( +>>>>>>> canary *varargs, i1:,i2:, baml_options: {} ) if varargs.any? +<<<<<<< HEAD + raise ArgumentError.new("InOutLiteralIntMapKey may only be called with keyword arguments") +======= raise ArgumentError.new("InOutLiteralStringUnionMapKey may only be called with keyword arguments") +>>>>>>> canary end if (baml_options.keys - [:client_registry, :tb]).any? raise ArgumentError.new("Received unknown keys in baml_options (valid keys: :client_registry, :tb): #{baml_options.keys - [:client_registry, :tb]}") end raw = @runtime.call_function( +<<<<<<< HEAD + "InOutLiteralIntMapKey", +======= "InOutLiteralStringUnionMapKey", +>>>>>>> canary { i1: i1,i2: i2, }, @@ -1845,6 +1857,15 @@ def InOutLiteralStringUnionMapKey( sig { params( varargs: T.untyped, +<<<<<<< HEAD + i1: T::Hash[String, String],i2: T::Hash[String, String], + baml_options: T::Hash[Symbol, T.any(Baml::TypeBuilder, Baml::ClientRegistry)] + ).returns(T::Hash[String, String]) + } + def InOutLiteralStringMapKey( + *varargs, + i1:,i2:, +======= m: T::Hash[String, String], baml_options: T::Hash[Symbol, T.any(Baml::TypeBuilder, Baml::ClientRegistry)] ).returns(T::Hash[String, String]) @@ -1852,20 +1873,31 @@ def InOutLiteralStringUnionMapKey( def InOutSingleLiteralStringMapKey( *varargs, m:, +>>>>>>> canary baml_options: {} ) if varargs.any? +<<<<<<< HEAD + raise ArgumentError.new("InOutLiteralStringMapKey may only be called with keyword arguments") +======= raise ArgumentError.new("InOutSingleLiteralStringMapKey may only be called with keyword arguments") +>>>>>>> canary end if (baml_options.keys - [:client_registry, :tb]).any? raise ArgumentError.new("Received unknown keys in baml_options (valid keys: :client_registry, :tb): #{baml_options.keys - [:client_registry, :tb]}") end raw = @runtime.call_function( +<<<<<<< HEAD + "InOutLiteralStringMapKey", + { + i1: i1,i2: i2, +======= "InOutSingleLiteralStringMapKey", { m: m, +>>>>>>> canary }, @ctx_manager, baml_options[:tb]&.instance_variable_get(:@registry), @@ -5739,21 +5771,33 @@ def InOutEnumMapKey( baml_options: T::Hash[Symbol, T.any(Baml::TypeBuilder, Baml::ClientRegistry)] ).returns(Baml::BamlStream[T::Hash[String, String]]) } +<<<<<<< HEAD + def InOutLiteralIntMapKey( +======= def InOutLiteralStringUnionMapKey( +>>>>>>> canary *varargs, i1:,i2:, baml_options: {} ) if varargs.any? +<<<<<<< HEAD + raise ArgumentError.new("InOutLiteralIntMapKey may only be called with keyword arguments") +======= raise ArgumentError.new("InOutLiteralStringUnionMapKey may only be called with keyword arguments") +>>>>>>> canary end if (baml_options.keys - [:client_registry, :tb]).any? raise ArgumentError.new("Received unknown keys in baml_options (valid keys: :client_registry, :tb): #{baml_options.keys - [:client_registry, :tb]}") end raw = @runtime.stream_function( +<<<<<<< HEAD + "InOutLiteralIntMapKey", +======= "InOutLiteralStringUnionMapKey", +>>>>>>> canary { i1: i1,i2: i2, }, @@ -5770,6 +5814,15 @@ def InOutLiteralStringUnionMapKey( sig { params( varargs: T.untyped, +<<<<<<< HEAD + i1: T::Hash[String, String],i2: T::Hash[String, String], + baml_options: T::Hash[Symbol, T.any(Baml::TypeBuilder, Baml::ClientRegistry)] + ).returns(Baml::BamlStream[T::Hash[String, String]]) + } + def InOutLiteralStringMapKey( + *varargs, + i1:,i2:, +======= m: T::Hash[String, String], baml_options: T::Hash[Symbol, T.any(Baml::TypeBuilder, Baml::ClientRegistry)] ).returns(Baml::BamlStream[T::Hash[String, String]]) @@ -5777,20 +5830,31 @@ def InOutLiteralStringUnionMapKey( def InOutSingleLiteralStringMapKey( *varargs, m:, +>>>>>>> canary baml_options: {} ) if varargs.any? +<<<<<<< HEAD + raise ArgumentError.new("InOutLiteralStringMapKey may only be called with keyword arguments") +======= raise ArgumentError.new("InOutSingleLiteralStringMapKey may only be called with keyword arguments") +>>>>>>> canary end if (baml_options.keys - [:client_registry, :tb]).any? raise ArgumentError.new("Received unknown keys in baml_options (valid keys: :client_registry, :tb): #{baml_options.keys - [:client_registry, :tb]}") end raw = @runtime.stream_function( +<<<<<<< HEAD + "InOutLiteralStringMapKey", + { + i1: i1,i2: i2, +======= "InOutSingleLiteralStringMapKey", { m: m, +>>>>>>> canary }, @ctx_manager, baml_options[:tb]&.instance_variable_get(:@registry), diff --git a/integ-tests/ruby/baml_client/inlined.rb b/integ-tests/ruby/baml_client/inlined.rb index 8eac818cc..278def0cb 100644 --- a/integ-tests/ruby/baml_client/inlined.rb +++ b/integ-tests/ruby/baml_client/inlined.rb @@ -75,7 +75,7 @@ module Inlined "test-files/functions/output/literal-string.baml" => "function FnOutputLiteralString(input: string) -> \"example output\" {\n client GPT35\n prompt #\"\n Return a string: {{ ctx.output_format}}\n \"#\n}\n\ntest FnOutputLiteralString {\n functions [FnOutputLiteralString]\n args {\n input \"example input\"\n }\n}\n", "test-files/functions/output/literal-unions.baml" => "function LiteralUnionsTest(input: string) -> 1 | true | \"string output\" {\n client GPT35\n prompt #\"\n Return one of these values: \n {{ctx.output_format}}\n \"#\n}\n\ntest LiteralUnionsTest {\n functions [LiteralUnionsTest]\n args {\n input \"example input\"\n }\n}\n", "test-files/functions/output/map-enum-key.baml" => "enum MapKey {\n A\n B\n C\n}\n\nfunction InOutEnumMapKey(i1: map, i2: map) -> map {\n client \"openai/gpt-4o\"\n prompt #\"\n Merge these: {{i1}} {{i2}}\n\n {{ ctx.output_format }}\n \"#\n}\n", - "test-files/functions/output/map-literal-union-key.baml" => "function InOutLiteralStringUnionMapKey(\n i1: map<\"one\" | \"two\" | (\"three\" | \"four\"), string>, \n i2: map<\"one\" | \"two\" | (\"three\" | \"four\"), string>\n) -> map<\"one\" | \"two\" | (\"three\" | \"four\"), string> {\n client \"openai/gpt-4o\"\n prompt #\"\n Merge these:\n \n {{i1}}\n \n {{i2}}\n\n {{ ctx.output_format }}\n \"#\n}\n\nfunction InOutSingleLiteralStringMapKey(m: map<\"key\", string>) -> map<\"key\", string> {\n client \"openai/gpt-4o\"\n prompt #\"\n Return the same map you were given:\n \n {{m}}\n\n {{ ctx.output_format }}\n \"#\n}\n", + "test-files/functions/output/map-literal-union-key.baml" => "function InOutLiteralStringMapKey(\n i1: map<\"one\" | \"two\" | (\"three\" | \"four\"), string>, \n i2: map<\"one\" | \"two\" | (\"three\" | \"four\"), string>\n) -> map<\"one\" | \"two\" | (\"three\" | \"four\"), string> {\n client \"openai/gpt-4o\"\n prompt #\"\n Merge these:\n \n {{i1}}\n \n {{i2}}\n\n {{ ctx.output_format }}\n \"#\n}\n\nfunction InOutLiteralIntMapKey(\n i1: map<1 | 2 | (3 | 4), string>, \n i2: map<1 | 2 | (3 | 4), string>\n) -> map<1 | 2 | (3 | 4), string> {\n client \"openai/gpt-4o\"\n prompt #\"\n Merge these:\n \n {{i1}}\n \n {{i2}}\n\n {{ ctx.output_format }}\n \"#\n}\n", "test-files/functions/output/mutually-recursive-classes.baml" => "class Tree {\n data int\n children Forest\n}\n\nclass Forest {\n trees Tree[]\n}\n\nclass BinaryNode {\n data int\n left BinaryNode?\n right BinaryNode?\n}\n\nfunction BuildTree(input: BinaryNode) -> Tree {\n client GPT35\n prompt #\"\n Given the input binary tree, transform it into a generic tree using the given schema.\n\n INPUT:\n {{ input }}\n\n {{ ctx.output_format }} \n \"#\n}\n\ntest TestTree {\n functions [BuildTree]\n args {\n input {\n data 2\n left {\n data 1\n left null\n right null\n }\n right {\n data 3\n left null\n right null\n }\n }\n }\n}", "test-files/functions/output/optional-class.baml" => "class ClassOptionalOutput {\n prop1 string\n prop2 string\n}\n\nfunction FnClassOptionalOutput(input: string) -> ClassOptionalOutput? {\n client GPT35\n prompt #\"\n Return a json blob for the following input:\n {{input}}\n\n {{ctx.output_format}}\n\n JSON:\n \"#\n}\n\n\nclass Blah {\n prop4 string?\n}\n\nclass ClassOptionalOutput2 {\n prop1 string?\n prop2 string?\n prop3 Blah?\n}\n\nfunction FnClassOptionalOutput2(input: string) -> ClassOptionalOutput2? {\n client GPT35\n prompt #\"\n Return a json blob for the following input:\n {{input}}\n\n {{ctx.output_format}}\n\n JSON:\n \"#\n}\n\ntest FnClassOptionalOutput2 {\n functions [FnClassOptionalOutput2, FnClassOptionalOutput]\n args {\n input \"example input\"\n }\n}\n", "test-files/functions/output/optional.baml" => "class OptionalTest_Prop1 {\n omega_a string\n omega_b int\n}\n\nenum OptionalTest_CategoryType {\n Aleph\n Beta\n Gamma\n}\n \nclass OptionalTest_ReturnType {\n omega_1 OptionalTest_Prop1?\n omega_2 string?\n omega_3 (OptionalTest_CategoryType?)[]\n} \n \nfunction OptionalTest_Function(input: string) -> (OptionalTest_ReturnType?)[]\n{ \n client GPT35\n prompt #\"\n Return a JSON blob with this schema: \n {{ctx.output_format}}\n\n JSON:\n \"#\n}\n\ntest OptionalTest_Function {\n functions [OptionalTest_Function]\n args {\n input \"example input\"\n }\n}\n", diff --git a/integ-tests/typescript/baml_client/async_client.ts b/integ-tests/typescript/baml_client/async_client.ts index ae277c2a6..5c38c1c3e 100644 --- a/integ-tests/typescript/baml_client/async_client.ts +++ b/integ-tests/typescript/baml_client/async_client.ts @@ -16,16 +16,107 @@ $ pnpm add @boundaryml/baml // @ts-nocheck // biome-ignore format: autogenerated code import { BamlRuntime, FunctionResult, BamlCtxManager, BamlStream, Image, ClientRegistry, BamlValidationError, createBamlValidationError } from "@boundaryml/baml" -import { Checked, Check } from "./types" -import {BigNumbers, BinaryNode, Blah, BlockConstraint, BlockConstraintForParam, BookOrder, ClassOptionalOutput, ClassOptionalOutput2, ClassWithImage, CompoundBigNumbers, ContactInfo, CustomTaskResult, DummyOutput, DynInputOutput, DynamicClassOne, DynamicClassTwo, DynamicOutput, Earthling, Education, Email, EmailAddress, Event, FakeImage, FlightConfirmation, FooAny, Forest, GroceryReceipt, InnerClass, InnerClass2, InputClass, InputClassNested, LinkedList, LiteralClassHello, LiteralClassOne, LiteralClassTwo, MalformedConstraints, MalformedConstraints2, Martian, NamedArgsSingleClass, Nested, Nested2, NestedBlockConstraint, NestedBlockConstraintForParam, Node, OptionalTest_Prop1, OptionalTest_ReturnType, OrderInfo, OriginalA, OriginalB, Person, PhoneNumber, Quantity, RaysData, ReceiptInfo, ReceiptItem, Recipe, Resume, Schema, SearchParams, SomeClassNestedDynamic, StringToClassEntry, TestClassAlias, TestClassNested, TestClassWithEnum, TestOutputClass, Tree, TwoStoriesOneTitle, UnionTest_ReturnType, WithReasoning, AliasedEnum, Category, Category2, Category3, Color, DataType, DynEnumOne, DynEnumTwo, EnumInClass, EnumOutput, Hobby, MapKey, NamedArgsSingleEnum, NamedArgsSingleEnumList, OptionalTest_CategoryType, OrderStatus, Tag, TestEnum} from "./types" -import TypeBuilder from "./type_builder" -import { DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX, DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_RUNTIME } from "./globals" +import { Checked, Check } from './types' +import { + BigNumbers, + BinaryNode, + Blah, + BlockConstraint, + BlockConstraintForParam, + BookOrder, + ClassOptionalOutput, + ClassOptionalOutput2, + ClassWithImage, + CompoundBigNumbers, + ContactInfo, + CustomTaskResult, + DummyOutput, + DynInputOutput, + DynamicClassOne, + DynamicClassTwo, + DynamicOutput, + Earthling, + Education, + Email, + EmailAddress, + Event, + FakeImage, + FlightConfirmation, + FooAny, + Forest, + GroceryReceipt, + InnerClass, + InnerClass2, + InputClass, + InputClassNested, + LinkedList, + LiteralClassHello, + LiteralClassOne, + LiteralClassTwo, + MalformedConstraints, + MalformedConstraints2, + Martian, + NamedArgsSingleClass, + Nested, + Nested2, + NestedBlockConstraint, + NestedBlockConstraintForParam, + Node, + OptionalTest_Prop1, + OptionalTest_ReturnType, + OrderInfo, + OriginalA, + OriginalB, + Person, + PhoneNumber, + Quantity, + RaysData, + ReceiptInfo, + ReceiptItem, + Recipe, + Resume, + Schema, + SearchParams, + SomeClassNestedDynamic, + StringToClassEntry, + TestClassAlias, + TestClassNested, + TestClassWithEnum, + TestOutputClass, + Tree, + TwoStoriesOneTitle, + UnionTest_ReturnType, + WithReasoning, + AliasedEnum, + Category, + Category2, + Category3, + Color, + DataType, + DynEnumOne, + DynEnumTwo, + EnumInClass, + EnumOutput, + Hobby, + MapKey, + NamedArgsSingleEnum, + NamedArgsSingleEnumList, + OptionalTest_CategoryType, + OrderStatus, + Tag, + TestEnum, +} from './types' +import TypeBuilder from './type_builder' +import { + DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX, + DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_RUNTIME, +} from './globals' export type RecursivePartialNull = T extends object ? { - [P in keyof T]?: RecursivePartialNull; + [P in keyof T]?: RecursivePartialNull } - : T | null; + : T | null export class BamlAsyncClient { private runtime: BamlRuntime @@ -40,18 +131,17 @@ export class BamlAsyncClient { get stream() { return this.stream_client - } + } - async AaaSamOutputFormat( - recipe: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + recipe: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "AaaSamOutputFormat", + 'AaaSamOutputFormat', { - "recipe": recipe + recipe: recipe, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -59,24 +149,24 @@ export class BamlAsyncClient { ) return raw.parsed() as Recipe } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async AliasedInputClass( - input: InputClass, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: InputClass, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "AliasedInputClass", + 'AliasedInputClass', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -84,24 +174,24 @@ export class BamlAsyncClient { ) return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async AliasedInputClass2( - input: InputClass, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: InputClass, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "AliasedInputClass2", + 'AliasedInputClass2', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -109,24 +199,24 @@ export class BamlAsyncClient { ) return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async AliasedInputClassNested( - input: InputClassNested, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: InputClassNested, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "AliasedInputClassNested", + 'AliasedInputClassNested', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -134,24 +224,24 @@ export class BamlAsyncClient { ) return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async AliasedInputEnum( - input: AliasedEnum, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: AliasedEnum, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "AliasedInputEnum", + 'AliasedInputEnum', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -159,24 +249,24 @@ export class BamlAsyncClient { ) return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async AliasedInputList( - input: AliasedEnum[], - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: AliasedEnum[], + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "AliasedInputList", + 'AliasedInputList', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -184,24 +274,24 @@ export class BamlAsyncClient { ) return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async AudioInput( - aud: Audio, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + aud: Audio, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "AudioInput", + 'AudioInput', { - "aud": aud + aud: aud, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -209,24 +299,24 @@ export class BamlAsyncClient { ) return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async BuildLinkedList( - input: number[], - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: number[], + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "BuildLinkedList", + 'BuildLinkedList', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -234,24 +324,24 @@ export class BamlAsyncClient { ) return raw.parsed() as LinkedList } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async BuildTree( - input: BinaryNode, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: BinaryNode, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "BuildTree", + 'BuildTree', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -259,49 +349,49 @@ export class BamlAsyncClient { ) return raw.parsed() as Tree } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async ClassifyDynEnumTwo( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise<(string | DynEnumTwo)> { + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, + ): Promise { try { const raw = await this.runtime.callFunction( - "ClassifyDynEnumTwo", + 'ClassifyDynEnumTwo', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) - return raw.parsed() as (string | DynEnumTwo) + return raw.parsed() as string | DynEnumTwo } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async ClassifyMessage( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "ClassifyMessage", + 'ClassifyMessage', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -309,24 +399,24 @@ export class BamlAsyncClient { ) return raw.parsed() as Category } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async ClassifyMessage2( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "ClassifyMessage2", + 'ClassifyMessage2', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -334,24 +424,24 @@ export class BamlAsyncClient { ) return raw.parsed() as Category } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async ClassifyMessage3( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "ClassifyMessage3", + 'ClassifyMessage3', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -359,24 +449,24 @@ export class BamlAsyncClient { ) return raw.parsed() as Category } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async CustomTask( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "CustomTask", + 'CustomTask', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -384,24 +474,24 @@ export class BamlAsyncClient { ) return raw.parsed() as BookOrder | FlightConfirmation | GroceryReceipt } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async DescribeImage( - img: Image, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + img: Image, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "DescribeImage", + 'DescribeImage', { - "img": img + img: img, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -409,24 +499,26 @@ export class BamlAsyncClient { ) return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async DescribeImage2( - classWithImage: ClassWithImage,img2: Image, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + classWithImage: ClassWithImage, + img2: Image, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "DescribeImage2", + 'DescribeImage2', { - "classWithImage": classWithImage,"img2": img2 + classWithImage: classWithImage, + img2: img2, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -434,24 +526,26 @@ export class BamlAsyncClient { ) return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async DescribeImage3( - classWithImage: ClassWithImage,img2: Image, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + classWithImage: ClassWithImage, + img2: Image, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "DescribeImage3", + 'DescribeImage3', { - "classWithImage": classWithImage,"img2": img2 + classWithImage: classWithImage, + img2: img2, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -459,24 +553,26 @@ export class BamlAsyncClient { ) return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async DescribeImage4( - classWithImage: ClassWithImage,img2: Image, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + classWithImage: ClassWithImage, + img2: Image, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "DescribeImage4", + 'DescribeImage4', { - "classWithImage": classWithImage,"img2": img2 + classWithImage: classWithImage, + img2: img2, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -484,49 +580,46 @@ export class BamlAsyncClient { ) return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - async DifferentiateUnions( - - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { + + async DifferentiateUnions(__baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): Promise< + OriginalA | OriginalB + > { try { const raw = await this.runtime.callFunction( - "DifferentiateUnions", - { - - }, + 'DifferentiateUnions', + {}, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as OriginalA | OriginalB } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async DummyOutputFunction( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "DummyOutputFunction", + 'DummyOutputFunction', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -534,24 +627,24 @@ export class BamlAsyncClient { ) return raw.parsed() as DummyOutput } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async DynamicFunc( - input: DynamicClassOne, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: DynamicClassOne, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "DynamicFunc", + 'DynamicFunc', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -559,24 +652,24 @@ export class BamlAsyncClient { ) return raw.parsed() as DynamicClassTwo } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async DynamicInputOutput( - input: DynInputOutput, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: DynInputOutput, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "DynamicInputOutput", + 'DynamicInputOutput', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -584,24 +677,24 @@ export class BamlAsyncClient { ) return raw.parsed() as DynInputOutput } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async DynamicListInputOutput( - input: DynInputOutput[], - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: DynInputOutput[], + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "DynamicListInputOutput", + 'DynamicListInputOutput', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -609,49 +702,44 @@ export class BamlAsyncClient { ) return raw.parsed() as DynInputOutput[] } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - async ExpectFailure( - - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { + + async ExpectFailure(__baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): Promise { try { const raw = await this.runtime.callFunction( - "ExpectFailure", - { - - }, + 'ExpectFailure', + {}, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async ExtractContactInfo( - document: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + document: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "ExtractContactInfo", + 'ExtractContactInfo', { - "document": document + document: document, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -659,24 +747,24 @@ export class BamlAsyncClient { ) return raw.parsed() as ContactInfo } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async ExtractHobby( - text: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + text: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise<(string | Hobby)[]> { try { const raw = await this.runtime.callFunction( - "ExtractHobby", + 'ExtractHobby', { - "text": text + text: text, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -684,24 +772,24 @@ export class BamlAsyncClient { ) return raw.parsed() as (string | Hobby)[] } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async ExtractNames( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "ExtractNames", + 'ExtractNames', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -709,24 +797,24 @@ export class BamlAsyncClient { ) return raw.parsed() as string[] } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async ExtractPeople( - text: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + text: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "ExtractPeople", + 'ExtractPeople', { - "text": text + text: text, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -734,24 +822,26 @@ export class BamlAsyncClient { ) return raw.parsed() as Person[] } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async ExtractReceiptInfo( - email: string,reason: "curiosity" | "personal_finance", - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + email: string, + reason: 'curiosity' | 'personal_finance', + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "ExtractReceiptInfo", + 'ExtractReceiptInfo', { - "email": email,"reason": reason + email: email, + reason: reason, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -759,24 +849,26 @@ export class BamlAsyncClient { ) return raw.parsed() as ReceiptInfo } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async ExtractResume( - resume: string,img?: Image | null, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + resume: string, + img?: Image | null, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "ExtractResume", + 'ExtractResume', { - "resume": resume,"img": img?? null + resume: resume, + img: img ?? null, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -784,24 +876,24 @@ export class BamlAsyncClient { ) return raw.parsed() as Resume } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async ExtractResume2( - resume: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + resume: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "ExtractResume2", + 'ExtractResume2', { - "resume": resume + resume: resume, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -809,24 +901,24 @@ export class BamlAsyncClient { ) return raw.parsed() as Resume } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnClassOptionalOutput( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "FnClassOptionalOutput", + 'FnClassOptionalOutput', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -834,24 +926,24 @@ export class BamlAsyncClient { ) return raw.parsed() as ClassOptionalOutput | null } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnClassOptionalOutput2( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "FnClassOptionalOutput2", + 'FnClassOptionalOutput2', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -859,24 +951,24 @@ export class BamlAsyncClient { ) return raw.parsed() as ClassOptionalOutput2 | null } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnEnumListOutput( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "FnEnumListOutput", + 'FnEnumListOutput', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -884,24 +976,24 @@ export class BamlAsyncClient { ) return raw.parsed() as EnumOutput[] } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnEnumOutput( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "FnEnumOutput", + 'FnEnumOutput', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -909,24 +1001,24 @@ export class BamlAsyncClient { ) return raw.parsed() as EnumOutput } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnLiteralClassInputOutput( - input: LiteralClassHello, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: LiteralClassHello, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "FnLiteralClassInputOutput", + 'FnLiteralClassInputOutput', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -934,24 +1026,24 @@ export class BamlAsyncClient { ) return raw.parsed() as LiteralClassHello } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnLiteralUnionClassInputOutput( - input: LiteralClassOne | LiteralClassTwo, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: LiteralClassOne | LiteralClassTwo, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "FnLiteralUnionClassInputOutput", + 'FnLiteralUnionClassInputOutput', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -959,24 +1051,24 @@ export class BamlAsyncClient { ) return raw.parsed() as LiteralClassOne | LiteralClassTwo } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnNamedArgsSingleStringOptional( - myString?: string | null, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + myString?: string | null, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "FnNamedArgsSingleStringOptional", + 'FnNamedArgsSingleStringOptional', { - "myString": myString?? null + myString: myString ?? null, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -984,24 +1076,24 @@ export class BamlAsyncClient { ) return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnOutputBool( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "FnOutputBool", + 'FnOutputBool', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -1009,24 +1101,24 @@ export class BamlAsyncClient { ) return raw.parsed() as boolean } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnOutputClass( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "FnOutputClass", + 'FnOutputClass', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -1034,24 +1126,24 @@ export class BamlAsyncClient { ) return raw.parsed() as TestOutputClass } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnOutputClassList( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "FnOutputClassList", + 'FnOutputClassList', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -1059,24 +1151,24 @@ export class BamlAsyncClient { ) return raw.parsed() as TestOutputClass[] } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnOutputClassNested( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "FnOutputClassNested", + 'FnOutputClassNested', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -1084,24 +1176,24 @@ export class BamlAsyncClient { ) return raw.parsed() as TestClassNested } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnOutputClassWithEnum( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "FnOutputClassWithEnum", + 'FnOutputClassWithEnum', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -1109,24 +1201,24 @@ export class BamlAsyncClient { ) return raw.parsed() as TestClassWithEnum } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnOutputInt( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "FnOutputInt", + 'FnOutputInt', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -1134,24 +1226,24 @@ export class BamlAsyncClient { ) return raw.parsed() as number } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnOutputLiteralBool( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "FnOutputLiteralBool", + 'FnOutputLiteralBool', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -1159,24 +1251,24 @@ export class BamlAsyncClient { ) return raw.parsed() as false } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnOutputLiteralInt( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise<5> { try { const raw = await this.runtime.callFunction( - "FnOutputLiteralInt", + 'FnOutputLiteralInt', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -1184,49 +1276,49 @@ export class BamlAsyncClient { ) return raw.parsed() as 5 } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnOutputLiteralString( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise<"example output"> { + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, + ): Promise<'example output'> { try { const raw = await this.runtime.callFunction( - "FnOutputLiteralString", + 'FnOutputLiteralString', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) - return raw.parsed() as "example output" + return raw.parsed() as 'example output' } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnOutputStringList( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "FnOutputStringList", + 'FnOutputStringList', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -1234,24 +1326,24 @@ export class BamlAsyncClient { ) return raw.parsed() as string[] } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnTestAliasedEnumOutput( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "FnTestAliasedEnumOutput", + 'FnTestAliasedEnumOutput', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -1259,24 +1351,24 @@ export class BamlAsyncClient { ) return raw.parsed() as TestEnum } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnTestClassAlias( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "FnTestClassAlias", + 'FnTestClassAlias', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -1284,24 +1376,24 @@ export class BamlAsyncClient { ) return raw.parsed() as TestClassAlias } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async FnTestNamedArgsSingleEnum( - myArg: NamedArgsSingleEnum, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + myArg: NamedArgsSingleEnum, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "FnTestNamedArgsSingleEnum", + 'FnTestNamedArgsSingleEnum', { - "myArg": myArg + myArg: myArg, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -1309,24 +1401,24 @@ export class BamlAsyncClient { ) return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async GetDataType( - text: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + text: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "GetDataType", + 'GetDataType', { - "text": text + text: text, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -1334,24 +1426,24 @@ export class BamlAsyncClient { ) return raw.parsed() as RaysData } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async GetOrderInfo( - email: Email, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + email: Email, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "GetOrderInfo", + 'GetOrderInfo', { - "email": email + email: email, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -1359,24 +1451,24 @@ export class BamlAsyncClient { ) return raw.parsed() as OrderInfo } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async GetQuery( - query: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + query: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise { try { const raw = await this.runtime.callFunction( - "GetQuery", + 'GetQuery', { - "query": query + query: query, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -1384,24 +1476,26 @@ export class BamlAsyncClient { ) return raw.parsed() as SearchParams } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + async InOutEnumMapKey( - i1: Partial>,i2: Partial>, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + i1: Partial>, + i2: Partial>, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Promise>> { try { const raw = await this.runtime.callFunction( - "InOutEnumMapKey", + 'InOutEnumMapKey', { - "i1": i1,"i2": i2 + i1: i1, + i2: i2, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -1409,1580 +1503,1781 @@ export class BamlAsyncClient { ) return raw.parsed() as Partial> } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - async InOutLiteralStringUnionMapKey( - i1: Partial>,i2: Partial>, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise>> { + + <<<<<<< + HEAD + async InOutLiteralIntMapKey( + i1: Partial>, + i2: Partial>, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, + ): Promise>> { try { const raw = await this.runtime.callFunction( - "InOutLiteralStringUnionMapKey", + 'InOutLiteralIntMapKey', { - "i1": i1,"i2": i2 + i1: i1, + i2: i2, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) - return raw.parsed() as Partial> + return raw.parsed() as Partial> } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - async InOutSingleLiteralStringMapKey( - m: Partial>, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise>> { - try { - const raw = await this.runtime.callFunction( - "InOutSingleLiteralStringMapKey", + + async InOutLiteralStringMapKey( + ======= + async InOutLiteralStringUnionMapKey( + >>>>>>> + canary + i1: Partial>; + , + i2: Partial>; + , + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }; + ): + Promise + >> { + try { + const + raw = await this.runtime.callFunction( +<<<<<<< HEAD + "InOutLiteralStringMapKey", +======= + "InOutLiteralStringUnionMapKey", +>>>>>>> canary { - "m": m + "i1": i1,"i2": i2 }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) - return raw.parsed() as Partial> - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } - } + return + raw; + . + parsed() + as; + Partial + > +} +catch (error: any) +{ + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } +} +} async LiteralUnionsTest( input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise<1 | true | "string output"> { - try { - const raw = await this.runtime.callFunction( - "LiteralUnionsTest", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as 1 | true | "string output" - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + __baml_options__?: +{ + tb?: TypeBuilder, clientRegistry?: ClientRegistry +} +): Promise<1 | true | "string output"> +{ + try { + const raw = await this.runtime.callFunction( + 'LiteralUnionsTest', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as 1 | true | "string output" + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async MakeBlockConstraint( +} + +async +MakeBlockConstraint( __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise> { - try { - const raw = await this.runtime.callFunction( - "MakeBlockConstraint", - { - - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as Checked - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise> +{ + try { + const raw = await this.runtime.callFunction( + 'MakeBlockConstraint', + {}, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as Checked + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async MakeNestedBlockConstraint( +} + +async +MakeNestedBlockConstraint( __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "MakeNestedBlockConstraint", - { - - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as NestedBlockConstraint - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'MakeNestedBlockConstraint', + {}, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as NestedBlockConstraint + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async MyFunc( +} + +async +MyFunc( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "MyFunc", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as DynamicOutput - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'MyFunc', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as DynamicOutput + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async OptionalTest_Function( +} + +async +OptionalTest_Function( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise<(OptionalTest_ReturnType | null)[]> { - try { - const raw = await this.runtime.callFunction( - "OptionalTest_Function", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as (OptionalTest_ReturnType | null)[] - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise<(OptionalTest_ReturnType | null)[]> +{ + try { + const raw = await this.runtime.callFunction( + 'OptionalTest_Function', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as (OptionalTest_ReturnType | null)[] + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async PredictAge( +} + +async +PredictAge( name: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "PredictAge", - { - "name": name - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as FooAny - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'PredictAge', + { + name: name, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as FooAny + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async PredictAgeBare( +} + +async +PredictAgeBare( inp: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise> { - try { - const raw = await this.runtime.callFunction( - "PredictAgeBare", - { - "inp": inp - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as Checked - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise> +{ + try { + const raw = await this.runtime.callFunction( + 'PredictAgeBare', + { + inp: inp, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as Checked + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async PromptTestClaude( +} + +async +PromptTestClaude( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "PromptTestClaude", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'PromptTestClaude', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async PromptTestClaudeChat( +} + +async +PromptTestClaudeChat( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "PromptTestClaudeChat", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'PromptTestClaudeChat', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async PromptTestClaudeChatNoSystem( +} + +async +PromptTestClaudeChatNoSystem( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "PromptTestClaudeChatNoSystem", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'PromptTestClaudeChatNoSystem', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async PromptTestOpenAI( +} + +async +PromptTestOpenAI( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "PromptTestOpenAI", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'PromptTestOpenAI', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async PromptTestOpenAIChat( +} + +async +PromptTestOpenAIChat( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "PromptTestOpenAIChat", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'PromptTestOpenAIChat', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async PromptTestOpenAIChatNoSystem( +} + +async +PromptTestOpenAIChatNoSystem( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "PromptTestOpenAIChatNoSystem", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'PromptTestOpenAIChatNoSystem', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async PromptTestStreaming( +} + +async +PromptTestStreaming( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "PromptTestStreaming", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'PromptTestStreaming', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async ReturnFailingAssert( +} + +async +ReturnFailingAssert( inp: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "ReturnFailingAssert", - { - "inp": inp - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as number - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'ReturnFailingAssert', + { + inp: inp, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as number + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async ReturnMalformedConstraints( +} + +async +ReturnMalformedConstraints( a: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "ReturnMalformedConstraints", - { - "a": a - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as MalformedConstraints - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'ReturnMalformedConstraints', + { + a: a, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as MalformedConstraints + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async SchemaDescriptions( +} + +async +SchemaDescriptions( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "SchemaDescriptions", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as Schema - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'SchemaDescriptions', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as Schema + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async StreamBigNumbers( +} + +async +StreamBigNumbers( digits: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "StreamBigNumbers", - { - "digits": digits - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as BigNumbers - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'StreamBigNumbers', + { + digits: digits, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as BigNumbers + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async StreamFailingAssertion( +} + +async +StreamFailingAssertion( theme: string,length: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "StreamFailingAssertion", - { - "theme": theme,"length": length - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as TwoStoriesOneTitle - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'StreamFailingAssertion', + { + theme: theme, + length: length, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as TwoStoriesOneTitle + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async StreamOneBigNumber( +} + +async +StreamOneBigNumber( digits: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "StreamOneBigNumber", - { - "digits": digits - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as number - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'StreamOneBigNumber', + { + digits: digits, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as number + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async StreamUnionIntegers( +} + +async +StreamUnionIntegers( digits: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise<(number | string)[]> { - try { - const raw = await this.runtime.callFunction( - "StreamUnionIntegers", - { - "digits": digits - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as (number | string)[] - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise<(number | string)[]> +{ + try { + const raw = await this.runtime.callFunction( + 'StreamUnionIntegers', + { + digits: digits, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as (number | string)[] + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async StreamingCompoundNumbers( +} + +async +StreamingCompoundNumbers( digits: number,yapping: boolean, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "StreamingCompoundNumbers", - { - "digits": digits,"yapping": yapping - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as CompoundBigNumbers - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'StreamingCompoundNumbers', + { + digits: digits, + yapping: yapping, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as CompoundBigNumbers + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestAnthropic( +} + +async +TestAnthropic( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestAnthropic", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestAnthropic', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestAnthropicShorthand( +} + +async +TestAnthropicShorthand( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestAnthropicShorthand", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestAnthropicShorthand', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestAws( +} + +async +TestAws( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestAws", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestAws', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestAwsInvalidRegion( +} + +async +TestAwsInvalidRegion( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestAwsInvalidRegion", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestAwsInvalidRegion', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestAzure( +} + +async +TestAzure( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestAzure", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestAzure', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestCaching( +} + +async +TestCaching( input: string,not_cached: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestCaching", - { - "input": input,"not_cached": not_cached - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestCaching', + { + input: input, + not_cached: not_cached, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestFallbackClient( +} + +async +TestFallbackClient( __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestFallbackClient", - { - - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestFallbackClient', + {}, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestFallbackToShorthand( +} + +async +TestFallbackToShorthand( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestFallbackToShorthand", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestFallbackToShorthand', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestFnNamedArgsSingleBool( +} + +async +TestFnNamedArgsSingleBool( myBool: boolean, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestFnNamedArgsSingleBool", - { - "myBool": myBool - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestFnNamedArgsSingleBool', + { + myBool: myBool, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestFnNamedArgsSingleClass( +} + +async +TestFnNamedArgsSingleClass( myArg: NamedArgsSingleClass, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestFnNamedArgsSingleClass", - { - "myArg": myArg - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestFnNamedArgsSingleClass', + { + myArg: myArg, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestFnNamedArgsSingleEnumList( +} + +async +TestFnNamedArgsSingleEnumList( myArg: NamedArgsSingleEnumList[], __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestFnNamedArgsSingleEnumList", - { - "myArg": myArg - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestFnNamedArgsSingleEnumList', + { + myArg: myArg, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestFnNamedArgsSingleFloat( +} + +async +TestFnNamedArgsSingleFloat( myFloat: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestFnNamedArgsSingleFloat", - { - "myFloat": myFloat - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } - } - } - - async TestFnNamedArgsSingleInt( - myInt: number, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestFnNamedArgsSingleInt", - { - "myInt": myInt - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestFnNamedArgsSingleFloat', + { + myFloat: myFloat, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestFnNamedArgsSingleMapStringToClass( +} + +async +TestFnNamedArgsSingleInt( + myInt: number, + __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestFnNamedArgsSingleInt', + { + myInt: myInt, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error + } + } +} + +async +TestFnNamedArgsSingleMapStringToClass( myMap: Record, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise> { - try { - const raw = await this.runtime.callFunction( - "TestFnNamedArgsSingleMapStringToClass", - { - "myMap": myMap - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as Record - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise> +{ + try { + const raw = await this.runtime.callFunction( + 'TestFnNamedArgsSingleMapStringToClass', + { + myMap: myMap, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as Record + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestFnNamedArgsSingleMapStringToMap( +} + +async +TestFnNamedArgsSingleMapStringToMap( myMap: Record>, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise>> { - try { - const raw = await this.runtime.callFunction( - "TestFnNamedArgsSingleMapStringToMap", - { - "myMap": myMap - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as Record> - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise>> +{ + try { + const raw = await this.runtime.callFunction( + 'TestFnNamedArgsSingleMapStringToMap', + { + myMap: myMap, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as Record> + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestFnNamedArgsSingleMapStringToString( +} + +async +TestFnNamedArgsSingleMapStringToString( myMap: Record, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise> { - try { - const raw = await this.runtime.callFunction( - "TestFnNamedArgsSingleMapStringToString", - { - "myMap": myMap - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as Record - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise> +{ + try { + const raw = await this.runtime.callFunction( + 'TestFnNamedArgsSingleMapStringToString', + { + myMap: myMap, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as Record + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestFnNamedArgsSingleString( +} + +async +TestFnNamedArgsSingleString( myString: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestFnNamedArgsSingleString", - { - "myString": myString - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestFnNamedArgsSingleString', + { + myString: myString, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestFnNamedArgsSingleStringArray( +} + +async +TestFnNamedArgsSingleStringArray( myStringArray: string[], __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestFnNamedArgsSingleStringArray", - { - "myStringArray": myStringArray - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestFnNamedArgsSingleStringArray', + { + myStringArray: myStringArray, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestFnNamedArgsSingleStringList( +} + +async +TestFnNamedArgsSingleStringList( myArg: string[], __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestFnNamedArgsSingleStringList", - { - "myArg": myArg - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestFnNamedArgsSingleStringList', + { + myArg: myArg, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestGemini( +} + +async +TestGemini( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestGemini", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestGemini', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestImageInput( +} + +async +TestImageInput( img: Image, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestImageInput", - { - "img": img - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestImageInput', + { + img: img, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestImageInputAnthropic( +} + +async +TestImageInputAnthropic( img: Image, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestImageInputAnthropic", - { - "img": img - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestImageInputAnthropic', + { + img: img, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestImageListInput( +} + +async +TestImageListInput( imgs: Image[], __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestImageListInput", - { - "imgs": imgs - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestImageListInput', + { + imgs: imgs, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestMulticlassNamedArgs( +} + +async +TestMulticlassNamedArgs( myArg: NamedArgsSingleClass,myArg2: NamedArgsSingleClass, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestMulticlassNamedArgs", - { - "myArg": myArg,"myArg2": myArg2 - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestMulticlassNamedArgs', + { + myArg: myArg, + myArg2: myArg2, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestNamedArgsLiteralBool( +} + +async +TestNamedArgsLiteralBool( myBool: true, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestNamedArgsLiteralBool", - { - "myBool": myBool - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestNamedArgsLiteralBool', + { + myBool: myBool, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestNamedArgsLiteralInt( +} + +async +TestNamedArgsLiteralInt( myInt: 1, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestNamedArgsLiteralInt", - { - "myInt": myInt - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestNamedArgsLiteralInt', + { + myInt: myInt, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestNamedArgsLiteralString( +} + +async +TestNamedArgsLiteralString( myString: "My String", __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestNamedArgsLiteralString", - { - "myString": myString - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestNamedArgsLiteralString', + { + myString: myString, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestOllama( +} + +async +TestOllama( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestOllama", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestOllama', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestOpenAILegacyProvider( +} + +async +TestOpenAILegacyProvider( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestOpenAILegacyProvider", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestOpenAILegacyProvider', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestOpenAIShorthand( +} + +async +TestOpenAIShorthand( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestOpenAIShorthand", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestOpenAIShorthand', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestRetryConstant( +} + +async +TestRetryConstant( __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestRetryConstant", - { - - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestRetryConstant', + {}, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestRetryExponential( +} + +async +TestRetryExponential( __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestRetryExponential", - { - - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestRetryExponential', + {}, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestSingleFallbackClient( +} + +async +TestSingleFallbackClient( __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestSingleFallbackClient", - { - - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestSingleFallbackClient', + {}, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async TestVertex( +} + +async +TestVertex( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "TestVertex", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'TestVertex', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async UnionTest_Function( +} + +async +UnionTest_Function( input: string | boolean, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "UnionTest_Function", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as UnionTest_ReturnType - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'UnionTest_Function', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as UnionTest_ReturnType + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async UseBlockConstraint( +} + +async +UseBlockConstraint( inp: BlockConstraintForParam, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "UseBlockConstraint", - { - "inp": inp - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as number - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'UseBlockConstraint', + { + inp: inp, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as number + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async UseMalformedConstraints( +} + +async +UseMalformedConstraints( a: MalformedConstraints2, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "UseMalformedConstraints", - { - "a": a - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as number - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'UseMalformedConstraints', + { + a: a, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as number + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - async UseNestedBlockConstraint( +} + +async +UseNestedBlockConstraint( inp: NestedBlockConstraintForParam, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Promise { - try { - const raw = await this.runtime.callFunction( - "UseNestedBlockConstraint", - { - "inp": inp - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as number - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) +: Promise +{ + try { + const raw = await this.runtime.callFunction( + 'UseNestedBlockConstraint', + { + inp: inp, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as number + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - +} + } class BamlStreamClient { - constructor(private runtime: BamlRuntime, private ctx_manager: BamlCtxManager) {} + constructor( + private runtime: BamlRuntime, + private ctx_manager: BamlCtxManager, + ) {} - AaaSamOutputFormat( - recipe: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + recipe: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, Recipe> { try { const raw = this.runtime.streamFunction( - "AaaSamOutputFormat", + 'AaaSamOutputFormat', { - "recipe": recipe + recipe: recipe, }, undefined, this.ctx_manager.cloneContext(), @@ -2998,24 +3293,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + AliasedInputClass( - input: InputClass, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: InputClass, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, string> { try { const raw = this.runtime.streamFunction( - "AliasedInputClass", + 'AliasedInputClass', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -3031,24 +3326,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + AliasedInputClass2( - input: InputClass, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: InputClass, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, string> { try { const raw = this.runtime.streamFunction( - "AliasedInputClass2", + 'AliasedInputClass2', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -3064,24 +3359,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + AliasedInputClassNested( - input: InputClassNested, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: InputClassNested, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, string> { try { const raw = this.runtime.streamFunction( - "AliasedInputClassNested", + 'AliasedInputClassNested', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -3097,24 +3392,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + AliasedInputEnum( - input: AliasedEnum, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: AliasedEnum, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, string> { try { const raw = this.runtime.streamFunction( - "AliasedInputEnum", + 'AliasedInputEnum', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -3130,24 +3425,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + AliasedInputList( - input: AliasedEnum[], - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: AliasedEnum[], + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, string> { try { const raw = this.runtime.streamFunction( - "AliasedInputList", + 'AliasedInputList', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -3163,24 +3458,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + AudioInput( - aud: Audio, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + aud: Audio, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, string> { try { const raw = this.runtime.streamFunction( - "AudioInput", + 'AudioInput', { - "aud": aud + aud: aud, }, undefined, this.ctx_manager.cloneContext(), @@ -3196,24 +3491,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + BuildLinkedList( - input: number[], - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: number[], + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, LinkedList> { try { const raw = this.runtime.streamFunction( - "BuildLinkedList", + 'BuildLinkedList', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -3229,24 +3524,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + BuildTree( - input: BinaryNode, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: BinaryNode, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, Tree> { try { const raw = this.runtime.streamFunction( - "BuildTree", + 'BuildTree', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -3262,57 +3557,57 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + ClassifyDynEnumTwo( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, (string | DynEnumTwo)> { + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, + ): BamlStream, string | DynEnumTwo> { try { const raw = this.runtime.streamFunction( - "ClassifyDynEnumTwo", + 'ClassifyDynEnumTwo', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) - return new BamlStream, (string | DynEnumTwo)>( + return new BamlStream, string | DynEnumTwo>( raw, - (a): a is RecursivePartialNull<(string | DynEnumTwo)> => a, - (a): a is (string | DynEnumTwo) => a, + (a): a is RecursivePartialNull => a, + (a): a is string | DynEnumTwo => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + ClassifyMessage( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, Category> { try { const raw = this.runtime.streamFunction( - "ClassifyMessage", + 'ClassifyMessage', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -3328,24 +3623,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + ClassifyMessage2( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, Category> { try { const raw = this.runtime.streamFunction( - "ClassifyMessage2", + 'ClassifyMessage2', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -3361,24 +3656,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + ClassifyMessage3( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, Category> { try { const raw = this.runtime.streamFunction( - "ClassifyMessage3", + 'ClassifyMessage3', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -3394,31 +3689,37 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + CustomTask( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, BookOrder | FlightConfirmation | GroceryReceipt> { + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, + ): BamlStream< + RecursivePartialNull, + BookOrder | FlightConfirmation | GroceryReceipt + > { try { const raw = this.runtime.streamFunction( - "CustomTask", + 'CustomTask', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) - return new BamlStream, BookOrder | FlightConfirmation | GroceryReceipt>( + return new BamlStream< + RecursivePartialNull, + BookOrder | FlightConfirmation | GroceryReceipt + >( raw, (a): a is RecursivePartialNull => a, (a): a is BookOrder | FlightConfirmation | GroceryReceipt => a, @@ -3427,24 +3728,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + DescribeImage( - img: Image, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + img: Image, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, string> { try { const raw = this.runtime.streamFunction( - "DescribeImage", + 'DescribeImage', { - "img": img + img: img, }, undefined, this.ctx_manager.cloneContext(), @@ -3460,24 +3761,26 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + DescribeImage2( - classWithImage: ClassWithImage,img2: Image, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + classWithImage: ClassWithImage, + img2: Image, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, string> { try { const raw = this.runtime.streamFunction( - "DescribeImage2", + 'DescribeImage2', { - "classWithImage": classWithImage,"img2": img2 + classWithImage: classWithImage, + img2: img2, }, undefined, this.ctx_manager.cloneContext(), @@ -3493,24 +3796,26 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + DescribeImage3( - classWithImage: ClassWithImage,img2: Image, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + classWithImage: ClassWithImage, + img2: Image, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, string> { try { const raw = this.runtime.streamFunction( - "DescribeImage3", + 'DescribeImage3', { - "classWithImage": classWithImage,"img2": img2 + classWithImage: classWithImage, + img2: img2, }, undefined, this.ctx_manager.cloneContext(), @@ -3526,24 +3831,26 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + DescribeImage4( - classWithImage: ClassWithImage,img2: Image, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + classWithImage: ClassWithImage, + img2: Image, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, string> { try { const raw = this.runtime.streamFunction( - "DescribeImage4", + 'DescribeImage4', { - "classWithImage": classWithImage,"img2": img2 + classWithImage: classWithImage, + img2: img2, }, undefined, this.ctx_manager.cloneContext(), @@ -3559,25 +3866,23 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - - DifferentiateUnions( - - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, OriginalA | OriginalB> { + + DifferentiateUnions(__baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): BamlStream< + RecursivePartialNull, + OriginalA | OriginalB + > { try { const raw = this.runtime.streamFunction( - "DifferentiateUnions", - { - - }, + 'DifferentiateUnions', + {}, undefined, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -3592,24 +3897,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + DummyOutputFunction( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, DummyOutput> { try { const raw = this.runtime.streamFunction( - "DummyOutputFunction", + 'DummyOutputFunction', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -3625,24 +3930,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + DynamicFunc( - input: DynamicClassOne, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: DynamicClassOne, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, DynamicClassTwo> { try { const raw = this.runtime.streamFunction( - "DynamicFunc", + 'DynamicFunc', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -3658,24 +3963,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + DynamicInputOutput( - input: DynInputOutput, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: DynInputOutput, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, DynInputOutput> { try { const raw = this.runtime.streamFunction( - "DynamicInputOutput", + 'DynamicInputOutput', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -3691,24 +3996,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + DynamicListInputOutput( - input: DynInputOutput[], - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: DynInputOutput[], + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, DynInputOutput[]> { try { const raw = this.runtime.streamFunction( - "DynamicListInputOutput", + 'DynamicListInputOutput', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -3724,25 +4029,23 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - - ExpectFailure( - - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { + + ExpectFailure(__baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): BamlStream< + RecursivePartialNull, + string + > { try { - const raw = this.runtime.streamFunction( - "ExpectFailure", - { - - }, + const raw = this.runtime.streamFunction( + 'ExpectFailure', + {}, undefined, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), @@ -3757,24 +4060,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + ExtractContactInfo( - document: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + document: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, ContactInfo> { try { const raw = this.runtime.streamFunction( - "ExtractContactInfo", + 'ExtractContactInfo', { - "document": document + document: document, }, undefined, this.ctx_manager.cloneContext(), @@ -3790,24 +4093,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + ExtractHobby( - text: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + text: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, (string | Hobby)[]> { try { const raw = this.runtime.streamFunction( - "ExtractHobby", + 'ExtractHobby', { - "text": text + text: text, }, undefined, this.ctx_manager.cloneContext(), @@ -3823,24 +4126,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + ExtractNames( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, string[]> { try { const raw = this.runtime.streamFunction( - "ExtractNames", + 'ExtractNames', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -3856,24 +4159,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + ExtractPeople( - text: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + text: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, Person[]> { try { const raw = this.runtime.streamFunction( - "ExtractPeople", + 'ExtractPeople', { - "text": text + text: text, }, undefined, this.ctx_manager.cloneContext(), @@ -3889,24 +4192,26 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + ExtractReceiptInfo( - email: string,reason: "curiosity" | "personal_finance", - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + email: string, + reason: 'curiosity' | 'personal_finance', + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, ReceiptInfo> { try { const raw = this.runtime.streamFunction( - "ExtractReceiptInfo", + 'ExtractReceiptInfo', { - "email": email,"reason": reason + email: email, + reason: reason, }, undefined, this.ctx_manager.cloneContext(), @@ -3922,24 +4227,26 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + ExtractResume( - resume: string,img?: Image | null, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + resume: string, + img?: Image | null, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, Resume> { try { const raw = this.runtime.streamFunction( - "ExtractResume", + 'ExtractResume', { - "resume": resume,"img": img ?? null + resume: resume, + img: img ?? null, }, undefined, this.ctx_manager.cloneContext(), @@ -3955,24 +4262,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + ExtractResume2( - resume: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + resume: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, Resume> { try { const raw = this.runtime.streamFunction( - "ExtractResume2", + 'ExtractResume2', { - "resume": resume + resume: resume, }, undefined, this.ctx_manager.cloneContext(), @@ -3988,24 +4295,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnClassOptionalOutput( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, ClassOptionalOutput | null> { try { const raw = this.runtime.streamFunction( - "FnClassOptionalOutput", + 'FnClassOptionalOutput', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -4021,24 +4328,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnClassOptionalOutput2( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, ClassOptionalOutput2 | null> { try { const raw = this.runtime.streamFunction( - "FnClassOptionalOutput2", + 'FnClassOptionalOutput2', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -4054,24 +4361,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnEnumListOutput( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, EnumOutput[]> { try { const raw = this.runtime.streamFunction( - "FnEnumListOutput", + 'FnEnumListOutput', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -4087,24 +4394,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnEnumOutput( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, EnumOutput> { try { const raw = this.runtime.streamFunction( - "FnEnumOutput", + 'FnEnumOutput', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -4120,24 +4427,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnLiteralClassInputOutput( - input: LiteralClassHello, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: LiteralClassHello, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, LiteralClassHello> { try { const raw = this.runtime.streamFunction( - "FnLiteralClassInputOutput", + 'FnLiteralClassInputOutput', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -4153,24 +4460,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnLiteralUnionClassInputOutput( - input: LiteralClassOne | LiteralClassTwo, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: LiteralClassOne | LiteralClassTwo, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, LiteralClassOne | LiteralClassTwo> { try { const raw = this.runtime.streamFunction( - "FnLiteralUnionClassInputOutput", + 'FnLiteralUnionClassInputOutput', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -4186,24 +4493,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnNamedArgsSingleStringOptional( - myString?: string | null, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + myString?: string | null, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, string> { try { const raw = this.runtime.streamFunction( - "FnNamedArgsSingleStringOptional", + 'FnNamedArgsSingleStringOptional', { - "myString": myString ?? null + myString: myString ?? null, }, undefined, this.ctx_manager.cloneContext(), @@ -4219,24 +4526,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnOutputBool( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, boolean> { try { const raw = this.runtime.streamFunction( - "FnOutputBool", + 'FnOutputBool', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -4252,24 +4559,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnOutputClass( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, TestOutputClass> { try { const raw = this.runtime.streamFunction( - "FnOutputClass", + 'FnOutputClass', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -4285,24 +4592,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnOutputClassList( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, TestOutputClass[]> { try { const raw = this.runtime.streamFunction( - "FnOutputClassList", + 'FnOutputClassList', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -4318,24 +4625,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnOutputClassNested( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, TestClassNested> { try { const raw = this.runtime.streamFunction( - "FnOutputClassNested", + 'FnOutputClassNested', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -4351,24 +4658,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnOutputClassWithEnum( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, TestClassWithEnum> { try { const raw = this.runtime.streamFunction( - "FnOutputClassWithEnum", + 'FnOutputClassWithEnum', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -4384,24 +4691,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnOutputInt( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, number> { try { const raw = this.runtime.streamFunction( - "FnOutputInt", + 'FnOutputInt', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -4417,24 +4724,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnOutputLiteralBool( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, false> { try { const raw = this.runtime.streamFunction( - "FnOutputLiteralBool", + 'FnOutputLiteralBool', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -4450,24 +4757,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnOutputLiteralInt( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, 5> { try { const raw = this.runtime.streamFunction( - "FnOutputLiteralInt", + 'FnOutputLiteralInt', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -4483,57 +4790,57 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnOutputLiteralString( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, "example output"> { + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, + ): BamlStream, 'example output'> { try { const raw = this.runtime.streamFunction( - "FnOutputLiteralString", + 'FnOutputLiteralString', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) - return new BamlStream, "example output">( + return new BamlStream, 'example output'>( raw, - (a): a is RecursivePartialNull<"example output"> => a, - (a): a is "example output" => a, + (a): a is RecursivePartialNull<'example output'> => a, + (a): a is 'example output' => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnOutputStringList( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, string[]> { try { const raw = this.runtime.streamFunction( - "FnOutputStringList", + 'FnOutputStringList', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -4549,24 +4856,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnTestAliasedEnumOutput( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, TestEnum> { try { const raw = this.runtime.streamFunction( - "FnTestAliasedEnumOutput", + 'FnTestAliasedEnumOutput', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -4582,24 +4889,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnTestClassAlias( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, TestClassAlias> { try { const raw = this.runtime.streamFunction( - "FnTestClassAlias", + 'FnTestClassAlias', { - "input": input + input: input, }, undefined, this.ctx_manager.cloneContext(), @@ -4615,24 +4922,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + FnTestNamedArgsSingleEnum( - myArg: NamedArgsSingleEnum, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + myArg: NamedArgsSingleEnum, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, string> { try { const raw = this.runtime.streamFunction( - "FnTestNamedArgsSingleEnum", + 'FnTestNamedArgsSingleEnum', { - "myArg": myArg + myArg: myArg, }, undefined, this.ctx_manager.cloneContext(), @@ -4648,24 +4955,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + GetDataType( - text: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + text: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, RaysData> { try { const raw = this.runtime.streamFunction( - "GetDataType", + 'GetDataType', { - "text": text + text: text, }, undefined, this.ctx_manager.cloneContext(), @@ -4681,24 +4988,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + GetOrderInfo( - email: Email, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + email: Email, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, OrderInfo> { try { const raw = this.runtime.streamFunction( - "GetOrderInfo", + 'GetOrderInfo', { - "email": email + email: email, }, undefined, this.ctx_manager.cloneContext(), @@ -4714,24 +5021,24 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + GetQuery( - query: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + query: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream, SearchParams> { try { const raw = this.runtime.streamFunction( - "GetQuery", + 'GetQuery', { - "query": query + query: query, }, undefined, this.ctx_manager.cloneContext(), @@ -4747,24 +5054,26 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - + InOutEnumMapKey( - i1: Partial>,i2: Partial>, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + i1: Partial>, + i2: Partial>, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BamlStream>>, Partial>> { try { const raw = this.runtime.streamFunction( - "InOutEnumMapKey", + 'InOutEnumMapKey', { - "i1": i1,"i2": i2 + i1: i1, + i2: i2, }, undefined, this.ctx_manager.cloneContext(), @@ -4780,2061 +5089,2231 @@ class BamlStreamClient { ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - - InOutLiteralStringUnionMapKey( - i1: Partial>,i2: Partial>, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream>>, Partial>> { + + <<<<<<< + HEAD + InOutLiteralIntMapKey( + i1: Partial>, + i2: Partial>, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, + ): BamlStream>>, Partial>> { try { const raw = this.runtime.streamFunction( - "InOutLiteralStringUnionMapKey", + 'InOutLiteralIntMapKey', { - "i1": i1,"i2": i2 + i1: i1, + i2: i2, }, undefined, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) - return new BamlStream>>, Partial>>( + return new BamlStream< + RecursivePartialNull>>, + Partial> + >( raw, - (a): a is RecursivePartialNull>> => a, - (a): a is Partial> => a, + (a): a is RecursivePartialNull>> => a, + (a): a is Partial> => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) } catch (error) { if (error instanceof Error) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } } - throw error; + throw error } } - - InOutSingleLiteralStringMapKey( - m: Partial>, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream>>, Partial>> { - try { - const raw = this.runtime.streamFunction( - "InOutSingleLiteralStringMapKey", - { - "m": m - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream>>, Partial>>( - raw, - (a): a is RecursivePartialNull>> => a, - (a): a is Partial> => a, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), + + InOutLiteralStringMapKey( + ======= + InOutLiteralStringUnionMapKey( + >>>>>>> + canary + i1: Partial>; + , + i2: Partial>; + , + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }; + ): + BamlStream + >>, + Partial + >> { + try { + const + raw = this.runtime.streamFunction( + 'InOutLiteralStringMapKey', + { + i1: i1, + i2: i2, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return + new; + BamlStream + >>, + Partial + >>( + raw; + , + ( + a; + ): + a + is; + RecursivePartialNull + >> => + a; + , + ( + a; + ): + a + is; + Partial + > => + a; + , + this. + ctx_manager; + . + cloneContext() + , + __baml_options__; + ?. + tb; + ?. + __tb() + , ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } - } - throw error; +} +catch (error) +{ + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } } + throw error +} +} LiteralUnionsTest( input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, 1 | true | "string output"> { - try { - const raw = this.runtime.streamFunction( - "LiteralUnionsTest", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, 1 | true | "string output">( + __baml_options__?: +{ + tb?: TypeBuilder, clientRegistry?: ClientRegistry +} +): BamlStream, 1 | true | "string output"> +{ + try { + const raw = this.runtime.streamFunction( + 'LiteralUnionsTest', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, 1 | true | "string output">( raw, (a): a is RecursivePartialNull<1 | true | "string output"> => a, (a): a is 1 | true | "string output" => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - MakeBlockConstraint( +} + +MakeBlockConstraint( __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream>, Checked> { - try { - const raw = this.runtime.streamFunction( - "MakeBlockConstraint", - { - - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream>, Checked>( + ) +: BamlStream>, Checked> +{ + try { + const raw = this.runtime.streamFunction( + 'MakeBlockConstraint', + {}, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream>, Checked>( raw, (a): a is RecursivePartialNull> => a, (a): a is Checked => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - MakeNestedBlockConstraint( +} + +MakeNestedBlockConstraint( __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, NestedBlockConstraint> { - try { - const raw = this.runtime.streamFunction( - "MakeNestedBlockConstraint", - { - - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, NestedBlockConstraint>( + ) +: BamlStream, NestedBlockConstraint> +{ + try { + const raw = this.runtime.streamFunction( + 'MakeNestedBlockConstraint', + {}, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, NestedBlockConstraint>( raw, (a): a is RecursivePartialNull => a, (a): a is NestedBlockConstraint => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - MyFunc( +} + +MyFunc( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, DynamicOutput> { - try { - const raw = this.runtime.streamFunction( - "MyFunc", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, DynamicOutput>( + ) +: BamlStream, DynamicOutput> +{ + try { + const raw = this.runtime.streamFunction( + 'MyFunc', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, DynamicOutput>( raw, (a): a is RecursivePartialNull => a, (a): a is DynamicOutput => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - OptionalTest_Function( +} + +OptionalTest_Function( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, (OptionalTest_ReturnType | null)[]> { - try { - const raw = this.runtime.streamFunction( - "OptionalTest_Function", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, (OptionalTest_ReturnType | null)[]>( + ) +: BamlStream, (OptionalTest_ReturnType | null)[]> +{ + try { + const raw = this.runtime.streamFunction( + 'OptionalTest_Function', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, (OptionalTest_ReturnType | null)[]>( raw, (a): a is RecursivePartialNull<(OptionalTest_ReturnType | null)[]> => a, (a): a is (OptionalTest_ReturnType | null)[] => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - PredictAge( +} + +PredictAge( name: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, FooAny> { - try { - const raw = this.runtime.streamFunction( - "PredictAge", - { - "name": name - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, FooAny>( + ) +: BamlStream, FooAny> +{ + try { + const raw = this.runtime.streamFunction( + 'PredictAge', + { + name: name, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, FooAny>( raw, (a): a is RecursivePartialNull => a, (a): a is FooAny => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } - } - throw error; - } - } - - PredictAgeBare( - inp: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream>, Checked> { - try { - const raw = this.runtime.streamFunction( - "PredictAgeBare", - { - "inp": inp - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream>, Checked>( + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } + } + throw error + } +} + +PredictAgeBare( + inp: string, + __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + ) +: BamlStream>, Checked> +{ + try { + const raw = this.runtime.streamFunction( + 'PredictAgeBare', + { + inp: inp, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream>, Checked>( raw, (a): a is RecursivePartialNull> => a, (a): a is Checked => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - PromptTestClaude( +} + +PromptTestClaude( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "PromptTestClaude", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'PromptTestClaude', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - PromptTestClaudeChat( +} + +PromptTestClaudeChat( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "PromptTestClaudeChat", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'PromptTestClaudeChat', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - PromptTestClaudeChatNoSystem( +} + +PromptTestClaudeChatNoSystem( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "PromptTestClaudeChatNoSystem", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'PromptTestClaudeChatNoSystem', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - PromptTestOpenAI( +} + +PromptTestOpenAI( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "PromptTestOpenAI", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'PromptTestOpenAI', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - PromptTestOpenAIChat( +} + +PromptTestOpenAIChat( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "PromptTestOpenAIChat", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'PromptTestOpenAIChat', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - PromptTestOpenAIChatNoSystem( +} + +PromptTestOpenAIChatNoSystem( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "PromptTestOpenAIChatNoSystem", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'PromptTestOpenAIChatNoSystem', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - PromptTestStreaming( +} + +PromptTestStreaming( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "PromptTestStreaming", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'PromptTestStreaming', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - ReturnFailingAssert( +} + +ReturnFailingAssert( inp: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, number> { - try { - const raw = this.runtime.streamFunction( - "ReturnFailingAssert", - { - "inp": inp - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, number>( + ) +: BamlStream, number> +{ + try { + const raw = this.runtime.streamFunction( + 'ReturnFailingAssert', + { + inp: inp, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, number>( raw, (a): a is RecursivePartialNull => a, (a): a is number => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - ReturnMalformedConstraints( +} + +ReturnMalformedConstraints( a: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, MalformedConstraints> { - try { - const raw = this.runtime.streamFunction( - "ReturnMalformedConstraints", - { - "a": a - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, MalformedConstraints>( + ) +: BamlStream, MalformedConstraints> +{ + try { + const raw = this.runtime.streamFunction( + 'ReturnMalformedConstraints', + { + a: a, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, MalformedConstraints>( raw, (a): a is RecursivePartialNull => a, (a): a is MalformedConstraints => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - SchemaDescriptions( +} + +SchemaDescriptions( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, Schema> { - try { - const raw = this.runtime.streamFunction( - "SchemaDescriptions", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, Schema>( + ) +: BamlStream, Schema> +{ + try { + const raw = this.runtime.streamFunction( + 'SchemaDescriptions', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, Schema>( raw, (a): a is RecursivePartialNull => a, (a): a is Schema => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - StreamBigNumbers( +} + +StreamBigNumbers( digits: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, BigNumbers> { - try { - const raw = this.runtime.streamFunction( - "StreamBigNumbers", - { - "digits": digits - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, BigNumbers>( + ) +: BamlStream, BigNumbers> +{ + try { + const raw = this.runtime.streamFunction( + 'StreamBigNumbers', + { + digits: digits, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, BigNumbers>( raw, (a): a is RecursivePartialNull => a, (a): a is BigNumbers => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - StreamFailingAssertion( +} + +StreamFailingAssertion( theme: string,length: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, TwoStoriesOneTitle> { - try { - const raw = this.runtime.streamFunction( - "StreamFailingAssertion", - { - "theme": theme,"length": length - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, TwoStoriesOneTitle>( + ) +: BamlStream, TwoStoriesOneTitle> +{ + try { + const raw = this.runtime.streamFunction( + 'StreamFailingAssertion', + { + theme: theme, + length: length, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, TwoStoriesOneTitle>( raw, (a): a is RecursivePartialNull => a, (a): a is TwoStoriesOneTitle => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } - } - throw error; - } - } - - StreamOneBigNumber( - digits: number, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, number> { - try { - const raw = this.runtime.streamFunction( - "StreamOneBigNumber", - { - "digits": digits - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, number>( - raw, - (a): a is RecursivePartialNull => a, - (a): a is number => a, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - StreamUnionIntegers( +} + +StreamOneBigNumber( digits: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, (number | string)[]> { - try { - const raw = this.runtime.streamFunction( - "StreamUnionIntegers", - { - "digits": digits - }, - undefined, + ) +: BamlStream, number> +{ + try { + const raw = this.runtime.streamFunction( + 'StreamOneBigNumber', + { + digits: digits, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, number>( + raw, + (a): a is RecursivePartialNull => a, + (a): a is number => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, ) - return new BamlStream, (number | string)[]>( + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } + } + throw error + } +} + +StreamUnionIntegers( + digits: number, + __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + ) +: BamlStream, (number | string)[]> +{ + try { + const raw = this.runtime.streamFunction( + 'StreamUnionIntegers', + { + digits: digits, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, (number | string)[]>( raw, (a): a is RecursivePartialNull<(number | string)[]> => a, (a): a is (number | string)[] => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - StreamingCompoundNumbers( +} + +StreamingCompoundNumbers( digits: number,yapping: boolean, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, CompoundBigNumbers> { - try { - const raw = this.runtime.streamFunction( - "StreamingCompoundNumbers", - { - "digits": digits,"yapping": yapping - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, CompoundBigNumbers>( + ) +: BamlStream, CompoundBigNumbers> +{ + try { + const raw = this.runtime.streamFunction( + 'StreamingCompoundNumbers', + { + digits: digits, + yapping: yapping, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, CompoundBigNumbers>( raw, (a): a is RecursivePartialNull => a, (a): a is CompoundBigNumbers => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestAnthropic( +} + +TestAnthropic( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestAnthropic", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestAnthropic', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestAnthropicShorthand( +} + +TestAnthropicShorthand( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestAnthropicShorthand", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestAnthropicShorthand', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestAws( +} + +TestAws( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestAws", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestAws', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestAwsInvalidRegion( +} + +TestAwsInvalidRegion( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestAwsInvalidRegion", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestAwsInvalidRegion', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestAzure( +} + +TestAzure( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestAzure", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestAzure', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestCaching( +} + +TestCaching( input: string,not_cached: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestCaching", - { - "input": input,"not_cached": not_cached - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestCaching', + { + input: input, + not_cached: not_cached, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestFallbackClient( +} + +TestFallbackClient( __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestFallbackClient", - { - - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestFallbackClient', + {}, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestFallbackToShorthand( +} + +TestFallbackToShorthand( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestFallbackToShorthand", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestFallbackToShorthand', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestFnNamedArgsSingleBool( +} + +TestFnNamedArgsSingleBool( myBool: boolean, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestFnNamedArgsSingleBool", - { - "myBool": myBool - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestFnNamedArgsSingleBool', + { + myBool: myBool, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestFnNamedArgsSingleClass( +} + +TestFnNamedArgsSingleClass( myArg: NamedArgsSingleClass, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestFnNamedArgsSingleClass", - { - "myArg": myArg - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestFnNamedArgsSingleClass', + { + myArg: myArg, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestFnNamedArgsSingleEnumList( +} + +TestFnNamedArgsSingleEnumList( myArg: NamedArgsSingleEnumList[], __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestFnNamedArgsSingleEnumList", - { - "myArg": myArg - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestFnNamedArgsSingleEnumList', + { + myArg: myArg, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestFnNamedArgsSingleFloat( +} + +TestFnNamedArgsSingleFloat( myFloat: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestFnNamedArgsSingleFloat", - { - "myFloat": myFloat - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestFnNamedArgsSingleFloat', + { + myFloat: myFloat, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestFnNamedArgsSingleInt( +} + +TestFnNamedArgsSingleInt( myInt: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestFnNamedArgsSingleInt", - { - "myInt": myInt - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestFnNamedArgsSingleInt', + { + myInt: myInt, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestFnNamedArgsSingleMapStringToClass( +} + +TestFnNamedArgsSingleMapStringToClass( myMap: Record, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream>, Record> { - try { - const raw = this.runtime.streamFunction( - "TestFnNamedArgsSingleMapStringToClass", - { - "myMap": myMap - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream>, Record>( + ) +: BamlStream>, Record> +{ + try { + const raw = this.runtime.streamFunction( + 'TestFnNamedArgsSingleMapStringToClass', + { + myMap: myMap, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream>, Record>( raw, (a): a is RecursivePartialNull> => a, (a): a is Record => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestFnNamedArgsSingleMapStringToMap( +} + +TestFnNamedArgsSingleMapStringToMap( myMap: Record>, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream>>, Record>> { - try { - const raw = this.runtime.streamFunction( - "TestFnNamedArgsSingleMapStringToMap", - { - "myMap": myMap - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream>>, Record>>( + ) +: BamlStream>>, Record>> +{ + try { + const raw = this.runtime.streamFunction( + 'TestFnNamedArgsSingleMapStringToMap', + { + myMap: myMap, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream>>, Record>>( raw, (a): a is RecursivePartialNull>> => a, (a): a is Record> => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestFnNamedArgsSingleMapStringToString( +} + +TestFnNamedArgsSingleMapStringToString( myMap: Record, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream>, Record> { - try { - const raw = this.runtime.streamFunction( - "TestFnNamedArgsSingleMapStringToString", - { - "myMap": myMap - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream>, Record>( + ) +: BamlStream>, Record> +{ + try { + const raw = this.runtime.streamFunction( + 'TestFnNamedArgsSingleMapStringToString', + { + myMap: myMap, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream>, Record>( raw, (a): a is RecursivePartialNull> => a, (a): a is Record => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestFnNamedArgsSingleString( +} + +TestFnNamedArgsSingleString( myString: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestFnNamedArgsSingleString", - { - "myString": myString - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestFnNamedArgsSingleString', + { + myString: myString, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestFnNamedArgsSingleStringArray( +} + +TestFnNamedArgsSingleStringArray( myStringArray: string[], __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestFnNamedArgsSingleStringArray", - { - "myStringArray": myStringArray - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestFnNamedArgsSingleStringArray', + { + myStringArray: myStringArray, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestFnNamedArgsSingleStringList( +} + +TestFnNamedArgsSingleStringList( myArg: string[], __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestFnNamedArgsSingleStringList", - { - "myArg": myArg - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestFnNamedArgsSingleStringList', + { + myArg: myArg, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestGemini( +} + +TestGemini( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestGemini", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestGemini', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestImageInput( +} + +TestImageInput( img: Image, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestImageInput", - { - "img": img - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestImageInput', + { + img: img, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestImageInputAnthropic( +} + +TestImageInputAnthropic( img: Image, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestImageInputAnthropic", - { - "img": img - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestImageInputAnthropic', + { + img: img, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestImageListInput( +} + +TestImageListInput( imgs: Image[], __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestImageListInput", - { - "imgs": imgs - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestImageListInput', + { + imgs: imgs, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestMulticlassNamedArgs( +} + +TestMulticlassNamedArgs( myArg: NamedArgsSingleClass,myArg2: NamedArgsSingleClass, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestMulticlassNamedArgs", - { - "myArg": myArg,"myArg2": myArg2 - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestMulticlassNamedArgs', + { + myArg: myArg, + myArg2: myArg2, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestNamedArgsLiteralBool( - myBool: true, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestNamedArgsLiteralBool", - { - "myBool": myBool - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( +} + +TestNamedArgsLiteralBool( + myBool: true, + __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestNamedArgsLiteralBool', + { + myBool: myBool, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestNamedArgsLiteralInt( +} + +TestNamedArgsLiteralInt( myInt: 1, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestNamedArgsLiteralInt", - { - "myInt": myInt - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestNamedArgsLiteralInt', + { + myInt: myInt, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestNamedArgsLiteralString( +} + +TestNamedArgsLiteralString( myString: "My String", __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestNamedArgsLiteralString", - { - "myString": myString - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestNamedArgsLiteralString', + { + myString: myString, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestOllama( +} + +TestOllama( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestOllama", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestOllama', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestOpenAILegacyProvider( +} + +TestOpenAILegacyProvider( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestOpenAILegacyProvider", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestOpenAILegacyProvider', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestOpenAIShorthand( +} + +TestOpenAIShorthand( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestOpenAIShorthand", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestOpenAIShorthand', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestRetryConstant( +} + +TestRetryConstant( __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestRetryConstant", - { - - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestRetryConstant', + {}, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestRetryExponential( +} + +TestRetryExponential( __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestRetryExponential", - { - - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestRetryExponential', + {}, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestSingleFallbackClient( +} + +TestSingleFallbackClient( __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestSingleFallbackClient", - { - - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestSingleFallbackClient', + {}, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - TestVertex( +} + +TestVertex( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, string> { - try { - const raw = this.runtime.streamFunction( - "TestVertex", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, string>( + ) +: BamlStream, string> +{ + try { + const raw = this.runtime.streamFunction( + 'TestVertex', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, string>( raw, (a): a is RecursivePartialNull => a, (a): a is string => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - UnionTest_Function( +} + +UnionTest_Function( input: string | boolean, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, UnionTest_ReturnType> { - try { - const raw = this.runtime.streamFunction( - "UnionTest_Function", - { - "input": input - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, UnionTest_ReturnType>( + ) +: BamlStream, UnionTest_ReturnType> +{ + try { + const raw = this.runtime.streamFunction( + 'UnionTest_Function', + { + input: input, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, UnionTest_ReturnType>( raw, (a): a is RecursivePartialNull => a, (a): a is UnionTest_ReturnType => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - UseBlockConstraint( +} + +UseBlockConstraint( inp: BlockConstraintForParam, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, number> { - try { - const raw = this.runtime.streamFunction( - "UseBlockConstraint", - { - "inp": inp - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, number>( + ) +: BamlStream, number> +{ + try { + const raw = this.runtime.streamFunction( + 'UseBlockConstraint', + { + inp: inp, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, number>( raw, (a): a is RecursivePartialNull => a, (a): a is number => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - UseMalformedConstraints( +} + +UseMalformedConstraints( a: MalformedConstraints2, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, number> { - try { - const raw = this.runtime.streamFunction( - "UseMalformedConstraints", - { - "a": a - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, number>( + ) +: BamlStream, number> +{ + try { + const raw = this.runtime.streamFunction( + 'UseMalformedConstraints', + { + a: a, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, number>( raw, (a): a is RecursivePartialNull => a, (a): a is number => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - - UseNestedBlockConstraint( +} + +UseNestedBlockConstraint( inp: NestedBlockConstraintForParam, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BamlStream, number> { - try { - const raw = this.runtime.streamFunction( - "UseNestedBlockConstraint", - { - "inp": inp - }, - undefined, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return new BamlStream, number>( + ) +: BamlStream, number> +{ + try { + const raw = this.runtime.streamFunction( + 'UseNestedBlockConstraint', + { + inp: inp, + }, + undefined, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return new BamlStream, number>( raw, (a): a is RecursivePartialNull => a, (a): a is number => a, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), ) - } catch (error) { - if (error instanceof Error) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } + } catch (error) { + if (error instanceof Error) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError } - throw error; } + throw error } - } -export const b = new BamlAsyncClient(DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_RUNTIME, DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX) \ No newline at end of file +} + +export const b = new BamlAsyncClient( + DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_RUNTIME, + DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX, +) diff --git a/integ-tests/typescript/baml_client/inlinedbaml.ts b/integ-tests/typescript/baml_client/inlinedbaml.ts index 439752eaa..4743c4ef7 100644 --- a/integ-tests/typescript/baml_client/inlinedbaml.ts +++ b/integ-tests/typescript/baml_client/inlinedbaml.ts @@ -76,7 +76,7 @@ const fileMap = { "test-files/functions/output/literal-string.baml": "function FnOutputLiteralString(input: string) -> \"example output\" {\n client GPT35\n prompt #\"\n Return a string: {{ ctx.output_format}}\n \"#\n}\n\ntest FnOutputLiteralString {\n functions [FnOutputLiteralString]\n args {\n input \"example input\"\n }\n}\n", "test-files/functions/output/literal-unions.baml": "function LiteralUnionsTest(input: string) -> 1 | true | \"string output\" {\n client GPT35\n prompt #\"\n Return one of these values: \n {{ctx.output_format}}\n \"#\n}\n\ntest LiteralUnionsTest {\n functions [LiteralUnionsTest]\n args {\n input \"example input\"\n }\n}\n", "test-files/functions/output/map-enum-key.baml": "enum MapKey {\n A\n B\n C\n}\n\nfunction InOutEnumMapKey(i1: map, i2: map) -> map {\n client \"openai/gpt-4o\"\n prompt #\"\n Merge these: {{i1}} {{i2}}\n\n {{ ctx.output_format }}\n \"#\n}\n", - "test-files/functions/output/map-literal-union-key.baml": "function InOutLiteralStringUnionMapKey(\n i1: map<\"one\" | \"two\" | (\"three\" | \"four\"), string>, \n i2: map<\"one\" | \"two\" | (\"three\" | \"four\"), string>\n) -> map<\"one\" | \"two\" | (\"three\" | \"four\"), string> {\n client \"openai/gpt-4o\"\n prompt #\"\n Merge these:\n \n {{i1}}\n \n {{i2}}\n\n {{ ctx.output_format }}\n \"#\n}\n\nfunction InOutSingleLiteralStringMapKey(m: map<\"key\", string>) -> map<\"key\", string> {\n client \"openai/gpt-4o\"\n prompt #\"\n Return the same map you were given:\n \n {{m}}\n\n {{ ctx.output_format }}\n \"#\n}\n", + "test-files/functions/output/map-literal-union-key.baml": "function InOutLiteralStringMapKey(\n i1: map<\"one\" | \"two\" | (\"three\" | \"four\"), string>, \n i2: map<\"one\" | \"two\" | (\"three\" | \"four\"), string>\n) -> map<\"one\" | \"two\" | (\"three\" | \"four\"), string> {\n client \"openai/gpt-4o\"\n prompt #\"\n Merge these:\n \n {{i1}}\n \n {{i2}}\n\n {{ ctx.output_format }}\n \"#\n}\n\nfunction InOutLiteralIntMapKey(\n i1: map<1 | 2 | (3 | 4), string>, \n i2: map<1 | 2 | (3 | 4), string>\n) -> map<1 | 2 | (3 | 4), string> {\n client \"openai/gpt-4o\"\n prompt #\"\n Merge these:\n \n {{i1}}\n \n {{i2}}\n\n {{ ctx.output_format }}\n \"#\n}\n", "test-files/functions/output/mutually-recursive-classes.baml": "class Tree {\n data int\n children Forest\n}\n\nclass Forest {\n trees Tree[]\n}\n\nclass BinaryNode {\n data int\n left BinaryNode?\n right BinaryNode?\n}\n\nfunction BuildTree(input: BinaryNode) -> Tree {\n client GPT35\n prompt #\"\n Given the input binary tree, transform it into a generic tree using the given schema.\n\n INPUT:\n {{ input }}\n\n {{ ctx.output_format }} \n \"#\n}\n\ntest TestTree {\n functions [BuildTree]\n args {\n input {\n data 2\n left {\n data 1\n left null\n right null\n }\n right {\n data 3\n left null\n right null\n }\n }\n }\n}", "test-files/functions/output/optional-class.baml": "class ClassOptionalOutput {\n prop1 string\n prop2 string\n}\n\nfunction FnClassOptionalOutput(input: string) -> ClassOptionalOutput? {\n client GPT35\n prompt #\"\n Return a json blob for the following input:\n {{input}}\n\n {{ctx.output_format}}\n\n JSON:\n \"#\n}\n\n\nclass Blah {\n prop4 string?\n}\n\nclass ClassOptionalOutput2 {\n prop1 string?\n prop2 string?\n prop3 Blah?\n}\n\nfunction FnClassOptionalOutput2(input: string) -> ClassOptionalOutput2? {\n client GPT35\n prompt #\"\n Return a json blob for the following input:\n {{input}}\n\n {{ctx.output_format}}\n\n JSON:\n \"#\n}\n\ntest FnClassOptionalOutput2 {\n functions [FnClassOptionalOutput2, FnClassOptionalOutput]\n args {\n input \"example input\"\n }\n}\n", "test-files/functions/output/optional.baml": "class OptionalTest_Prop1 {\n omega_a string\n omega_b int\n}\n\nenum OptionalTest_CategoryType {\n Aleph\n Beta\n Gamma\n}\n \nclass OptionalTest_ReturnType {\n omega_1 OptionalTest_Prop1?\n omega_2 string?\n omega_3 (OptionalTest_CategoryType?)[]\n} \n \nfunction OptionalTest_Function(input: string) -> (OptionalTest_ReturnType?)[]\n{ \n client GPT35\n prompt #\"\n Return a JSON blob with this schema: \n {{ctx.output_format}}\n\n JSON:\n \"#\n}\n\ntest OptionalTest_Function {\n functions [OptionalTest_Function]\n args {\n input \"example input\"\n }\n}\n", diff --git a/integ-tests/typescript/baml_client/sync_client.ts b/integ-tests/typescript/baml_client/sync_client.ts index 2cc0e6f65..174eb59f7 100644 --- a/integ-tests/typescript/baml_client/sync_client.ts +++ b/integ-tests/typescript/baml_client/sync_client.ts @@ -16,2958 +16,3142 @@ $ pnpm add @boundaryml/baml // @ts-nocheck // biome-ignore format: autogenerated code import { BamlRuntime, FunctionResult, BamlCtxManager, BamlSyncStream, Image, ClientRegistry, createBamlValidationError, BamlValidationError } from "@boundaryml/baml" -import { Checked, Check } from "./types" -import {BigNumbers, BinaryNode, Blah, BlockConstraint, BlockConstraintForParam, BookOrder, ClassOptionalOutput, ClassOptionalOutput2, ClassWithImage, CompoundBigNumbers, ContactInfo, CustomTaskResult, DummyOutput, DynInputOutput, DynamicClassOne, DynamicClassTwo, DynamicOutput, Earthling, Education, Email, EmailAddress, Event, FakeImage, FlightConfirmation, FooAny, Forest, GroceryReceipt, InnerClass, InnerClass2, InputClass, InputClassNested, LinkedList, LiteralClassHello, LiteralClassOne, LiteralClassTwo, MalformedConstraints, MalformedConstraints2, Martian, NamedArgsSingleClass, Nested, Nested2, NestedBlockConstraint, NestedBlockConstraintForParam, Node, OptionalTest_Prop1, OptionalTest_ReturnType, OrderInfo, OriginalA, OriginalB, Person, PhoneNumber, Quantity, RaysData, ReceiptInfo, ReceiptItem, Recipe, Resume, Schema, SearchParams, SomeClassNestedDynamic, StringToClassEntry, TestClassAlias, TestClassNested, TestClassWithEnum, TestOutputClass, Tree, TwoStoriesOneTitle, UnionTest_ReturnType, WithReasoning, AliasedEnum, Category, Category2, Category3, Color, DataType, DynEnumOne, DynEnumTwo, EnumInClass, EnumOutput, Hobby, MapKey, NamedArgsSingleEnum, NamedArgsSingleEnumList, OptionalTest_CategoryType, OrderStatus, Tag, TestEnum} from "./types" -import TypeBuilder from "./type_builder" -import { DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX, DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_RUNTIME } from "./globals" +import { Checked, Check } from './types' +import { + BigNumbers, + BinaryNode, + Blah, + BlockConstraint, + BlockConstraintForParam, + BookOrder, + ClassOptionalOutput, + ClassOptionalOutput2, + ClassWithImage, + CompoundBigNumbers, + ContactInfo, + CustomTaskResult, + DummyOutput, + DynInputOutput, + DynamicClassOne, + DynamicClassTwo, + DynamicOutput, + Earthling, + Education, + Email, + EmailAddress, + Event, + FakeImage, + FlightConfirmation, + FooAny, + Forest, + GroceryReceipt, + InnerClass, + InnerClass2, + InputClass, + InputClassNested, + LinkedList, + LiteralClassHello, + LiteralClassOne, + LiteralClassTwo, + MalformedConstraints, + MalformedConstraints2, + Martian, + NamedArgsSingleClass, + Nested, + Nested2, + NestedBlockConstraint, + NestedBlockConstraintForParam, + Node, + OptionalTest_Prop1, + OptionalTest_ReturnType, + OrderInfo, + OriginalA, + OriginalB, + Person, + PhoneNumber, + Quantity, + RaysData, + ReceiptInfo, + ReceiptItem, + Recipe, + Resume, + Schema, + SearchParams, + SomeClassNestedDynamic, + StringToClassEntry, + TestClassAlias, + TestClassNested, + TestClassWithEnum, + TestOutputClass, + Tree, + TwoStoriesOneTitle, + UnionTest_ReturnType, + WithReasoning, + AliasedEnum, + Category, + Category2, + Category3, + Color, + DataType, + DynEnumOne, + DynEnumTwo, + EnumInClass, + EnumOutput, + Hobby, + MapKey, + NamedArgsSingleEnum, + NamedArgsSingleEnumList, + OptionalTest_CategoryType, + OrderStatus, + Tag, + TestEnum, +} from './types' +import TypeBuilder from './type_builder' +import { + DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX, + DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_RUNTIME, +} from './globals' export type RecursivePartialNull = T extends object ? { - [P in keyof T]?: RecursivePartialNull; + [P in keyof T]?: RecursivePartialNull } - : T | null; + : T | null export class BamlSyncClient { private runtime: BamlRuntime private ctx_manager: BamlCtxManager - constructor(private runtime: BamlRuntime, private ctx_manager: BamlCtxManager) {} + constructor( + private runtime: BamlRuntime, + private ctx_manager: BamlCtxManager, + ) {} /* - * @deprecated NOT IMPLEMENTED as streaming must by async. We - * are not providing an async version as we want to reserve the - * right to provide a sync version in the future. - */ + * @deprecated NOT IMPLEMENTED as streaming must by async. We + * are not providing an async version as we want to reserve the + * right to provide a sync version in the future. + */ get stream() { throw new Error("stream is not available in BamlSyncClient. Use `import { b } from 'baml_client/async_client") - } + } - - AaaSamOutputFormat( - recipe: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Recipe { + AaaSamOutputFormat(recipe: string, __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): Recipe { try { - const raw = this.runtime.callFunctionSync( - "AaaSamOutputFormat", - { - "recipe": recipe - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as Recipe + const raw = this.runtime.callFunctionSync( + 'AaaSamOutputFormat', + { + recipe: recipe, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as Recipe } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + AliasedInputClass( - input: InputClass, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: InputClass, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): string { try { - const raw = this.runtime.callFunctionSync( - "AliasedInputClass", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string + const raw = this.runtime.callFunctionSync( + 'AliasedInputClass', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + AliasedInputClass2( - input: InputClass, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: InputClass, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): string { try { - const raw = this.runtime.callFunctionSync( - "AliasedInputClass2", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string + const raw = this.runtime.callFunctionSync( + 'AliasedInputClass2', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + AliasedInputClassNested( - input: InputClassNested, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: InputClassNested, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): string { try { - const raw = this.runtime.callFunctionSync( - "AliasedInputClassNested", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string + const raw = this.runtime.callFunctionSync( + 'AliasedInputClassNested', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + AliasedInputEnum( - input: AliasedEnum, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: AliasedEnum, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): string { try { - const raw = this.runtime.callFunctionSync( - "AliasedInputEnum", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string + const raw = this.runtime.callFunctionSync( + 'AliasedInputEnum', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + AliasedInputList( - input: AliasedEnum[], - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: AliasedEnum[], + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): string { try { - const raw = this.runtime.callFunctionSync( - "AliasedInputList", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string + const raw = this.runtime.callFunctionSync( + 'AliasedInputList', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - AudioInput( - aud: Audio, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { + + AudioInput(aud: Audio, __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): string { try { - const raw = this.runtime.callFunctionSync( - "AudioInput", - { - "aud": aud - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string + const raw = this.runtime.callFunctionSync( + 'AudioInput', + { + aud: aud, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + BuildLinkedList( - input: number[], - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: number[], + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): LinkedList { try { - const raw = this.runtime.callFunctionSync( - "BuildLinkedList", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as LinkedList + const raw = this.runtime.callFunctionSync( + 'BuildLinkedList', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as LinkedList } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - BuildTree( - input: BinaryNode, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Tree { + + BuildTree(input: BinaryNode, __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): Tree { try { - const raw = this.runtime.callFunctionSync( - "BuildTree", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as Tree + const raw = this.runtime.callFunctionSync( + 'BuildTree', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as Tree } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + ClassifyDynEnumTwo( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): (string | DynEnumTwo) { + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, + ): string | DynEnumTwo { try { - const raw = this.runtime.callFunctionSync( - "ClassifyDynEnumTwo", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as (string | DynEnumTwo) + const raw = this.runtime.callFunctionSync( + 'ClassifyDynEnumTwo', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string | DynEnumTwo } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - ClassifyMessage( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Category { + + ClassifyMessage(input: string, __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): Category { try { - const raw = this.runtime.callFunctionSync( - "ClassifyMessage", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as Category + const raw = this.runtime.callFunctionSync( + 'ClassifyMessage', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as Category } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - ClassifyMessage2( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Category { + + ClassifyMessage2(input: string, __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): Category { try { - const raw = this.runtime.callFunctionSync( - "ClassifyMessage2", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as Category + const raw = this.runtime.callFunctionSync( + 'ClassifyMessage2', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as Category } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - ClassifyMessage3( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Category { + + ClassifyMessage3(input: string, __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): Category { try { - const raw = this.runtime.callFunctionSync( - "ClassifyMessage3", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as Category + const raw = this.runtime.callFunctionSync( + 'ClassifyMessage3', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as Category } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + CustomTask( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): BookOrder | FlightConfirmation | GroceryReceipt { try { - const raw = this.runtime.callFunctionSync( - "CustomTask", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as BookOrder | FlightConfirmation | GroceryReceipt + const raw = this.runtime.callFunctionSync( + 'CustomTask', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as BookOrder | FlightConfirmation | GroceryReceipt } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - DescribeImage( - img: Image, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { + + DescribeImage(img: Image, __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): string { try { - const raw = this.runtime.callFunctionSync( - "DescribeImage", - { - "img": img - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string + const raw = this.runtime.callFunctionSync( + 'DescribeImage', + { + img: img, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + DescribeImage2( - classWithImage: ClassWithImage,img2: Image, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + classWithImage: ClassWithImage, + img2: Image, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): string { try { - const raw = this.runtime.callFunctionSync( - "DescribeImage2", - { - "classWithImage": classWithImage,"img2": img2 - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string + const raw = this.runtime.callFunctionSync( + 'DescribeImage2', + { + classWithImage: classWithImage, + img2: img2, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + DescribeImage3( - classWithImage: ClassWithImage,img2: Image, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + classWithImage: ClassWithImage, + img2: Image, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): string { try { - const raw = this.runtime.callFunctionSync( - "DescribeImage3", - { - "classWithImage": classWithImage,"img2": img2 - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string + const raw = this.runtime.callFunctionSync( + 'DescribeImage3', + { + classWithImage: classWithImage, + img2: img2, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + DescribeImage4( - classWithImage: ClassWithImage,img2: Image, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + classWithImage: ClassWithImage, + img2: Image, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): string { try { - const raw = this.runtime.callFunctionSync( - "DescribeImage4", - { - "classWithImage": classWithImage,"img2": img2 - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string + const raw = this.runtime.callFunctionSync( + 'DescribeImage4', + { + classWithImage: classWithImage, + img2: img2, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - DifferentiateUnions( - - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): OriginalA | OriginalB { + + DifferentiateUnions(__baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): OriginalA | OriginalB { try { - const raw = this.runtime.callFunctionSync( - "DifferentiateUnions", - { - - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as OriginalA | OriginalB + const raw = this.runtime.callFunctionSync( + 'DifferentiateUnions', + {}, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as OriginalA | OriginalB } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + DummyOutputFunction( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): DummyOutput { try { - const raw = this.runtime.callFunctionSync( - "DummyOutputFunction", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as DummyOutput + const raw = this.runtime.callFunctionSync( + 'DummyOutputFunction', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as DummyOutput } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + DynamicFunc( - input: DynamicClassOne, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: DynamicClassOne, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): DynamicClassTwo { try { - const raw = this.runtime.callFunctionSync( - "DynamicFunc", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as DynamicClassTwo + const raw = this.runtime.callFunctionSync( + 'DynamicFunc', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as DynamicClassTwo } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + DynamicInputOutput( - input: DynInputOutput, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: DynInputOutput, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): DynInputOutput { try { - const raw = this.runtime.callFunctionSync( - "DynamicInputOutput", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as DynInputOutput + const raw = this.runtime.callFunctionSync( + 'DynamicInputOutput', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as DynInputOutput } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + DynamicListInputOutput( - input: DynInputOutput[], - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: DynInputOutput[], + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): DynInputOutput[] { try { - const raw = this.runtime.callFunctionSync( - "DynamicListInputOutput", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as DynInputOutput[] + const raw = this.runtime.callFunctionSync( + 'DynamicListInputOutput', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as DynInputOutput[] } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - ExpectFailure( - - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { + + ExpectFailure(__baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): string { try { - const raw = this.runtime.callFunctionSync( - "ExpectFailure", - { - - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string + const raw = this.runtime.callFunctionSync( + 'ExpectFailure', + {}, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + ExtractContactInfo( - document: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + document: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): ContactInfo { try { - const raw = this.runtime.callFunctionSync( - "ExtractContactInfo", - { - "document": document - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as ContactInfo + const raw = this.runtime.callFunctionSync( + 'ExtractContactInfo', + { + document: document, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as ContactInfo } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + ExtractHobby( - text: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + text: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): (string | Hobby)[] { try { - const raw = this.runtime.callFunctionSync( - "ExtractHobby", - { - "text": text - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as (string | Hobby)[] + const raw = this.runtime.callFunctionSync( + 'ExtractHobby', + { + text: text, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as (string | Hobby)[] } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - ExtractNames( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string[] { + + ExtractNames(input: string, __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): string[] { try { - const raw = this.runtime.callFunctionSync( - "ExtractNames", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string[] + const raw = this.runtime.callFunctionSync( + 'ExtractNames', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string[] } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - ExtractPeople( - text: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Person[] { + + ExtractPeople(text: string, __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): Person[] { try { - const raw = this.runtime.callFunctionSync( - "ExtractPeople", - { - "text": text - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as Person[] + const raw = this.runtime.callFunctionSync( + 'ExtractPeople', + { + text: text, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as Person[] } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + ExtractReceiptInfo( - email: string,reason: "curiosity" | "personal_finance", - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + email: string, + reason: 'curiosity' | 'personal_finance', + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): ReceiptInfo { try { - const raw = this.runtime.callFunctionSync( - "ExtractReceiptInfo", - { - "email": email,"reason": reason - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as ReceiptInfo + const raw = this.runtime.callFunctionSync( + 'ExtractReceiptInfo', + { + email: email, + reason: reason, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as ReceiptInfo } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + ExtractResume( - resume: string,img?: Image | null, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + resume: string, + img?: Image | null, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Resume { try { - const raw = this.runtime.callFunctionSync( - "ExtractResume", - { - "resume": resume,"img": img?? null - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as Resume + const raw = this.runtime.callFunctionSync( + 'ExtractResume', + { + resume: resume, + img: img ?? null, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as Resume } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - ExtractResume2( - resume: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Resume { + + ExtractResume2(resume: string, __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): Resume { try { - const raw = this.runtime.callFunctionSync( - "ExtractResume2", - { - "resume": resume - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as Resume + const raw = this.runtime.callFunctionSync( + 'ExtractResume2', + { + resume: resume, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as Resume } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + FnClassOptionalOutput( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): ClassOptionalOutput | null { try { - const raw = this.runtime.callFunctionSync( - "FnClassOptionalOutput", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as ClassOptionalOutput | null + const raw = this.runtime.callFunctionSync( + 'FnClassOptionalOutput', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as ClassOptionalOutput | null } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + FnClassOptionalOutput2( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): ClassOptionalOutput2 | null { try { - const raw = this.runtime.callFunctionSync( - "FnClassOptionalOutput2", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as ClassOptionalOutput2 | null + const raw = this.runtime.callFunctionSync( + 'FnClassOptionalOutput2', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as ClassOptionalOutput2 | null } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + FnEnumListOutput( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): EnumOutput[] { try { - const raw = this.runtime.callFunctionSync( - "FnEnumListOutput", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as EnumOutput[] + const raw = this.runtime.callFunctionSync( + 'FnEnumListOutput', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as EnumOutput[] } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - FnEnumOutput( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): EnumOutput { + + FnEnumOutput(input: string, __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): EnumOutput { try { - const raw = this.runtime.callFunctionSync( - "FnEnumOutput", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as EnumOutput + const raw = this.runtime.callFunctionSync( + 'FnEnumOutput', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as EnumOutput } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + FnLiteralClassInputOutput( - input: LiteralClassHello, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: LiteralClassHello, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): LiteralClassHello { try { - const raw = this.runtime.callFunctionSync( - "FnLiteralClassInputOutput", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as LiteralClassHello + const raw = this.runtime.callFunctionSync( + 'FnLiteralClassInputOutput', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as LiteralClassHello } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + FnLiteralUnionClassInputOutput( - input: LiteralClassOne | LiteralClassTwo, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: LiteralClassOne | LiteralClassTwo, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): LiteralClassOne | LiteralClassTwo { - try { - const raw = this.runtime.callFunctionSync( - "FnLiteralUnionClassInputOutput", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as LiteralClassOne | LiteralClassTwo + try { + const raw = this.runtime.callFunctionSync( + 'FnLiteralUnionClassInputOutput', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as LiteralClassOne | LiteralClassTwo } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + FnNamedArgsSingleStringOptional( - myString?: string | null, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + myString?: string | null, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): string { try { - const raw = this.runtime.callFunctionSync( - "FnNamedArgsSingleStringOptional", - { - "myString": myString?? null - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string + const raw = this.runtime.callFunctionSync( + 'FnNamedArgsSingleStringOptional', + { + myString: myString ?? null, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - FnOutputBool( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): boolean { + + FnOutputBool(input: string, __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): boolean { try { - const raw = this.runtime.callFunctionSync( - "FnOutputBool", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as boolean + const raw = this.runtime.callFunctionSync( + 'FnOutputBool', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as boolean } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + FnOutputClass( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): TestOutputClass { try { - const raw = this.runtime.callFunctionSync( - "FnOutputClass", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as TestOutputClass + const raw = this.runtime.callFunctionSync( + 'FnOutputClass', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as TestOutputClass } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + FnOutputClassList( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): TestOutputClass[] { try { - const raw = this.runtime.callFunctionSync( - "FnOutputClassList", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as TestOutputClass[] + const raw = this.runtime.callFunctionSync( + 'FnOutputClassList', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as TestOutputClass[] } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + FnOutputClassNested( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): TestClassNested { try { - const raw = this.runtime.callFunctionSync( - "FnOutputClassNested", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as TestClassNested + const raw = this.runtime.callFunctionSync( + 'FnOutputClassNested', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as TestClassNested } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + FnOutputClassWithEnum( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): TestClassWithEnum { try { - const raw = this.runtime.callFunctionSync( - "FnOutputClassWithEnum", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as TestClassWithEnum + const raw = this.runtime.callFunctionSync( + 'FnOutputClassWithEnum', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as TestClassWithEnum } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - FnOutputInt( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): number { + + FnOutputInt(input: string, __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): number { try { - const raw = this.runtime.callFunctionSync( - "FnOutputInt", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as number + const raw = this.runtime.callFunctionSync( + 'FnOutputInt', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as number } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - FnOutputLiteralBool( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): false { + + FnOutputLiteralBool(input: string, __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): false { try { - const raw = this.runtime.callFunctionSync( - "FnOutputLiteralBool", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as false + const raw = this.runtime.callFunctionSync( + 'FnOutputLiteralBool', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as false } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - FnOutputLiteralInt( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): 5 { + + FnOutputLiteralInt(input: string, __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): 5 { try { - const raw = this.runtime.callFunctionSync( - "FnOutputLiteralInt", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as 5 + const raw = this.runtime.callFunctionSync( + 'FnOutputLiteralInt', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as 5 } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + FnOutputLiteralString( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): "example output" { + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, + ): 'example output' { try { - const raw = this.runtime.callFunctionSync( - "FnOutputLiteralString", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as "example output" + const raw = this.runtime.callFunctionSync( + 'FnOutputLiteralString', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as 'example output' } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + FnOutputStringList( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): string[] { try { - const raw = this.runtime.callFunctionSync( - "FnOutputStringList", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string[] + const raw = this.runtime.callFunctionSync( + 'FnOutputStringList', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string[] } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + FnTestAliasedEnumOutput( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): TestEnum { try { - const raw = this.runtime.callFunctionSync( - "FnTestAliasedEnumOutput", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as TestEnum + const raw = this.runtime.callFunctionSync( + 'FnTestAliasedEnumOutput', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as TestEnum } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + FnTestClassAlias( - input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + input: string, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): TestClassAlias { try { - const raw = this.runtime.callFunctionSync( - "FnTestClassAlias", - { - "input": input - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as TestClassAlias + const raw = this.runtime.callFunctionSync( + 'FnTestClassAlias', + { + input: input, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as TestClassAlias } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + FnTestNamedArgsSingleEnum( - myArg: NamedArgsSingleEnum, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + myArg: NamedArgsSingleEnum, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): string { try { - const raw = this.runtime.callFunctionSync( - "FnTestNamedArgsSingleEnum", - { - "myArg": myArg - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as string + const raw = this.runtime.callFunctionSync( + 'FnTestNamedArgsSingleEnum', + { + myArg: myArg, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as string } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - GetDataType( - text: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): RaysData { + + GetDataType(text: string, __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): RaysData { try { - const raw = this.runtime.callFunctionSync( - "GetDataType", - { - "text": text - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as RaysData + const raw = this.runtime.callFunctionSync( + 'GetDataType', + { + text: text, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as RaysData } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - GetOrderInfo( - email: Email, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): OrderInfo { + + GetOrderInfo(email: Email, __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): OrderInfo { try { - const raw = this.runtime.callFunctionSync( - "GetOrderInfo", - { - "email": email - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as OrderInfo + const raw = this.runtime.callFunctionSync( + 'GetOrderInfo', + { + email: email, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as OrderInfo } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - GetQuery( - query: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): SearchParams { + + GetQuery(query: string, __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }): SearchParams { try { - const raw = this.runtime.callFunctionSync( - "GetQuery", - { - "query": query - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as SearchParams + const raw = this.runtime.callFunctionSync( + 'GetQuery', + { + query: query, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as SearchParams } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - + InOutEnumMapKey( - i1: Partial>,i2: Partial>, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } + i1: Partial>, + i2: Partial>, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, ): Partial> { try { - const raw = this.runtime.callFunctionSync( - "InOutEnumMapKey", - { - "i1": i1,"i2": i2 - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as Partial> + const raw = this.runtime.callFunctionSync( + 'InOutEnumMapKey', + { + i1: i1, + i2: i2, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as Partial> } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - InOutLiteralStringUnionMapKey( - i1: Partial>,i2: Partial>, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Partial> { + + <<<<<<< + HEAD + InOutLiteralIntMapKey( + i1: Partial>, + i2: Partial>, + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }, + ): Partial> { try { - const raw = this.runtime.callFunctionSync( - "InOutLiteralStringUnionMapKey", - { - "i1": i1,"i2": i2 - }, - this.ctx_manager.cloneContext(), - __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as Partial> + const raw = this.runtime.callFunctionSync( + 'InOutLiteralIntMapKey', + { + i1: i1, + i2: i2, + }, + this.ctx_manager.cloneContext(), + __baml_options__?.tb?.__tb(), + __baml_options__?.clientRegistry, + ) + return raw.parsed() as Partial> } catch (error: any) { - const bamlError = createBamlValidationError(error); + const bamlError = createBamlValidationError(error) if (bamlError instanceof BamlValidationError) { - throw bamlError; + throw bamlError } else { - throw error; + throw error } } } - - InOutSingleLiteralStringMapKey( - m: Partial>, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Partial> { - try { - const raw = this.runtime.callFunctionSync( - "InOutSingleLiteralStringMapKey", + + InOutLiteralStringMapKey( + ======= + InOutLiteralStringUnionMapKey( + >>>>>>> + canary + i1: Partial>; + , + i2: Partial>; + , + __baml_options__?: { tb?: TypeBuilder; clientRegistry?: ClientRegistry }; + ): + Partial + > { + try { + const + raw = this.runtime.callFunctionSync( +<<<<<<< HEAD + "InOutLiteralStringMapKey", +======= + "InOutLiteralStringUnionMapKey", +>>>>>>> canary { - "m": m + "i1": i1,"i2": i2 }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) - return raw.parsed() as Partial> - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } - } + return + raw; + . + parsed() + as; + Partial + > +} +catch (error: any) +{ + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } +} +} LiteralUnionsTest( input: string, - __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): 1 | true | "string output" { - try { + __baml_options__?: +{ + tb?: TypeBuilder, clientRegistry?: ClientRegistry +} +): 1 | true | "string output" +{ + try { const raw = this.runtime.callFunctionSync( - "LiteralUnionsTest", + 'LiteralUnionsTest', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as 1 | true | "string output" - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - MakeBlockConstraint( +} + +MakeBlockConstraint( __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Checked { - try { + ) +: Checked +{ + try { const raw = this.runtime.callFunctionSync( - "MakeBlockConstraint", - { - - }, + 'MakeBlockConstraint', + {}, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as Checked - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - MakeNestedBlockConstraint( +} + +MakeNestedBlockConstraint( __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): NestedBlockConstraint { - try { + ) +: NestedBlockConstraint +{ + try { const raw = this.runtime.callFunctionSync( - "MakeNestedBlockConstraint", - { - - }, + 'MakeNestedBlockConstraint', + {}, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), - __baml_options__?.clientRegistry, - ) - return raw.parsed() as NestedBlockConstraint - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + __baml_options__?.clientRegistry, + ) + return raw.parsed() as NestedBlockConstraint + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - MyFunc( +} + +MyFunc( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): DynamicOutput { - try { + ) +: DynamicOutput +{ + try { const raw = this.runtime.callFunctionSync( - "MyFunc", + 'MyFunc', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as DynamicOutput - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - OptionalTest_Function( +} + +OptionalTest_Function( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): (OptionalTest_ReturnType | null)[] { - try { + ) +: (OptionalTest_ReturnType | null)[] +{ + try { const raw = this.runtime.callFunctionSync( - "OptionalTest_Function", + 'OptionalTest_Function', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as (OptionalTest_ReturnType | null)[] - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - PredictAge( +} + +PredictAge( name: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): FooAny { - try { + ) +: FooAny +{ + try { const raw = this.runtime.callFunctionSync( - "PredictAge", + 'PredictAge', { - "name": name + name: name, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as FooAny - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - PredictAgeBare( +} + +PredictAgeBare( inp: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Checked { - try { + ) +: Checked +{ + try { const raw = this.runtime.callFunctionSync( - "PredictAgeBare", + 'PredictAgeBare', { - "inp": inp + inp: inp, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as Checked - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - PromptTestClaude( +} + +PromptTestClaude( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "PromptTestClaude", + 'PromptTestClaude', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - PromptTestClaudeChat( +} + +PromptTestClaudeChat( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "PromptTestClaudeChat", + 'PromptTestClaudeChat', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - PromptTestClaudeChatNoSystem( +} + +PromptTestClaudeChatNoSystem( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "PromptTestClaudeChatNoSystem", + 'PromptTestClaudeChatNoSystem', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - PromptTestOpenAI( +} + +PromptTestOpenAI( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "PromptTestOpenAI", + 'PromptTestOpenAI', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - PromptTestOpenAIChat( +} + +PromptTestOpenAIChat( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "PromptTestOpenAIChat", + 'PromptTestOpenAIChat', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - PromptTestOpenAIChatNoSystem( +} + +PromptTestOpenAIChatNoSystem( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "PromptTestOpenAIChatNoSystem", + 'PromptTestOpenAIChatNoSystem', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - PromptTestStreaming( +} + +PromptTestStreaming( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "PromptTestStreaming", + 'PromptTestStreaming', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - ReturnFailingAssert( +} + +ReturnFailingAssert( inp: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): number { - try { + ) +: number +{ + try { const raw = this.runtime.callFunctionSync( - "ReturnFailingAssert", + 'ReturnFailingAssert', { - "inp": inp + inp: inp, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as number - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - ReturnMalformedConstraints( +} + +ReturnMalformedConstraints( a: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): MalformedConstraints { - try { + ) +: MalformedConstraints +{ + try { const raw = this.runtime.callFunctionSync( - "ReturnMalformedConstraints", + 'ReturnMalformedConstraints', { - "a": a + a: a, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as MalformedConstraints - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - SchemaDescriptions( +} + +SchemaDescriptions( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Schema { - try { + ) +: Schema +{ + try { const raw = this.runtime.callFunctionSync( - "SchemaDescriptions", + 'SchemaDescriptions', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as Schema - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - StreamBigNumbers( +} + +StreamBigNumbers( digits: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): BigNumbers { - try { + ) +: BigNumbers +{ + try { const raw = this.runtime.callFunctionSync( - "StreamBigNumbers", + 'StreamBigNumbers', { - "digits": digits + digits: digits, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as BigNumbers - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - StreamFailingAssertion( +} + +StreamFailingAssertion( theme: string,length: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): TwoStoriesOneTitle { - try { + ) +: TwoStoriesOneTitle +{ + try { const raw = this.runtime.callFunctionSync( - "StreamFailingAssertion", + 'StreamFailingAssertion', { - "theme": theme,"length": length + theme: theme, + length: length, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as TwoStoriesOneTitle - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - StreamOneBigNumber( +} + +StreamOneBigNumber( digits: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): number { - try { + ) +: number +{ + try { const raw = this.runtime.callFunctionSync( - "StreamOneBigNumber", + 'StreamOneBigNumber', { - "digits": digits + digits: digits, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as number - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - StreamUnionIntegers( +} + +StreamUnionIntegers( digits: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): (number | string)[] { - try { + ) +: (number | string)[] +{ + try { const raw = this.runtime.callFunctionSync( - "StreamUnionIntegers", + 'StreamUnionIntegers', { - "digits": digits + digits: digits, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as (number | string)[] - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - StreamingCompoundNumbers( +} + +StreamingCompoundNumbers( digits: number,yapping: boolean, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): CompoundBigNumbers { - try { + ) +: CompoundBigNumbers +{ + try { const raw = this.runtime.callFunctionSync( - "StreamingCompoundNumbers", + 'StreamingCompoundNumbers', { - "digits": digits,"yapping": yapping + digits: digits, + yapping: yapping, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as CompoundBigNumbers - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestAnthropic( +} + +TestAnthropic( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestAnthropic", + 'TestAnthropic', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestAnthropicShorthand( +} + +TestAnthropicShorthand( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestAnthropicShorthand", + 'TestAnthropicShorthand', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestAws( +} + +TestAws( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestAws", + 'TestAws', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestAwsInvalidRegion( +} + +TestAwsInvalidRegion( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestAwsInvalidRegion", + 'TestAwsInvalidRegion', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestAzure( +} + +TestAzure( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestAzure", + 'TestAzure', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestCaching( +} + +TestCaching( input: string,not_cached: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestCaching", + 'TestCaching', { - "input": input,"not_cached": not_cached + input: input, + not_cached: not_cached, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestFallbackClient( +} + +TestFallbackClient( __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestFallbackClient", - { - - }, + 'TestFallbackClient', + {}, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestFallbackToShorthand( +} + +TestFallbackToShorthand( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestFallbackToShorthand", + 'TestFallbackToShorthand', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestFnNamedArgsSingleBool( +} + +TestFnNamedArgsSingleBool( myBool: boolean, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestFnNamedArgsSingleBool", + 'TestFnNamedArgsSingleBool', { - "myBool": myBool + myBool: myBool, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestFnNamedArgsSingleClass( +} + +TestFnNamedArgsSingleClass( myArg: NamedArgsSingleClass, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestFnNamedArgsSingleClass", + 'TestFnNamedArgsSingleClass', { - "myArg": myArg + myArg: myArg, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, - ) - return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + ) + return raw.parsed() as string + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestFnNamedArgsSingleEnumList( +} + +TestFnNamedArgsSingleEnumList( myArg: NamedArgsSingleEnumList[], __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestFnNamedArgsSingleEnumList", + 'TestFnNamedArgsSingleEnumList', { - "myArg": myArg + myArg: myArg, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestFnNamedArgsSingleFloat( +} + +TestFnNamedArgsSingleFloat( myFloat: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestFnNamedArgsSingleFloat", + 'TestFnNamedArgsSingleFloat', { - "myFloat": myFloat + myFloat: myFloat, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestFnNamedArgsSingleInt( +} + +TestFnNamedArgsSingleInt( myInt: number, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestFnNamedArgsSingleInt", + 'TestFnNamedArgsSingleInt', { - "myInt": myInt + myInt: myInt, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestFnNamedArgsSingleMapStringToClass( +} + +TestFnNamedArgsSingleMapStringToClass( myMap: Record, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Record { - try { + ) +: Record +{ + try { const raw = this.runtime.callFunctionSync( - "TestFnNamedArgsSingleMapStringToClass", + 'TestFnNamedArgsSingleMapStringToClass', { - "myMap": myMap + myMap: myMap, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as Record - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestFnNamedArgsSingleMapStringToMap( +} + +TestFnNamedArgsSingleMapStringToMap( myMap: Record>, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Record> { - try { + ) +: Record> +{ + try { const raw = this.runtime.callFunctionSync( - "TestFnNamedArgsSingleMapStringToMap", + 'TestFnNamedArgsSingleMapStringToMap', { - "myMap": myMap + myMap: myMap, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as Record> - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestFnNamedArgsSingleMapStringToString( +} + +TestFnNamedArgsSingleMapStringToString( myMap: Record, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): Record { - try { + ) +: Record +{ + try { const raw = this.runtime.callFunctionSync( - "TestFnNamedArgsSingleMapStringToString", + 'TestFnNamedArgsSingleMapStringToString', { - "myMap": myMap + myMap: myMap, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as Record - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestFnNamedArgsSingleString( +} + +TestFnNamedArgsSingleString( myString: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestFnNamedArgsSingleString", + 'TestFnNamedArgsSingleString', { - "myString": myString + myString: myString, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestFnNamedArgsSingleStringArray( +} + +TestFnNamedArgsSingleStringArray( myStringArray: string[], __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestFnNamedArgsSingleStringArray", + 'TestFnNamedArgsSingleStringArray', { - "myStringArray": myStringArray + myStringArray: myStringArray, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestFnNamedArgsSingleStringList( +} + +TestFnNamedArgsSingleStringList( myArg: string[], __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestFnNamedArgsSingleStringList", + 'TestFnNamedArgsSingleStringList', { - "myArg": myArg + myArg: myArg, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestGemini( +} + +TestGemini( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestGemini", + 'TestGemini', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestImageInput( +} + +TestImageInput( img: Image, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestImageInput", + 'TestImageInput', { - "img": img + img: img, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestImageInputAnthropic( +} + +TestImageInputAnthropic( img: Image, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestImageInputAnthropic", + 'TestImageInputAnthropic', { - "img": img + img: img, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestImageListInput( +} + +TestImageListInput( imgs: Image[], __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestImageListInput", + 'TestImageListInput', { - "imgs": imgs + imgs: imgs, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestMulticlassNamedArgs( +} + +TestMulticlassNamedArgs( myArg: NamedArgsSingleClass,myArg2: NamedArgsSingleClass, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestMulticlassNamedArgs", + 'TestMulticlassNamedArgs', { - "myArg": myArg,"myArg2": myArg2 + myArg: myArg, + myArg2: myArg2, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestNamedArgsLiteralBool( +} + +TestNamedArgsLiteralBool( myBool: true, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestNamedArgsLiteralBool", + 'TestNamedArgsLiteralBool', { - "myBool": myBool + myBool: myBool, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestNamedArgsLiteralInt( +} + +TestNamedArgsLiteralInt( myInt: 1, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestNamedArgsLiteralInt", + 'TestNamedArgsLiteralInt', { - "myInt": myInt + myInt: myInt, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestNamedArgsLiteralString( +} + +TestNamedArgsLiteralString( myString: "My String", __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestNamedArgsLiteralString", + 'TestNamedArgsLiteralString', { - "myString": myString + myString: myString, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestOllama( +} + +TestOllama( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestOllama", + 'TestOllama', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestOpenAILegacyProvider( +} + +TestOpenAILegacyProvider( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestOpenAILegacyProvider", + 'TestOpenAILegacyProvider', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestOpenAIShorthand( +} + +TestOpenAIShorthand( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestOpenAIShorthand", + 'TestOpenAIShorthand', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestRetryConstant( +} + +TestRetryConstant( __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestRetryConstant", - { - - }, + 'TestRetryConstant', + {}, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestRetryExponential( +} + +TestRetryExponential( __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestRetryExponential", - { - - }, + 'TestRetryExponential', + {}, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestSingleFallbackClient( +} + +TestSingleFallbackClient( __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestSingleFallbackClient", - { - - }, + 'TestSingleFallbackClient', + {}, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - TestVertex( +} + +TestVertex( input: string, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): string { - try { + ) +: string +{ + try { const raw = this.runtime.callFunctionSync( - "TestVertex", + 'TestVertex', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as string - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - UnionTest_Function( +} + +UnionTest_Function( input: string | boolean, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): UnionTest_ReturnType { - try { + ) +: UnionTest_ReturnType +{ + try { const raw = this.runtime.callFunctionSync( - "UnionTest_Function", + 'UnionTest_Function', { - "input": input + input: input, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as UnionTest_ReturnType - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - UseBlockConstraint( +} + +UseBlockConstraint( inp: BlockConstraintForParam, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): number { - try { + ) +: number +{ + try { const raw = this.runtime.callFunctionSync( - "UseBlockConstraint", + 'UseBlockConstraint', { - "inp": inp + inp: inp, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as number - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - UseMalformedConstraints( +} + +UseMalformedConstraints( a: MalformedConstraints2, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): number { - try { + ) +: number +{ + try { const raw = this.runtime.callFunctionSync( - "UseMalformedConstraints", + 'UseMalformedConstraints', { - "a": a + a: a, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as number - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - - UseNestedBlockConstraint( +} + +UseNestedBlockConstraint( inp: NestedBlockConstraintForParam, __baml_options__?: { tb?: TypeBuilder, clientRegistry?: ClientRegistry } - ): number { - try { + ) +: number +{ + try { const raw = this.runtime.callFunctionSync( - "UseNestedBlockConstraint", + 'UseNestedBlockConstraint', { - "inp": inp + inp: inp, }, this.ctx_manager.cloneContext(), __baml_options__?.tb?.__tb(), __baml_options__?.clientRegistry, ) return raw.parsed() as number - } catch (error: any) { - const bamlError = createBamlValidationError(error); - if (bamlError instanceof BamlValidationError) { - throw bamlError; - } else { - throw error; - } + } catch (error: any) { + const bamlError = createBamlValidationError(error) + if (bamlError instanceof BamlValidationError) { + throw bamlError + } else { + throw error } } - } -export const b = new BamlSyncClient(DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_RUNTIME, DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX) \ No newline at end of file +} + +export const b = new BamlSyncClient( + DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_RUNTIME, + DO_NOT_USE_DIRECTLY_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_CTX, +) diff --git a/integ-tests/typescript/test-report.html b/integ-tests/typescript/test-report.html index b6e28a9e4..7071dfec1 100644 --- a/integ-tests/typescript/test-report.html +++ b/integ-tests/typescript/test-report.html @@ -257,6 +257,12 @@ font-size: 1rem; padding: 0 0.5rem; } +<<<<<<< HEAD +

Test Report

Started: 2024-11-17 01:19:05
Suites (1)
0 passed
1 failed
0 pending
Tests (67)
0 passed
1 failed
66 pending
Integ tests > should work for all inputs
single bool
pending
0s
Integ tests > should work for all inputs
single string list
pending
0s
Integ tests > should work for all inputs
return literal union
pending
0s
Integ tests > should work for all inputs
single class
pending
0s
Integ tests > should work for all inputs
multiple classes
pending
0s
Integ tests > should work for all inputs
single enum list
pending
0s
Integ tests > should work for all inputs
single float
pending
0s
Integ tests > should work for all inputs
single int
pending
0s
Integ tests > should work for all inputs
single literal int
pending
0s
Integ tests > should work for all inputs
single literal bool
pending
0s
Integ tests > should work for all inputs
single literal string
pending
0s
Integ tests > should work for all inputs
single class with literal prop
pending
0s
Integ tests > should work for all inputs
single class with literal union prop
pending
0s
Integ tests > should work for all inputs
single optional string
pending
0s
Integ tests > should work for all inputs
single map string to string
pending
0s
Integ tests > should work for all inputs
single map string to class
pending
0s
Integ tests > should work for all inputs
single map string to map
pending
0s
Integ tests > should work for all inputs
enum key in map
pending
0s
Integ tests > should work for all inputs
literal string key in map
pending
0s
Integ tests > should work for all inputs
literal int key in map
failed
0.003s
Error: BamlError: BamlInvalidArgumentError:   Error: i1: <key>: Expected one of [Literal(Int(1)), Literal(Int(2)), Union([Literal(Int(3)), Literal(Int(4))])], got `String("1")`
+  Error: i2: <key>: Expected one of [Literal(Int(1)), Literal(Int(2)), Union([Literal(Int(3)), Literal(Int(4))])], got `String("2")`
+
Integ tests
should work for all outputs
pending
0s
Integ tests
works with retries1
pending
0s
Integ tests
works with retries2
pending
0s
Integ tests
works with fallbacks
pending
0s
Integ tests
should work with image from url
pending
0s
Integ tests
should work with image from base 64
pending
0s
Integ tests
should work with audio base 64
pending
0s
Integ tests
should work with audio from url
pending
0s
Integ tests
should support streaming in OpenAI
pending
0s
Integ tests
should support streaming in Gemini
pending
0s
Integ tests
should support AWS
pending
0s
Integ tests
should support streaming in AWS
pending
0s
Integ tests
should allow overriding the region
pending
0s
Integ tests
should support OpenAI shorthand
pending
0s
Integ tests
should support OpenAI shorthand streaming
pending
0s
Integ tests
should support anthropic shorthand
pending
0s
Integ tests
should support anthropic shorthand streaming
pending
0s
Integ tests
should support streaming without iterating
pending
0s
Integ tests
should support streaming in Claude
pending
0s
Integ tests
should support vertex
pending
0s
Integ tests
supports tracing sync
pending
0s
Integ tests
supports tracing async
pending
0s
Integ tests
should work with dynamic types single
pending
0s
Integ tests
should work with dynamic types enum
pending
0s
Integ tests
should work with dynamic literals
pending
0s
Integ tests
should work with dynamic types class
pending
0s
Integ tests
should work with dynamic inputs class
pending
0s
Integ tests
should work with dynamic inputs list
pending
0s
Integ tests
should work with dynamic output map
pending
0s
Integ tests
should work with dynamic output union
pending
0s
Integ tests
should work with nested classes
pending
0s
Integ tests
should work with dynamic client
pending
0s
Integ tests
should work with 'onLogEvent'
pending
0s
Integ tests
should work with a sync client
pending
0s
Integ tests
should raise an error when appropriate
pending
0s
Integ tests
should raise a BAMLValidationError
pending
0s
Integ tests
should reset environment variables correctly
pending
0s
Integ tests
should use aliases when serializing input objects - classes
pending
0s
Integ tests
should use aliases when serializing, but still have original keys in jinja
pending
0s
Integ tests
should use aliases when serializing input objects - enums
pending
0s
Integ tests
should use aliases when serializing input objects - lists
pending
0s
Integ tests
constraints: should handle checks in return types
pending
0s
Integ tests
constraints: should handle checks in returned unions
pending
0s
Integ tests
constraints: should handle block-level checks
pending
0s
Integ tests
constraints: should handle nested-block-level checks
pending
0s
Integ tests
simple recursive type
pending
0s
Integ tests
mutually recursive type
pending
0s
+=======

Test Report

Started: 2024-11-19 03:07:16
Suites (1)
0 passed
1 failed
0 pending
Tests (67)
66 passed
1 failed
0 pending
Integ tests > should work for all inputs
single bool
passed
0.471s
Integ tests > should work for all inputs
single string list
passed
0.507s
Integ tests > should work for all inputs
return literal union
passed
0.407s
Integ tests > should work for all inputs
single class
passed
0.514s
Integ tests > should work for all inputs
multiple classes
passed
0.514s
Integ tests > should work for all inputs
single enum list
passed
0.71s
Integ tests > should work for all inputs
single float
passed
0.411s
Integ tests > should work for all inputs
single int
passed
0.283s
Integ tests > should work for all inputs
single literal int
passed
0.429s
Integ tests > should work for all inputs
single literal bool
passed
0.862s
Integ tests > should work for all inputs
single literal string
passed
0.571s
Integ tests > should work for all inputs
single class with literal prop
passed
0.576s
Integ tests > should work for all inputs
single class with literal union prop
passed
0.564s
Integ tests > should work for all inputs
single optional string
passed
0.396s
Integ tests > should work for all inputs
single map string to string
passed
0.508s
Integ tests > should work for all inputs
single map string to class
passed
0.721s
Integ tests > should work for all inputs
single map string to map
passed
0.618s
Integ tests > should work for all inputs
enum key in map
passed
0.714s
Integ tests > should work for all inputs
literal string union key in map
passed
0.817s
Integ tests > should work for all inputs
single literal string key in map
passed
0.69s
Integ tests
should work for all outputs
passed
5.774s
Integ tests
works with retries1
passed
0.994s
Integ tests
works with retries2
passed
2.058s
Integ tests
works with fallbacks
passed
2.055s
Integ tests
should work with image from url
passed
1.277s
Integ tests
should work with image from base 64
passed
0.984s
Integ tests
should work with audio base 64
passed
1.632s
Integ tests
should work with audio from url
passed
1.611s
Integ tests
should support streaming in OpenAI
passed
2.018s
Integ tests
should support streaming in Gemini
passed
6.424s
Integ tests
should support AWS
passed
1.619s
Integ tests
should support streaming in AWS
passed
1.527s
Integ tests
should allow overriding the region
passed
0.01s
Integ tests
should support OpenAI shorthand
passed
9.113s
Integ tests
should support OpenAI shorthand streaming
passed
8.598s
Integ tests
should support anthropic shorthand
passed
3.379s
Integ tests
should support anthropic shorthand streaming
passed
2.332s
Integ tests
should support streaming without iterating
passed
3.02s
Integ tests
should support streaming in Claude
passed
1.525s
Integ tests
should support vertex
passed
11.555s
Integ tests
supports tracing sync
passed
0.02s
Integ tests
supports tracing async
passed
2.937s
Integ tests
should work with dynamic types single
passed
1.243s
Integ tests
should work with dynamic types enum
passed
0.731s
Integ tests
should work with dynamic literals
passed
1.094s
Integ tests
should work with dynamic types class
passed
1.041s
Integ tests
should work with dynamic inputs class
passed
0.596s
Integ tests
should work with dynamic inputs list
passed
0.631s
Integ tests
should work with dynamic output map
passed
0.819s
Integ tests
should work with dynamic output union
passed
2.357s
Integ tests
should work with nested classes
failed
0.117s
Error: BamlError: BamlClientError: Something went wrong with the LLM client: reqwest::Error { kind: Request, url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(11434), path: "/v1/chat/completions", query: None, fragment: None }, source: hyper_util::client::legacy::Error(Connect, ConnectError("tcp connect error", Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })) }
     at BamlStream.parsed [as getFinalResponse] (/workspaces/baml/engine/language_client_typescript/stream.js:58:39)
-    at Object.<anonymous> (/workspaces/baml/integ-tests/typescript/tests/integ-tests.test.ts:602:19)
Integ tests
should work with dynamic client
passed
0.379s
Integ tests
should work with 'onLogEvent'
passed
2.343s
Integ tests
should work with a sync client
passed
0.498s
Integ tests
should raise an error when appropriate
passed
0.987s
Integ tests
should raise a BAMLValidationError
passed
0.477s
Integ tests
should reset environment variables correctly
passed
1.431s
Integ tests
should use aliases when serializing input objects - classes
passed
0.918s
Integ tests
should use aliases when serializing, but still have original keys in jinja
passed
0.805s
Integ tests
should use aliases when serializing input objects - enums
passed
0.424s
Integ tests
should use aliases when serializing input objects - lists
passed
0.512s
Integ tests
constraints: should handle checks in return types
passed
0.822s
Integ tests
constraints: should handle checks in returned unions
passed
0.827s
Integ tests
constraints: should handle block-level checks
passed
0.602s
Integ tests
constraints: should handle nested-block-level checks
passed
0.78s
Integ tests
simple recursive type
passed
1.427s
Integ tests
mutually recursive type
passed
2.402s
\ No newline at end of file + at Object.<anonymous> (/workspaces/baml/integ-tests/typescript/tests/integ-tests.test.ts:602:19)
Integ tests
should work with dynamic client
passed
0.379s
Integ tests
should work with 'onLogEvent'
passed
2.343s
Integ tests
should work with a sync client
passed
0.498s
Integ tests
should raise an error when appropriate
passed
0.987s
Integ tests
should raise a BAMLValidationError
passed
0.477s
Integ tests
should reset environment variables correctly
passed
1.431s
Integ tests
should use aliases when serializing input objects - classes
passed
0.918s
Integ tests
should use aliases when serializing, but still have original keys in jinja
passed
0.805s
Integ tests
should use aliases when serializing input objects - enums
passed
0.424s
Integ tests
should use aliases when serializing input objects - lists
passed
0.512s
Integ tests
constraints: should handle checks in return types
passed
0.822s
Integ tests
constraints: should handle checks in returned unions
passed
0.827s
Integ tests
constraints: should handle block-level checks
passed
0.602s
Integ tests
constraints: should handle nested-block-level checks
passed
0.78s
Integ tests
simple recursive type
passed
1.427s
Integ tests
mutually recursive type
passed
2.402s
+>>>>>>> canary diff --git a/integ-tests/typescript/tests/integ-tests.test.ts b/integ-tests/typescript/tests/integ-tests.test.ts index 3ad7066d1..5774bd21b 100644 --- a/integ-tests/typescript/tests/integ-tests.test.ts +++ b/integ-tests/typescript/tests/integ-tests.test.ts @@ -148,6 +148,11 @@ describe('Integ tests', () => { const res = await b.InOutSingleLiteralStringMapKey({ key: '1' }) expect(res).toHaveProperty('key', '1') }) + + it('literal int key in map', async () => { + const res = await b.InOutLiteralIntMapKey({ 1: 'one' }, { 2: 'two' }) + expect(res[1]).toEqual('one') + expect(res[2]).toEqual('two') }) it('should work for all outputs', async () => {