Initial commit. This script lets 2 LLMs on my local machine talk to each other.
This commit is contained in:
45
bash-llama.sh
Executable file
45
bash-llama.sh
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user