-
Notifications
You must be signed in to change notification settings - Fork 19
feat(ChatAuto)!: Single provider/name argument and prefer function arguments over envvars #159
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
Conversation
Here's another way to motivate the change... The prior approach was embracing the idea that "a sysadmin can override decisions made by the developer without any code changes". At the time that seemed like a useful thing, but you could also argue it's at best surprising and at worst dangerous. That is, if the developer has set a model, they've likely designed and tested only for that specific model, and may not even be aware that someone else could change the model without their input. With this new way, the developer has more control over whether the model is fixed or configurable. |
9cc0be5 to
4db84ab
Compare
Fixes #90
This PR updates
ChatAuto()to improve the experience for interactive use while leaving room for the developer-facing features of the previous implementation.New
provider_modelfirst argumentThe first change is to use a single argument and environment variable to specify the provider and model:
The new argument,
provider_model, is now first in the function signature, and we've movedsystem_promptbehind the*so that it must be named. Theprovider_modelvalue has a corresponding envvar:CHATLAS_CHAT_PROVIDER_MODEL.New argument/envvar precedence
The second biggest change in this function is to prioritize interactive ergonomics. Prior to this PR,
ChatAuto()treatedproviderandmodel(nowprovider_model) as default values that were used if environment variables are not set.After this PR, we now only use env vars when function arguments are not provided. This sounds limiting, but it opens up a much better experience for interactive use without really blocking any developer-facing benefits.
This major change introduces a new flow:
provider_modelandkwargsare always used if provided directly toChatAuto().CHATLAS_CHAT_PROVIDER_MODELandCHATLAS_CHAT_ARGSare only used if not provided in the function call.This means that interactive users never have to unset or manage environment variables. On the other hand, developers can now more easily insert their own env vars in front of chatlas's defaults, e.g. the following will consult
MYAPP_PROVIDER_MODELbefore chatlas's envvars, which was previously quite tricky to get right:Prior to this, devs would have to temporarily overwrite chatlas's envvars with the values of their custom envvar to do the same thing.
Finally, the previous envvars and arguments are still used with a deprecation warning.