18 lines
479 B
Bash
Executable File
18 lines
479 B
Bash
Executable File
#!/bin/bash
|
|
|
|
OLLAMA_URL="http://10.0.0.15:11434"
|
|
OLLAMA_MODEL="llama3.1"
|
|
|
|
ask_ollama() {
|
|
local PROMPT="$1"
|
|
|
|
local RAW
|
|
RAW=$(curl -s "$OLLAMA_URL/api/generate" \
|
|
-H "Content-Type: application/json" \
|
|
-d "$(jq -n \
|
|
--arg model "$OLLAMA_MODEL" \
|
|
--arg prompt "$PROMPT" \
|
|
'{model:$model,prompt:$prompt,stream:false}')")
|
|
|
|
echo "$RAW" | jq -r '.response // .error // "Fehler: Ungültige Antwort vom Ollama-Server."'
|
|
} |