Assistants API + Curl

parmarjatin4911@gmail.com - Jan 28 - - Dev Community

Assistants API + Curl

curl --request POST \
--url https://api.openai.com/v1/assistants \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "OpenAI-Beta: assistants=v1" \
-H "Content-Type: application/json" \
--data '{
"model": "gpt-4-1106-preview",
"instructions": "You are an expert in geography, be helpful and concise."
}'

export ASSISTANT_ID=

curl --request POST \
--url https://api.openai.com/v1/threads \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-H "OpenAI-Beta: assistants=v1"

export THREAD_ID=thread_txhecUZk0AUrfkpyW6sVK55o

curl --request POST \
--url https://api.openai.com/v1/threads/$THREAD_ID/messages \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "OpenAI-Beta: assistants=v1" \
-H "Content-Type: application/json" \
-d '{
"role": "user",
"content": "What is the capital of France?"
}'

curl --request POST \
--url https://api.openai.com/v1/threads/$THREAD_ID/runs \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "OpenAI-Beta: assistants=v1" \
-H "Content-Type: application/json" \
-d "{
\"assistant_id\": \"$ASSISTANT_ID\"
}"

curl --request GET \

--url https://api.openai.com/v1/threads/$THREAD_ID/messages \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "OpenAI-Beta: assistants=v1" \
-H "Content-Type: application/json"

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player