Skip to content

Commit b67275f

Browse files
committed
feat: add default model provider option
Signed-off-by: Donnie Adams <[email protected]>
1 parent 9bb1c82 commit b67275f

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ When creating a `GTPScript` instance, you can pass the following global options.
2626

2727
- `APIKey`: Specify an OpenAI API key for authenticating requests
2828
- `BaseURL`: A base URL for an OpenAI compatible API (the default is `https://api.openai.com/v1`)
29-
- `DefaultModel`: The default model to use for OpenAI requests
29+
- `DefaultModel`: The default model to use for chat completion requests
30+
- `DefaultModelProvider`: The default model provider to use for chat completion requests
3031
- `Env`: Supply the environment variables. Supplying anything here means that nothing from the environment is used. The default is `os.Environ()`. Supplying `Env` at the run/evaluate level will be treated as "additional."
3132

3233
## Run Options

opts.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ package gptscript
33
// GlobalOptions allows specification of settings that are used for every call made.
44
// These options can be overridden by the corresponding Options.
55
type GlobalOptions struct {
6-
OpenAIAPIKey string `json:"APIKey"`
7-
OpenAIBaseURL string `json:"BaseURL"`
8-
DefaultModel string `json:"DefaultModel"`
9-
Env []string `json:"env"`
6+
OpenAIAPIKey string `json:"APIKey"`
7+
OpenAIBaseURL string `json:"BaseURL"`
8+
DefaultModel string `json:"DefaultModel"`
9+
DefaultModelProvider string `json:"DefaultModelProvider"`
10+
Env []string `json:"env"`
1011
}
1112

1213
func (g GlobalOptions) toEnv() []string {
@@ -20,6 +21,9 @@ func (g GlobalOptions) toEnv() []string {
2021
if g.DefaultModel != "" {
2122
args = append(args, "GPTSCRIPT_SDKSERVER_DEFAULT_MODEL="+g.DefaultModel)
2223
}
24+
if g.DefaultModelProvider != "" {
25+
args = append(args, "GPTSCRIPT_SDKSERVER_DEFAULT_MODEL_PROVIDER="+g.DefaultModelProvider)
26+
}
2327

2428
return args
2529
}

0 commit comments

Comments
 (0)