Skip to content

Commit

Permalink
Merge branch 'canary' into orchestration_graph
Browse files Browse the repository at this point in the history
  • Loading branch information
anish-palakurthi committed Aug 8, 2024
2 parents 64e3557 + ec9b66c commit d14bce2
Show file tree
Hide file tree
Showing 43 changed files with 2,939 additions and 1,924 deletions.
63 changes: 41 additions & 22 deletions .github/workflows/build-python-release.reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Release language_client_python

on:
workflow_call: {}
push:
branches: [sam/glibc-aarch64]

concurrency:
# suffix is important to prevent a concurrency deadlock with the calling workflow
Expand All @@ -14,28 +16,41 @@ jobs:
fail-fast: false
matrix:
_:
- runs_on: ubuntu-latest
target: x86_64
name: x86_64-unknown-linux-gnu
manylinux: 'auto'
- target: x86_64-unknown-linux-gnu
runs_on: ubuntu-latest

- runs_on: ubuntu-latest
target: aarch64
name: aarch64-unknown-linux-gnu
manylinux: '2_28'
- target: aarch64-unknown-linux-gnu
runs_on: ubuntu-latest
manylinux: 2_24
# I'm not sure if this actually works; I can't 'pip install ./local-path.whl'
# from inside a container based off quay.io/pypa/manylinux2014_aarch64
# see https://github.com/astral-sh/uv/issues/3439#issuecomment-2110448346
# manylinux: 2_28
# env:
# # Workaround ring 0.17 build issue
# # see https://github.com/briansmith/ring/issues/1728
# CFLAGS_aarch64_unknown_linux_gnu: "-D__ARM_ARCH=8"

- runs_on: macos-latest
target: x86_64
name: x86_64-apple-darwin
- target: x86_64-unknown-linux-musl
runs_on: ubuntu-latest
# see https://github.com/astral-sh/uv/blob/9bb55c4ac0582e05d1a7a5bbd99cc7b2c82f1847/.github/workflows/build-binaries.yml#L594
manylinux: musllinux_1_1

- runs_on: macos-latest
target: aarch64
name: aarch64-apple-darwin

- runs_on: windows-latest
target: x64
name: x86_64-pc-windows-msvc
- target: aarch64-unknown-linux-musl
runs_on: ubuntu-latest
# see https://github.com/astral-sh/uv/blob/9bb55c4ac0582e05d1a7a5bbd99cc7b2c82f1847/.github/workflows/build-binaries.yml#L594
manylinux: musllinux_1_1

- target: x86_64-apple-darwin
runs_on: macos-latest

- target: aarch64-apple-darwin
runs_on: macos-latest

- target: x86_64-pc-windows-msvc
runs_on: windows-latest

name: ${{ matrix._.target }}
runs-on: ${{ matrix._.runs_on }}
steps:
- uses: actions/checkout@v4
Expand All @@ -46,23 +61,27 @@ jobs:

- name: Build wheels
uses: PyO3/maturin-action@v1
env: ${{ matrix._.env || fromJSON('{}') }}
with:
target: ${{ matrix._.target }}
command: build
args: --release --out engine/language_client_python/dist --manifest-path engine/language_client_python/Cargo.toml
# building in engine/ ensures that we pick up .cargo/config.toml
working-directory: engine
args: --release --out language_client_python/dist --manifest-path language_client_python/Cargo.toml
sccache: "true"
manylinux: ${{ matrix._.manylinux }}
before-script-linux: |
if command -v yum &> /dev/null; then
yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic
else
# If we're running on debian-based system.
apt update -y && apt-get install -y libssl-dev openssl pkg-config
# sudo apt update -y && apt-get install -y libssl-dev openssl pkg-config
:
fi
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix._.name }}
name: wheels-${{ matrix._.target }}
path: engine/language_client_python/dist
if-no-files-found: error
if-no-files-found: error
25 changes: 23 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@

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

## [0.53.0](https://github.com/boundaryml/baml/compare/0.52.1..0.53.0) - 2024-08-05

