44
55## Examples
66
7+ - [ Chat] ( #chat-in-bash )
8+ - [ Text to Speech] ( #text-to-speech-in-bash )
9+
710### Chat in Bash
811
912We can chat straight from the command line.
1013For example, via the DeepInfra API:
1114
1215``` sh
13- $ DEEPINFRA_KEY=" $( cat /path/to/key ) " ; echo " hi there" | ata chat
16+ $ DEEPINFRA_KEY=" <KEY> " ; echo " hi there" | ata chat
1417```
1518
1619This defaults to the ` meta-llama/Llama-3.3-70B-Instruct ` model.
@@ -20,9 +23,6 @@ For example, create a file called `chat.sh` with the following content:
2023``` bash
2124#! /usr/bin/env bash
2225
23- # Exit on (pipe) errors.
24- set -euo pipefail
25-
2626export OPENAI_KEY=" $( cat /path/to/key) "
2727
2828ata chat --model=" gpt-4o"
@@ -36,6 +36,33 @@ $ echo "This is a test. Respond with 'hello'." | ata chat
3636hello
3737```
3838
39+ Or we can run a spellcheck on a file:
40+
41+ ``` sh
42+ $ echo " Do you see spelling errors in the following text?" ; cat myfile.txt | ata chat
43+ ```
44+
45+ Here is a more complex example.
46+ For example, create a file called ` writing-tips.sh ` with the following content:
47+
48+ ``` bash
49+ #! /usr/bin/env bash
50+ set -euo pipefail
51+
52+ export DEEPINFRA_KEY=" $( cat /path/to/key) "
53+
54+ PROMPT="
55+ You are a helpful writing assistant.
56+ Respond with a few suggestions for improving the text.
57+ Use plain text only; no markdown.
58+
59+ Here is the text to check:
60+
61+ "
62+
63+ (echo " $PROMPT " ; cat README.md) | ata chat --model=" deepseek-ai/DeepSeek-R1"
64+ ```
65+
3966### Text to Speech in Bash
4067
4168We can read a file out loud from the command line.
0 commit comments