-
Notifications
You must be signed in to change notification settings - Fork 0
/
curl_llm.sh
27 lines (21 loc) · 1.96 KB
/
curl_llm.sh
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
#!/bin/bash
# Check if OPENAI_API_KEY environment variable is set
if [ -z "$OPENAI_API_KEY" ]; then
echo "Error: OPENAI_API_KEY is not set."
else
# Perform the curl operation using the API key from the environment variable
curl -X POST http://localhost:8501/llm/batch_infer \
-H "Content-Type: application/json" \
-d '{
"ai_type": "openai",
"model": "gpt-3.5-turbo",
"system_prompt": "You are an expert on tabletop role playing games",
"user_prompt": "Generate a presentation on what Dungeons And Dragons is|||Generate a presentation on Dungeons And Dragons Adventurers League and how it contributed to the renewal of interest in the game",
"api_key": "'"$OPENAI_API_KEY"'",
"schema":"{type:object,properties:{title:{type:string},subtitle:{type:string},slides:{type:array,items:{type:object,properties:{heading:{title:Heading,description:The_slide_Heading,type:string},bullet_points:{title:Bullet_Points,description:The_bullet_points,type:array,items:{type:string}}},required:[heading,bullet_points]}}},required:[title,slides]}"
}' -o ./test/output.bin
fi
# ok: "schema":"{type:object,properties:{title:{type:string},subtitle:{type:string},slides:{type:array,items:{type:object,properties:{bullet_points:{type:array,items:{type:string}}}}}},required:[title,slides]}"
# bad: "schema":"{type:object,properties:{title:{type:string},subtitle:{type:string},slides:{type:array,items:{type:object,properties:{heading:{type:string},bullet_points:{type:array,items:{type:string}},required:[heading,bullet_points]}}},required:[title,slides]}}"
# new: "schema":"{type:object,properties:{title:{type:string},subtitle:{type:string},slides:{type:array,items:{type:object,properties:{heading:{title:Heading,description:The_slide_Heading,type:string},bullet_points:{title:Bullet_Points,description:The_bullet_points,type:array,items:{type:string}}},required:[heading,bullet_points]}}},required:[title,slides]}"
# gpt4 : "model": "gpt-4-turbo",