one: runs an LLM on one input
Before running this script, create a klex.json
file in the
root of your git repo, with these contents:
{
"project_name": "**name**",
"owner_username": "**your oscarkilo.com username**",
"reader_username": "**your oscarkilo.com username**",
"datasets_dir": "**optional**",
"klex_url": "https://las.oscarkilo.com/klex",
"api_key_file": "klex.key"
}
Then put your Klex API key into
the klex.key
file.
Then run this command once:
go get oscarkilo.com/klex-git
Now you’re ready for the examples below.
Hello World example
go run oscarkilo.com/klex-git/one <<EOF
{
"model": "Any big LLM",
"messages": [{
"role": "user",
"content": [{
"type": "text",
"text": "Which band played Hotel California in Lebowski?"
}]
}]
}
EOF
Reading prompts from files
echo "Tell me it's going to rain tomorrow." > prompt.txt
echo "You're a folksy pirate; speak like it." > system.txt
echo "{}" | go run oscarkilo.com/klex-git/one \
-model=llama3 \
-system_file=system.txt \
-prompt_file=prompt.txt
rm prompt.txt system.txt
Analyzing images
echo "{}" | go run oscarkilo.com/klex-git/one \
-model=gpt-4o \
-image_file=<(curl -s https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Tux.svg/1024px-Tux.svg.png) \
-prompt_file=<(echo "What is this guy's name?")