@@ -148,10 +148,6 @@ This is useful when working with credential overrides.
148
148
149
149
## Credential Overrides (Advanced)
150
150
151
- ::: note
152
- The syntax for this will change at some point in the future.
153
- :::
154
-
155
151
You can bypass credential tools and stored credentials by setting the ` --credential-override ` argument (or the
156
152
` GPTSCRIPT_CREDENTIAL_OVERRIDE ` environment variable) when running GPTScript. To set up a credential override, you
157
153
need to be aware of which environment variables the credential tool sets. You can find this out by running the
@@ -166,41 +162,24 @@ This can be overridden with a credential alias, i.e. `credential: my-cred-tool.g
166
162
If the credential has an alias, use it instead of the tool name when you specify an override.
167
163
:::
168
164
169
- The ` --credential-override ` argument must be formatted in one of the following three ways:
165
+ The ` --credential-override ` argument must be formatted in one of the following two ways:
170
166
171
167
#### 1. Key-Value Pairs
172
168
173
- ` toolA:ENV_VAR_1=value1,ENV_VAR_2=value2;toolB:ENV_VAR_1=value3,ENV_VAR_2=value4 `
169
+ ` toolA:ENV_VAR_1=value1,ENV_VAR_2=value2 `
170
+
171
+ In this example, both ` toolA ` provides the variables ` ENV_VAR_1 ` and ` ENV_VAR_2 ` .
172
+ This will set the environment variables ` ENV_VAR_1 ` and ` ENV_VAR_2 ` to the specific values ` value1 ` and ` value2 ` .
174
173
175
- In this example, both ` toolA ` and ` toolB ` provide the variables ` ENV_VAR_1 ` and ` ENV_VAR_2 ` .
176
- This will set the environment variables ` ENV_VAR_1 ` and ` ENV_VAR_2 ` to the specific values provided for each tool.
174
+ ::: info
175
+ To override more than one credential, use ` ; ` as a separator. For example, ` toolA:ENV_VAR_1=value1;toolB:ENV_VAR_2=value2 ` .
176
+ :::
177
177
178
178
#### 2. Environment Variables
179
179
180
- ` toolA:ENV_VAR_1,ENV_VAR_2;toolB:ENV_VAR_3,ENV_VAR_4 `
180
+ ` toolA:ENV_VAR_1,ENV_VAR_2 `
181
181
182
- In this example, ` toolA ` provides the variables ` ENV_VAR_1 ` and ` ENV_VAR_2 ` , and ` toolB ` provides the variables ` ENV_VAR_3 ` and ` ENV_VAR_4 ` .
183
- This will read the values of ` ENV_VAR_1 ` through ` ENV_VAR_4 ` from the current environment and set them for each tool .
182
+ In this example, ` toolA ` provides the variables ` ENV_VAR_1 ` and ` ENV_VAR_2 ` ,
183
+ This will read the values of ` ENV_VAR_1 ` through ` ENV_VAR_4 ` from the current environment and set them for the credential .
184
184
This is a direct mapping of environment variable names. ** This is not recommended when overriding credentials for
185
185
multiple tools that use the same environment variable names.**
186
-
187
- #### 3. Environment Variable Mapping
188
-
189
- ` toolA:ENV_VAR_1->TOOL_A_ENV_VAR_1,ENV_VAR_2->TOOL_A_ENV_VAR_2;toolB:ENV_VAR_1->TOOL_B_ENV_VAR_1,ENV_VAR_2->TOOL_B_ENV_VAR_2 `
190
-
191
- In this example, ` toolA ` and ` toolB ` both provide the variables ` ENV_VAR_1 ` and ` ENV_VAR_2 ` .
192
- This will set the environment variables ` ENV_VAR_1 ` and ` ENV_VAR_2 ` to the values of ` TOOL_A_ENV_VAR_1 ` and
193
- ` TOOL_A_ENV_VAR_2 ` from the current environment for ` toolA ` . The same applies for ` toolB ` , but with the values of
194
- ` TOOL_B_ENV_VAR_1 ` and ` TOOL_B_ENV_VAR_2 ` . This is a mapping of one environment variable name to another.
195
-
196
- ### Real-World Example
197
-
198
- Here is an example of how you can use a credential override to skip running the credential tool for the Brave Search tool:
199
-
200
- ``` bash
201
- gptscript --credential-override " github.com/gptscript-ai/search/brave-credential:GPTSCRIPT_BRAVE_SEARCH_TOKEN->MY_BRAVE_SEARCH_TOKEN" github.com/gptscript-ai/search/brave ' {"q": "cute cats"}'
202
- ```
203
-
204
- If you run this command, rather than being prompted by the credential tool for your token, GPTScript will read the contents
205
- of the environment variable ` MY_BRAVE_SEARCH_TOKEN ` and set that as the variable ` GPTSCRIPT_BRAVE_SEARCH_TOKEN ` when it runs
206
- the script.
0 commit comments