From b42382fed88a56f76777919d86ef79e269350204 Mon Sep 17 00:00:00 2001 From: hellovai Date: Sat, 22 Jun 2024 00:28:42 -0700 Subject: [PATCH] Adding various stability fixes (#709) * 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) --- engine/baml-runtime/src/cli/init.rs | 2 +- .../internal/llm_client/primitive/openai/properties/azure.rs | 4 ++++ engine/baml-runtime/src/type_builder/mod.rs | 3 +-- integ-tests/python/README.md | 1 - integ-tests/python/test_functions.py | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/engine/baml-runtime/src/cli/init.rs b/engine/baml-runtime/src/cli/init.rs index b2056624e..261f3340b 100644 --- a/engine/baml-runtime/src/cli/init.rs +++ b/engine/baml-runtime/src/cli/init.rs @@ -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 "../" diff --git a/engine/baml-runtime/src/internal/llm_client/primitive/openai/properties/azure.rs b/engine/baml-runtime/src/internal/llm_client/primitive/openai/properties/azure.rs index b0c79b560..a95aeff7d 100644 --- a/engine/baml-runtime/src/internal/llm_client/primitive/openai/properties/azure.rs +++ b/engine/baml-runtime/src/internal/llm_client/primitive/openai/properties/azure.rs @@ -98,6 +98,10 @@ pub fn resolve_properties( } }; + properties + .entry("max_tokens".into()) + .or_insert_with(|| 4096.into()); + Ok(PostRequestProperities { default_role, base_url, diff --git a/engine/baml-runtime/src/type_builder/mod.rs b/engine/baml-runtime/src/type_builder/mod.rs index 84e578074..aec8acb98 100644 --- a/engine/baml-runtime/src/type_builder/mod.rs +++ b/engine/baml-runtime/src/type_builder/mod.rs @@ -1,4 +1,3 @@ -use std::collections::HashMap; use std::sync::{Arc, Mutex}; use baml_types::{BamlValue, FieldType}; @@ -94,7 +93,7 @@ impl ClassBuilder { } pub struct EnumBuilder { - values: Arc>>>>, + values: Arc>>>>, meta: MetaData, } impl_meta!(EnumBuilder); diff --git a/integ-tests/python/README.md b/integ-tests/python/README.md index 9a89befd3..de458c20b 100644 --- a/integ-tests/python/README.md +++ b/integ-tests/python/README.md @@ -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 ``` - diff --git a/integ-tests/python/test_functions.py b/integ-tests/python/test_functions.py index 6d7e04463..8372daa9d 100644 --- a/integ-tests/python/test_functions.py +++ b/integ-tests/python/test_functions.py @@ -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(