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

Use test vars in function schema #775

Closed
tomquist opened this issue May 13, 2024 · 4 comments
Closed

Use test vars in function schema #775

tomquist opened this issue May 13, 2024 · 4 comments

Comments

@tomquist
Copy link
Contributor

I'm trying to evaluate a prompt that uses function calls. However, the function schema depends on one of the variables in the test output. It looks like function calls currently are part of the provider config and not of the prompt, so I don't see a way to inject variables into a function definition. Is there any other way to adjust the function schema per test case?

@typpo
Copy link
Collaborator

typpo commented May 17, 2024

Thanks for the suggestion @tomquist! #792 implements this and will be in the next release.

@typpo
Copy link
Collaborator

typpo commented May 18, 2024

Released in 0.59.0!

@typpo typpo closed this as completed May 18, 2024
@tomquist
Copy link
Contributor Author

tomquist commented May 18, 2024

@typpo Awesome! Thanks for the quick implementation. 🎉

I have one use-case which still wouldn’t be possible with this implementation:

I want to pass in a JSON Array as a var so I can use it in a string schema as the enum property. Would it be possible to support a function at any level of the template object? This waz you could do something like this:

tools: [
  {
    type: …, parameters: (context) => ({ enum: context.vars.options, …})
  }
]

Sorry for the minimalistic example, I’m on mobile right now

I think this could just be handled as another case in renderVarsInObject().

Also I’m happy to open a new issue if you prefer.

@tomquist
Copy link
Contributor Author

@typpo I submitted a PR to implement this: #813

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

2 participants