diff --git a/CHANGELOG.md b/CHANGELOG.md index d9e6498ae..71f84dee9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -368,7 +368,7 @@ The default base URL for the Gemini provider has been updated to v1beta. This ch - LLVM install and rebuild script (#794) - ([9ee66ed](https://github.com/boundaryml/baml/commit/9ee66ed2dd14bc0ee12a788f41eae64377e7f2b0)) - Anish Palakurthi - Prevent version mismatches when generating baml_client (#791) - ([d793603](https://github.com/boundaryml/baml/commit/d7936036e6afa4a0e738242cfb3feaa9e15b3657)) - aaronvg - fiddle build fix (#800) - ([d304203](https://github.com/boundaryml/baml/commit/d304203241726ac0ba8781db7ac5693339189eb4)) - aaronvg -- Dont drop extra fields in dynamic classes when passing them as inputs to a function (#802) - ([4264c9b](https://github.com/boundaryml/baml/commit/4264c9b143edda0239af197d110357b1969bf12c)) - aaronvg +- Don't drop extra fields in dynamic classes when passing them as inputs to a function (#802) - ([4264c9b](https://github.com/boundaryml/baml/commit/4264c9b143edda0239af197d110357b1969bf12c)) - aaronvg - Adding support for a sync client for Python + Typescript (#803) - ([62085e7](https://github.com/boundaryml/baml/commit/62085e79d4d86f580ce189bc60f36bd1414893c4)) - hellovai - Fix WASM-related issues introduced in #803 (#804) - ([0a950e0](https://github.com/boundaryml/baml/commit/0a950e084748837ee2e269504d22dba66f339ca4)) - hellovai - Adding various fixes (#806) - ([e8c1a61](https://github.com/boundaryml/baml/commit/e8c1a61a96051160566b6458dac5c89d5ddfb86e)) - hellovai @@ -416,7 +416,7 @@ The default base URL for the Gemini provider has been updated to v1beta. This ch ### Bug Fixes -- Fix env variables dialoge on VSCode (#750) +- Fix env variables dialog on VSCode (#750) - Playground selects correct function after loading (#757) - ([09963a0](https://github.com/boundaryml/baml/commit/09963a02e581da9eb8f7bafd3ba812058c97f672)) - aaronvg ### Miscellaneous Chores @@ -528,7 +528,7 @@ The default base URL for the Gemini provider has been updated to v1beta. This ch - add internal build tooling for sam (#512) - ([9ebacca](https://github.com/boundaryml/baml/commit/9ebaccaa542760cb96382ae2a91d780f1ade613b)) - Samuel Lijin - delete clients dir, this is now dead code (#652) - ([ec2627f](https://github.com/boundaryml/baml/commit/ec2627f59c7fe9edfff46fcdb65f9b9f0e2e072c)) - Samuel Lijin - consolidate vscode workspace, bump a bunch of deps (#654) - ([82bf6ab](https://github.com/boundaryml/baml/commit/82bf6ab1ad839f84782a7ef0441f21124c368757)) - Samuel Lijin -- Add RB2B tracking script to propmt fiddle (#681) - ([4cf806b](https://github.com/boundaryml/baml/commit/4cf806bba26563fd8b6ddbd68296ab8bdfac21c4)) - hellovai +- Add RB2B tracking script to prompt fiddle (#681) - ([4cf806b](https://github.com/boundaryml/baml/commit/4cf806bba26563fd8b6ddbd68296ab8bdfac21c4)) - hellovai - Adding better release script (#688) - ([5bec282](https://github.com/boundaryml/baml/commit/5bec282d39d2250b39ef4aba5d6bba9830a35988)) - hellovai ### [AUTO diff --git a/README.md b/README.md index 4e0095810..62382c42b 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,7 @@ Showcase of applications using BAML - [Aer Compliance](https://www.aercompliance.com/) - AI-powered compliance tasks - [Haven](https://www.usehaven.ai/) - Automate Tenant communications with AI - [Muckrock](https://www.muckrock.com/) - FOIA request tracking and filing -- and more! [Let us know](https://calendly.com/boundaryml/meeting-with-founders) if you want to be showcased or want to work with us 1-1 to solve your usecase. +- and more! [Let us know](https://calendly.com/boundaryml/meeting-with-founders) if you want to be showcased or want to work with us 1-1 to solve your use cases. ## Observability @@ -227,7 +227,7 @@ BAML handles this and many more cases, such as identifying `Enums` in LLM string **Aliasing issues** -Prompt engineering requires you to think carefully about what the name of each key in the schema is. Rather than changing your code everytime you want to try a new name out, you can alias fields to a different name and convert them back into the original field name during parsing. +Prompt engineering requires you to think carefully about what the name of each key in the schema is. Rather than changing your code every time you want to try a new name out, you can alias fields to a different name and convert them back into the original field name during parsing. Here's how BAML differs from these frameworks: @@ -302,7 +302,7 @@ We basically wanted [Jinja](https://jinja.palletsprojects.com/en/3.1.x/), but wi ### Does BAML use LLMs to generate code? -No, the BAML dependency transpiles the code using Rust 🦀. It takes just a few milliseconds! +No, the BAML dependency transpile the code using Rust 🦀. It takes just a few milliseconds! ### What does BAML stand for? diff --git a/engine/baml-lib/baml-core/src/ir/repr.rs b/engine/baml-lib/baml-core/src/ir/repr.rs index d4ad06dac..35bc8d1c3 100644 --- a/engine/baml-lib/baml-core/src/ir/repr.rs +++ b/engine/baml-lib/baml-core/src/ir/repr.rs @@ -355,7 +355,7 @@ impl WithRepr for ast::FieldType { pub enum Identifier { /// Starts with env.* ENV(String), - /// The path to a Local Identifer + the local identifer. Separated by '.' + /// The path to a Local Identifier + the local identifier. Separated by '.' #[allow(dead_code)] Ref(Vec), /// A string without spaces or '.' Always starts with a letter. May contain numbers @@ -622,7 +622,7 @@ pub enum OracleType { #[derive(serde::Serialize, Debug)] pub struct AliasOverride { pub name: String, - // This is used to generate deserializers with aliased keys (see .overload in python deserializer) + // This is used to generate deserializer with aliased keys (see .overload in python deserializer) pub aliased_keys: Vec, } @@ -974,7 +974,7 @@ impl WithRepr for ConfigurationWalker<'_> { } #[derive(Debug, Clone, Serialize)] pub enum Prompt { - // The prompt stirng, and a list of input replacer keys (raw key w/ magic string, and key to replace with) + // The prompt string, and a list of input replacer keys (raw key w/ magic string, and key to replace with) String(String, Vec<(String, String)>), // same thing, the chat message, and the replacer input keys (raw key w/ magic string, and key to replace with) 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 cc26b9ed0..c3778fe1c 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 @@ -17,7 +17,7 @@ fn errors_with_names<'a>(ctx: &'a mut Context<'_>, idn: &Identifier) { /// /// Operates in two passes: /// -/// 1. Verify that the type is resolveable (for REF types) +/// 1. Verify that the type is resolvable (for REF types) /// 2. Verify that the type is well-formed/allowed in the language pub(crate) fn validate_type(ctx: &mut Context<'_>, field_type: &FieldType) { validate_type_exists(ctx, field_type); @@ -46,7 +46,7 @@ fn validate_type_exists(ctx: &mut Context<'_>, field_type: &FieldType) -> bool { fn validate_type_allowed(ctx: &mut Context<'_>, field_type: &FieldType) { match field_type { FieldType::Map(arity, kv_types, ..) => { - if (arity.is_optional()) { + if arity.is_optional() { ctx.push_error(DatamodelError::new_validation_error( format!("Maps are not allowed to be optional").as_str(), field_type.span().clone(), @@ -70,7 +70,7 @@ fn validate_type_allowed(ctx: &mut Context<'_>, field_type: &FieldType) { FieldType::Symbol(..) => {} FieldType::List(arity, field_type, ..) => { - if (arity.is_optional()) { + if arity.is_optional() { ctx.push_error(DatamodelError::new_validation_error( format!("Lists are not allowed to be optional").as_str(), field_type.span().clone(), diff --git a/engine/baml-lib/baml-types/src/field_type/mod.rs b/engine/baml-lib/baml-types/src/field_type/mod.rs index bde7184ab..91d4a3c80 100644 --- a/engine/baml-lib/baml-types/src/field_type/mod.rs +++ b/engine/baml-lib/baml-types/src/field_type/mod.rs @@ -113,9 +113,9 @@ impl std::fmt::Display for FieldType { .join(", ") ) } - FieldType::Map(k, v) => write!(f, "map<{}, {}>", k.to_string(), v.to_string()), - FieldType::List(t) => write!(f, "{}[]", t.to_string()), - FieldType::Optional(t) => write!(f, "{}?", t.to_string()), + FieldType::Map(k, v) => write!(f, "map<{}, {}>", k, v), + FieldType::List(t) => write!(f, "{}[]", t), + FieldType::Optional(t) => write!(f, "{}?", t), } } } diff --git a/engine/baml-lib/baml/tests/parsing/comments.rs b/engine/baml-lib/baml/tests/parsing/comments.rs index 01b4c6c9a..dd8df89eb 100644 --- a/engine/baml-lib/baml/tests/parsing/comments.rs +++ b/engine/baml-lib/baml/tests/parsing/comments.rs @@ -3,7 +3,7 @@ use crate::common::*; #[test] fn trailing_comments_allowed_in_configuration_blocks() { let schema = r#" - // This is a random commet + // This is a random comment // Anther random comment // But in a block diff --git a/engine/baml-lib/baml/tests/validation_files/class/misspeled_boolean_literals.baml b/engine/baml-lib/baml/tests/validation_files/class/misspeled_boolean_literals.baml index 186264b68..3a4ff6175 100644 --- a/engine/baml-lib/baml/tests/validation_files/class/misspeled_boolean_literals.baml +++ b/engine/baml-lib/baml/tests/validation_files/class/misspeled_boolean_literals.baml @@ -4,13 +4,13 @@ class TestLiterals { } // error: Type `True` does not exist. Did you mean one of these: `true`, `string`, `int`, `bool`, `false`, `float`, `TestLiterals`? -// --> class/misspeled_boolean_literals.baml:3 +// --> class/misspelled_boolean_literals.baml:3 // | // 2 | a "SingleLiteral" // 3 | b "boolean" | True | False // | // error: Type `False` does not exist. Did you mean one of these: `false`, `float`, `true`, `int`, `bool`, `string`, `TestLiterals`? -// --> class/misspeled_boolean_literals.baml:3 +// --> class/misspelled_boolean_literals.baml:3 // | // 2 | a "SingleLiteral" // 3 | b "boolean" | True | False diff --git a/engine/baml-lib/baml/tests/validation_files/dictionary/valid_dictionary.baml b/engine/baml-lib/baml/tests/validation_files/dictionary/valid_dictionary.baml index 7edabb321..db29d66a6 100644 --- a/engine/baml-lib/baml/tests/validation_files/dictionary/valid_dictionary.baml +++ b/engine/baml-lib/baml/tests/validation_files/dictionary/valid_dictionary.baml @@ -7,7 +7,7 @@ client MyClient { array_key_with_quoted_unquoted [ "abc", "abc", "ccc" ] // separate by commas key2 "some random value", hello "world", thing "hello" - block_string #"hello there my frien + block_string #"hello there my friend d"# inline_raw_string #"inline "raw" string,,"# keyStringNoSpacesWorksWithoutQuotes NoQuotes!!123 diff --git a/engine/baml-lib/baml/tests/validation_files/functions_v2/shorthand_clients.baml b/engine/baml-lib/baml/tests/validation_files/functions_v2/shorthand_clients.baml index cd85dc401..cb7fbbeae 100644 --- a/engine/baml-lib/baml/tests/validation_files/functions_v2/shorthand_clients.baml +++ b/engine/baml-lib/baml/tests/validation_files/functions_v2/shorthand_clients.baml @@ -29,7 +29,7 @@ function InputEnum(color: Color) -> string { prompt #" color {{ color }} "# } -// Try it with wierd spacing and comments +// Try it with weird spacing and comments function InputEnum2( color: Color, diff --git a/engine/baml-lib/baml/tests/validation_files/functions_v2/tests/failing_tests.baml b/engine/baml-lib/baml/tests/validation_files/functions_v2/tests/failing_tests.baml index 21e683607..3aa153c50 100644 --- a/engine/baml-lib/baml/tests/validation_files/functions_v2/tests/failing_tests.baml +++ b/engine/baml-lib/baml/tests/validation_files/functions_v2/tests/failing_tests.baml @@ -33,7 +33,7 @@ function InputEnum(color: Color) -> string { prompt #" color {{ color }} "# } -// Try it with wierd spacing and comments +// Try it with weird spacing and comments function InputEnum2( color: Color, diff --git a/engine/baml-lib/baml/tests/validation_files/functions_v2/tests/valid_tests.baml b/engine/baml-lib/baml/tests/validation_files/functions_v2/tests/valid_tests.baml index 746a452e5..5818a7594 100644 --- a/engine/baml-lib/baml/tests/validation_files/functions_v2/tests/valid_tests.baml +++ b/engine/baml-lib/baml/tests/validation_files/functions_v2/tests/valid_tests.baml @@ -33,7 +33,7 @@ function InputEnum(color: Color) -> string { prompt #" color {{ color }} "# } -// Try it with wierd spacing and comments +// Try it with weird spacing and comments function InputEnum2( color: Color, diff --git a/engine/baml-lib/baml/tests/validation_files/functions_v2/valid.baml b/engine/baml-lib/baml/tests/validation_files/functions_v2/valid.baml index 5167c9e4f..114b843ca 100644 --- a/engine/baml-lib/baml/tests/validation_files/functions_v2/valid.baml +++ b/engine/baml-lib/baml/tests/validation_files/functions_v2/valid.baml @@ -33,7 +33,7 @@ function InputEnum(color: Color) -> string { prompt #" color {{ color }} "# } -// Try it with wierd spacing and comments +// Try it with weird spacing and comments function InputEnum2( color: Color, 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 243abea3d..c079e60f4 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 @@ -42,7 +42,7 @@ impl IntoMiniJinjaValue for BamlValue { // For enums and classes we compute the aliases from the IR, and generate custom jinja structs that print out the alias if stringified. BamlValue::Enum(name, value) => { minijinja::Value::from(value.clone()) - // Until we can fix the broken test, just return the normal value. For now we wont suppport enum alias rendering. + // Until we can fix the broken test, just return the normal value. For now we wont support enum alias rendering. // let mut alias: Option = None; // if let Ok(e) = ir.find_enum(name) { // if let Some(enum_value) = e diff --git a/engine/baml-lib/jinja-runtime/src/lib.rs b/engine/baml-lib/jinja-runtime/src/lib.rs index 3bd1c2f76..be288194e 100644 --- a/engine/baml-lib/jinja-runtime/src/lib.rs +++ b/engine/baml-lib/jinja-runtime/src/lib.rs @@ -1849,7 +1849,7 @@ mod render_tests { } // See the note in baml_value_to_jinja_value.rs for Enum for why we don't support aliases. - // tl;dr we don't havea way to override the equality operator for enum comparisons to NOT use the alias. + // tl;dr we don't have a way to override the equality operator for enum comparisons to NOT use the alias. // #[test] // fn test_render_prompt_with_enum() -> anyhow::Result<()> { // setup_logging(); diff --git a/engine/baml-lib/jinja/src/evaluate_type/mod.rs b/engine/baml-lib/jinja/src/evaluate_type/mod.rs index aafa1530c..355557476 100644 --- a/engine/baml-lib/jinja/src/evaluate_type/mod.rs +++ b/engine/baml-lib/jinja/src/evaluate_type/mod.rs @@ -194,7 +194,7 @@ impl TypeError { ) }; - Self { message: format!("{message}\n\nSee: https://docs.rs/minijinja/latest/minijinja/filters/index.html#functions for the compelete list"), span } + Self { message: format!("{message}\n\nSee: https://docs.rs/minijinja/latest/minijinja/filters/index.html#functions for the complete list"), span } } fn new_invalid_type(expr: &Expr, got: &Type, expected: &str, span: Span) -> Self { diff --git a/engine/baml-lib/jinja/src/evaluate_type/types.rs b/engine/baml-lib/jinja/src/evaluate_type/types.rs index c0bdb994f..ea6381463 100644 --- a/engine/baml-lib/jinja/src/evaluate_type/types.rs +++ b/engine/baml-lib/jinja/src/evaluate_type/types.rs @@ -304,7 +304,7 @@ impl PredefinedTypes { }; // Any vars that are in both branches are merged - // Any vars that are only in one branch, unioned with undefined + // Any vars that are only in one branch, united with undefined let mut new_vars = HashMap::new(); for (name, t) in true_vars.iter() { diff --git a/engine/baml-lib/jsonish/src/deserializer/coercer/array_helper.rs b/engine/baml-lib/jsonish/src/deserializer/coercer/array_helper.rs index 67628e803..fd17a9dfd 100644 --- a/engine/baml-lib/jsonish/src/deserializer/coercer/array_helper.rs +++ b/engine/baml-lib/jsonish/src/deserializer/coercer/array_helper.rs @@ -1,5 +1,3 @@ -use std::any::Any; - use crate::deserializer::{deserialize_flags::Flag, types::BamlValueWithFlags}; use anyhow::Result; use internal_baml_core::{ast::Field, ir::FieldType}; diff --git a/engine/baml-lib/jsonish/src/deserializer/coercer/coerce_optional.rs b/engine/baml-lib/jsonish/src/deserializer/coercer/coerce_optional.rs index 76778913b..e68579123 100644 --- a/engine/baml-lib/jsonish/src/deserializer/coercer/coerce_optional.rs +++ b/engine/baml-lib/jsonish/src/deserializer/coercer/coerce_optional.rs @@ -32,7 +32,7 @@ pub(super) fn coerce_optional( Some(v) => match inner.coerce(ctx, optional_target, Some(v)) { Ok(v) => Ok(v), Err(e) => { - flags.add_flag(Flag::DefaultButHadUnparseableValue(e)); + flags.add_flag(Flag::DefaultButHadUnparsableValue(e)); Ok(BamlValueWithFlags::Null(flags)) } }, diff --git a/engine/baml-lib/jsonish/src/deserializer/coercer/field_type.rs b/engine/baml-lib/jsonish/src/deserializer/coercer/field_type.rs index 8dde401fb..07b52864a 100644 --- a/engine/baml-lib/jsonish/src/deserializer/coercer/field_type.rs +++ b/engine/baml-lib/jsonish/src/deserializer/coercer/field_type.rs @@ -93,7 +93,7 @@ impl DefaultValue for FieldType { fn default_value(&self, error: Option<&ParsingError>) -> Option { let get_flags = || { DeserializerConditions::new().with_flag(error.map_or(Flag::DefaultFromNoValue, |e| { - Flag::DefaultButHadUnparseableValue(e.clone()) + Flag::DefaultButHadUnparsableValue(e.clone()) })) }; diff --git a/engine/baml-lib/jsonish/src/deserializer/coercer/ir_ref/coerce_class.rs b/engine/baml-lib/jsonish/src/deserializer/coercer/ir_ref/coerce_class.rs index 4ebf500f5..1616b0450 100644 --- a/engine/baml-lib/jsonish/src/deserializer/coercer/ir_ref/coerce_class.rs +++ b/engine/baml-lib/jsonish/src/deserializer/coercer/ir_ref/coerce_class.rs @@ -132,7 +132,7 @@ impl TypeCoercer for Class { let parsed = match field.1.coerce(&scope, &field.1, Some(x)) { Ok(mut v) => { v.add_flag(Flag::ImpliedKey(field.0.real_name().into())); - flags.add_flag(Flag::InferedObject(x.clone())); + flags.add_flag(Flag::InferredObject(x.clone())); Ok(v) } Err(e) => Err(e), @@ -275,7 +275,7 @@ impl TypeCoercer for Class { k.to_string(), BamlValueWithFlags::Null( DeserializerConditions::new() - .with_flag(Flag::DefaultButHadUnparseableValue(e)), + .with_flag(Flag::DefaultButHadUnparsableValue(e)), ), ), } diff --git a/engine/baml-lib/jsonish/src/deserializer/coercer/match_string.rs b/engine/baml-lib/jsonish/src/deserializer/coercer/match_string.rs index a5475642d..7203815c8 100644 --- a/engine/baml-lib/jsonish/src/deserializer/coercer/match_string.rs +++ b/engine/baml-lib/jsonish/src/deserializer/coercer/match_string.rs @@ -49,10 +49,10 @@ pub(super) fn match_string( } }; - // Trim whitespaces. + // Trim whitespace. let match_context = jsonish_string.trim(); - // First attempt, case sensitive match ignoring possible pucntuation. + // First attempt, case sensitive match ignoring possible punctuation. if let Some(string_match) = string_match_strategy(&match_context, &candidates, &mut flags) { return try_match_only_once(parsing_context, target, string_match, flags); } @@ -125,10 +125,10 @@ fn try_match_only_once( /// Heuristic string match algorithm. /// /// The algorithm is case sensitive so for case insensitive matches it must -/// recieve lowercase strings. This algorithm will first try to look for exact +/// receive lowercase strings. This algorithm will first try to look for exact /// matches in the input string, if it doesn't find any it will look for /// substring matches and return the one with the most matches. Whether that is -/// an ambigous match or not is up to the caller to decide. +/// an ambiguous match or not is up to the caller to decide. fn string_match_strategy<'c>( value_str: &str, candidates: &'c [(&'c str, Vec)], @@ -148,7 +148,7 @@ fn string_match_strategy<'c>( let match_count_pos = valid_names .iter() .filter_map(|valid_name| { - // Match ocurrences of valid name. + // Match occurrences of valid name. let matches = value_str.match_indices(valid_name); // Return (count, first_idx) matches.fold(None, |acc, (idx, _)| match acc { diff --git a/engine/baml-lib/jsonish/src/deserializer/deserialize_flags.rs b/engine/baml-lib/jsonish/src/deserializer/deserialize_flags.rs index a05b85399..8a658ceb1 100644 --- a/engine/baml-lib/jsonish/src/deserializer/deserialize_flags.rs +++ b/engine/baml-lib/jsonish/src/deserializer/deserialize_flags.rs @@ -6,7 +6,7 @@ pub enum Flag { ObjectFromMarkdown(i32), ObjectFromFixedJson(Vec), - DefaultButHadUnparseableValue(ParsingError), + DefaultButHadUnparsableValue(ParsingError), ObjectToString(crate::jsonish::Value), ObjectToPrimitive(crate::jsonish::Value), ObjectToMap(crate::jsonish::Value), @@ -20,7 +20,7 @@ pub enum Flag { JsonToString(crate::jsonish::Value), ImpliedKey(String), - InferedObject(crate::jsonish::Value), + InferredObject(crate::jsonish::Value), // Values here are all the possible matches. FirstMatch(usize, Vec>), @@ -32,15 +32,15 @@ pub enum Flag { DefaultButHadValue(crate::jsonish::Value), OptionalDefaultFromNoValue, - // String -> X convertions. + // String -> X conversions. StringToBool(String), StringToNull(String), StringToChar(String), - // Number -> X convertions. + // Number -> X conversions. FloatToInt(f64), - // X -> Object convertions. + // X -> Object conversions. NoFields(Option), } @@ -77,7 +77,7 @@ impl DeserializerConditions { } Flag::JsonToString(_) => None, Flag::ImpliedKey(_) => None, - Flag::InferedObject(_) => None, + Flag::InferredObject(_) => None, Flag::FirstMatch(_idx, _) => None, Flag::StrMatchOneFromMany(_matches) => None, Flag::DefaultFromNoValue => None, @@ -89,7 +89,7 @@ impl DeserializerConditions { Flag::FloatToInt(_) => None, Flag::NoFields(_) => None, Flag::UnionMatch(_idx, _) => None, - Flag::DefaultButHadUnparseableValue(e) => Some(e.clone()), + Flag::DefaultButHadUnparsableValue(e) => Some(e.clone()), }) .collect::>() } @@ -119,8 +119,8 @@ impl std::fmt::Display for DeserializerConditions { impl std::fmt::Display for Flag { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - Flag::InferedObject(value) => { - write!(f, "Infered object from: {}", value.r#type())?; + Flag::InferredObject(value) => { + write!(f, "Inferred object from: {}", value.r#type())?; } Flag::OptionalDefaultFromNoValue => { write!(f, "Optional Default value")?; @@ -165,8 +165,8 @@ impl std::fmt::Display for Flag { writeln!(f, "Item {}: {}", idx, value)?; } } - Flag::DefaultButHadUnparseableValue(value) => { - write!(f, "Null but had unparseable value")?; + Flag::DefaultButHadUnparsableValue(value) => { + write!(f, "Null but had unparsable value")?; writeln!(f, "----RAW----")?; writeln!(f, "{}", value)?; writeln!(f, "-----------")?; diff --git a/engine/baml-lib/jsonish/src/deserializer/score.rs b/engine/baml-lib/jsonish/src/deserializer/score.rs index cba62ce0c..37b29e68b 100644 --- a/engine/baml-lib/jsonish/src/deserializer/score.rs +++ b/engine/baml-lib/jsonish/src/deserializer/score.rs @@ -32,13 +32,13 @@ impl WithScore for BamlValueWithFlags { impl WithScore for Flag { fn score(&self) -> i32 { match self { - Flag::InferedObject(_) => 0, // Dont penalize for this but instead handle it at the top level + Flag::InferredObject(_) => 0, // Don't penalize for this but instead handle it at the top level Flag::OptionalDefaultFromNoValue => 1, Flag::DefaultFromNoValue => 100, Flag::DefaultButHadValue(_) => 110, Flag::ObjectFromFixedJson(_) => 0, Flag::ObjectFromMarkdown(s) => *s, - Flag::DefaultButHadUnparseableValue(_) => 2, + Flag::DefaultButHadUnparsableValue(_) => 2, Flag::ObjectToMap(_) => 1, Flag::ObjectToString(_) => 2, Flag::ObjectToPrimitive(_) => 2, diff --git a/engine/baml-lib/jsonish/src/jsonish/iterative_parser.rs b/engine/baml-lib/jsonish/src/jsonish/iterative_parser.rs index 72dad29d7..2e598c527 100644 --- a/engine/baml-lib/jsonish/src/jsonish/iterative_parser.rs +++ b/engine/baml-lib/jsonish/src/jsonish/iterative_parser.rs @@ -439,7 +439,7 @@ impl JsonParseState { _ => return false, } } - // If we faile, terminate the string + // If we fail, terminate the string true } x if closing_char == *x => { diff --git a/engine/baml-lib/jsonish/src/jsonish/old/parse_state.rs b/engine/baml-lib/jsonish/src/jsonish/old/parse_state.rs index da091c9b0..0081cfe48 100644 --- a/engine/baml-lib/jsonish/src/jsonish/old/parse_state.rs +++ b/engine/baml-lib/jsonish/src/jsonish/old/parse_state.rs @@ -166,7 +166,7 @@ impl<'a> ParseState<'a> { pub fn new_not_parsed(&mut self, location: &'a JsonishValue, expected: &str) { self.errors.push(ParseError { - message: ErrorType::Error(format!("Not parseable: Expected: {}", expected)), + message: ErrorType::Error(format!("Not parsable: Expected: {}", expected)), location, }); } diff --git a/engine/baml-lib/jsonish/src/jsonish/old/raw_value.rs b/engine/baml-lib/jsonish/src/jsonish/old/raw_value.rs index 8e5e891e3..8a5ca1a27 100644 --- a/engine/baml-lib/jsonish/src/jsonish/old/raw_value.rs +++ b/engine/baml-lib/jsonish/src/jsonish/old/raw_value.rs @@ -175,7 +175,7 @@ impl<'a> JsonishValue<'a> { return JsonishValue::Number(trimmed, N::Float(n)); } - // Instead of doing fancy parsing on the string pre-emptively, just return it as a string. Later we can search that string for the actual value. + // Instead of doing fancy parsing on the string preemptively, just return it as a string. Later, we can search that string for the actual value. JsonishValue::Stringish(s) } @@ -186,7 +186,7 @@ impl<'a> JsonishValue<'a> { ) -> Result<&'a JsonishValue<'a>, JsonParseError> { let trimmed = s.trim(); - // Skip whitespaces at the start (if any) + // Skip whitespace at the start (if any) if trimmed.is_empty() { return Err(JsonParseError::EmptyString); } @@ -199,7 +199,7 @@ impl<'a> JsonishValue<'a> { Some('-') => parse_unquoted_single_word(trimmed, state), Some(x) if x.is_alphanumeric() => parse_unquoted_single_word(trimmed, state), Some(_) => Err(JsonParseError::InvalidSyntax( - "JSON is not parseable".into(), + "JSON is not parsable".into(), )), None => Err(JsonParseError::InvalidSyntax( "JSON has empty content".into(), diff --git a/engine/baml-lib/jsonish/src/jsonish/old/test_iterative_parser.rs b/engine/baml-lib/jsonish/src/jsonish/old/test_iterative_parser.rs index 1ee5232b3..c5bcb5a0d 100644 --- a/engine/baml-lib/jsonish/src/jsonish/old/test_iterative_parser.rs +++ b/engine/baml-lib/jsonish/src/jsonish/old/test_iterative_parser.rs @@ -59,7 +59,7 @@ test_jsonish!(test_incomplete_string_in_object, r#"{"key": "value"#, {"key": "va // This is un-changed test_jsonish!( - test_prefixed_incompleted_string, + test_prefixed_incomplete_string, r#"prefix "hello"#, r#"prefix "hello"# ); @@ -156,7 +156,7 @@ test_jsonish!( ```json { "key": "value", - "array": [1, 2, 3, "some stinrg"with quotes"], + "array": [1, 2, 3, "some string"with quotes"], "object": { "key": "value" }, @@ -165,7 +165,7 @@ test_jsonish!( "#, { "key": "value", - "array": [1, 2, 3, "some stinrg\"with quotes"], + "array": [1, 2, 3, "some string\"with quotes"], "object": { "key": "value" } @@ -179,7 +179,7 @@ test_jsonish!( ```json { "key": "value", - "array": [1, 2, 3, 'some stinrg' with quotes' /* test */], + "array": [1, 2, 3, 'some string' with quotes' /* test */], "object": { // Test comment "key": "value" }, @@ -188,7 +188,7 @@ test_jsonish!( "#, { "key": "value", - "array": [1, 2, 3, "some stinrg' with quotes"], + "array": [1, 2, 3, "some string' with quotes"], "object": { "key": "value" } diff --git a/engine/baml-lib/jsonish/src/jsonish/parser/fixing_parser.rs b/engine/baml-lib/jsonish/src/jsonish/parser/fixing_parser.rs index 224d5158b..dbf06b54b 100644 --- a/engine/baml-lib/jsonish/src/jsonish/parser/fixing_parser.rs +++ b/engine/baml-lib/jsonish/src/jsonish/parser/fixing_parser.rs @@ -96,7 +96,7 @@ pub fn parse<'a>(str: &'a str, _options: &ParseOptions) -> Result panic!("Expected two numbers.") + _ => panic!("Expected two numbers."), } } - _ => panic!("Expected object") + _ => panic!("Expected object"), } } } diff --git a/engine/baml-lib/jsonish/src/jsonish/parser/fixing_parser/json_collection.rs b/engine/baml-lib/jsonish/src/jsonish/parser/fixing_parser/json_collection.rs index 097110918..952b91648 100644 --- a/engine/baml-lib/jsonish/src/jsonish/parser/fixing_parser/json_collection.rs +++ b/engine/baml-lib/jsonish/src/jsonish/parser/fixing_parser/json_collection.rs @@ -1,5 +1,4 @@ use baml_types::BamlMap; - use crate::jsonish::Value; #[derive(Debug)] diff --git a/engine/baml-lib/jsonish/src/jsonish/parser/fixing_parser/json_parse_state.rs b/engine/baml-lib/jsonish/src/jsonish/parser/fixing_parser/json_parse_state.rs index 8c7b70460..d4255929d 100644 --- a/engine/baml-lib/jsonish/src/jsonish/parser/fixing_parser/json_parse_state.rs +++ b/engine/baml-lib/jsonish/src/jsonish/parser/fixing_parser/json_parse_state.rs @@ -331,7 +331,7 @@ impl JsonParseState { _ => return false, } } - // If we faile, terminate the string + // If we fail, terminate the string true } x if closing_char == *x => { diff --git a/engine/baml-lib/jsonish/src/lib.rs b/engine/baml-lib/jsonish/src/lib.rs index e89408c68..6de17640d 100644 --- a/engine/baml-lib/jsonish/src/lib.rs +++ b/engine/baml-lib/jsonish/src/lib.rs @@ -54,7 +54,7 @@ pub fn from_str( if v.conditions() .flags() .iter() - .any(|f| matches!(f, Flag::InferedObject(jsonish::Value::String(_)))) + .any(|f| matches!(f, Flag::InferredObject(jsonish::Value::String(_)))) { anyhow::bail!("Failed to coerce value: {:?}", v.conditions().flags()); } @@ -130,7 +130,7 @@ fn last_value_as_number(value: &mut Value) -> Vec<&mut Value> { * * Displaying partial results can be more harmful for certain datatypes, * like ints and floats, despite being useful for strings. This is because - * the prefix of a number conveys something very differenet about the full + * the prefix of a number conveys something very different about the full * number than what the prefix of a string conveys about the full string. * * To prevent confusing users with streamed number prefixes, we have diff --git a/engine/baml-lib/jsonish/src/tests/mod.rs b/engine/baml-lib/jsonish/src/tests/mod.rs index 8b39002c6..7b6bd8e79 100644 --- a/engine/baml-lib/jsonish/src/tests/mod.rs +++ b/engine/baml-lib/jsonish/src/tests/mod.rs @@ -353,7 +353,7 @@ test_deserializer!( json!({"id": null }) ); -// also fails -- if you are in an object and you are casting to a string, dont do that. +// also fails -- if you are in an object and you are casting to a string, don't do that. // TODO: find all the json blobs here correctly test_deserializer!( test_string_from_string24, @@ -698,7 +698,7 @@ fn singleton_list_int_deleted() { let output_format = OutputFormatContent::new(Vec::new(), Vec::new(), target.clone()); let res = from_str(&output_format, &target, "[123", true).expect("Can parse"); let baml_value: BamlValue = res.into(); - assert_eq!(baml_value, BamlValue::List( vec![] )); + assert_eq!(baml_value, BamlValue::List(vec![])); } #[test] @@ -710,7 +710,7 @@ fn list_int_deleted() { let output_format = OutputFormatContent::new(Vec::new(), Vec::new(), target.clone()); let res = from_str(&output_format, &target, "[123, 456", true).expect("Can parse"); let baml_value: BamlValue = res.into(); - assert_eq!(baml_value, BamlValue::List( vec![ BamlValue::Int(123)] )); + assert_eq!(baml_value, BamlValue::List(vec![BamlValue::Int(123)])); } #[test] @@ -722,7 +722,10 @@ fn list_int_not_deleted() { let output_format = OutputFormatContent::new(Vec::new(), Vec::new(), target.clone()); let res = from_str(&output_format, &target, "[123, 456 // Done", true).expect("Can parse"); let baml_value: BamlValue = res.into(); - assert_eq!(baml_value, BamlValue::List( vec![ BamlValue::Int(123), BamlValue::Int(456)] )); + assert_eq!( + baml_value, + BamlValue::List( vec![ BamlValue::Int(123), BamlValue::Int(456)]) + ); } #[test] diff --git a/engine/baml-lib/jsonish/src/tests/test_basics.rs b/engine/baml-lib/jsonish/src/tests/test_basics.rs index ea88ae476..d3e46b143 100644 --- a/engine/baml-lib/jsonish/src/tests/test_basics.rs +++ b/engine/baml-lib/jsonish/src/tests/test_basics.rs @@ -320,7 +320,7 @@ test_deserializer!( // This is un-changed test_deserializer!( - test_prefixed_incompleted_string, + test_prefixed_incompletestring, EMPTY_FILE, r#"prefix "hello"#, FieldType::string(), @@ -518,7 +518,7 @@ test_deserializer!( ```json { "key": "value", - "array": [1, 2, 3, 'some stinrg' with quotes' /* test */], + "array": [1, 2, 3, 'some string' with quotes' /* test */], "object": { // Test comment "key": "value" }, @@ -526,7 +526,7 @@ test_deserializer!( ``` "#, FieldType::class("Test"), - {"key": "value", "array": [1, 2, 3, "some stinrg' with quotes"], "object": {"key": "value"}} + {"key": "value", "array": [1, 2, 3, "some string' with quotes"], "object": {"key": "value"}} ); test_deserializer!( @@ -547,7 +547,7 @@ test_deserializer!( ```json { key: "value", - array: [1, 2, 3, 'some stinrg' with quotes' /* test */], + array: [1, 2, 3, 'some string' with quotes' /* test */], object: { // Test comment key: "value" }, @@ -555,7 +555,7 @@ test_deserializer!( ``` "#, FieldType::class("Test"), - {"key": "value", "array": [1, 2, 3, "some stinrg' with quotes"], "object": {"key": "value"}} + {"key": "value", "array": [1, 2, 3, "some string' with quotes"], "object": {"key": "value"}} ); test_deserializer!( diff --git a/engine/baml-lib/jsonish/src/tests/test_literals.rs b/engine/baml-lib/jsonish/src/tests/test_literals.rs index e75361b18..d9c6abd67 100644 --- a/engine/baml-lib/jsonish/src/tests/test_literals.rs +++ b/engine/baml-lib/jsonish/src/tests/test_literals.rs @@ -141,9 +141,9 @@ test_deserializer!( test_deserializer!( test_literal_string_case_mismatch_upper, EMPTY_FILE, - // Came up with this example unintentioanlly but this causes ambiguity + // Came up with this example unintentionally but this causes ambiguity // issues with unions ("two" | "one"), see the TODO at the end of this file. - r#"The ansewr "TWO" is the correct one"#, + r#"The answer "TWO" is the correct one"#, FieldType::Literal(LiteralValue::String("two".into())), "two" ); diff --git a/engine/baml-lib/jsonish/src/tests/test_partials.rs b/engine/baml-lib/jsonish/src/tests/test_partials.rs index 897086f19..cef9aefc4 100644 --- a/engine/baml-lib/jsonish/src/tests/test_partials.rs +++ b/engine/baml-lib/jsonish/src/tests/test_partials.rs @@ -261,7 +261,7 @@ class Vertex { class Edge { source_id string target_id string - // note, you could use an enum here if you know what rthe relationships are + // note, you could use an enum here if you know what the relationships are relationship string @description(#" A human-readable label for the edge, like 'knows' or "works_with", etc.. "#) diff --git a/engine/baml-lib/parser-database/src/attributes/mod.rs b/engine/baml-lib/parser-database/src/attributes/mod.rs index 0b0efc708..55774e380 100644 --- a/engine/baml-lib/parser-database/src/attributes/mod.rs +++ b/engine/baml-lib/parser-database/src/attributes/mod.rs @@ -92,14 +92,14 @@ fn resolve_type_exp_block_attributes<'db>( for (value_idx, _value) in ast_typexpr.iter_fields() { ctx.visit_attributes((type_id, value_idx).into()); if let Some(attrs) = to_string_attribute::visit(ctx, false) { - enum_attributes.value_serilizers.insert(value_idx, attrs); + enum_attributes.value_serializers.insert(value_idx, attrs); } ctx.validate_visited_attributes(); } // Now validate the enum attributes. ctx.visit_attributes(type_id.into()); - enum_attributes.serilizer = to_string_attribute::visit(ctx, true); + enum_attributes.serializer = to_string_attribute::visit(ctx, true); ctx.validate_visited_attributes(); ctx.types.enum_attributes.insert(type_id, enum_attributes); @@ -110,14 +110,14 @@ fn resolve_type_exp_block_attributes<'db>( for (field_idx, _field) in ast_typexpr.iter_fields() { ctx.visit_attributes((type_id, field_idx).into()); if let Some(attrs) = to_string_attribute::visit(ctx, false) { - class_attributes.field_serilizers.insert(field_idx, attrs); + class_attributes.field_serializers.insert(field_idx, attrs); } ctx.validate_visited_attributes(); } // Now validate the class attributes. ctx.visit_attributes(type_id.into()); - class_attributes.serilizer = to_string_attribute::visit(ctx, true); + class_attributes.serializer = to_string_attribute::visit(ctx, true); ctx.validate_visited_attributes(); ctx.types.class_attributes.insert(type_id, class_attributes); diff --git a/engine/baml-lib/parser-database/src/types/configurations.rs b/engine/baml-lib/parser-database/src/types/configurations.rs index 95f88c71c..1eea261ed 100644 --- a/engine/baml-lib/parser-database/src/types/configurations.rs +++ b/engine/baml-lib/parser-database/src/types/configurations.rs @@ -2,7 +2,6 @@ use internal_baml_diagnostics::{DatamodelError, DatamodelWarning, Span}; use internal_baml_schema_ast::ast::{ValExpId, ValueExprBlock, WithIdentifier, WithName, WithSpan}; use regex::Regex; use std::collections::HashSet; - use crate::{coerce, coerce_array, coerce_expression::coerce_map, context::Context}; use super::{ContantDelayStrategy, ExponentialBackoffStrategy, RetryPolicy, RetryPolicyStrategy}; diff --git a/engine/baml-lib/parser-database/src/types/types.rs b/engine/baml-lib/parser-database/src/types/types.rs index d60499c40..27dd5d6c8 100644 --- a/engine/baml-lib/parser-database/src/types/types.rs +++ b/engine/baml-lib/parser-database/src/types/types.rs @@ -6,14 +6,14 @@ use super::Attributes; #[derive(Debug, Default)] pub struct EnumAttributes { - pub value_serilizers: HashMap, + pub value_serializers: HashMap, - pub serilizer: Option, + pub serializer: Option, } #[derive(Debug, Default)] pub struct ClassAttributes { - pub field_serilizers: HashMap, + pub field_serializers: HashMap, - pub serilizer: Option, + pub serializer: Option, } diff --git a/engine/baml-lib/parser-database/src/walkers/class.rs b/engine/baml-lib/parser-database/src/walkers/class.rs index e096302f3..9e428530f 100644 --- a/engine/baml-lib/parser-database/src/walkers/class.rs +++ b/engine/baml-lib/parser-database/src/walkers/class.rs @@ -79,13 +79,13 @@ impl<'db> ClassWalker<'db> { .types .enum_attributes .get(&self.id) - .and_then(|f| f.serilizer.as_ref()), + .and_then(|f| f.serializer.as_ref()), _ => self .db .types .class_attributes .get(&self.id) - .and_then(|f| f.serilizer.as_ref()), + .and_then(|f| f.serializer.as_ref()), } } diff --git a/engine/baml-lib/parser-database/src/walkers/enum.rs b/engine/baml-lib/parser-database/src/walkers/enum.rs index 07f3f6420..508329e6a 100644 --- a/engine/baml-lib/parser-database/src/walkers/enum.rs +++ b/engine/baml-lib/parser-database/src/walkers/enum.rs @@ -51,7 +51,7 @@ impl<'db> EnumValueWalker<'db> { .types .enum_attributes .get(&self.id.0) - .and_then(|f| f.value_serilizers.get(&self.id.1)); + .and_then(|f| f.value_serializers.get(&self.id.1)); result } diff --git a/engine/baml-lib/parser-database/src/walkers/field.rs b/engine/baml-lib/parser-database/src/walkers/field.rs index 27b7de8e4..418a6d0f0 100644 --- a/engine/baml-lib/parser-database/src/walkers/field.rs +++ b/engine/baml-lib/parser-database/src/walkers/field.rs @@ -25,7 +25,7 @@ impl<'db> FieldWalker<'db> { /// Traverse the field's attributes. pub fn attributes(self) -> &'db Attributes { - &self.db.types.class_attributes[&self.id.0].field_serilizers[&self.id.1] + &self.db.types.class_attributes[&self.id.0].field_serializers[&self.id.1] } /// The field's default attributes. @@ -35,7 +35,7 @@ impl<'db> FieldWalker<'db> { .types .class_attributes .get(&self.id.0) - .and_then(|f| f.field_serilizers.get(&self.id.1)); + .and_then(|f| f.field_serializers.get(&self.id.1)); result } diff --git a/engine/baml-lib/parser-database/src/walkers/template_string.rs b/engine/baml-lib/parser-database/src/walkers/template_string.rs index 6ac6e6d44..6e9df23e4 100644 --- a/engine/baml-lib/parser-database/src/walkers/template_string.rs +++ b/engine/baml-lib/parser-database/src/walkers/template_string.rs @@ -1,7 +1,6 @@ use either::Either; use internal_baml_jinja_types::{PredefinedTypes, Type}; use internal_baml_schema_ast::ast::{self, BlockArgs, Span, WithIdentifier, WithName, WithSpan}; - use crate::types::TemplateStringProperties; use super::Walker; diff --git a/engine/baml-lib/schema-ast/src/ast/attribute.rs b/engine/baml-lib/schema-ast/src/ast/attribute.rs index 896d92ee2..c0537db48 100644 --- a/engine/baml-lib/schema-ast/src/ast/attribute.rs +++ b/engine/baml-lib/schema-ast/src/ast/attribute.rs @@ -36,8 +36,7 @@ impl Attribute { pub fn assert_eq_up_to_span(&self, other: &Attribute) { assert_eq!(self.name.to_string(), other.name.to_string()); assert_eq!(self.parenthesized, other.parenthesized); - self - .arguments + self.arguments .iter() .zip(other.arguments.iter()) .for_each(|(arg1, arg2)| { diff --git a/engine/baml-lib/schema-ast/src/ast/expression.rs b/engine/baml-lib/schema-ast/src/ast/expression.rs index 0c4892e92..a5267498a 100644 --- a/engine/baml-lib/schema-ast/src/ast/expression.rs +++ b/engine/baml-lib/schema-ast/src/ast/expression.rs @@ -1,5 +1,4 @@ use baml_types::TypeValue; - use crate::ast::Span; use std::fmt; @@ -257,7 +256,7 @@ impl Expression { } } - pub fn as_identifer(&self) -> Option<&Identifier> { + pub fn as_identifier(&self) -> Option<&Identifier> { match self { Expression::Identifier(id) => Some(id), _ => None, @@ -365,7 +364,7 @@ impl Expression { k1.assert_eq_up_to_span(k2); v1.assert_eq_up_to_span(v2); }); - }, + } (Map(_,_), _) => panic!("Types do not match: {:?} and {:?}", self, other), } diff --git a/engine/baml-lib/schema-ast/src/ast/identifier.rs b/engine/baml-lib/schema-ast/src/ast/identifier.rs index 68cdcfea0..adeeaa793 100644 --- a/engine/baml-lib/schema-ast/src/ast/identifier.rs +++ b/engine/baml-lib/schema-ast/src/ast/identifier.rs @@ -14,7 +14,7 @@ pub struct RefIdentifier { pub enum Identifier { /// Starts with env.* ENV(String, Span), - /// The path to a Local Identifer + the local identifer. Separated by '.' + /// The path to a Local Identifier + the local identifier. Separated by '.' Ref(RefIdentifier, Span), /// A string without spaces or '.' Always starts with a letter. May contain numbers Local(String, Span), @@ -69,16 +69,18 @@ impl Identifier { pub fn assert_eq_up_to_span(&self, other: &Identifier) { use Identifier::*; match (self, other) { - (ENV(e1,_), ENV(e2, _)) => assert_eq!(e1, e2), - (ENV(_,_), _) => panic!("Mismatched identifiers: {:?}, {:?}", self, other), - (Local(l1,_), Local(l2,_)) => assert_eq!(l1, l2), - (Local(_,_), _) => panic!("Mismatched identifiers: {:?}, {:?}", self, other), - (Ref(r1,_), Ref(r2,_)) => assert_eq!(r1, r2), - (Ref(_,_), _) => panic!("Mismatched identifiers: {:?}, {:?}", self, other), - (Identifier::String(s1,_), Identifier::String(s2,_)) => assert_eq!(s1,s2), - (Identifier::String(_,_), _) => panic!("Mismatched identifiers: {:?}, {:?}", self, other), - (Invalid(i1,_), Invalid(i2,_)) => assert_eq!(i1,i2), - (Invalid(_,_), _) => panic!("Mismatched identifiers: {:?}, {:?}", self, other), + (ENV(e1, _), ENV(e2, _)) => assert_eq!(e1, e2), + (ENV(_, _), _) => panic!("Mismatched identifiers: {:?}, {:?}", self, other), + (Local(l1, _), Local(l2, _)) => assert_eq!(l1, l2), + (Local(_, _), _) => panic!("Mismatched identifiers: {:?}, {:?}", self, other), + (Ref(r1, _), Ref(r2, _)) => assert_eq!(r1, r2), + (Ref(_, _), _) => panic!("Mismatched identifiers: {:?}, {:?}", self, other), + (Identifier::String(s1, _), Identifier::String(s2, _)) => assert_eq!(s1, s2), + (Identifier::String(_, _), _) => { + panic!("Mismatched identifiers: {:?}, {:?}", self, other) + } + (Invalid(i1, _), Invalid(i2, _)) => assert_eq!(i1, i2), + (Invalid(_, _), _) => panic!("Mismatched identifiers: {:?}, {:?}", self, other), } } } diff --git a/engine/baml-lib/schema-ast/src/parser/parse_field.rs b/engine/baml-lib/schema-ast/src/parser/parse_field.rs index 2644eb562..1569fe407 100644 --- a/engine/baml-lib/schema-ast/src/parser/parse_field.rs +++ b/engine/baml-lib/schema-ast/src/parser/parse_field.rs @@ -78,14 +78,16 @@ pub(crate) fn parse_type_expr( match current.as_rule() { Rule::identifier => { name = Some(parse_identifier(current, diagnostics)); - }, + } Rule::trailing_comment => { comment = merge_comments(comment, parse_trailing_comment(current)); } Rule::field_type_chain => { - field_type = parse_field_type_chain(current, diagnostics); + field_type = parse_field_type_chain(current, diagnostics); + } + Rule::field_attribute => { + field_attributes.push(parse_attribute(current, false, diagnostics)) } - Rule::field_attribute => field_attributes.push(parse_attribute(current, false, diagnostics)), _ => parsing_catch_all(current, "field"), } } @@ -178,8 +180,7 @@ pub(crate) fn parse_field_type_with_attr( // ft.set_attributes(attributes.clone()); // Clone the borrowed `Vec` // } } - _ => { - } + _ => {} } ft.extend_attributes(field_attributes); @@ -252,7 +253,10 @@ mod tests { let result = parse_field_type_chain(parsed, &mut diagnostics).unwrap(); if let FieldType::Union(_, types, _, _) = &result { assert_eq!(types[1].clone().attributes().len(), 1); - assert_eq!(types[1].clone().attributes()[0].name.to_string().as_str(), "description"); + assert_eq!( + types[1].clone().attributes()[0].name.to_string().as_str(), + "description" + ); } else { panic!("Expected union"); } diff --git a/engine/baml-lib/schema-ast/src/parser/parse_schema.rs b/engine/baml-lib/schema-ast/src/parser/parse_schema.rs index 79fcd479c..07f3b7e1e 100644 --- a/engine/baml-lib/schema-ast/src/parser/parse_schema.rs +++ b/engine/baml-lib/schema-ast/src/parser/parse_schema.rs @@ -156,7 +156,7 @@ pub fn parse_schema( pest::error::ErrorVariant::ParsingError { positives, .. } => { get_expected_from_error(&positives) } - _ => panic!("Could not construct parsing error. This should never happend."), + _ => panic!("Could not construct parsing error. This should never happened."), }; diagnostics.push_error(DatamodelError::new_parser_error(expected, location)); diff --git a/engine/baml-lib/schema-ast/src/parser/parse_type_expression_block.rs b/engine/baml-lib/schema-ast/src/parser/parse_type_expression_block.rs index fb62c302a..d7ce41f6e 100644 --- a/engine/baml-lib/schema-ast/src/parser/parse_type_expression_block.rs +++ b/engine/baml-lib/schema-ast/src/parser/parse_type_expression_block.rs @@ -120,7 +120,7 @@ mod tests { use super::*; use crate::parser::{BAMLParser, Rule}; use internal_baml_diagnostics::{Diagnostics, SourceFile}; - use pest::{Parser, consumes_to, fails_with, parses_to}; + use pest::{consumes_to, fails_with, parses_to, Parser}; #[test] fn keyword_name_mandatory_whitespace() { diff --git a/engine/baml-lib/schema-ast/src/parser/parse_value_expression_block.rs b/engine/baml-lib/schema-ast/src/parser/parse_value_expression_block.rs index c4544cc9e..e47721429 100644 --- a/engine/baml-lib/schema-ast/src/parser/parse_value_expression_block.rs +++ b/engine/baml-lib/schema-ast/src/parser/parse_value_expression_block.rs @@ -42,10 +42,12 @@ pub(crate) fn parse_value_expression_block( Ok(arg) => input = Some(arg), Err(err) => diagnostics.push_error(err), }, - Rule::field_type | Rule::field_type_chain => match parse_function_arg(current, diagnostics) { - Ok(arg) => output = Some(arg), - Err(err) => diagnostics.push_error(err), - }, + Rule::field_type | Rule::field_type_chain => { + match parse_function_arg(current, diagnostics) { + Ok(arg) => output = Some(arg), + Err(err) => diagnostics.push_error(err), + } + } Rule::BLOCK_OPEN | Rule::BLOCK_CLOSE => {} Rule::value_expression_contents => { diff --git a/engine/baml-runtime/build.rs b/engine/baml-runtime/build.rs index 483925000..a3cf1851a 100644 --- a/engine/baml-runtime/build.rs +++ b/engine/baml-runtime/build.rs @@ -4,9 +4,9 @@ use std::process::Command; fn check_ruby_version() -> Result<()> { // Run the 'ruby -v' command to get the Ruby version - let output = Command::new("ruby").arg("-v").output().context(format!( - "Failed while running 'ruby -v': Ruby does not appear to be installed" - ))?; + let output = Command::new("ruby").arg("-v").output().context( + "Failed while running 'ruby -v': Ruby does not appear to be installed".to_string() + )?; // Extract the version number from the string // Typical output: "ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20]" @@ -33,7 +33,7 @@ fn check_clang_support() -> Result<()> { let output = Command::new("clang") .arg("--print-targets") .output() - .context(format!("Failed while running 'clang --print-targets'"))?; + .context("Failed while running 'clang --print-targets'".to_string())?; // Extract the version number from the string let target_list = String::from_utf8_lossy(&output.stdout); @@ -94,9 +94,7 @@ fn main() { return; } - println!(""); - println!("Please install mise and direnv to build BAML (instructions: https://www.notion.so/gloochat/To-build-BAML-0e9e3e9b583e40fb8fb040505b24d65f )"); - println!(""); + println!("\nPlease install mise and direnv to build BAML (instructions: https://www.notion.so/gloochat/To-build-BAML-0e9e3e9b583e40fb8fb040505b24d65f )\n"); println!("The following errors occurred during build checks:"); for error in errors { println!("{:#}", error); @@ -114,7 +112,6 @@ fn main() { // the system Ruby, so the result is that rust-analyzer will soft fail on... I guess Linux? // which is a compromise I can live with for now. println!("Running inside rust-analyzer - will not induce build failure"); - return; } // comment this out - might cause a build break diff --git a/engine/baml-runtime/src/cli/init.rs b/engine/baml-runtime/src/cli/init.rs index 87a30be03..4aeec542e 100644 --- a/engine/baml-runtime/src/cli/init.rs +++ b/engine/baml-runtime/src/cli/init.rs @@ -1,5 +1,4 @@ use std::{path::PathBuf, process::Command}; - use anyhow::Result; use baml_types::GeneratorOutputType; use include_dir::include_dir; diff --git a/engine/baml-runtime/src/cli/serve/mod.rs b/engine/baml-runtime/src/cli/serve/mod.rs index 6cc67af64..2492c3fa1 100644 --- a/engine/baml-runtime/src/cli/serve/mod.rs +++ b/engine/baml-runtime/src/cli/serve/mod.rs @@ -615,7 +615,9 @@ Tip: test that the server is up using `curl http://localhost:{}/_debug/ping` true, GeneratorDefaultClientMode::Sync, Vec::new(), - ).map_err(|_| BamlError::InternalError{ message: "Failed to make placeholder generator".to_string()})?; + ).map_err(|_| BamlError::InternalError{ + message: "Failed to make placeholder generator".to_string() + })?; let schema: OpenApiSchema = (locked.inner.ir.as_ref(), &fake_generator) .try_into() .map_err(|e| { diff --git a/engine/baml-runtime/src/internal/llm_client/mod.rs b/engine/baml-runtime/src/internal/llm_client/mod.rs index b23686c94..363948172 100644 --- a/engine/baml-runtime/src/internal/llm_client/mod.rs +++ b/engine/baml-runtime/src/internal/llm_client/mod.rs @@ -15,7 +15,6 @@ use anyhow::Result; use internal_baml_core::ir::ClientWalker; use internal_baml_jinja::{ChatMessagePart, RenderedChatMessage, RenderedPrompt}; use serde::{Deserialize, Serialize}; -use serde_json::Map; use std::error::Error; use reqwest::StatusCode; diff --git a/engine/baml-runtime/src/internal/llm_client/orchestrator/call.rs b/engine/baml-runtime/src/internal/llm_client/orchestrator/call.rs index f16408694..7c8476a8d 100644 --- a/engine/baml-runtime/src/internal/llm_client/orchestrator/call.rs +++ b/engine/baml-runtime/src/internal/llm_client/orchestrator/call.rs @@ -39,7 +39,11 @@ pub async fn orchestrate( let prompt = match node.render_prompt(ir, prompt, ctx, params).await { Ok(p) => p, Err(e) => { - results.push((node.scope, LLMResponse::InternalFailure(e.to_string()), None)); + results.push(( + node.scope, + LLMResponse::InternalFailure(e.to_string()), + None + )); continue; } }; diff --git a/engine/baml-runtime/src/internal/llm_client/orchestrator/stream.rs b/engine/baml-runtime/src/internal/llm_client/orchestrator/stream.rs index ecf0ac5fb..ae48cde31 100644 --- a/engine/baml-runtime/src/internal/llm_client/orchestrator/stream.rs +++ b/engine/baml-runtime/src/internal/llm_client/orchestrator/stream.rs @@ -46,7 +46,11 @@ where let prompt = match node.render_prompt(ir, prompt, ctx, params).await { Ok(p) => p, Err(e) => { - results.push((node.scope, LLMResponse::InternalFailure(e.to_string()), None)); + results.push(( + node.scope, + LLMResponse::InternalFailure(e.to_string()), + None + )); continue; } }; diff --git a/engine/baml-runtime/src/internal/llm_client/primitive/anthropic/anthropic_client.rs b/engine/baml-runtime/src/internal/llm_client/primitive/anthropic/anthropic_client.rs index 807f08b0f..86764777c 100644 --- a/engine/baml-runtime/src/internal/llm_client/primitive/anthropic/anthropic_client.rs +++ b/engine/baml-runtime/src/internal/llm_client/primitive/anthropic/anthropic_client.rs @@ -36,7 +36,7 @@ use crate::RuntimeContext; use super::types::MessageChunk; // stores properties required for making a post request to the API -struct PostRequestProperities { +struct PostRequestProperties { default_role: String, base_url: String, api_key: Option, @@ -53,7 +53,7 @@ pub struct AnthropicClient { retry_policy: Option, context: RenderContext_Client, features: ModelFeatures, - properties: PostRequestProperities, + properties: PostRequestProperties, // clients client: reqwest::Client, @@ -64,7 +64,7 @@ pub struct AnthropicClient { fn resolve_properties( mut properties: HashMap, ctx: &RuntimeContext, -) -> Result { +) -> Result { // this is a required field properties .entry("max_tokens".into()) @@ -113,7 +113,7 @@ fn resolve_properties( .entry("anthropic-version".to_string()) .or_insert("2023-06-01".to_string()); - Ok(PostRequestProperities { + Ok(PostRequestProperties { default_role, base_url, api_key, @@ -289,7 +289,7 @@ impl SseResponseTrait for AnthropicClient { } } -// handles streamign chat interactions, when sending prompt to API and processing response stream +// handles streaming chat interactions, when sending prompt to API and processing response stream impl WithStreamChat for AnthropicClient { async fn stream_chat( &self, diff --git a/engine/baml-runtime/src/internal/llm_client/primitive/google/googleai_client.rs b/engine/baml-runtime/src/internal/llm_client/primitive/google/googleai_client.rs index 12c59081f..86195187c 100644 --- a/engine/baml-runtime/src/internal/llm_client/primitive/google/googleai_client.rs +++ b/engine/baml-runtime/src/internal/llm_client/primitive/google/googleai_client.rs @@ -27,7 +27,7 @@ use internal_baml_core::ir::ClientWalker; use internal_baml_jinja::{ChatMessagePart, RenderContext_Client, RenderedChatMessage}; use serde_json::json; use std::collections::HashMap; -struct PostRequestProperities { +struct PostRequestProperties { default_role: String, api_key: Option, headers: HashMap, @@ -44,13 +44,13 @@ pub struct GoogleAIClient { pub retry_policy: Option, pub context: RenderContext_Client, pub features: ModelFeatures, - properties: PostRequestProperities, + properties: PostRequestProperties, } fn resolve_properties( mut properties: HashMap, ctx: &RuntimeContext, -) -> Result { +) -> Result { let default_role = properties .remove("default_role") .and_then(|v| v.as_str().map(|s| s.to_string())) @@ -100,7 +100,7 @@ fn resolve_properties( None => Default::default(), }; - Ok(PostRequestProperities { + Ok(PostRequestProperties { default_role, api_key, headers, diff --git a/engine/baml-runtime/src/internal/llm_client/traits/mod.rs b/engine/baml-runtime/src/internal/llm_client/traits/mod.rs index 0dfe7601e..9a71ca895 100644 --- a/engine/baml-runtime/src/internal/llm_client/traits/mod.rs +++ b/engine/baml-runtime/src/internal/llm_client/traits/mod.rs @@ -1,5 +1,4 @@ use std::{collections::HashMap, path::PathBuf, pin::Pin}; - use anyhow::{Context, Result}; use aws_smithy_types::byte_stream::error::Error; use serde_json::{json, Map}; @@ -638,7 +637,7 @@ async fn fetch_with_proxy( proxy_url: Option<&str>, ) -> Result { let client = reqwest::Client::new(); - let mut request = if let Some(proxy) = proxy_url { + let request = if let Some(proxy) = proxy_url { client.get(proxy).header("baml-original-url", url) } else { client.get(url) diff --git a/engine/baml-runtime/src/lib.rs b/engine/baml-runtime/src/lib.rs index f9cccc9bd..86d1875e1 100644 --- a/engine/baml-runtime/src/lib.rs +++ b/engine/baml-runtime/src/lib.rs @@ -58,8 +58,6 @@ pub use internal_baml_jinja::{ChatMessagePart, RenderedPrompt}; #[cfg(feature = "internal")] pub use runtime_interface::InternalRuntimeInterface; -#[cfg(not(feature = "internal"))] -pub(crate) use internal_baml_jinja::{ChatMessagePart, RenderedPrompt}; #[cfg(not(feature = "internal"))] pub(crate) use runtime_interface::InternalRuntimeInterface; @@ -382,7 +380,7 @@ impl BamlRuntime { // generating code, run 'baml-cli dev' to generate code" because that's surprising // // We _could_ do something like "show that message the first time the user tries to - // codegen for rest/openapi", but that's overengineered, I think + // codegen for rest/openapi", but that's over engineered, I think return Ok(vec![]); } } diff --git a/engine/baml-runtime/src/tracing/api_wrapper/api_interface.rs b/engine/baml-runtime/src/tracing/api_wrapper/api_interface.rs index a83fc14d7..544dd8fb4 100644 --- a/engine/baml-runtime/src/tracing/api_wrapper/api_interface.rs +++ b/engine/baml-runtime/src/tracing/api_wrapper/api_interface.rs @@ -53,7 +53,7 @@ pub(crate) struct CacheRequest { provider: String, prompt: Template, prompt_vars: HashMap, - invovation_params: HashMap, + invocation_params: HashMap, } #[derive(Debug, Serialize)] diff --git a/engine/baml-runtime/src/tracing/api_wrapper/core_types.rs b/engine/baml-runtime/src/tracing/api_wrapper/core_types.rs index 05dd30a39..d522093fc 100644 --- a/engine/baml-runtime/src/tracing/api_wrapper/core_types.rs +++ b/engine/baml-runtime/src/tracing/api_wrapper/core_types.rs @@ -1,5 +1,4 @@ use std::{collections::HashMap, path::PathBuf}; - use indexmap::IndexMap; use serde::{Deserialize, Serialize}; use serde_json::Value; @@ -60,7 +59,7 @@ pub enum TypeSchemaName { #[serde(untagged)] pub enum ValueType { String(String), - // For mutli-args, we use a list of strings + // For multi-args, we use a list of strings List(Vec), } diff --git a/engine/baml-runtime/src/tracing/threaded_tracer.rs b/engine/baml-runtime/src/tracing/threaded_tracer.rs index a2fce1a67..b197590bb 100644 --- a/engine/baml-runtime/src/tracing/threaded_tracer.rs +++ b/engine/baml-runtime/src/tracing/threaded_tracer.rs @@ -202,7 +202,7 @@ impl ThreadedTracer { ProcessorStatus::Done(r_id) if r_id >= id => { return Ok(()); } - ProcessorStatus::Done(id) => { + ProcessorStatus::Done(_id) => { // Old flush, ignore } } diff --git a/engine/baml-runtime/tests/test_runtime.rs b/engine/baml-runtime/tests/test_runtime.rs index 45a61bc2d..1f6976dcb 100644 --- a/engine/baml-runtime/tests/test_runtime.rs +++ b/engine/baml-runtime/tests/test_runtime.rs @@ -6,15 +6,15 @@ mod internal_tests { use std::any; use std::collections::HashMap; + use baml_runtime::internal::llm_client::orchestrator::OrchestrationScope; use baml_runtime::BamlRuntime; use std::sync::Once; - use baml_runtime::internal::llm_client::orchestrator::OrchestrationScope; use baml_runtime::InternalRuntimeInterface; use baml_types::BamlValue; use baml_runtime::{ - internal::llm_client::LLMResponse, DiagnosticsError, IRHelper, RenderedPrompt, + internal::llm_client::LLMResponse, DiagnosticsError, IRHelper, RenderedPrompt, }; use wasm_bindgen_test::*; diff --git a/engine/baml-schema-wasm/nodejs/README.md b/engine/baml-schema-wasm/nodejs/README.md index 97186f4af..379e081b3 100644 --- a/engine/baml-schema-wasm/nodejs/README.md +++ b/engine/baml-schema-wasm/nodejs/README.md @@ -22,7 +22,7 @@ node -e "const prismaSchema = require('@prisma/prisma-schema-wasm'); console.log - It is triggered from the https://github.com/prisma/engines-wrapper publish action. - The [Rust source code](https://github.com/prisma/prisma-engines/tree/main/prisma-schema-wasm/src) for the wasm module - The [nix build definition](https://github.com/prisma/prisma-engines/blob/main/prisma-schema-wasm/default.nix) - - It gives us a fully reproducible, thoroughly described build process and environment. The alternative would be a bash script with installs through `rustup`, `cargo install` and `apt`, with underspecified system dependencies and best-effort version pinning. + - It gives us a fully reproducible, thoroughly described build process and environment. The alternative would be a bash script with installs through `rustup`, `cargo install` and `apt`, with under specified system dependencies and best-effort version pinning. - You can read more about nix on [nix.dev](https://nix.dev/) and the [official website](https://nixos.org/). ## Local Dev with Language-Tools diff --git a/engine/language_client_codegen/src/lib.rs b/engine/language_client_codegen/src/lib.rs index 4f6d152e4..319548ecd 100644 --- a/engine/language_client_codegen/src/lib.rs +++ b/engine/language_client_codegen/src/lib.rs @@ -60,7 +60,7 @@ impl GeneratorArgs { Ok(Self { output_dir_relative_to_baml_src: output_dir_relative_to_baml_src.into(), baml_src_dir: baml_src.clone(), - // for the key, whhich is the name, just get the filename + // for the key, which is the name, just get the filename inlined_file_map: input_file_map, version, no_version_check, diff --git a/engine/language_client_codegen/src/ruby/generate_types.rs b/engine/language_client_codegen/src/ruby/generate_types.rs index f67219449..1e8692a02 100644 --- a/engine/language_client_codegen/src/ruby/generate_types.rs +++ b/engine/language_client_codegen/src/ruby/generate_types.rs @@ -29,7 +29,7 @@ pub(crate) struct RubyStreamTypes<'ir> { partial_classes: Vec>, } -/// The Python class corresponding to Partial +/// The Python class corresponding to Partial struct PartialRubyStruct<'ir> { name: &'ir str, // the name, and the type of the field diff --git a/engine/language_client_codegen/src/typescript/mod.rs b/engine/language_client_codegen/src/typescript/mod.rs index deb8277f7..0dd54749c 100644 --- a/engine/language_client_codegen/src/typescript/mod.rs +++ b/engine/language_client_codegen/src/typescript/mod.rs @@ -101,8 +101,8 @@ impl TryFrom<(&'_ IntermediateRepr, &'_ crate::GeneratorArgs)> for AsyncTypescri type Error = anyhow::Error; fn try_from(params: (&'_ IntermediateRepr, &'_ crate::GeneratorArgs)) -> Result { - let typscript_client = TypescriptClient::try_from(params)?; - Ok(typscript_client.into()) + let typescript_client = TypescriptClient::try_from(params)?; + Ok(typescript_client.into()) } } @@ -110,8 +110,8 @@ impl TryFrom<(&'_ IntermediateRepr, &'_ crate::GeneratorArgs)> for SyncTypescrip type Error = anyhow::Error; fn try_from(params: (&'_ IntermediateRepr, &'_ crate::GeneratorArgs)) -> Result { - let typscript_client = TypescriptClient::try_from(params)?; - Ok(typscript_client.into()) + let typescript_client = TypescriptClient::try_from(params)?; + Ok(typescript_client.into()) } } diff --git a/engine/language_client_codegen/src/version_check.rs b/engine/language_client_codegen/src/version_check.rs index 64d7bcc6b..0d942919c 100644 --- a/engine/language_client_codegen/src/version_check.rs +++ b/engine/language_client_codegen/src/version_check.rs @@ -98,10 +98,18 @@ pub fn check_version( ) } else { let update_instruction = match generator_language { - GeneratorOutputType::OpenApi => format!("use 'npx @boundaryml/baml@{gen_version}'"), - GeneratorOutputType::PythonPydantic => format!("pip install --upgrade baml-py=={}", gen_version), - GeneratorOutputType::Typescript => format!("npm install --save-dev @boundaryml/baml@{}", gen_version), - GeneratorOutputType::RubySorbet => format!("gem install baml -v {}", gen_version), + GeneratorOutputType::OpenApi => { + format!("use 'npx @boundaryml/baml@{gen_version}'") + } + GeneratorOutputType::PythonPydantic => { + format!("pip install --upgrade baml-py=={}", gen_version) + } + GeneratorOutputType::Typescript => { + format!("npm install --save-dev @boundaryml/baml@{}", gen_version) + } + GeneratorOutputType::RubySorbet => { + format!("gem install baml -v {}", gen_version) + } }; ( match generator_type { @@ -121,12 +129,11 @@ pub fn check_version( false => format!("[documentation]({})", docs_link), _ => docs_link.to_string(), }; - let error_message = format!( "{}\n\nAction required: {}\n\nTo prevent this issue, see: {}", base_message, update_message, formatted_link ); - + return Some(VersionCheckError { msg: if !is_diagnostic { format!("⚠️⚠️⚠️ BAML GENERATION DISABLED: {}", error_message) @@ -135,7 +142,6 @@ pub fn check_version( }, }); } - None } diff --git a/engine/language_client_python/src/parse_py_type.rs b/engine/language_client_python/src/parse_py_type.rs index 7a1f5ee45..55496ba9f 100644 --- a/engine/language_client_python/src/parse_py_type.rs +++ b/engine/language_client_python/src/parse_py_type.rs @@ -98,8 +98,8 @@ fn pyobject_to_json<'py, F>( where F: FnMut(Python<'py>, PyObject, &UnknownTypeHandler) -> Result, { - let infered = match to_type(py, any, handle_unknown_types) { - Ok(infered) => infered, + let inferred = match to_type(py, any, handle_unknown_types) { + Ok(inferred) => inferred, Err(e) => { return Err(vec![SerializationError { position: vec![], @@ -107,7 +107,7 @@ where }]) } }; - Ok(Some(match infered { + Ok(Some(match inferred { MappedPyType::Enum(e, value) => BamlValue::Enum(e, value), MappedPyType::Class(c, kvs) => { let mut errs = vec![]; diff --git a/engine/language_client_typescript/src/runtime.rs b/engine/language_client_typescript/src/runtime.rs index 570872a4f..76fdc561f 100644 --- a/engine/language_client_typescript/src/runtime.rs +++ b/engine/language_client_typescript/src/runtime.rs @@ -346,7 +346,7 @@ impl BamlRuntime { } #[napi] - pub fn flush(&mut self, env: Env) -> napi::Result<()> { + pub fn flush(&mut self, _env: Env) -> napi::Result<()> { self.inner.flush().map_err(|e| from_anyhow_error(e)) } diff --git a/integ-tests/python/baml_example_app.py b/integ-tests/python/baml_example_app.py index aab26fcb7..84e979f9e 100644 --- a/integ-tests/python/baml_example_app.py +++ b/integ-tests/python/baml_example_app.py @@ -23,7 +23,7 @@ async def extract_resume(resume: str) -> None: print("\n\nNow extracting using streaming") async with b.ExtractResume.stream(resume) as stream: async for x in stream.parsed_stream: - if x.is_parseable: + if x.is_parsable: print(f"streaming: {x.parsed.model_dump_json()}") response = await stream.get_final_response() if response.has_value: