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

Functions allow parameters that are aliased to checked values #1578

Open
imalsogreg opened this issue Mar 7, 2025 · 1 comment
Open

Functions allow parameters that are aliased to checked values #1578

imalsogreg opened this issue Mar 7, 2025 · 1 comment

Comments

@imalsogreg
Copy link
Contributor

imalsogreg commented Mar 7, 2025

// A type alias to a type with a check.
type MultipleAttrs = int @assert({{ this > 0 }}) @check(gt_ten, {{ this > 10 }})

// That alias is used as a parameter.
function AliasWithMultipleAttrs(money: MultipleAttrs) -> MultipleAttrs {
    client "openai/gpt-4o"
    prompt r#"
      Return the given integer without additional context:

      {{ money }}

      {{ ctx.output_format }}
    "#
}

This code passes validation, but won't work at runtime, because there is to way to construct a Checked value on the client.

We don't currently support checked values as function parameters, so we should also forbid them when they are behind a type alias.

Copy link

linear bot commented Mar 7, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant