8.3 Invoking the spit Program

spit [option...]

The spit program passes its input to a Large Language Model (LLM) instance and prints the response. With the --to option, it translates its input to the specified language through a Large Language Model (LLM) and prints the translation.

Warning: The output might not be what you expect. It might be of the wrong form, be of poor quality, or reflect some biases.

8.3.1 Large Language Model (LLM) options

--species=type

Specifies the type of Large Language Model execution engine. The default and only valid value is ollama.

--url=url

Specifies the URL of the server that runs Large Language Model execution engine. For ollama, the default is http://localhost:11434.

-m model
--model=model

Specifies the model to use. This option is mandatory; no default exists. The specified model must already be installed in the Large Language Model execution engine.

--to=language

Specifies the target language. language may be specified as an ISO 639 language code (such as fr for French), as a combination of an ISO 639 language code and an ISO 3166 country code (such as fr_CA for French in Canada, or zh_TW for traditional Chinese), or as the English name of a language (such as French).

The effect of this option is to add a prompt similar to "Translate to language:".

--prompt=text

Specifies the prompt to use before the input that comes from standard input. It allows you to specify extra instructions for the LLM.

This option overrides the --to option.

--postprocess=command

Specifies a command to post-process the output. This should be a Bourne shell command that reads from standard input and writes to standard output.

For instance, the ministral-3:14b model often emphasizes part of the output with ‘**’ characters. To eliminate these markers, you could use the command ‘sed -e 's/[*][*]//g'’.

8.3.2 Informative output

-h
--help

Display this help and exit.

-V
--version

Output version information and exit.

8.3.3 Examples

Machine translation of a single sentence:

$ echo 'Translate into German: "Welcome to the GNU project!"' \
    | spit --model=ministral-3:14b \
           --postprocess="sed -e 's/[*][*]//g'"
"Willkommen zum GNU-Projekt!"

The perfect translation would be "Willkommen beim GNU-Projekt!". You can see: some manual adjustment after the machine translation is needed.