Skip to main content

Pal

Pal is a modular command-line interface with AI function calling. Pal at its core provides a few in-built plugins, but it can easily be extended. Pal is a personal exploration project.

Install

[!IMPORTANT] Due to the halo library on PyPi being outdated it is not installed. Please make sure to install my fork of the library.

pip3 install git+https://github.com/SlumberDemon/halo

Stable

pip3 install -U sofapal

Development

# clone repository
pip3 install -U git+https://github.com/slumberdemon/pal
# create a virtual environment in the .venv directory
python3 -m venv .venv
# set up the current shell to use that virtual environment
source .venv/bin/activate

Ai

Pal uses OpenFunctions-v2 for its AI functionality. For optimal performance, it is recommended to have at least 16 GB of RAM. For instructions on setting up this feature, see below.

  1. Install ollama
  2. Download the AI model file from huggingface, I recommend gorilla-openfunctions-v2-q4_K_M.gguf
  3. Download the Modelfile and modify it by changing path_to_model_file to the file you downloaded in step 2
  4. Open a terminal in the same location as the Modelfile and run the following command:
ollama create -f Modelfile pal
  1. Add the AI configurations by creating .pal/ai.json with the following content:
{
  "model": "pal:latest",
  "host": "http://localhost:11434",
  "trust_mode": false
}

Enabling trust mode with true will automatically select all commands to be run.

Config

pal

Pal loads configs and plugins from the .pal folder located in $HOME. Example configs can be found in .pal. Therefore, when creating configurations/plugins, make sure they are in that folder. When a command's configuration is missing, Pal will assist you in adding it.

Inbuilt plugins

Create

Pal enables for quick project creation using user-created templates. Templates are written in shell and are provided one argument.

Pal runs templates like this: bash template.sh {name}.

Here is an example of a template to create a sveltekit project.

npm create svelte@latest $1
cd $1
npm install

This file is stored in the templates folder. In the example $1 is used to access the name of the project provided by pal.

It's recommended that the file name is in this format: language-language-tool.sh. This will make it easier to search for this template with pal.

usage: pal create [-h] [-n NAME] [-e {zed,code}]

Create project using a template

options:
  -h, --help            show this help message and exit
  -n NAME, --name NAME  Name of the project
  -e {zed,code}, --editor {zed,code}
                        Code editor to open project with

Browse

Pal lets you quickly query text with any search engine.

Pal opens searches in your default browser.

To use browse you will need to configure browse.json in your configs. The structure is as follows.

{
  "engines": [
    {
      "name": "duckduckgo",
      "url": "https://duckduckgo.com/?q=%s"
    }
  ],
  "default": {
    "name": "duckduckgo",
    "url": "https://duckduckgo.com/?q=%s"
  }
}

Pal requires a default engine to be set. Any other engines added can be accessed by providing the -e/--engine option. The url for an engine needs to include %s as this will be replaced with the search query.

usage: pal browse [-h] [-s SEARCH] [-e] [query]

Open queries in your browser

positional arguments:
  query                 Query to browse using default engine

options:
  -h, --help            show this help message and exit
  -s SEARCH, --search SEARCH
                        Search query to browse using default engine
  -e, --engine          When provided, displays search engine selector

Weather

Pal can display information on the weather. Pal needs an weatherapi api key to do so.

Setup for weather is easy and can be done with the following.

pal weather

Running with the command with no configs for the first time will start the interactive configuration process. For more information on manual setup, see the examples.

usage: pal weather [-h] [-s] [-l LOCATION] [-w]

Weather information

options:
  -h, --help            show this help message and exit
  -s, --search          Search location to get information from
  -l LOCATION, --location LOCATION
                        Location to get information from
  -w, --window          Disables displaying weather information via a window

Release files for sofapal 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sofapal 0.0.9
File Size Uploaded
sofapal-0.0.9.tar.gz 11.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sofapal 0.0.9
File Interpreter ABI Platform
sofapal-0.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 22.4 kB

Release files / sofapal-0.0.9.tar.gz

Download URL sofapal-0.0.9.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9f84609be0b3296e360266ed6eac9b71d47a3bf112ac3d86fc29122d6984d8e8
BLAKE2b-256 checksum
How to use checksums
469215f3ee298464721584ec99946d06c198625aef27a519b5c369433e66ce1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / sofapal-0.0.9-py3-none-any.whl

Download URL sofapal-0.0.9-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb6f9413521d1ad0641f59d0508aff9042461675a58d681457cf9a4abe43acea
BLAKE2b-256 checksum
How to use checksums
6966613e2d0023d2bf6ad8dbaa1dc70470035d0a4cb54dd00266a5cb4424c04c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.0.9 This release

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page