Skip to content

Commit

Permalink
fix cli (#672)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronvg authored Jun 13, 2024
1 parent 70c98a4 commit 3dbc0cd
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 1 deletion.
2 changes: 2 additions & 0 deletions engine/language_client_typescript/cli.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env node

if (require.main === module) {
const baml = require('./native')
baml.invoke_runtime_cli(process.argv.slice(1))
Expand Down
2 changes: 1 addition & 1 deletion engine/language_client_typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@boundaryml/baml",
"version": "0.39.0",
"version": "0.39.1",
"description": "BAML typescript bindings (package.json)",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// These are LLM clients you can use in your functions. We currently support Anthropic, OpenAI / Azure, and Ollama as providers but are expanding to many more.

// For this playground, we have setup a few clients for you to use already with some free credits.

client<llm> GPT4 {
// Use one of the following: https://docs.boundaryml.com/v3/syntax/client/client#providers
provider openai
// You can pass in any parameters from the OpenAI Python documentation into the options block.
options {
model gpt-4
api_key env.OPENAI_API_KEY
}
}

client<llm> GPT4Turbo {
provider openai
options {
model gpt-4-turbo
api_key env.OPENAI_API_KEY
}
}

client<llm> GPT35 {
provider openai
options {
model gpt-3.5-turbo
api_key env.OPENAI_API_KEY
}
}

client<llm> Claude {
provider anthropic
options {
model claude-3-haiku-20240307
api_key env.ANTHROPIC_API_KEY
max_tokens 1000

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
class Email {
subject string
body string
from_address string
}

enum OrderStatus {
ORDERED
SHIPPED
DELIVERED
CANCELLED
}

class OrderInfo {
order_status OrderStatus
tracking_number string?
estimated_arrival_date string?
}

function GetOrderInfo(email: Email) -> OrderInfo {
client GPT4Turbo
prompt #"
Given the email below:

\`\`\`
from: {{email.from_address}}
Email Subject: {{email.subject}}
Email Body: {{email.body}}
\`\`\`

Extract this info from the email in JSON format:
{{ ctx.output_format }}

Before you output the JSON, please explain your
reasoning step-by-step. Here is an example on how to do this:
'If we think step by step we can see that ...
therefore the output JSON is:
{
... the json schema ...
}'
"#
}

0 comments on commit 3dbc0cd

Please sign in to comment.