Skip to content

Commit

Permalink
Merge canary
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniosarosi committed Dec 18, 2024
2 parents 4eb543a + 20ec134 commit ca7b63e
Show file tree
Hide file tree
Showing 39 changed files with 1,079 additions and 420 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ jobs:
done
publish-to-github:
environment: release
needs: [all-builds]
if: ${{ startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
Expand All @@ -181,6 +182,7 @@ jobs:
body: ${{steps.latest_release.outputs.changelog}}

publish-to-open-vsx:
environment: release
needs: [all-builds]
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') || inputs.force_publish_vscode }}
Expand All @@ -202,6 +204,7 @@ jobs:
OVSX_PAT: ${{ secrets.OVSX_PAT }}

publish-to-vscode-marketplace:
environment: release
needs: [all-builds]
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') || inputs.force_publish_vscode }}
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.

## [0.70.5](https://github.com/boundaryml/baml/compare/0.70.1..0.70.5) - 2024-12-13

### Bug Fixes

- Remove log statements (#1230) - ([4bcdd19](https://github.com/boundaryml/baml/commit/4bcdd198f219cd016ee64cc6444dd62e69f796fb)) - hellovai
- Fix playground proxy related issues (#1228, #1229, #1237) - ([7384ba8](https://github.com/boundaryml/baml/commit/7384ba8cb5d1f012c50ddfb2a44a142ec9654397)) ([7bb6df4](https://github.com/boundaryml/baml/commit/7bb6df40fe37753b946ceeec6b30c4d9cdcc4ce7)) ([16054f5](https://github.com/boundaryml/baml/commit/16054f5f858dcaf80f013d466ceb9354c6a160b7)) - aaronvg

### DOCS

- deno run instead of dpx (#1225) - ([7c64299](https://github.com/boundaryml/baml/commit/7c642992cd7d52b7e7cd718542dfa68c41b5aab3)) - Jeffrey Konowitch
- Fix broken links (#1235) - ([859c699](https://github.com/boundaryml/baml/commit/859c6998cef7950d52cc3287f51d74106a58d89d)) - Samuel Lijin

### Features

- Support parsing primitive values from single-key objects (#1224) - ([935a190](https://github.com/boundaryml/baml/commit/935a190556d12077f961ce083723e7c1f816f387)) - revidious


## [0.70.1](https://github.com/boundaryml/baml/compare/0.70.0..0.70.1) - 2024-12-05

### Bug Fixes
Expand Down
36 changes: 18 additions & 18 deletions engine/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ internal-baml-jinja = { path = "baml-lib/jinja" }
internal-baml-schema-ast = { path = "baml-lib/schema-ast" }

[workspace.package]
version = "0.70.1"
version = "0.70.5"
authors = ["Boundary <[email protected]>"]

description = "BAML Toolchain"
Expand Down
44 changes: 38 additions & 6 deletions engine/baml-lib/jsonish/src/tests/test_aliases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type C = A[]
test_deserializer!(
test_json_without_nested_objects,
r#"
type JsonValue = int | float | string | bool | JsonValue[] | map<string, JsonValue>
type JsonValue = int | float | bool | string | null | JsonValue[] | map<string, JsonValue>
"#,
r#"
{
Expand All @@ -62,7 +62,7 @@ type JsonValue = int | float | string | bool | JsonValue[] | map<string, JsonVal
test_deserializer!(
test_json_with_nested_list,
r#"
type JsonValue = int | string | bool | JsonValue[] | map<string, JsonValue>
type JsonValue = int | float | bool | string | null | JsonValue[] | map<string, JsonValue>
"#,
r#"
{
Expand All @@ -84,7 +84,7 @@ type JsonValue = int | string | bool | JsonValue[] | map<string, JsonValue>
test_deserializer!(
test_json_with_nested_object,
r#"
type JsonValue = int | bool | string | JsonValue[] | map<string, JsonValue>
type JsonValue = int | float | bool | string | null | JsonValue[] | map<string, JsonValue>
"#,
r#"
{
Expand Down Expand Up @@ -114,7 +114,7 @@ type JsonValue = int | bool | string | JsonValue[] | map<string, JsonValue>
test_deserializer!(
test_full_json_with_nested_objects,
r#"
type JsonValue = JsonValue[] | map<string, JsonValue> | int | bool | string
type JsonValue = int | float | bool | string | null | JsonValue[] | map<string, JsonValue>
"#,
r#"
{
Expand Down Expand Up @@ -172,7 +172,7 @@ type JsonValue = JsonValue[] | map<string, JsonValue> | int | bool | string
test_deserializer!(
test_list_of_json_objects,
r#"
type JsonValue = int | string | bool | JsonValue[] | map<string, JsonValue>
type JsonValue = int | float | bool | string | null | JsonValue[] | map<string, JsonValue>
"#,
r#"
[
Expand Down Expand Up @@ -210,7 +210,7 @@ type JsonValue = int | string | bool | JsonValue[] | map<string, JsonValue>
test_deserializer!(
test_nested_list,
r#"
type JsonValue = int | float | bool | string | JsonValue[] | map<string, JsonValue>
type JsonValue = int | float | bool | string | null | JsonValue[] | map<string, JsonValue>
"#,
r#"
[[42.1]]
Expand All @@ -219,3 +219,35 @@ type JsonValue = int | float | bool | string | JsonValue[] | map<string, JsonVal
// [[[[[[[[[[[[[[[[[[[[42]]]]]]]]]]]]]]]]]]]]
[[42.1]]
);

test_deserializer!(
test_json_defined_with_cycles,
r#"
type JsonValue = int | float | bool | string | null | JsonArray | JsonObject
type JsonArray = JsonValue[]
type JsonObject = map<string, JsonValue>
"#,
r#"
{
"number": 1,
"string": "test",
"bool": true,
"json": {
"number": 1,
"string": "test",
"bool": true
}
}
"#,
FieldType::RecursiveTypeAlias("JsonValue".into()),
{
"number": 1,
"string": "test",
"bool": true,
"json": {
"number": 1,
"string": "test",
"bool": true
}
}
);
22 changes: 11 additions & 11 deletions engine/baml-runtime/src/internal/llm_client/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,9 +635,10 @@ async fn to_base64_with_inferred_mime_type(
Ok((base64, mime_type))
} else {
Err(anyhow::anyhow!(
"Failed to fetch media: {}, {}",
"Failed to fetch media: {} {}, {}",
response.status(),
response.text().await.unwrap_or_default()
media_url.url,
response.text().await.unwrap_or_default(),
))
}
}
Expand All @@ -664,15 +665,14 @@ async fn fetch_with_proxy(
let client = reqwest::Client::new();

let request = if let Some(proxy) = proxy_url {
client
.get(format!(
"{}{}",
proxy,
url.parse::<url::Url>()
.map_err(|e| anyhow::anyhow!("Failed to parse URL: {}", e))?
.path()
))
.header("baml-original-url", url)
let new_proxy_url = format!(
"{}{}",
proxy,
url.parse::<url::Url>()
.map_err(|e| anyhow::anyhow!("Failed to parse URL: {}", e))?
.path()
);
client.get(new_proxy_url).header("baml-original-url", url)
} else {
client.get(url)
};
Expand Down
22 changes: 22 additions & 0 deletions engine/baml-schema-wasm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#[cfg(target_arch = "wasm32")]
pub mod runtime_wasm;

use internal_baml_core::internal_baml_schema_ast::{format_schema, FormatOptions};
use std::env;
use wasm_bindgen::prelude::*;

Expand All @@ -9,3 +10,24 @@ pub fn version() -> String {
// register_panic_hook();
env!("CARGO_PKG_VERSION").to_string()
}

#[wasm_bindgen]
pub fn format_document(path: String, text: String) -> Option<String> {
log::info!("Trying to format document (rust): {}", path);
match format_schema(
&text,
FormatOptions {
indent_width: 2,
fail_on_unhandled_rule: false,
},
) {
Ok(formatted) => {
log::info!("Formatted document: {}", formatted);
Some(formatted)
}
Err(e) => {
log::error!("Failed to format document: {} {:?}", path, e);
None
}
}
}
6 changes: 6 additions & 0 deletions engine/baml-schema-wasm/src/runtime_wasm/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ pub struct WasmGeneratorOutput {
#[wasm_bindgen(readonly)]
pub output_dir: String,
#[wasm_bindgen(readonly)]
pub output_dir_relative_to_baml_src: String,
#[wasm_bindgen(readonly)]
pub files: Vec<WasmGeneratedFile>,
}

Expand All @@ -22,6 +24,10 @@ impl Into<WasmGeneratorOutput> for GenerateOutput {
fn into(self) -> WasmGeneratorOutput {
WasmGeneratorOutput {
output_dir: self.output_dir_full.to_string_lossy().to_string(),
output_dir_relative_to_baml_src: self
.output_dir_shorthand
.to_string_lossy()
.to_string(),
files: self
.files
.into_iter()
Expand Down
Loading

0 comments on commit ca7b63e

Please sign in to comment.