Skip to content
davlgdPublic

About

🤖 JarVis, your always ready-to-go CLI assistant, multi-platform, written in V

Topics

Resources

Stars

15 stars

Watchers

2 watching

Forks

Latest commit

 

History

49 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JarVis, your personal CLI assistant

JarVis is a CLI assistant that uses any OpenAI compatible API to help you with your daily tasks. You can list available models, switch between them, directly ask a question, or use the interactive mode.

Build

You'll need V to build and install JarVis:

tools/build

It installs jarvis in /usr/local/bin, replacing a previous version. Set PREFIX to install it elsewhere, e.g. PREFIX=~/.local tools/build installs ~/.local/bin/jarvis, or use tools/build --no-install to only build ./jarvis.

Configure

You can configure JarVis by editing the ~/.config/jarvis/config.toml file, for example:

api_host = "localhost"
api_port = "11434"
api_key = ""
api_model = "qwen2.5-coder"
api_tls = false

api_model must be one of the models listed by the server (jarvis list); choose it with jarvis switch <model>.

Reasoning models think before answering, and may reach their length limit before the answer. Optionally, set reasoning_effort (none, low, medium or high, as your server supports) and max_tokens, the maximum length of the answer; they are only sent when set. With Ollama, reasoning_effort = "none" turns the reasoning off:

reasoning_effort = "none"
max_tokens = 2048

With api_tls = true, the server certificate is checked against the system bundle of trusted CA certificates (on Windows, the Windows certificate store). Set api_ca_file to the path of another PEM bundle (not supported with the Windows store), or api_insecure = true to skip the check (e.g. for a server with a self-signed certificate).

Usage

jarvis                    # interactive mode
jarvis --help
jarvis list               # list the models available on the server
jarvis switch llama3.3    # use another model
jarvis "Learn me something interesting about a programming language of your choice"

Use it as a V module

JarVis can also be used as a library in your own V programs. Install it:

v install --git https://github.com/davlgd/JarVis

Then import jarvis.api to talk to any OpenAI compatible API:

import jarvis.api

fn main() {
	client := api.new_client(api.Config{
		api_host:  'localhost'
		api_port:  '11434'
		api_model: 'qwen2.5-coder'
		// optional: api_key, api_tls, api_ca_file, api_insecure, system_prompt,
		// temperature, reasoning_effort, max_tokens
	})!

	// List the models available on the server, check one exists
	println(client.list_models()!)
	client.validate_model('qwen2.5-coder')!

	// Get the whole answer at once...
	answer := client.complete('What is V?')!
	println(answer)

	// ...or stream it as it is generated
	client.stream_completion('What is V?', fn (chunk string) {
		print(chunk)
	})!
	println('')
}

With a reasoning model, stream_completion_with_reasoning(prompt, on_reasoning, on_chunk) also gives the reasoning the model streams before its answer, when the server sends it.

The jarvis.config module reads and writes the JarVis configuration file (config.load_config(), config.save_config()), if you want to share it with the CLI.

Licence

This project is licensed under the MIT License - see the LICENCE file for details.

About

🤖 JarVis, your always ready-to-go CLI assistant, multi-platform, written in V

Topics

Resources

Stars

15 stars

Watchers

2 watching

Forks

Releases

Contributors

Languages