Files
bash-llama/bash-llama.sh

46 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Replace with your actual connection details
server_one_url="http://localhost:11434"
server_two_url="http://localhost:11435"
model="llama3"
read -p "Kick things off with a question: " input
oneResponse=$(curl -s -X POST "$server_one_url/api/chat" \
-d "{\"model\": \"$model\",\
\"messages\": [
{
\"role\": \"user\",
\"content\": \"$input\"
} \
],\
\"stream\": false }" | jq -r .message.content | tr -d '[\n]')
printf "LLM One: $oneResponse\n"
while true; do
twoResponse=$(curl -s -X POST "http://localhost:11435/api/chat" \
-d "{\"model\": \"$model\",\
\"messages\": [
{
\"role\": \"user\",
\"content\": \"$oneResponse\"
} \
],\
\"stream\": false }" | jq -r .message.content | tr -d '[\n]')
printf "LLM Two: $twoResponse\n"
oneResponse=$(curl -s -X POST "http://localhost:11434/api/chat" \
-d "{\"model\": \"$model\",\
\"messages\": [
{
\"role\": \"user\",
\"content\": \"$twoResponse\"
} \
],\
\"stream\": false }" | jq -r .message.content | tr -d '[\n]')
printf "LLM One: $oneResponse\n"
done