I just built a tiny script to help me pipe stuff into chatgpt.<p>You can install it with:<p><pre><code> go install github.com/jackdoe/updown/cmd/llm@latest
</code></pre>
Or just fork it and change it for your needs (its so small I just put it in my go scripts repo).<p>I literally built it few hours ago and already am using it non stop, so decided to share it.<p>Example usages:<p><pre><code> $ ls -al | llm which are the biggest files
$ git diff | llm write a commit message
$ git commit -a -m "$(git diff | llm write a commit message)"
$ cat file.csv | llm transform it into json
$ find . | llm -m gpt-4 which files probably contain configuration
</code></pre>
It works pretty good, example csv to json:<p><pre><code> $ cat a.csv
name,age
john,19
jane,19
jack doe,20
$ cat a.csv | llm transform into json
[
{"name": "john", "age": 19},
{"name": "jane", "age": 19},
{"name": "jack doe", "age": 20}
]
</code></pre>
And of course to pipe it into itself:<p><pre><code> $ cat a.csv | llm transform into json | llm transform to key by age
{
"19":[
{
"name":"john",
"age":19
},
{
"name":"jane",
"age":19
}
],
"20":[
{
"name":"jack doe",
"age":20
}
]
}
</code></pre>
You can use -p @prompt1.txt -p 'then do the next thing' -p @prompt2.txt etc to construct more complicated prompt from multiple files, and use -m gpt-4 to use gpt4 instead of gpt3.5<p>PS: be careful not to send secrets, and of course know that openai will probably keep everything you sent to them until the sun scorches the earth and their servers die with it, so beware.<p>PPS: there are probably other clients like that, but since its only few lines I thoughts its better to have my own that i can tweak.