Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode: add link to tracing, show token counts #703

Merged
merged 5 commits into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions engine/.vscode/settings.json

This file was deleted.

53 changes: 53 additions & 0 deletions engine/Cargo.lock

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

1 change: 1 addition & 0 deletions engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ serde = { version = "1", features = ["derive"] }
static_assertions = "1.1.0"
strum = { version = "0.26.2", features = ["derive"] }
strum_macros = "0.26.2"
time = { version = "0.3.36", features = ["formatting"] }
walkdir = "2.5.0"
web-time = "1.1.0"
baml-types = { path = "baml-lib/baml-types" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,13 @@ impl RequestBuilder for OpenAIClient {
}

if stream {
body_obj.insert("stream".into(), true.into());
body_obj.insert("stream".into(), json!(true));
body_obj.insert(
"stream_options".into(),
json!({
"include_usage": true,
}),
);
}

req.json(&body)
Expand Down Expand Up @@ -366,6 +372,11 @@ impl SseResponseTrait for OpenAIClient {
}
}
inner.latency = instant_start.elapsed();
if let Some(usage) = event.usage.as_ref() {
inner.metadata.prompt_tokens = Some(usage.prompt_tokens);
inner.metadata.output_tokens = Some(usage.completion_tokens);
inner.metadata.total_tokens = Some(usage.total_tokens);
}

std::future::ready(Some(LLMResponse::Success(inner.clone())))
},
Expand Down
1 change: 1 addition & 0 deletions engine/baml-schema-wasm/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist/src/*
nodejs/src/*
web/src/*
1 change: 1 addition & 0 deletions engine/baml-schema-wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ log.workspace = true
serde.workspace = true
serde_json.workspace = true
serde-wasm-bindgen = "0.4"
time.workspace = true
uuid = { version = "1.8", features = ["v4", "js"] }
wasm-bindgen = "=0.2.92"
wasm-bindgen-futures = "0.4.42"
Expand Down
26 changes: 0 additions & 26 deletions engine/baml-schema-wasm/dist/src/baml_schema_build.d.ts

This file was deleted.

191 changes: 0 additions & 191 deletions engine/baml-schema-wasm/dist/src/baml_schema_build.js

This file was deleted.

Binary file not shown.
10 changes: 0 additions & 10 deletions engine/baml-schema-wasm/dist/src/baml_schema_build_bg.wasm.d.ts

This file was deleted.

Loading
Loading