Skip to content
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

--set-<value> should have a --value counter part for session based options #36

Closed
nopeless opened this issue Mar 22, 2024 · 13 comments
Closed

Comments

@nopeless
Copy link
Contributor

nopeless commented Mar 22, 2024

--set-<value> writes to file. I wouldn't want that.

@kardolus
Copy link
Owner

@nopeless flags would be one way of doing that, however you can already use the environment variables. Every configuration option has an associated environment variable, eg:

OPENAI_MODEL=gpt-3.5-turbo chatgpt what is the capital of Belgium?

or

OPENAI_ROLE='you extract wisdom' cat README.md | chatgpt summarize

@nopeless
Copy link
Contributor Author

nopeless commented Mar 22, 2024

@kardolus environment variables are hard to keep in closures especially in powershell they don't have something like env to keep them temporarily :/

@kardolus
Copy link
Owner

@nopeless ahh gotcha. I didn't know that about powershell. I can add the --value flags. May take me a week or two.

@nopeless
Copy link
Contributor Author

btw by --value i was thinking about --max-tokens for example. i hope it isn't that confusing

e.g.

chatgpt-cli --role "You are developer" -i

@kardolus
Copy link
Owner

kardolus commented Oct 3, 2024

I am finally ready to pick this one up. I am reinventing a lot of the Viper functionality in my CLI. I want to get rid of my own logic as much as I can and fall back to Viper. Will work on this issue in parallel to this one: #68

I think both can be solved within the same refactor.

@kardolus
Copy link
Owner

kardolus commented Oct 6, 2024

FYI, started working on it here: https://github.com/kardolus/chatgpt-cli/tree/viper-refactor

It's a massive refactor. It's not done yet (I want setters for all values). Here's a preview though:

 2024-10-06 09:35:12 ⌚ (☸️ |kind-apache:N/A) Guillermos-MacBook-Pro in ~/workspace/chatgpt-cli
± |viper-refactor {3} ✓| → ./bin/chatgpt --help
A powerful ChatGPT client that enables seamless interactions with the GPT model. Provides multiple modes and context management features, including the ability to pipe custom context into the conversation.

Usage:
  chatgpt [flags]

Flags:
      --api-key string             Set the API key for authentication
      --auth-header string         Set the authorization header
      --auth-token-prefix string   Set the authorization token prefix
      --auto-create-new-thread     Automatically create a new thread for each session
      --clear-history              Clear all prior conversation context for the current thread
      --command-prompt string      Set the command prompt format
      --completions-path string    Set the completions API endpoint
  -c, --config                     Display the configuration
      --debug                      Enable debug mode
      --delete-thread string       Delete the specified thread
      --frequency-penalty float    Set the frequency penalty
  -h, --help                       help for chatgpt
  -i, --interactive                Use interactive mode
  -l, --list-models                List available models
      --list-threads               List available threads
      --models-path string         Set the models API endpoint
      --omit-history               Omit history in the conversation
      --output-prompt string       Set the output prompt format
      --presence-penalty float     Set the presence penalty
  -q, --query                      Use query mode instead of stream mode
      --set-completions string     Generate autocompletion script for your current shell
      --set-context-window int     Set a new default context window size
      --set-max-tokens int         Set a new default max token size by specifying the max tokens
      --set-model string           Set a new default GPT model by specifying the model name
      --set-thread string          Set a new active thread by specifying the thread name
      --skip-tls-verify            Skip TLS certificate verification
      --temperature float          Set the sampling temperature (default 1)
      --top-p float                Set the top-p value for nucleus sampling (default 1)
      --track-token-usage          Track token usage
      --url string                 Set the API base URL
  -v, --version                    Display the version information

@kardolus
Copy link
Owner

kardolus commented Oct 7, 2024

Yikes, it's pretty cluttered haha. Getting there though.

 2024-10-06 21:24:20 ⌚ (☸️ |kind-cloudera:N/A) Guillermos-MacBook-Pro in ~/workspace/chatgpt-cli
± |viper-refactor {3} U:1 ✗| → ./bin/chatgpt --help
ChatGPT CLI - A powerful client for interacting with GPT models.

Usage:
  chatgpt [flags]

General Flags:
  -q, --query                    Use query mode instead of stream mode
  -i, --interactive              Use interactive mode
  -c, --config                   Display the configuration
  -v, --version                  Display the version information
  --list-models                  List available models
  --list-threads                 List available threads
  --clear-history                Clear the history of the current thread
  --delete-thread                Delete the specified thread
  --set-completions              Generate autocompletion script for your current shell

Configuration Setters:
  --set-api-key                  Set the API key for authentication
  --set-auth-header              Set the authorization header
  --set-auth-token-prefix        Set the authorization token prefix
  --set-auto-create-new-thread   Automatically create a new thread for each session
  --set-command-prompt           Set the command prompt format
  --set-completions              Generate autocompletion script for your current shell
  --set-completions-path         Set the completions API endpoint
  --set-context-window           Set a new default context window size
  --set-debug                    Enable debug mode
  --set-frequency-penalty        Set the frequency penalty
  --set-max-tokens               Set a new default max token size
  --set-model                    Set a new default GPT model by specifying the model name
  --set-models-path              Set the models API endpoint
  --set-omit-history             Omit history in the conversation
  --set-output-prompt            Set the output prompt format
  --set-presence-penalty         Set the presence penalty
  --set-skip-tls-verify          Skip TLS certificate verification
  --set-temperature              Set the sampling temperature
  --set-thread                   Set a new active thread by specifying the thread name
  --set-top-p                    Set the top-p value for nucleus sampling
  --set-track-token-usage        Track token usage
  --set-url                      Set the API base URL

