@toothfairyai/sdk 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,61 @@ A comprehensive, TypeScript-first SDK for integrating with the ToothFairyAI API.
|
|
|
8
8
|
npm install @toothfairyai/sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## Configuration
|
|
12
|
+
|
|
13
|
+
### Region-Specific Endpoints
|
|
14
|
+
|
|
15
|
+
ToothFairyAI operates in multiple regions. Configure your client to use the appropriate endpoints for your region:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { ToothFairyClient } from '@toothfairyai/sdk';
|
|
19
|
+
|
|
20
|
+
// US Region
|
|
21
|
+
const clientUS = new ToothFairyClient({
|
|
22
|
+
apiKey: 'your-api-key',
|
|
23
|
+
workspaceId: 'your-workspace-id',
|
|
24
|
+
baseUrl: 'https://api.us.toothfairyai.com',
|
|
25
|
+
aiUrl: 'https://ai.us.toothfairyai.com',
|
|
26
|
+
aiStreamUrl: 'https://ai-stream.us.toothfairyai.com'
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// EU Region
|
|
30
|
+
const clientEU = new ToothFairyClient({
|
|
31
|
+
apiKey: 'your-api-key',
|
|
32
|
+
workspaceId: 'your-workspace-id',
|
|
33
|
+
baseUrl: 'https://api.eu.toothfairyai.com',
|
|
34
|
+
aiUrl: 'https://ai.eu.toothfairyai.com',
|
|
35
|
+
aiStreamUrl: 'https://ai-stream.eu.toothfairyai.com'
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Australia Region (default if not specified)
|
|
39
|
+
const clientAU = new ToothFairyClient({
|
|
40
|
+
apiKey: 'your-api-key',
|
|
41
|
+
workspaceId: 'your-workspace-id',
|
|
42
|
+
baseUrl: 'https://api.toothfairyai.com',
|
|
43
|
+
aiUrl: 'https://ai.toothfairyai.com',
|
|
44
|
+
aiStreamUrl: 'https://ai-stream.toothfairyai.com'
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Available Regions:**
|
|
49
|
+
- **US**: `api.us.toothfairyai.com` / `ai.us.toothfairyai.com`
|
|
50
|
+
- **EU**: `api.eu.toothfairyai.com` / `ai.eu.toothfairyai.com`
|
|
51
|
+
- **Australia** (default): `api.toothfairyai.com` / `ai.toothfairyai.com`
|
|
52
|
+
|
|
53
|
+
### Configuration Options
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
const client = new ToothFairyClient({
|
|
57
|
+
apiKey: 'your-api-key', // Required: Your ToothFairyAI API key
|
|
58
|
+
workspaceId: 'your-workspace-id', // Required: Your workspace ID
|
|
59
|
+
baseUrl: 'https://api.us.toothfairyai.com', // Optional: API base URL (region-specific)
|
|
60
|
+
aiUrl: 'https://ai.us.toothfairyai.com', // Optional: AI service URL (region-specific)
|
|
61
|
+
aiStreamUrl: 'https://ai-stream.us.toothfairyai.com', // Optional: Streaming URL (region-specific)
|
|
62
|
+
timeout: 120000 // Optional: Request timeout in ms
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
11
66
|
## Quick Start
|
|
12
67
|
|
|
13
68
|
```typescript
|
|
@@ -16,6 +71,7 @@ import { ToothFairyClient } from '@toothfairyai/sdk';
|
|
|
16
71
|
const client = new ToothFairyClient({
|
|
17
72
|
apiKey: 'your-api-key',
|
|
18
73
|
workspaceId: 'your-workspace-id'
|
|
74
|
+
// Uses Australia region by default
|
|
19
75
|
});
|
|
20
76
|
|
|
21
77
|
// Send a message to an agent
|
|
@@ -27,37 +83,25 @@ console.log(response.agentResponse);
|
|
|
27
83
|
|
|
28
84
|
- 🔄 **Real-time Streaming**: Event-driven streaming for live agent interactions
|
|
29
85
|
- 📄 **Document Management**: Upload, download, and search through documents
|
|
30
|
-
- 🏷️ **Entity Management**: Manage topics, intents, and NER entities
|
|
86
|
+
- 🏷️ **Entity Management**: Manage topics, intents, and NER entities
|
|
31
87
|
- 📁 **Folder Organization**: Organize documents hierarchically
|
|
32
88
|
- 🤖 **Prompt Management**: Create and manage AI prompts
|
|
33
89
|
- 💬 **Chat Management**: Handle conversations and messaging
|
|
34
90
|
- 🔧 **TypeScript First**: Comprehensive type definitions included
|
|
35
91
|
- 📦 **Modular Design**: Use only what you need
|
|
92
|
+
- 🌍 **Multi-Region Support**: US, EU, and Australia endpoints
|
|
36
93
|
|
|
37
94
|
## Architecture
|
|
38
95
|
|
|
39
96
|
The SDK is organized into logical modules:
|
|
40
97
|
|
|
41
98
|
- **`client.chat`** - Chat and messaging operations
|
|
42
|
-
- **`client.streaming`** - Real-time streaming functionality
|
|
99
|
+
- **`client.streaming`** - Real-time streaming functionality
|
|
43
100
|
- **`client.documents`** - Document upload, download, search, and management
|
|
44
101
|
- **`client.entities`** - Entity management (topics, intents, NER)
|
|
45
102
|
- **`client.folders`** - Folder organization
|
|
46
103
|
- **`client.prompts`** - AI prompt management
|
|
47
104
|
|
|
48
|
-
## Configuration
|
|
49
|
-
|
|
50
|
-
```typescript
|
|
51
|
-
const client = new ToothFairyClient({
|
|
52
|
-
apiKey: 'your-api-key', // Required: Your ToothFairyAI API key
|
|
53
|
-
workspaceId: 'your-workspace-id', // Required: Your workspace ID
|
|
54
|
-
baseUrl: 'https://api.toothfairyai.com', // Optional: API base URL
|
|
55
|
-
aiUrl: 'https://ai.toothfairyai.com', // Optional: AI service URL
|
|
56
|
-
aiStreamUrl: 'https://ai-stream.toothfairyai.com', // Optional: Streaming URL
|
|
57
|
-
timeout: 120000 // Optional: Request timeout in ms
|
|
58
|
-
});
|
|
59
|
-
```
|
|
60
|
-
|
|
61
105
|
## Usage Examples
|
|
62
106
|
|
|
63
107
|
### Real-time Streaming Chat
|