Giter Site home page Giter Site logo

vichat's Introduction

vichat

A simple LLM chat cli (with Vim).

demo

Why

I find it easier to use text files to test different system prompts on the same user input than a Web UI.

Installation

go install github.com/JackKCWong/vichat@latest

# install vim plugin
vichat i 

Usage

export OPENAI_API_KEY=<your LLM api key>
export OPENAI_API_BASE=<your LLM api base>

Chat directly on cli and open the respone in Vim:

vichat chat [options] tell me a joke about Go

# e.g. 
vichat tell me a joke about Vim

# or output to terminal directly
vichat -r tell me a joke about emacs

Chat with history:

cat <<_EOF | vichat chat
SYSTEM: You are a professional joke writer

USER: tell me a joke about goose

AI: Why did the goose go to the doctor? Because he was feeling a little down!

USER: Why did it feel down?
_EOF

Or chat with history in Vim:

cat <<_EOF > test.chat
SYSTEM: You are a professional joke writer

USER: tell me a joke about goose
_EOF

vim test.chat

ctrl+s

When in Vim:

  • ctrl+s (n or i mode) to send the full chat, the result will be appended to the end of the current buffer, just like a usual chat experience.

  • ctrl+t (n or i mode) to send the full chat, but the result will be put to a new buffer, useful when you want to ask many simple questions that doesn't require context. Saves token usages.

  • ctrl+a (n mode) to jump to the end and start asking a new question.

  • ctrl+t (n mode) to estimate the number of tokens using titoken gpt-like encoding.

  • ctrl+k (n or v mode) to count the number of tokens.

  • ctrl+c (n or v mode) to chunk the text using RecursiveTextSplitter.

  • ctrl+n (n mode) to start a new chat with the same system prompt.

  • q (n mode) close current chat.

  • ctrl+q (n mode) force close current chat.

Vim tips:

  • put this line in your ~/.vimrc to enable code block highlight in markdown
syntax on
let g:markdown_fenced_languages = ['html', 'js=javascript', 'rust', 'go', 'java']

vichat's People

Contributors

jackkcwong avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.