Configuration Aliases:
  --api_key                      Alias for setting api key
  --auth_header                  Alias for setting auth header
  --auth_token_prefix            Alias for setting auth token prefix
  --auto_create_new_thread       Alias for setting auto create new thread
  --command_prompt               Alias for setting command prompt
  --completions_path             Alias for setting completions path
  --context_window               Alias for setting context window
  --debug                        Alias for setting debug
  --frequency_penalty            Alias for setting frequency penalty
  --help                         Alias for setting help
  --max_tokens                   Alias for setting max tokens
  --model                        Alias for setting model
  --models_path                  Alias for setting models path
  --omit_history                 Alias for setting omit history
  --output_prompt                Alias for setting output prompt
  --presence_penalty             Alias for setting presence penalty
  --skip_tls_verify              Alias for setting skip tls verify
  --temperature                  Alias for setting temperature
  --thread                       Alias for setting thread
  --top_p                        Alias for setting top p
  --track_token_usage            Alias for setting track token usage
  --url                          Alias for setting url

Environment Variables:
  You can also use environment variables to set config values. For example:
  OPENAI_API_KEY=your_api_key chatgpt --query 'Hello'

@kardolus
Copy link
Owner

kardolus commented Oct 8, 2024

@kardolus kardolus closed this as completed by moving to Done in LLM Kanban Oct 8, 2024
@nopeless
Copy link
Contributor Author

nopeless commented Oct 9, 2024

@kardolus I'm reading your second most recent comment, and it appears that the casing for the commands seem inconsistent? I don't think that's a good idea. Id like to hear your reasoning

@kardolus
Copy link
Owner

kardolus commented Oct 9, 2024

Your right! That’s fixed :)

@kardolus
Copy link
Owner

kardolus commented Oct 9, 2024

Here's the new output:

 2024-10-08 18:38:03 ⌚ (☸️ |kind-apache:N/A) Guillermos-MacBook-Pro in ~/workspace/chatgpt-cli
± |main {6} ✓| → chatgpt --help
ChatGPT CLI - A powerful client for interacting with GPT models.

Usage:
  chatgpt [flags]

General Flags:
  -q, --query                    Use query mode instead of stream mode
  -i, --interactive              Use interactive mode
  -c, --config                   Display the configuration
  -v, --version                  Display the version information
  -l, --list-models              List available models
  --list-threads                 List available threads
  --clear-history                Clear the history of the current thread
  --delete-thread                Delete the specified thread
  --set-completions              Generate autocompletion script for your current shell

Persistent Configuration Setters:
  --set-api-key                  Set the API key for authentication
  --set-auth-header              Set the authorization header
  --set-auth-token-prefix        Set the authorization token prefix
  --set-auto-create-new-thread   Automatically create a new thread for each session
  --set-command-prompt           Set the command prompt format
  --set-completions-path         Set the completions API endpoint
  --set-context-window           Set a new default context window size
  --set-debug                    Enable debug mode
  --set-frequency-penalty        Set the frequency penalty
  --set-max-tokens               Set a new default max token size
  --set-model                    Set a new default GPT model by specifying the model name
  --set-models-path              Set the models API endpoint
  --set-name                     The prefix for environment variable overrides
  --set-omit-history             Omit history in the conversation
  --set-output-prompt            Set the output prompt format
  --set-presence-penalty         Set the presence penalty
  --set-role                     Set the role of the AI assistant
  --set-skip-tls-verify          Skip TLS certificate verification
  --set-temperature              Set the sampling temperature
  --set-thread                   Set a new active thread by specifying the thread name
  --set-top-p                    Set the top-p value for nucleus sampling
  --set-track-token-usage        Track token usage
  --set-url                      Set the API base URL

Runtime Value Overrides:
  --api-key                      Override value for api-key
  --auth-header                  Override value for auth-header
  --auth-token-prefix            Override value for auth-token-prefix
  --auto-create-new-thread       Override value for auto-create-new-thread
  --command-prompt               Override value for command-prompt
  --completions-path             Override value for completions-path
  --context-window               Override value for context-window
  --debug                        Override value for debug
  --frequency-penalty            Override value for frequency-penalty
  --max-tokens                   Override value for max-tokens
  --model                        Override value for model
  --models-path                  Override value for models-path
  --name                         Override value for name
  --omit-history                 Override value for omit-history
  --output-prompt                Override value for output-prompt
  --presence-penalty             Override value for presence-penalty
  --role                         Override value for role
  --skip-tls-verify              Override value for skip-tls-verify
  --temperature                  Override value for temperature
  --thread                       Override value for thread
  --top-p                        Override value for top-p
  --track-token-usage            Override value for track-token-usage
  --url                          Override value for url

Environment Variables:
  You can also use environment variables to set config values. For example:
  OPENAI_API_KEY=your_api_key chatgpt --query 'Hello'

Configuration File:
  All configuration changes made with the setters will be saved in the config.yaml file.
  The config.yaml file is located in the following path: /Users/guillermo/.chatgpt-cli/config.yaml
  You can edit this file manually to change configuration settings as well.

@kardolus
Copy link
Owner

kardolus commented Oct 9, 2024

@nopeless unless you mean something else. I figured the snake vs kebab case was what you meant. Am I overlooking upper/lower casing?

@nopeless
Copy link
Contributor Author

nopeless commented Oct 9, 2024

@kardolus I was referring to the mixed kebab and snake case. Thanks for fixing it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants