Skip to content

Add the ability to do --credential-override multiple times #574

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

Closed
g-linville opened this issue Jun 27, 2024 · 2 comments
Closed

Add the ability to do --credential-override multiple times #574

g-linville opened this issue Jun 27, 2024 · 2 comments
Assignees

Comments

@g-linville
Copy link
Member

Rather than making the user specify all credential overrides in a single --credential-override argument, we want to support the ability to specify it multiple times, like this:

gptscript --credential-override toolA:MY_VAR=value --credential-override toolB:MY_OTHER_VAR=value script.gpt
@g-linville
Copy link
Member Author

@sangee2004 this is ready for testing.

@sangee2004
Copy link
Contributor

Tested with gptscript - version v0.0.0-dev-3b38281a-dirty

Able to do -credential-override multiple times for overriding multiple credentials.

  1. Execute the following script and set the values for creds to mytest1(credA) and mytest2(credB)
cred: github.com/gptscript-ai/credential as credA with VAR_A as env and "Please enter your cred for A" as message
cred: github.com/gptscript-ai/credential as credB with VAR_B as env and "Please enter your cred for B" as message

#!/usr/bin/env bash

echo "A: $VAR_A"
echo "B: $VAR_B"
  1. Execute the script to Override credential values using - gptscript --disable-cache --credential-override credA:VAR_A=mytest1override --credential-override credB:VAR_B=mytest2override credential.gpt

Environment variables get overridden as expected.

gptscript --disable-cache --credential-override credA:VAR_A=mytest1override  --credential-override credB:VAR_B=mytest2override credential.gpt
17:33:22 started  [main]
17:33:22 sent     [main]
         content  [1] content | A: mytest1override
         content  [1] content | B: mytest2override
         content  [1] content | 
17:33:22 ended    [main] [output=A: mytest1override\nB: mytest2override]

OUTPUT:

A: mytest1override
B: mytest2override
  1. Execute the script with no override

Values set in the credential entries get used as expected.

gptscript --disable-cache credential.gpt 
17:34:56 started  [main]
17:34:56 sent     [main]
         content  [1] content | A: mytest1
         content  [1] content | B: mytest2
         content  [1] content | 
17:34:56 ended    [main] [output=A: mytest1\nB: mytest2]

OUTPUT:

A: mytest1
B: mytest2

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