-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8465b7c
commit d1091c5
Showing
4 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
engine/baml-lib/baml/tests/validation_files/functions_v2/check_in_parameter.baml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
// | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} |