Skip to content

Commit

Permalink
feat: add default model provider option
Browse files Browse the repository at this point in the history
Signed-off-by: Donnie Adams <[email protected]>
  • Loading branch information
thedadams committed Jul 31, 2024
1 parent a41859f commit 04d0a85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ option. Any `env` provided in the run options are appended.

- `APIKey`: Specify an OpenAI API key for authenticating requests
- `BaseURL`: A base URL for an OpenAI compatible API (the default is `https://api.openai.com/v1`)
- `DefaultModel`: The default model to use for OpenAI requests
- `DefaultModel`: The default model to use for chat completion requests
- `DefaultModelProvider`: The default model provider to use for chat completion requests
- `Env`: Replace the system's environment variables with these in the for `KEY=VAL`

## Run Options
Expand Down
4 changes: 4 additions & 0 deletions src/gptscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface GlobalOpts {
APIKey?: string
BaseURL?: string
DefaultModel?: string
DefaultModelProvider?: string
Env?: string[]
}

Expand All @@ -24,6 +25,9 @@ function globalOptsToEnv(env: NodeJS.ProcessEnv, opts?: GlobalOpts) {
if (opts.DefaultModel) {
env["GPTSCRIPT_SDKSERVER_DEFAULT_MODEL"] = opts.DefaultModel
}
if (opts.DefaultModelProvider) {
env["GPTSCRIPT_SDKSERVER_DEFAULT_MODEL_PROVIDER"] = opts.DefaultModelProvider
}
}

export interface RunOpts {
Expand Down

0 comments on commit 04d0a85

Please sign in to comment.