Skip to content

Commit a49ea01

Browse files
committed
Add example in dir
1 parent 9bdbe64 commit a49ea01

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

examples/writing-tips.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
3+
# Gives writing tips for a given text file.
4+
#
5+
# Usage:
6+
#
7+
# ./writing-tips.sh <input-file>
8+
9+
set -euo pipefail
10+
11+
# Can also use other keys such as DEEPINFRA_KEY, GOOGLE_KEY, etc.
12+
# trf will automatically use the right API based on the available keys.
13+
export OPENAI_KEY="$(cat /path/to/key)"
14+
15+
if [ "$#" -ne 1 ]; then
16+
echo "Error: Exactly one input file argument is required"
17+
echo "Usage: $0 <input-file>"
18+
exit 1
19+
fi
20+
21+
INPUT_FILE="$1"
22+
23+
PROMPT="
24+
You are a helpful writing assistant.
25+
Respond with a few suggestions for improving the text.
26+
Use plain text only; no markdown.
27+
28+
Here is the text to check:
29+
30+
"
31+
MODEL="meta-llama/Meta-Llama-3-8B-Instruct"
32+
33+
(echo "$PROMPT"; cat "$INPUT_FILE") | cargo run -- --verbose chat --model="$MODEL"

0 commit comments

Comments
 (0)