Skip to content

Commit

Permalink
Adding various stability fixes (#709)
Browse files Browse the repository at this point in the history
* Dynamic enums are now ordered in the order of insertion
* ruby -> ruby/sorbet in the generator
* Default max_tokens for azure-openai provider is now  4096 (previous was azure's api default for 16)
  • Loading branch information
hellovai authored Jun 22, 2024
1 parent 282b419 commit b42382f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion engine/baml-runtime/src/cli/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl InitArgs {
// your choice. You can have multiple generators if you use multiple languages.
// Just ensure that the output_dir is different for each generator.
generator target {{
// Valid values: "typescript", "python-pydantic", "ruby"
// Valid values: "python/pydantic", "typescript", "ruby/sorbet"
output_type "{}"
// Where the generated code will be saved (relative to baml_src/)
output_dir "../"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ pub fn resolve_properties(
}
};

properties
.entry("max_tokens".into())
.or_insert_with(|| 4096.into());

Ok(PostRequestProperities {
default_role,
base_url,
Expand Down
3 changes: 1 addition & 2 deletions engine/baml-runtime/src/type_builder/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::collections::HashMap;
use std::sync::{Arc, Mutex};

use baml_types::{BamlValue, FieldType};
Expand Down Expand Up @@ -94,7 +93,7 @@ impl ClassBuilder {
}

pub struct EnumBuilder {
values: Arc<Mutex<HashMap<String, Arc<Mutex<EnumValueBuilder>>>>>,
values: Arc<Mutex<IndexMap<String, Arc<Mutex<EnumValueBuilder>>>>>,
meta: MetaData,
}
impl_meta!(EnumBuilder);
Expand Down
1 change: 0 additions & 1 deletion integ-tests/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ env -u CONDA_PREFIX poetry run maturin develop --manifest-path ../../engine/lang
BAML_LOG=baml_events infisical run --env=dev -- poetry run pytest app/test_functions.py -s
```

2 changes: 1 addition & 1 deletion integ-tests/python/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ async def test_stream_dynamic_class_output():
tb = TypeBuilder()
tb.DynamicOutput.add_property("hair_color", tb.string())
print(tb.DynamicOutput.list_properties())
for prop in tb.DynamicOutput.list_properties():
for prop, _ in tb.DynamicOutput.list_properties():
print(f"Property: {prop}")

stream = b.stream.MyFunc(
Expand Down

0 comments on commit b42382f

Please sign in to comment.