Skip to content

Latest commit

 

History

History
63 lines (53 loc) · 1.44 KB

OPENAI_AZURE_ASSISTANT.md

File metadata and controls

63 lines (53 loc) · 1.44 KB

Assistant Setup

curl 'https://${endpoint}/openai/assistants?api-version=2024-05-01-preview' \
-H 'api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
  "instructions": "",
  "name": "vs-dev-01",
  "tools": [
    {
      "type": "file_search"
    }
  ],
  "model": "gpt-4o",
  "tool_resources": {
    "file_search": {
      "vector_store_ids": []
    }
  },
  "temperature": 1,
  "top_p": 1
}'

Run Assistant

## Create a thread
curl "https://${endpoint}/openai/threads?api-version=2024-05-01-preview" \
-H 'api-key: YOUR_API_KEY' \
-H "Content-Type: application/json" \
-d ''

## Add a user question to the thread
curl "https://${endpoint}/openai/threads/${thread-id}/messages?api-version=2024-05-01-preview" \
-H 'api-key: YOUR_API_KEY' \
-H "Content-Type: application/json" \
-d '{
  "role": "user",
  "content": "hi"
}'

## Run the thread
curl "https://${endpoint}/openai/threads/${thread-id}/runs?api-version=2024-05-01-preview" \
-H 'api-key: YOUR_API_KEY' \
-H "Content-Type: application/json" \
-d '{ 
    "assistant_id": asst_GwRJb8Qg6EC3PTACysI2Eofn, 
}'



## Get the status of the run
curl "https://${endpoint}/openai/threads/${thread-id}/runs/${run_id}?api-version=2024-05-01-preview" \
-H 'api-key: YOUR_API_KEY' \

## See the Assistant response

curl "https://${endpoint}/openai/threads/${thread-id}/messages?api-version=2024-05-01-preview" \
    -H 'api-key: YOUR_API_KEY' \
    -H "Content-Type: application/json" \