Skip to content

TUI - Prompted for entering openAI API keys when executing gptscript that is chat enabled using a local provider. #510

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
sangee2004 opened this issue Jun 18, 2024 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@sangee2004
Copy link
Contributor

sangee2004 commented Jun 18, 2024

gptscript version v0.8.2+1b5e068f

Steps to reproduce the problem:

  1. Execute the following script that is chat enabled using a local provider
cat examples/bobchat.gpt  
tools: bob
chat: true
Ask Bob how he is doing and let me know exactly what he said.

---
name: bob
description: I'm Bob, a friendly guy.
args: question: The question to ask Bob.
chat: true

When asked how I am doing, respond with "Thanks for asking "${question}", I'm doing great fellow friendly AI tool!"
  1. User is prompted to enter OpenAI API key.
gptscript --disable-cache --default-model 'Llama-3-8b-function-calling-alpha-v1.gguf from http://localhost:1234/v1' examples/bobchat.gpt
12:32:27 WARNING: Changing the default model can have unknown behavior for existing tools. Use the model field per tool instead.

Please provide your OpenAI API key:
>  

On entering an invalid(or empty) openAI API key , the script fails to execute.

 gptscript --disable-cache --default-model 'Llama-3-8b-function-calling-alpha-v1.gguf from http://localhost:1234/v1' examples/bobchat.gpt
12:31:32 WARNING: Changing the default model can have unknown behavior for existing tools. Use the model field per tool instead.
2024/06/18 12:31:42 error, status code: 401, message: Incorrect API key provided: 234. You can find your API key at https://platform.openai.com/account/api-keys.

Expected Behavior:
User should not be prompted to enter openAI API keys when executing chat scripts with local providers.

Note - When TUI is disabled - gptscript --disable-cache --default-model 'Llama-3-8b-function-calling-alpha-v1.gguf from http://localhost:1234/v1' --disable-tui examples/bobchat.gpt , there is no prompting for openai API key and chat completion requests get directed to local models and succeeds.

@sangee2004 sangee2004 added the bug Something isn't working label Jun 18, 2024
@sangee2004 sangee2004 changed the title Prompted for entering openAI API keys when executing gptscript that is chat enabled using a local provider. TUI - Prompted for entering openAI API keys when executing gptscript that is chat enabled using a local provider. Jun 18, 2024
@sangee2004
Copy link
Contributor Author

Similar issue is also seen when testing with "--ui" option with local provider. User is prompted to enter openai api keys and chat completion requests are sent to openai instead of being sent to local provider.

@njhale njhale self-assigned this Jun 20, 2024
@sangee2004
Copy link
Contributor Author

sangee2004 commented Jun 24, 2024

This issue is seen when testing with any provider other than the default gpt provider.

gptscript --default-model 'claude-3-opus-20240229  from github.com/gptscript-ai/anthropic-provider' examples/bobchat.gpt                
10:58:49 WARNING: Changing the default model can have unknown behavior for existing tools. Use the model field per tool instead.

Please provide your OpenAI API key:

@njhale
Copy link
Member

njhale commented Jun 25, 2024

@sangee2004 just merged a fix (#541) to main. Please verify the issue is resolved when you get the chance.

@sangee2004
Copy link
Contributor Author

sangee2004 commented Jun 25, 2024

@njhale When i try to TUI with other providers , I am not prompted to enter openai api keys anymore. But tool calls do not succeed. In case of local model , i just see a message about starttoolcall and in the case of anthropic provider , it just hangs. Seems like confirmation prompt for repo is broken in this flow which might be causing this problem.

%gptscript --default-model 'Llama-3-8b-function-calling-alpha-v1.gguf from http://localhost:1234/v1' --disable-cache github.com/gptscript-ai/cli-demo
09:55:02 WARNING: Changing the default model can have unknown behavior for existing tools. Use the model field per tool instead.

  Hello! How can I assist you today?                                                                                                                                          

> get me all my github repos

  starttoolcall{"name": "github", "arguments": "{\"task\":\"list all repos\"}"}endtoolcall                                                                                    
% gptscript --default-model 'claude-3-5-sonnet-20240620 from github.com/gptscript-ai/claude3-anthropic-provider' --disable-cache github.com/gptscript-ai/cli-demo
09:55:48 WARNING: Changing the default model can have unknown behavior for existing tools. Use the model field per tool instead.

@njhale
Copy link
Member

njhale commented Jun 25, 2024

The latter issue w/ the anthropic provider should be fixed by #551

@sangee2004
Copy link
Contributor Author

Tested with gptscript version v0.0.0-dev-3033b05a-dirty

Able to chat with local provider and Anthropic provider using TUI ( and --disable-tui) option.

@sangee2004
Copy link
Contributor Author

sangee2004 commented Jun 26, 2024

Closing this issue with findings from #510 (comment).

We are still not able to launch ui with other providers which is tracked in
#556, #559

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants