LocalAI

From DWIKI
Revision as of 13:33, 31 March 2024 by Tony (talk | contribs) (Created page with "=Scripts= ==Talk to the chat interface== #!/bin/bash echo -n "Ask me anything: " read A curl -s http://localhost:8080/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4", "messages": [{"role": "user", "content": "'"$A"'", "temperature": 0.1}] }' |\ jq '.choices[].message.content' | sed 's/\\n/\n/g' | sed 's/\\"/"/g'")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Scripts

Talk to the chat interface

#!/bin/bash
echo -n "Ask me anything: "
read A
curl -s http://localhost:8080/v1/chat/completions \
   -H "Content-Type: application/json" \
   -d '{ "model": "gpt-4", "messages": [{"role": "user", "content": "'"$A"'", "temperature": 0.1}] }' |\
    jq     '.choices[].message.content' | sed 's/\\n/\n/g' | sed 's/\\"/"/g'