chatsee-sdk 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 [Your Name]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
File without changes
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Chatsee AI SDK
3
+ * Production-grade tracker for LLM conversations, tool calls, and errors.
4
+ * Sends each turn with full metadata to the Chatsee API.
5
+ */
6
+ /**
7
+ * Represents a tool/function call
8
+ */
9
+ export interface ToolCall {
10
+ tool_name: string;
11
+ arguments: Record<string, any>;
12
+ result?: any;
13
+ error?: string;
14
+ timestamp: string;
15
+ }
16
+ /**
17
+ * Represents a single conversation turn
18
+ */
19
+ export interface ConversationEntry {
20
+ user_message: string;
21
+ bot_message: string;
22
+ tool_call: number;
23
+ tool_calls_details: ToolCall[];
24
+ error_encountered: number;
25
+ exception: string | null;
26
+ metadata: Record<string, any>;
27
+ timestamp: string;
28
+ agent_id: string;
29
+ user_id: string;
30
+ }
31
+ /**
32
+ * Configuration options for ChatseeTracker
33
+ */
34
+ export interface ChatseeTrackerConfig {
35
+ agent_id: string;
36
+ user_id: string;
37
+ tenant_id: string;
38
+ tenant_name: string;
39
+ chatsee_api_key: string;
40
+ session_id?: string;
41
+ timeout?: number;
42
+ verify_ssl?: boolean;
43
+ }
44
+ /**
45
+ * Main SDK class for tracking LLM conversations and logging them
46
+ * to the Chatsee platform.
47
+ */
48
+ export declare class ChatseeTracker {
49
+ private static readonly API_ENDPOINT;
50
+ private agent_id;
51
+ private user_id;
52
+ private tenant_id;
53
+ private tenant_name;
54
+ private chatsee_api_key;
55
+ private timeout;
56
+ private verify_ssl;
57
+ private session_id;
58
+ private conversation_history;
59
+ private current_entry;
60
+ private axiosInstance;
61
+ /**
62
+ * Initialize the Chatsee Tracker.
63
+ *
64
+ * @param config - Configuration object containing all required parameters
65
+ * @throws Error if required parameters are missing
66
+ */
67
+ constructor(config: ChatseeTrackerConfig);
68
+ /**
69
+ * Generate unique session ID
70
+ */
71
+ private generateSessionId;
72
+ /**
73
+ * Return the agent_id for this tracker instance
74
+ */
75
+ getAgentId(): string;
76
+ /**
77
+ * Return the tenant_id for this tracker instance
78
+ */
79
+ getTenantId(): string;
80
+ /**
81
+ * Return the tenant_name for this tracker instance
82
+ */
83
+ getTenantName(): string;
84
+ /**
85
+ * Start tracking a new conversation turn.
86
+ *
87
+ * @param user_message - The user's input message
88
+ * @param metadata - Optional metadata object
89
+ */
90
+ startTurn(user_message: string, metadata?: Record<string, any>): void;
91
+ /**
92
+ * Log a tool/function call that occurred within the current turn.
93
+ *
94
+ * @param tool_name - Name of the function/tool called
95
+ * @param args - Arguments passed to the tool
96
+ * @param result - The successful result from the tool (if any)
97
+ * @param error - The error message from the tool (if any)
98
+ */
99
+ logToolCall(tool_name: string, args: Record<string, any>, result?: any, error?: string): void;
100
+ /**
101
+ * Log an exception that occurred during the turn.
102
+ *
103
+ * @param exception - The exception/error object or message
104
+ */
105
+ logException(exception: Error | string): void;
106
+ /**
107
+ * Complete the current conversation turn and send it to the Chatsee API.
108
+ *
109
+ * @param bot_message - The final response from the bot
110
+ * @returns Promise resolving to the ConversationEntry if successful, null otherwise
111
+ */
112
+ endTurn(bot_message: string): Promise<ConversationEntry | null>;
113
+ /**
114
+ * Internal method to send the completed turn data to the API.
115
+ */
116
+ private sendToApi;
117
+ /**
118
+ * Get all conversation entries
119
+ */
120
+ getConversationHistory(): ConversationEntry[];
121
+ /**
122
+ * Get summary statistics for the current session
123
+ */
124
+ getSummary(): {
125
+ session_id: string;
126
+ agent_id: string;
127
+ user_id: string;
128
+ tenant_id: string;
129
+ tenant_name: string;
130
+ total_turns: number;
131
+ tool_calls_count: number;
132
+ errors_count: number;
133
+ conversation_history: ConversationEntry[];
134
+ };
135
+ /**
136
+ * Export conversation history summary to a JSON string or file
137
+ *
138
+ * @param filepath - Optional file path (Node.js only)
139
+ * @returns JSON string of the summary
140
+ */
141
+ exportJson(filepath?: string): string;
142
+ /**
143
+ * Print a formatted summary to the console
144
+ */
145
+ printSummary(): void;
146
+ }
147
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAA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AIvB;;;;;OAKG;IACH,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAAG,IAAI;IAuBzE;;;;;;;OAOG;IACH,WAAW,CACT,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,MAAM,CAAC,EAAE,GAAG,EACZ,KAAK,CAAC,EAAE,MAAM,GACb,IAAI;IAyBP;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI;IAY7C;;;;;OAKG;IACG,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAqCrE;;OAEG;YACW,SAAS;IA6EvB;;OAEG;IACH,sBAAsB,IAAI,iBAAiB,EAAE;IAI7C;;OAEG;IACH,UAAU,IAAI;QACZ,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,gBAAgB,EAAE,MAAM,CAAC;QACzB,YAAY,EAAE,MAAM,CAAC;QACrB,oBAAoB,EAAE,iBAAiB,EAAE,CAAC;KAC3C;IAsBD;;;;;OAKG;IACH,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IA6BrC;;OAEG;IACH,YAAY,IAAI,IAAI;CAgDrB"}
package/dist/index.js ADDED
@@ -0,0 +1,386 @@
1
+ "use strict";
2
+ /**
3
+ * Chatsee AI SDK
4
+ * Production-grade tracker for LLM conversations, tool calls, and errors.
5
+ * Sends each turn with full metadata to the Chatsee API.
6
+ */
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.ChatseeTracker = void 0;
12
+ const axios_1 = __importDefault(require("axios"));
13
+ /**
14
+ * Main SDK class for tracking LLM conversations and logging them
15
+ * to the Chatsee platform.
16
+ */
17
+ class ChatseeTracker {
18
+ /**
19
+ * Initialize the Chatsee Tracker.
20
+ *
21
+ * @param config - Configuration object containing all required parameters
22
+ * @throws Error if required parameters are missing
23
+ */
24
+ constructor(config) {
25
+ var _a;
26
+ this.conversation_history = [];
27
+ this.current_entry = null;
28
+ // Validate required parameters
29
+ if (!config.agent_id) {
30
+ throw new Error('agent_id must be provided.');
31
+ }
32
+ if (!config.user_id) {
33
+ throw new Error('user_id must be provided.');
34
+ }
35
+ if (!config.tenant_id) {
36
+ throw new Error('tenant_id must be provided.');
37
+ }
38
+ if (!config.tenant_name) {
39
+ throw new Error('tenant_name must be provided.');
40
+ }
41
+ if (!config.chatsee_api_key) {
42
+ throw new Error('chatsee_api_key must be provided.');
43
+ }
44
+ this.agent_id = config.agent_id;
45
+ this.user_id = config.user_id;
46
+ this.tenant_id = config.tenant_id;
47
+ this.tenant_name = config.tenant_name;
48
+ this.chatsee_api_key = config.chatsee_api_key;
49
+ this.timeout = config.timeout || 10000; // Convert to milliseconds
50
+ this.verify_ssl = config.verify_ssl !== false; // Default true
51
+ this.session_id = config.session_id || this.generateSessionId();
52
+ // Create axios instance with persistent configuration
53
+ this.axiosInstance = axios_1.default.create({
54
+ headers: {
55
+ 'Content-Type': 'application/json',
56
+ },
57
+ timeout: this.timeout,
58
+ // Note: In Node.js, use https.Agent to disable SSL verification if needed
59
+ // In browser, SSL verification cannot be disabled
60
+ });
61
+ if (!this.verify_ssl) {
62
+ console.warn('SSL verification is disabled. This is not recommended for production.');
63
+ // For Node.js environments
64
+ if (typeof process !== 'undefined' && ((_a = process.versions) === null || _a === void 0 ? void 0 : _a.node)) {
65
+ const https = require('https');
66
+ this.axiosInstance.defaults.httpsAgent = new https.Agent({
67
+ rejectUnauthorized: false,
68
+ });
69
+ }
70
+ }
71
+ console.log('ChatseeTracker initialized');
72
+ console.log(`Tenant ID: ${this.tenant_id}`);
73
+ console.log(`User ID: ${this.user_id}`);
74
+ console.log(`Tenant Name: ${this.tenant_name}`);
75
+ console.log(`Agent ID: ${this.agent_id}`);
76
+ console.log(`Session ID: ${this.session_id}`);
77
+ }
78
+ /**
79
+ * Generate unique session ID
80
+ */
81
+ generateSessionId() {
82
+ const now = new Date();
83
+ const dateStr = now.toISOString().replace(/[-:]/g, '').replace('T', '_').split('.')[0];
84
+ const ms = now.getMilliseconds().toString().padStart(3, '0');
85
+ return `session_${dateStr}_${ms}`;
86
+ }
87
+ /**
88
+ * Return the agent_id for this tracker instance
89
+ */
90
+ getAgentId() {
91
+ return this.agent_id;
92
+ }
93
+ /**
94
+ * Return the tenant_id for this tracker instance
95
+ */
96
+ getTenantId() {
97
+ return this.tenant_id;
98
+ }
99
+ /**
100
+ * Return the tenant_name for this tracker instance
101
+ */
102
+ getTenantName() {
103
+ return this.tenant_name;
104
+ }
105
+ /**
106
+ * Start tracking a new conversation turn.
107
+ *
108
+ * @param user_message - The user's input message
109
+ * @param metadata - Optional metadata object
110
+ */
111
+ startTurn(user_message, metadata = {}) {
112
+ if (this.current_entry !== null) {
113
+ console.warn('A new turn was started before the previous turn ended. ' +
114
+ 'Call endTurn() to complete the previous turn. Overwriting.');
115
+ }
116
+ this.current_entry = {
117
+ user_message,
118
+ bot_message: '',
119
+ tool_calls: [],
120
+ error_encountered: 0,
121
+ exception: null,
122
+ metadata,
123
+ timestamp: new Date().toISOString(),
124
+ agent_id: this.agent_id,
125
+ user_id: this.user_id,
126
+ };
127
+ console.debug(`Turn started for agent: ${this.agent_id}`);
128
+ }
129
+ /**
130
+ * Log a tool/function call that occurred within the current turn.
131
+ *
132
+ * @param tool_name - Name of the function/tool called
133
+ * @param args - Arguments passed to the tool
134
+ * @param result - The successful result from the tool (if any)
135
+ * @param error - The error message from the tool (if any)
136
+ */
137
+ logToolCall(tool_name, args, result, error) {
138
+ if (this.current_entry === null) {
139
+ throw new Error('Must call startTurn() before logging tool calls.');
140
+ }
141
+ const toolCall = {
142
+ tool_name,
143
+ arguments: args,
144
+ result,
145
+ error,
146
+ timestamp: new Date().toISOString(),
147
+ };
148
+ this.current_entry.tool_calls.push(toolCall);
149
+ console.debug(`Tool call logged: ${tool_name}`);
150
+ if (error) {
151
+ this.current_entry.error_encountered = 1;
152
+ if (this.current_entry.exception === null) {
153
+ this.current_entry.exception = error;
154
+ }
155
+ console.warn(`Tool call error logged for ${tool_name}: ${error}`);
156
+ }
157
+ }
158
+ /**
159
+ * Log an exception that occurred during the turn.
160
+ *
161
+ * @param exception - The exception/error object or message
162
+ */
163
+ logException(exception) {
164
+ if (this.current_entry === null) {
165
+ throw new Error('Must call startTurn() before logging exceptions.');
166
+ }
167
+ this.current_entry.error_encountered = 1;
168
+ this.current_entry.exception =
169
+ exception instanceof Error ? exception.message : exception;
170
+ console.error(`General turn exception logged: ${exception}`);
171
+ }
172
+ /**
173
+ * Complete the current conversation turn and send it to the Chatsee API.
174
+ *
175
+ * @param bot_message - The final response from the bot
176
+ * @returns Promise resolving to the ConversationEntry if successful, null otherwise
177
+ */
178
+ async endTurn(bot_message) {
179
+ if (this.current_entry === null) {
180
+ throw new Error('Must call endTurn() without first calling startTurn().');
181
+ }
182
+ this.current_entry.bot_message = bot_message;
183
+ try {
184
+ const entry = {
185
+ user_message: this.current_entry.user_message,
186
+ bot_message: this.current_entry.bot_message,
187
+ tool_call: this.current_entry.tool_calls.length > 0 ? 1 : 0,
188
+ tool_calls_details: this.current_entry.tool_calls,
189
+ error_encountered: this.current_entry.error_encountered,
190
+ exception: this.current_entry.exception,
191
+ metadata: this.current_entry.metadata,
192
+ timestamp: this.current_entry.timestamp,
193
+ agent_id: this.current_entry.agent_id,
194
+ user_id: this.current_entry.user_id,
195
+ };
196
+ this.conversation_history.push(entry);
197
+ // Send full data to API
198
+ await this.sendToApi(entry);
199
+ return entry;
200
+ }
201
+ catch (error) {
202
+ console.error('Failed to finalize and send turn:', error);
203
+ return null;
204
+ }
205
+ finally {
206
+ // Always reset the current turn, even if API send fails
207
+ this.current_entry = null;
208
+ console.debug('Turn ended and reset.');
209
+ }
210
+ }
211
+ /**
212
+ * Internal method to send the completed turn data to the API.
213
+ */
214
+ async sendToApi(entry) {
215
+ var _a;
216
+ try {
217
+ const payload = {
218
+ session_id: this.session_id,
219
+ user_id: this.user_id,
220
+ agent_id: entry.agent_id,
221
+ tenant_id: this.tenant_id,
222
+ tenant_name: this.tenant_name,
223
+ chatsee_api_key: this.chatsee_api_key,
224
+ user_message: entry.user_message,
225
+ bot_message: entry.bot_message,
226
+ tool_call: entry.tool_call,
227
+ tool_calls_details: entry.tool_calls_details,
228
+ error_encountered: entry.error_encountered,
229
+ exception: entry.exception,
230
+ metadata: entry.metadata,
231
+ };
232
+ const response = await this.axiosInstance.post(ChatseeTracker.API_ENDPOINT, payload);
233
+ const interaction_id = ((_a = response.data) === null || _a === void 0 ? void 0 : _a.interaction_id) || 'N/A';
234
+ console.log(`Successfully sent turn to API. ` +
235
+ `Status: ${response.status}. ` +
236
+ `Interaction ID: ${interaction_id}`);
237
+ }
238
+ catch (error) {
239
+ if (axios_1.default.isAxiosError(error)) {
240
+ const axiosError = error;
241
+ if (axiosError.response) {
242
+ // HTTP error (4xx, 5xx)
243
+ let errorDetail = 'Unknown error';
244
+ try {
245
+ const errorData = axiosError.response.data;
246
+ errorDetail = (errorData === null || errorData === void 0 ? void 0 : errorData.detail) || JSON.stringify(axiosError.response.data);
247
+ }
248
+ catch {
249
+ errorDetail = String(axiosError.response.data);
250
+ }
251
+ console.error(`API Error: Failed to send turn data. ` +
252
+ `Status Code: ${axiosError.response.status}. ` +
253
+ `Error: ${errorDetail}`);
254
+ }
255
+ else if (axiosError.code === 'ECONNABORTED') {
256
+ // Timeout error
257
+ console.error(`Timeout Error: Request to ${ChatseeTracker.API_ENDPOINT} timed out ` +
258
+ `after ${this.timeout}ms. Error: ${axiosError.message}`);
259
+ }
260
+ else if (axiosError.request) {
261
+ // Connection error
262
+ console.error(`Connection Error: Failed to connect to ${ChatseeTracker.API_ENDPOINT}. ` +
263
+ `Check network/DNS. Error: ${axiosError.message}`);
264
+ }
265
+ else {
266
+ // Other axios errors
267
+ console.error(`API Log ERROR: Failed to send turn data to ${ChatseeTracker.API_ENDPOINT}. ` +
268
+ `Error: ${axiosError.message}`);
269
+ }
270
+ }
271
+ else {
272
+ // Non-axios errors
273
+ console.error(`Unexpected error while sending turn data: ${error}`);
274
+ }
275
+ }
276
+ }
277
+ /**
278
+ * Get all conversation entries
279
+ */
280
+ getConversationHistory() {
281
+ return [...this.conversation_history];
282
+ }
283
+ /**
284
+ * Get summary statistics for the current session
285
+ */
286
+ getSummary() {
287
+ const total_turns = this.conversation_history.length;
288
+ const tool_calls_count = this.conversation_history.filter((entry) => entry.tool_call === 1).length;
289
+ const errors_count = this.conversation_history.filter((entry) => entry.error_encountered === 1).length;
290
+ return {
291
+ session_id: this.session_id,
292
+ agent_id: this.agent_id,
293
+ user_id: this.user_id,
294
+ tenant_id: this.tenant_id,
295
+ tenant_name: this.tenant_name,
296
+ total_turns,
297
+ tool_calls_count,
298
+ errors_count,
299
+ conversation_history: this.getConversationHistory(),
300
+ };
301
+ }
302
+ /**
303
+ * Export conversation history summary to a JSON string or file
304
+ *
305
+ * @param filepath - Optional file path (Node.js only)
306
+ * @returns JSON string of the summary
307
+ */
308
+ exportJson(filepath) {
309
+ var _a;
310
+ const data = this.getSummary();
311
+ let jsonStr;
312
+ try {
313
+ jsonStr = JSON.stringify(data, null, 2);
314
+ }
315
+ catch (error) {
316
+ console.error('Failed to serialize summary to JSON:', error);
317
+ return '{}';
318
+ }
319
+ if (filepath) {
320
+ // Only works in Node.js environment
321
+ if (typeof process !== 'undefined' && ((_a = process.versions) === null || _a === void 0 ? void 0 : _a.node)) {
322
+ try {
323
+ const fs = require('fs');
324
+ fs.writeFileSync(filepath, jsonStr, 'utf8');
325
+ console.log(`Summary successfully exported to ${filepath}`);
326
+ }
327
+ catch (error) {
328
+ console.error(`Failed to write summary to file ${filepath}:`, error);
329
+ }
330
+ }
331
+ else {
332
+ console.warn('File system operations are not available in browser environment.');
333
+ }
334
+ }
335
+ return jsonStr;
336
+ }
337
+ /**
338
+ * Print a formatted summary to the console
339
+ */
340
+ printSummary() {
341
+ const summary = this.getSummary();
342
+ console.log('\n' + '='.repeat(60));
343
+ console.log(`Tenant ID: ${this.tenant_id}`);
344
+ console.log(`Tenant Name: ${this.tenant_name}`);
345
+ console.log(`Agent ID: ${this.agent_id}`);
346
+ console.log(`Session ID: ${this.session_id}`);
347
+ console.log('='.repeat(60));
348
+ if (this.conversation_history.length === 0) {
349
+ console.log('No turns have been logged in this session.');
350
+ }
351
+ this.conversation_history.forEach((entry, idx) => {
352
+ console.log(`\n--- Turn ${idx + 1} [${entry.timestamp}] ---`);
353
+ console.log(`User: ${entry.user_message}`);
354
+ console.log(`Bot: ${entry.bot_message}`);
355
+ console.log(`Tool Call: ${entry.tool_call ? 'Yes' : 'No'}`);
356
+ if (entry.tool_calls_details.length > 0) {
357
+ console.log('Tool Calls Details:');
358
+ entry.tool_calls_details.forEach((tc) => {
359
+ console.log(` - ${tc.tool_name}`);
360
+ console.log(` Args: ${JSON.stringify(tc.arguments)}`);
361
+ if (tc.result) {
362
+ console.log(` Result: ${JSON.stringify(tc.result)}`);
363
+ }
364
+ if (tc.error) {
365
+ console.log(` Error: ${tc.error}`);
366
+ }
367
+ });
368
+ }
369
+ console.log(`Error Encountered: ${entry.error_encountered ? 'Yes' : 'No'}`);
370
+ if (entry.exception) {
371
+ console.log(`Exception: ${entry.exception}`);
372
+ }
373
+ if (Object.keys(entry.metadata).length > 0) {
374
+ console.log(`Metadata: ${JSON.stringify(entry.metadata)}`);
375
+ }
376
+ });
377
+ console.log('\n' + '='.repeat(60));
378
+ console.log(`Total Turns: ${summary.total_turns}`);
379
+ console.log(`Tool Calls: ${summary.tool_calls_count}`);
380
+ console.log(`Errors: ${summary.errors_count}`);
381
+ console.log('='.repeat(60) + '\n');
382
+ }
383
+ }
384
+ exports.ChatseeTracker = ChatseeTracker;
385
+ ChatseeTracker.API_ENDPOINT = 'https://qa-api.chatsee.ai:8000/v1/api/process_interaction';
386
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,kDAAyD;AA0DzD;;;GAGG;AACH,MAAa,cAAc;IAgBzB;;;;;OAKG;IACH,YAAY,MAA4B;;QAVhC,yBAAoB,GAAwB,EAAE,CAAC;QAC/C,kBAAa,GAAwB,IAAI,CAAC;QAUhD,+BAA+B;QAC/B,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC/C,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACnD,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,C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AC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YAC5E,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;gBACpB,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;YAC/C,CAAC;YACD,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC3C,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QACnC,OAAO,CAAC,GAAG,CAAC,gBAAgB,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;QACnD,OAAO,CAAC,GAAG,CAAC,eAAe,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;QACvD,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IACrC,CAAC;;AA7bH,wCA8bC;AA7byB,2BAAY,GAClC,2DAA2D,AADzB,CAC0B"}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "chatsee-sdk",
3
+ "version": "1.0.0",
4
+ "description": "Production-grade tracker for LLM conversations, tool calls, and errors for the Chatsee platform",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "prepare": "npm run build",
10
+ "test": "jest",
11
+ "lint": "eslint src/**/*.ts",
12
+ "format": "prettier --write \"src/**/*.ts\""
13
+ },
14
+ "keywords": [
15
+ "chatsee",
16
+ "llm",
17
+ "conversation",
18
+ "tracking",
19
+ "ai",
20
+ "chatbot",
21
+ "monitoring",
22
+ "analytics"
23
+ ],
24
+ "author": "Your Name <your.email@example.com>",
25
+ "license": "MIT",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/yourusername/chatsee-sdk.git"
29
+ },
30
+ "bugs": {
31
+ "url": "https://github.com/yourusername/chatsee-sdk/issues"
32
+ },
33
+ "homepage": "https://github.com/yourusername/chatsee-sdk#readme",
34
+ "dependencies": {
35
+ "axios": "^1.6.0"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^20.0.0",
39
+ "typescript": "^5.3.0",
40
+ "eslint": "^8.55.0",
41
+ "@typescript-eslint/eslint-plugin": "^6.15.0",
42
+ "@typescript-eslint/parser": "^6.15.0",
43
+ "prettier": "^3.1.0",
44
+ "jest": "^29.7.0",
45
+ "@types/jest": "^29.5.0",
46
+ "ts-jest": "^29.1.0"
47
+ },
48
+ "files": [
49
+ "dist",
50
+ "README.md",
51
+ "LICENSE"
52
+ ],
53
+ "engines": {
54
+ "node": ">=14.0.0"
55
+ }
56
+ }