Skip to content

Commit

Permalink
attempts at evaluting perf
Browse files Browse the repository at this point in the history
  • Loading branch information
hellovai committed Nov 13, 2024
1 parent 8b51b6e commit e722f2e
Show file tree
Hide file tree
Showing 35 changed files with 2,588 additions and 34 deletions.
2 changes: 2 additions & 0 deletions engine/baml-runtime/src/tracing/api_wrapper/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ impl APIConfig {
Self::LocalOnly(config) => config.api_key.as_deref(),
Self::Web(config) => Some(config.api_key.as_str()),
}
.map(|s| s.trim()).filter(|s| !s.is_empty())
}

pub fn stage(&self) -> &str {
Expand Down Expand Up @@ -337,6 +338,7 @@ impl APIWrapper {

pub fn project_id(&self) -> Option<&str> {
self.config.project_id()
.map(|s| s.trim()).filter(|s| !s.is_empty())
}

pub fn session_id(&self) -> &str {
Expand Down
13 changes: 11 additions & 2 deletions integ-tests/baml_src/fiddle-examples/classify-message.baml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ enum Category {
}

function ClassifyMessage(input: string) -> Category {
client GPT4
client "openai/gpt-4o"

prompt #"
Classify the following INPUT into ONE
Expand All @@ -20,4 +20,13 @@ function ClassifyMessage(input: string) -> Category {

Response:
"#
}
}

test TestName {
functions [ClassifyMessage]
args {
input #"
hello world
"#
}
}
29 changes: 27 additions & 2 deletions integ-tests/baml_src/fiddle-examples/extract-receipt-info.baml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ class ReceiptInfo {
venue "barisa" | "ox_burger"
}

function ExtractReceiptInfo(email: string, reason: "curiosity" | "personal_finance") -> ReceiptInfo {
function ExtractReceiptInfo(email: string, idx: int) -> ReceiptInfo {
client GPT4o
prompt #"
Given the receipt below:
{{idx}}: Given the receipt below:

```
{{email}}
Expand All @@ -24,3 +24,28 @@ function ExtractReceiptInfo(email: string, reason: "curiosity" | "personal_finan
"#
}

test TestName {
functions [ExtractReceiptInfo]
args {
email #"
04/14/2024 1:05 pm
Venue: Ox Burger
Ticket: 220000082489
Register: Shop Counter
Employee: Connor
Customer: Sam
Item # Price
Guide leash (1 Pair) uni UNI
1 $34.95
The Index Town Walls
1 $35.00
Boot Punch
3 $60.00
Subtotal $129.95
Tax ($129.95 @ 9%) $11.70
Total Tax $11.70
Total $141.65
"#
reason "curiosity"
}
}
Loading

0 comments on commit e722f2e

Please sign in to comment.