diff options
Diffstat (limited to 'access.sh')
| -rwxr-xr-x | access.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/access.sh b/access.sh new file mode 100755 index 0000000..adf51fc --- /dev/null +++ b/access.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +[ ! -f .env ] || export $(grep -v '^#' .env | xargs) +SERVER="${OLLAMA_HOST:-http://localhost:11434}" +MODEL="${OLLAMA_MODEL:-llama3.2}" +PROMPT=$(cat << EOF +Please clean up the following code, leaving ample documentation: +def test(a: int, b: float) -> int: + return a + b ** 0.5 +EOF +) +RESPONSE=$(curl -s "$SERVER/api/generate" \ + -H "Content-Type: application/json" \ + -d "$(jq -n --arg model "$MODEL" --arg prompt "$PROMPT" \ + '{model:$model, prompt:$prompt, stream:false}')" \ + | jq -r '.response') +echo "${RESPONSE}" +#curl -s "$SERVER/api/generate" \ +# -H "Content-Type: application/json" \ +# -d "{ +# \"model\": \"$MODEL\", +# \"prompt\": \"$PROMPT\", +# \"stream\": false +# }" | jq -r '.response' |
