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

declare required environment keys #662

Open
pelikhan opened this issue Aug 26, 2024 · 5 comments
Open

declare required environment keys #662

pelikhan opened this issue Aug 26, 2024 · 5 comments

Comments

@pelikhan
Copy link
Contributor

Since most tools require some environment variables, it would be nice to add some kind of "env: string[]" entry to the function spec so that we can do a friendly check ahead of execution.

@transitive-bullshit
Copy link
Owner

transitive-bullshit commented Aug 26, 2024

I like the idea of declaratively exposing any required environment keys.

Keep in mind that most of these classes need to be constructed and verify their keys before being used as AI functions. calculator is an AIFunction whereas most of these are AIFunctionProvider classes which expose AIFunctionProvider.functions, and once they've been new'ed, they will have already had their required env vars validated (or bypassed these env vars by passing values directly).

import { WeatherClient } from '@agentic/weather'

const weather = new WeatherClient() // this is where the env var is currently checked
defTool(weather.functions.get('get_current_weather'))

$`What is the weather in SF?`

Happy to expose env vars to the function spec or AIFunction type itself, since the spec currently has the data passed to OpenAI directly, so if we added anything else there we'd have to strip it off before using spec w/ OpenAI.

What about adding something like an abstract static method to AIFunctionProvider which would declaratively expose any env var required to instantiate that class?

@transitive-bullshit
Copy link
Owner

transitive-bullshit commented Aug 26, 2024

Related to my example code above, I believe it could be useful to either add an adaptor to Agentic for GenAIScript to support Agentic's notion of AIFunctionLike objects (AIFunction | AIFunctionProvider | AIFunctionSet), which will make working with the majority of the clients easier.

What you have as I understand it as examples for GenAIScript's defTool will currently work for simple AIFunctions like calculator, but the majority are classes which may expose multiple functions.

Happy to discuss the best way to support these and interop with GenAIScript as cleanly as possible.

@pelikhan
Copy link
Contributor Author

Related to my example code above, I believe it could be useful to either add an adaptor to Agentic for GenAIScript to support Agentic's notion of AIFunctionLike objects (AIFunction | AIFunctionProvider | AIFunctionSet), which will make working with the majority of the clients easier.

What you have as I understand it as examples for GenAIScript's defTool will currently work for simple AIFunctions like calculator, but the majority are classes which may expose multiple functions.

Happy to discuss the best way to support these and interop with GenAIScript as cleanly as possible.

Ha, I shall fix that.

@pelikhan
Copy link
Contributor Author

I like the idea of declaratively exposing any required environment keys.

Keep in mind that most of these classes need to be constructed and verify their keys before being used as AI functions. calculator is an AIFunction whereas most of these are AIFunctionProvider classes which expose AIFunctionProvider.functions, and once they've been new'ed, they will have already had their required env vars validated (or bypassed these env vars by passing values directly).

import { WeatherClient } from '@agentic/weather'

const weather = new WeatherClient() // this is where the env var is currently checked
defTool(weather.functions.get('get_current_weather'))

$`What is the weather in SF?`

Happy to expose env vars to the function spec or AIFunction type itself, since the spec currently has the data passed to OpenAI directly, so if we added anything else there we'd have to strip it off before using spec w/ OpenAI.

What about adding something like an abstract static method to AIFunctionProvider which would declaratively expose any env var required to instantiate that class?

Static field sound good. I could recover it from the instance constructor.

@pelikhan
Copy link
Contributor Author

pelikhan commented Aug 27, 2024

I've updated support for the AIProvider types (tested on the weather tool) --> https://microsoft.github.io/genaiscript/guides/agentic-tools/#weather-example

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