LocalAI

From DWIKI
Revision as of 12:58, 6 July 2024 by Tony (talk | contribs)

Links

HOWTO

List models

curl http://localhost:8080/v1/models

Audio to text


Apply model

curl http://localhost:8080/models/apply -H "Content-Type: application/json" -d '{
  "id": "huggingface@TheBloke/Yarn-Mistral-7B-128k-GGUF/yarn-mistral-7b-128k.Q5_K_M.gguf"
}'

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'