Skip to content

Commit

Permalink
add forgotten files
Browse files Browse the repository at this point in the history
  • Loading branch information
imalsogreg committed Oct 15, 2024
1 parent 8465b7c commit d1091c5
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
client<llm> MyClient {
provider baml-openai-chat
}

class Foo {
bar Bar?
baz int
}

class Bar {
name string @check({{ this|length > 0 }}, nonempty_name)
}

function Go(a: Foo) -> int {
client MyClient
prompt #"Hi"#
}

// error: Error validating: Types with checks are not allowed as function parameters.
// --> functions_v2/check_in_parameter.baml:14
// |
// 13 |
// 14 | function Go(a: Foo) -> int {
// |
14 changes: 14 additions & 0 deletions engine/language_client_typescript/checked.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export interface Checked<T, K extends BaseChecks> {
value: T;
checks: K;
}
interface Check {
name: string;
expr: string;
result: "succeeded" | "failed";
}
interface BaseChecks {
[key: string]: Check;
}
export {};
//# sourceMappingURL=checked.d.ts.map
1 change: 1 addition & 0 deletions engine/language_client_typescript/checked.d.ts.map

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

5 changes: 5 additions & 0 deletions engine/language_client_typescript/checked.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function all_succeeded(checks) {
return Object.values(checks).every(value => value.result == "succeeded");
}

0 comments on commit d1091c5

Please sign in to comment.