ttc-ai-chat-sdk 0.0.2-beta → 0.0.3-beta

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.
Files changed (2) hide show
  1. package/README.md +85 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,2 +1,86 @@
1
+ # TTC AI Chat SDK
1
2
 
2
- App is currently in alpha version. Use at your own risk.
3
+ A TypeScript/JavaScript SDK for building custom chat interfaces and integrating AI capabilities into your applications.
4
+
5
+ ## Overview
6
+
7
+ The `ttc-ai-chat-sdk` provides the core tools for integrating Tentarcles AI into your applications. Use it to send messages, subscribe to real-time events, trigger AI actions, and expose your app's functions to the AI.
8
+
9
+ ## Installation
10
+
11
+ Install the SDK using your preferred package manager:
12
+
13
+ ```bash
14
+ npm install ttc-ai-chat-sdk
15
+ ```
16
+
17
+ ## Quick Start
18
+
19
+ ### Initialize the SDK
20
+
21
+ Set up the SDK with your app ID and modules:
22
+
23
+ ```typescript
24
+ import { ttc } from "ttc-ai-chat-sdk";
25
+ import { MyAppModule } from "./modules";
26
+
27
+ ttc.init({
28
+ app_id: "your-app-id",
29
+ modules: [MyAppModule]
30
+ });
31
+ ```
32
+
33
+ ### Subscribe to Events
34
+
35
+ Listen for real-time events like messages, function calls, and status changes:
36
+
37
+ ```typescript
38
+ // Subscribe to incoming messages
39
+ ttc.subscribe("message", (payload) => {
40
+ console.log("New message:", payload);
41
+ });
42
+
43
+ // Subscribe to function calls
44
+ ttc.subscribe("function_call", (payload) => {
45
+ console.log("Function called:", payload);
46
+ });
47
+
48
+ // Subscribe to permission requests
49
+ ttc.subscribe("permission", (payload) => {
50
+ console.log("permission:", payload);
51
+ });
52
+ ```
53
+
54
+ ### Send a Message
55
+
56
+ Send messages to the AI using the server's ttcCore methods:
57
+
58
+ ```typescript
59
+ // Send a message to the AI
60
+ const response = await ttc.server.ttcCore.chatAI(
61
+ conversationId,
62
+ "Hello, how can you help me today?"
63
+ );
64
+
65
+ console.log(response);
66
+ ```
67
+
68
+ ### Trigger the AI
69
+
70
+ Programmatically trigger the AI to act based on a message:
71
+
72
+ ```typescript
73
+ // Trigger the AI to perform an action
74
+ await ttc.server.TCC.trigger(
75
+ conversationId,
76
+ "Check the user's cart and suggest related products",
77
+ 5 // eta in seconds
78
+ );
79
+ ```
80
+
81
+ ## Full Documentation
82
+
83
+ For complete API reference, all available methods, and advanced configuration, check out the full SDK documentation.
84
+
85
+ - [See Documentation](/sdk-reference)
86
+ - [View on npm](https://www.npmjs.com/package/ttc-ai-chat-sdk)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ttc-ai-chat-sdk",
3
- "version": "0.0.2-beta",
3
+ "version": "0.0.3-beta",
4
4
  "description": "TypeScript client sdk for TTC AI services with decorators and schema validation.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",