LocalAI: Difference between revisions
From DWIKI
mNo edit summary |
m (→Scripts) |
||
Line 7: | Line 7: | ||
echo -n "Ask me anything: " | echo -n "Ask me anything: " | ||
read A | read A | ||
curl -s http://localhost:8080/v1/chat/completions \ | curl -s http://localhost:8080/v1/chat/completions \ | ||
-H "Content-Type: application/json" \ | -H "Content-Type: application/json" \ | ||
-d '{ "model": "gpt-4", "messages": [{"role": "user", "content": "'"$A"'", "temperature": 0.1}] }' |\ | -d '{ "model": "gpt-4", "messages": [{"role": "user", "content": "'"$A"'", "temperature": 0.1}] }' |\ | ||
jq '.choices[].message.content' | sed 's/\\n/\n/g' | sed 's/\\"/"/g' | jq '.choices[].message.content' | sed 's/\\n/\n/g' | sed 's/\\"/"/g' |
Revision as of 13:55, 31 March 2024
Links
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'