### Bug Fixes

- make image[] render correctly in prompts (#855) - ([4a17dce](https://github.com/boundaryml/baml/commit/4a17dce43c05efd5f4ea304f2609fe140de1dd8c)) - Samuel Lijin

### Features

- **(ruby)** implement dynamic types, dynamic clients, images, and audio (#842) - ([4a21eed](https://github.com/boundaryml/baml/commit/4a21eed668f32b042fba61f24c9efb8b3794a420)) - Samuel Lijin
- Codelenses for test cases (#812) - ([7cd8794](https://github.com/boundaryml/baml/commit/7cd87942bf50a72de0ad46154f164fb2c174f25b)) - Anish Palakurthi

### Issue

- removed vertex auth token printing (#846) - ([b839316](https://github.com/boundaryml/baml/commit/b83931665a2c3b840eb6c6d31cf3d01c7926e52e)) - Anish Palakurthi
- Fix google type deserialization issue - ([a55b9a1](https://github.com/boundaryml/baml/commit/a55b9a106176ed1ce34bb63397610c2640b37f16)) - Aaron Villalpando

### Miscellaneous Chores

- clean up release stuff (#836) - ([eed41b7](https://github.com/boundaryml/baml/commit/eed41b7474417d2e65b2c5d742234cc20fc5644e)) - Samuel Lijin
- Add bfcl results to readme, fix links icons (#856) - ([5ef7f3d](https://github.com/boundaryml/baml/commit/5ef7f3db99d8d23ff97f1e8372ee71ab7aa127aa)) - aaronvg
- Fix prompt fiddle and playground styles, add more logging, and add stop-reason to playground (#858) - ([38e3153](https://github.com/boundaryml/baml/commit/38e3153843a17ae1e87ae9879ab4374b083d77d0)) - aaronvg
- Bump version to 0.53.0 - ([fd16839](https://github.com/boundaryml/baml/commit/fd16839a2c0b9d92bd5bdcb57f950e22d0a29959)) - Aaron Villalpando

## [0.52.1](https://github.com/boundaryml/baml/compare/0.52.0..0.52.1) - 2024-07-24

### Bug Fixes
Expand All @@ -18,14 +41,12 @@ All notable changes to this project will be documented in this file. See [conven

- Fix ClientRegistry for Typescript code-gen (#828) - ([b69921f](https://github.com/boundaryml/baml/commit/b69921f45df0182072b09ab28fe6231ccfaa5767)) - hellovai


## [0.51.2](https://github.com/boundaryml/baml/compare/0.51.1..0.51.2) - 2024-07-24

### Features

- Add support for unions / maps / null in TypeBuilder. (#820) - ([8d9e92d](https://github.com/boundaryml/baml/commit/8d9e92d3050a67edbec5ee6056397becbcdb754b)) - hellovai


### Bug Fixes

- [Playground] Add a feedback button (#818) - ([f749f2b](https://github.com/boundaryml/baml/commit/f749f2b19b247de2f050beccd1fe8e50b7625757)) - Samuel Lijin
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ BAML LLM functions plug into python, TS, and other languages, which makes it eas

BAML outperforms all other current methods of getting structured data, even when using it with GPT3.5. It also outperforms models fine-tuned for tool-use. See the [Berkeley Function Calling Benchmark](https://gorilla.cs.berkeley.edu/leaderboard.html) results. [Read more on our Schema-Aligned Parser](https://www.boundaryml.com/blog/schema-aligned-parsing).

<img src="docs/assets/bfcl-baml.png" width="80%" alt="Boundary Studio">
<img src="docs/assets/bfcl-baml-latest.png" width="80%" alt="Boundary Studio">

## Try it out in the playground -- [PromptFiddle.com](https://promptfiddle.com)

Expand Down
Binary file added docs/assets/bfcl-baml-latest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion engine/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# https://github.com/rust-lang/cargo/issues/8607
[target.x86_64-unknown-linux-musl]
rustflags = ["-C", "target-feature=-crt-static"]
[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-musl-gcc"
rustflags = ["-C", "target-feature=-crt-static"]
28 changes: 14 additions & 14 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 @@ -59,7 +59,7 @@ internal-baml-core = { path = "baml-lib/baml-core" }
internal-baml-jinja = { path = "baml-lib/jinja" }

[workspace.package]
version = "0.52.1"
version = "0.53.0"
authors = ["Boundary <contact@boundaryml.com>"]

description = "BAML Toolchain"
Expand Down
6 changes: 4 additions & 2 deletions engine/baml-runtime/src/internal/llm_client/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::collections::HashMap;

use base64::write;
use colored::*;
pub mod llm_provider;
pub mod orchestrator;
Expand Down Expand Up @@ -162,10 +163,11 @@ impl std::fmt::Display for LLMCompleteResponse {
f,
"{}",
format!(
"Client: {} ({}) - {}ms",
"Client: {} ({}) - {}ms. StopReason: {}",
self.client,
self.model,
self.latency.as_millis()
self.latency.as_millis(),
self.metadata.finish_reason.as_deref().unwrap_or("unknown")
)
.yellow()
)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ pub struct Candidate {
pub content: Content,
pub finish_reason: Option<FinishReason>,
pub safety_ratings: Option<Vec<SafetyRating>>,
pub citation_metadata: Option<CitationMetadata>,
// pub citation_metadata: Option<CitationMetadata>,
pub grounding_metadata: Option<GroundingMetadata>,
pub finish_message: Option<String>,
}
Expand Down Expand Up @@ -315,7 +315,8 @@ pub enum FinishReason {

#[derive(Serialize, Deserialize, Debug)]
pub struct CitationMetadata {
pub citations: Vec<Citation>,
// docs are wrong, this seems to be citationSources
pub citations: Option<Vec<Citation>>,
}

#[derive(Serialize, Deserialize, Debug)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,15 @@ impl SseResponseTrait for OpenAIClient {
inner.metadata.finish_reason =
Some(FinishReason::Stop.to_string());
}
_ => (),
finish_reason => {
// log::info!(
// "Received a non-stop finish reason: {:?}",
// finish_reason
// );
inner.metadata.baml_is_complete = false;
inner.metadata.finish_reason =
finish_reason.as_ref().map(|r| r.to_string());
}
}
}
inner.latency = instant_start.elapsed();
Expand Down Expand Up @@ -530,6 +538,7 @@ fn convert_message_parts_to_content(parts: &Vec<ChatMessagePart>) -> serde_json:
})})
}
BamlMedia::Base64(BamlMediaType::Image, image) => {
// TODO: validate the media_type is present!
json!({"type": "image_url", "image_url": json!({
"url" : format!("data:{};base64,{}", image.media_type, image.base64)
})})
Expand Down
8 changes: 8 additions & 0 deletions engine/baml-runtime/src/types/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ pub struct FunctionResult {

impl std::fmt::Display for FunctionResult {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
// print out the number of previous tries only if there was more than 1
if self.event_chain.len() > 1 {
writeln!(
f,
"{}",
format!("({} other previous tries)", self.event_chain.len() - 1).yellow()
)?;
}
writeln!(f, "{}", self.llm_response())?;
match &self.parsed() {
Some(Ok(val)) => {
Expand Down
2 changes: 2 additions & 0 deletions engine/baml-schema-wasm/src/runtime_wasm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ pub struct WasmLLMResponse {
pub input_tokens: Option<u64>,
pub output_tokens: Option<u64>,
pub total_tokens: Option<u64>,
pub stop_reason: Option<String>,
}

#[wasm_bindgen(getter_with_clone, inspectable)]
Expand Down Expand Up @@ -609,6 +610,7 @@ impl IntoWasm
input_tokens: s.metadata.prompt_tokens,
output_tokens: s.metadata.output_tokens,
total_tokens: s.metadata.total_tokens,
stop_reason: s.metadata.finish_reason.clone(),
}),
_ => None,
}
Expand Down
Loading

0 comments on commit d14bce2

Please sign in to comment.