Categorygithub.com/freesrz93/ask-gpt
repositorypackage
0.2.1
Repository: https://github.com/freesrz93/ask-gpt.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

Ask GPT

English | 简体中文

Ask GPT is a CLI tool to chat with OpenAI LLMs via API.

Features

  • Custom Roles: Customise multi roles, each with its own system prompt.
  • Save/Retrieve Conversations: Save conversations locally and continue it seamlessly in the future.
  • Streaming Output: See the output instantly after an input, no need to wait for completion.
  • Support Pipeline: Send any output of other CLI tools to AI via pipeline.
  • Interactive mode: Chat with AI interactively. Offer a user experience similar to the web-based ChatGPT.
  • Support Models: Compatibility with all models accessible through the OpenAI API.
  • Edit Config Easily: One-click access to configuration file for easy setup and customization.

Installation

Download the pre-built binary from release and add it to path.

Usage

  1. Run ask-gpt for the first time:

    ag -v
    

    and the app will create the config file at

    %USERPROFILE%/.config/ask-gpt/config.yaml
    

    for Windows and

    $HOME/.config/ask-gpt/config.yaml
    

    for Linux and macOS.

  2. Edit the config. See Configuration for detail.

  3. Quickly ask a question:

    ag "what's the best programming language in the world?"
    
  4. To create or continue a conversation, use -s:

    ag -s "chat 1" "Tell a story"
    
  5. To chat interactively, use -i:

    ag -i "Translate the given sentences to Chinese"
    

    -s can be used with -i:

    ag -s "translation" -i "Translate the given sentences to Chinese"
    
  6. Use pipeline:

    cat raw.txt | ag -i "Translate above contents to Chinese"
    
  7. To create a new role, use -n:

    ag -n
    

    then set its name, description and prompt interactively.

  8. To use a role, use -r (the role should already exist):

    ag -r "translator" -i "Translate the given sentences to Chinese"
    

    -r can be used with -s but only valid when creating a conversation.

  9. To show history of the conversation, use -h:

    ag -s "translation" -h -i
    

    this will print previous messages and continue with interactive mode.

  10. For more usage, see:

    chatgpt --help
    

Configuration

NameMeaningDefault
urlThe base URL for OpenAI API."https://api.openai.com/v1"
api_keyYour OpenAI API key.""
modelThe model to be used."gpt-4o-mini"
max_tokensThe maximum token cost in a single API call.4096
temperatureSee OpenAI Doc0.5
top_pSee OpenAI Doc1.0
frequency_penaltySee OpenAI Doc0
presence_penaltySee OpenAI Doc0
editorThe editor to be used to edit config file. Must in path."code"
editor_argThe arguments to be passed to the editor. %path will be replaced by the actual path."%path"