|
1 | 1 | --- |
2 | | -openapi: POST /chat/topic |
3 | | ---- |
| 2 | +title: "Create Assistant Topic" |
| 3 | +api: "POST https://api.example.com/assistant/topics" |
| 4 | +description: "Create a new assistant topic to organize conversations and interactions." |
| 5 | +--- |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +This endpoint allows you to create a new assistant topic. Topics help organize and categorize assistant conversations, making it easier to manage different discussion threads or subjects. |
| 10 | + |
| 11 | +## Request |
| 12 | + |
| 13 | +<ParamField body="name" type="string" required> |
| 14 | + The name of the assistant topic |
| 15 | +</ParamField> |
| 16 | + |
| 17 | +<ParamField body="description" type="string"> |
| 18 | + Optional description for the assistant topic |
| 19 | +</ParamField> |
| 20 | + |
| 21 | +<ParamField body="tags" type="array"> |
| 22 | + Array of tags to categorize the assistant topic |
| 23 | +</ParamField> |
| 24 | + |
| 25 | +## Response |
| 26 | + |
| 27 | +<ResponseField name="id" type="string"> |
| 28 | + Unique identifier for the created assistant topic |
| 29 | +</ResponseField> |
| 30 | + |
| 31 | +<ResponseField name="name" type="string"> |
| 32 | + Name of the assistant topic |
| 33 | +</ResponseField> |
| 34 | + |
| 35 | +<ResponseField name="description" type="string"> |
| 36 | + Description of the assistant topic |
| 37 | +</ResponseField> |
| 38 | + |
| 39 | +<ResponseField name="tags" type="array"> |
| 40 | + Tags associated with the assistant topic |
| 41 | +</ResponseField> |
| 42 | + |
| 43 | +<ResponseField name="created_at" type="string"> |
| 44 | + Timestamp when the assistant topic was created |
| 45 | +</ResponseField> |
| 46 | + |
| 47 | +<ResponseField name="updated_at" type="string"> |
| 48 | + Timestamp when the assistant topic was last updated |
| 49 | +</ResponseField> |
| 50 | + |
| 51 | +## Example |
| 52 | + |
| 53 | +<RequestExample> |
| 54 | + |
| 55 | +```bash cURL |
| 56 | +curl -X POST https://api.example.com/assistant/topics \ |
| 57 | + -H "Authorization: Bearer YOUR_API_KEY" \ |
| 58 | + -H "Content-Type: application/json" \ |
| 59 | + -d '{ |
| 60 | + "name": "Customer Support Assistant", |
| 61 | + "description": "Assistant topic for handling customer support inquiries", |
| 62 | + "tags": ["support", "customer-service"] |
| 63 | + }' |
| 64 | +``` |
| 65 | + |
| 66 | +```javascript JavaScript |
| 67 | +const response = await fetch('https://api.example.com/assistant/topics', { |
| 68 | + method: 'POST', |
| 69 | + headers: { |
| 70 | + 'Authorization': 'Bearer YOUR_API_KEY', |
| 71 | + 'Content-Type': 'application/json', |
| 72 | + }, |
| 73 | + body: JSON.stringify({ |
| 74 | + name: 'Customer Support Assistant', |
| 75 | + description: 'Assistant topic for handling customer support inquiries', |
| 76 | + tags: ['support', 'customer-service'] |
| 77 | + }) |
| 78 | +}); |
| 79 | + |
| 80 | +const assistantTopic = await response.json(); |
| 81 | +``` |
| 82 | + |
| 83 | +```python Python |
| 84 | +import requests |
| 85 | + |
| 86 | +url = "https://api.example.com/assistant/topics" |
| 87 | +headers = { |
| 88 | + "Authorization": "Bearer YOUR_API_KEY", |
| 89 | + "Content-Type": "application/json" |
| 90 | +} |
| 91 | +data = { |
| 92 | + "name": "Customer Support Assistant", |
| 93 | + "description": "Assistant topic for handling customer support inquiries", |
| 94 | + "tags": ["support", "customer-service"] |
| 95 | +} |
| 96 | + |
| 97 | +response = requests.post(url, headers=headers, json=data) |
| 98 | +assistant_topic = response.json() |
| 99 | +``` |
| 100 | + |
| 101 | +</RequestExample> |
| 102 | + |
| 103 | +<ResponseExample> |
| 104 | + |
| 105 | +```json Response |
| 106 | +{ |
| 107 | + "id": "topic_12345", |
| 108 | + "name": "Customer Support Assistant", |
| 109 | + "description": "Assistant topic for handling customer support inquiries", |
| 110 | + "tags": ["support", "customer-service"], |
| 111 | + "created_at": "2023-11-20T10:30:00Z", |
| 112 | + "updated_at": "2023-11-20T10:30:00Z" |
| 113 | +} |
| 114 | +``` |
| 115 | + |
| 116 | +</ResponseExample> |
0 commit comments