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

Add a way for function returns to set options for the next completion #13

Open
floomby opened this issue Jul 2, 2023 · 0 comments
Open

Comments

@floomby
Copy link
Contributor

floomby commented Jul 2, 2023

When functions return they create a completion with the existing options from the initial completion. There should be a way to override options in the completion.

What seems like a reasonable approach to me is to have the function return both its results and the option overrides in one object together.

function: async ({ location }) => {
  return {
    value: {
      location: "Albuquerque",
      temperature: "72",
      unit: "fahrenheit",
      forecast: ["sunny", "windy"],
    },
    options: {
      ... options to override here ...
    }
  };
}

This however would be a breaking change. The non breaking, but less ideal seeming, is to pass in a reference to the function and modify the underlying object which is then used for the completion.

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