-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebserver.sh
More file actions
executable file
·42 lines (33 loc) · 903 Bytes
/
webserver.sh
File metadata and controls
executable file
·42 lines (33 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
LLM_API=$(oc get route llamapod -o json | jq -r .spec.host)
TMP_FILE=$(mktemp)
while IFS= read -r -t 0.2 line; do
echo "$line" >> "$TMP_FILE"
done
REQUEST=$(cat $TMP_FILE)
DEFAULT_PARAMS='{
"n_predict": 128,
"repeat_last_n": 40,
"repeat_penalty": 1.30,
"cache_prompt": true,
"stop": ["<", "`"]
}'
PROMPT1='
<|system|>
You are an HTTP server. Given a URL, return the corresponding HTTP response and content. No explanations. You respect rfc2616.
<|user|>
GET /healthz HTTP/1.1
Host: hello.world
User-Agent: curl/8.4.0
Accept: */*
<|assistant|>
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
ok
<|user|>
'"${REQUEST}"'
<|assistant|>
'
PAYLOAD1=$(echo $DEFAULT_PARAMS | jq --arg prompt "$PROMPT1" '. + {"prompt": $prompt, "temperature": 0.1}')
curl -s $LLM_API/completion -H "Content-Type: application/json" -d "$PAYLOAD1" | jq -r .content
rm $TMP_FILE