@qelos/sdk 3.11.3 → 3.11.5

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.
@@ -0,0 +1,56 @@
1
+ import BaseSDK from '../base-sdk';
2
+ import { QelosSDKOptions } from '../types';
3
+ import { IThread, ICreateThreadRequest } from '.';
4
+
5
+ export default class ThreadsSDK extends BaseSDK {
6
+ private relativePath = '/api/ai';
7
+
8
+ constructor(options: QelosSDKOptions) {
9
+ super(options);
10
+ }
11
+
12
+ /**
13
+ * Create a new thread
14
+ */
15
+ create(data: ICreateThreadRequest): Promise<IThread> {
16
+ return this.callJsonApi<IThread>(this.relativePath + '/threads', {
17
+ method: 'POST',
18
+ headers: { 'content-type': 'application/json' },
19
+ body: JSON.stringify(data)
20
+ });
21
+ }
22
+
23
+ /**
24
+ * Get a specific thread by ID
25
+ */
26
+ getOne(threadId: string): Promise<IThread> {
27
+ return this.callJsonApi<IThread>(`${this.relativePath}/threads/${threadId}${this.getQueryParams({})}`);
28
+ }
29
+
30
+ /**
31
+ * List threads with optional filters
32
+ */
33
+ list(options?: {
34
+ integration?: string;
35
+ limit?: number;
36
+ page?: number;
37
+ sort?: string;
38
+ user?: string;
39
+ workspace?: string;
40
+ [key: string]: string | number;
41
+ }): Promise<IThread[]> {
42
+ const queryParams = this.getQueryParams(options);
43
+ return this.callJsonApi<IThread[]>(
44
+ `${this.relativePath}/threads${queryParams}`
45
+ );
46
+ }
47
+
48
+ /**
49
+ * Delete a thread
50
+ */
51
+ delete(threadId: string): Promise<{ success: boolean }> {
52
+ return this.callJsonApi<{ success: boolean }>(`${this.relativePath}/threads/${threadId}${this.getQueryParams({})}`, {
53
+ method: 'DELETE'
54
+ });
55
+ }
56
+ }
@@ -0,0 +1,101 @@
1
+ export interface IMessage {
2
+ role: string;
3
+ content: string;
4
+ timestamp?: Date | string;
5
+ tool_calls?: any[];
6
+ name?: string;
7
+ tool_call_id?: string;
8
+ function_call?: any;
9
+ message_id?: string;
10
+ }
11
+
12
+ export interface IMessageSummary {
13
+ fromIndex: number;
14
+ toIndex: number;
15
+ summary: string;
16
+ }
17
+
18
+ export interface IThread {
19
+ _id?: string;
20
+ integration: string;
21
+ title?: string;
22
+ messages: IMessage[];
23
+ messageSummaries: IMessageSummary[];
24
+ created?: Date;
25
+ updated?: Date;
26
+ user?: string;
27
+ workspace?: string;
28
+ }
29
+
30
+ export interface IChatCompletionOptions {
31
+ messages: IMessage[];
32
+ model?: string;
33
+ temperature?: number;
34
+ top_p?: number;
35
+ frequency_penalty?: number;
36
+ presence_penalty?: number;
37
+ stop?: string | string[];
38
+ max_tokens?: number;
39
+ response_format?: any;
40
+ context?: Record<string, any>;
41
+ stream?: boolean;
42
+ queryParams?: Record<string, any>;
43
+ }
44
+
45
+ export interface ISSEStreamProcessor extends AsyncIterable<any> {
46
+ processManually(onData: (data: any) => void | boolean): Promise<void>;
47
+ }
48
+
49
+ export interface IChatCompletionResponse {
50
+ id: string;
51
+ object: string;
52
+ created: number;
53
+ model: string;
54
+ choices: Array<{
55
+ index: number;
56
+ message: IMessage;
57
+ finish_reason: string;
58
+ }>;
59
+ usage?: {
60
+ prompt_tokens: number;
61
+ completion_tokens: number;
62
+ total_tokens: number;
63
+ };
64
+ }
65
+
66
+ export interface ICreateThreadRequest {
67
+ integration: string;
68
+ title?: string;
69
+ }
70
+
71
+ export interface ICreateVectorStorageRequest {
72
+ integrationId: string;
73
+ scope: 'thread' | 'user' | 'workspace' | 'tenant';
74
+ subjectId?: string;
75
+ expirationAfterDays?: number;
76
+ }
77
+
78
+ export interface IUploadContentRequest {
79
+ integrationId?: string;
80
+ vectorStoreId?: string;
81
+ content: string | object;
82
+ fileName?: string;
83
+ metadata?: Record<string, any>;
84
+ }
85
+
86
+ export interface IClearStorageRequest {
87
+ integrationId?: string;
88
+ vectorStoreId?: string;
89
+ fileIds?: string[];
90
+ }
91
+
92
+ export interface IVectorStore {
93
+ _id: string;
94
+ scope: string;
95
+ subjectId?: string;
96
+ tenant: string;
97
+ agent: string;
98
+ externalId: string;
99
+ expirationAfterDays?: number;
100
+ created: Date;
101
+ }
@@ -0,0 +1,172 @@
1
+ # Qelos AI SDK Migration Guide
2
+
3
+ The Qelos AI SDK has been refactored to provide a more organized and intuitive API with three sub-SDKs:
4
+ - `threads` - Thread CRUD operations
5
+ - `chat` - Chat completion (streaming and non-streaming) and SSE parsing
6
+ - `rag` - Vector storage management for RAG (Retrieval-Augmented Generation)
7
+
8
+ ## File Structure
9
+
10
+ The SDK is now split into multiple files for better organization:
11
+ ```
12
+ /packages/sdk/src/ai/
13
+ ├── index.ts - Exports all sub-SDKs and types
14
+ ├── types.ts - All AI-related type definitions
15
+ ├── threads.ts - ThreadsSDK implementation
16
+ ├── chat.ts - ChatSDK implementation
17
+ └── rag.ts - RAGSDK implementation
18
+ ```
19
+
20
+ ## New API Structure
21
+
22
+ ### 1. Threads Sub-SDK
23
+
24
+ All thread-related operations are now available under `sdk.ai.threads`:
25
+
26
+ ```typescript
27
+ // Create a new thread
28
+ const thread = await sdk.ai.threads.create({
29
+ integration: 'integration-id',
30
+ title: 'Optional title'
31
+ });
32
+
33
+ // Get a specific thread
34
+ const thread = await sdk.ai.threads.getOne('thread-id');
35
+
36
+ // List threads with filters
37
+ const threads = await sdk.ai.threads.list({
38
+ integration: 'integration-id',
39
+ limit: 10,
40
+ page: 1
41
+ });
42
+
43
+ // Delete a thread
44
+ await sdk.ai.threads.delete('thread-id');
45
+ ```
46
+
47
+ ### 2. Chat Sub-SDK
48
+
49
+ All chat completion operations are now available under `sdk.ai.chat`:
50
+
51
+ ```typescript
52
+ // Non-streaming chat
53
+ const response = await sdk.ai.chat.chat('integration-id', {
54
+ messages: [{ role: 'user', content: 'Hello!' }],
55
+ model: 'gpt-4',
56
+ queryParams: { bypassAdmin: true } // Optional query parameters
57
+ });
58
+
59
+ // Non-streaming chat in thread
60
+ const response = await sdk.ai.chat.chatInThread('integration-id', 'thread-id', {
61
+ messages: [{ role: 'user', content: 'Hello!' }]
62
+ });
63
+
64
+ // Streaming chat
65
+ const stream = await sdk.ai.chat.stream('integration-id', {
66
+ messages: [{ role: 'user', content: 'Hello!' }],
67
+ stream: true
68
+ });
69
+
70
+ // Streaming chat in thread
71
+ const stream = await sdk.ai.chat.streamInThread('integration-id', 'thread-id', {
72
+ messages: [{ role: 'user', content: 'Hello!' }],
73
+ stream: true
74
+ });
75
+
76
+ // Parse SSE stream
77
+ const processor = sdk.ai.chat.parseSSEStream(stream);
78
+ for await (const chunk of processor) {
79
+ console.log(chunk);
80
+ }
81
+ ```
82
+
83
+ ### 3. RAG Sub-SDK
84
+
85
+ All vector storage operations are now available under `sdk.ai.rag`:
86
+
87
+ ```typescript
88
+ // Create vector storage
89
+ const result = await sdk.ai.rag.createStorage('source-id', {
90
+ integrationId: 'integration-id',
91
+ scope: 'thread', // 'thread' | 'user' | 'workspace' | 'tenant'
92
+ subjectId: 'thread-id', // Required for non-tenant scopes
93
+ expirationAfterDays: 30
94
+ });
95
+
96
+ // Upload content to storage
97
+ const uploadResult = await sdk.ai.rag.uploadContent('source-id', {
98
+ integrationId: 'integration-id',
99
+ content: 'Your content here', // Can be string or object
100
+ fileName: 'document.txt',
101
+ metadata: { type: 'documentation' }
102
+ });
103
+
104
+ // Clear files from storage
105
+ const clearResult = await sdk.ai.rag.clearStorage('source-id', {
106
+ integrationId: 'integration-id',
107
+ fileIds: ['file-id-1', 'file-id-2'] // Optional: clears all if not provided
108
+ });
109
+
110
+ // Get vector stores (internal API)
111
+ const stores = await sdk.ai.rag.getVectorStores({
112
+ scope: 'thread',
113
+ subjectId: 'thread-id'
114
+ });
115
+
116
+ // Internal API methods (for server-side use)
117
+ await sdk.ai.rag.uploadContentInternal('source-id', data);
118
+ await sdk.ai.rag.clearStorageInternal('source-id', data);
119
+ ```
120
+
121
+ ## Backward Compatibility
122
+
123
+ The old API methods are still available and marked as deprecated. They internally delegate to the new sub-SDKs:
124
+
125
+ ```typescript
126
+ // These still work but are deprecated:
127
+ await sdk.ai.createThread(data); // → sdk.ai.threads.create(data)
128
+ await sdk.ai.getThread(id); // → sdk.ai.threads.getOne(id)
129
+ await sdk.ai.streamChat(id, options); // → sdk.ai.chat.stream(id, options)
130
+ await sdk.ai.parseSSEStream(stream); // → sdk.ai.chat.parseSSEStream(stream)
131
+ ```
132
+
133
+ ## Migration Benefits
134
+
135
+ 1. **Better Organization**: Related functionality is grouped together
136
+ 2. **Improved Discoverability**: IDE autocomplete shows relevant methods for each sub-SDK
137
+ 3. **Type Safety**: Better TypeScript support with specific interfaces for each sub-domain
138
+ 4. **Future-Proof**: Easy to extend each sub-SDK independently
139
+
140
+ ## Updating Your Code
141
+
142
+ While the old API still works, we recommend updating to the new structure:
143
+
144
+ ```typescript
145
+ // Old way
146
+ const thread = await sdk.ai.createThread({ integration: 'id' });
147
+ const stream = await sdk.ai.streamChat('id', options);
148
+ for await (const chunk of sdk.ai.parseSSEStream(stream)) {
149
+ // process chunk
150
+ }
151
+
152
+ // New way
153
+ const thread = await sdk.ai.threads.create({ integration: 'id' });
154
+ const stream = await sdk.ai.chat.stream('id', options);
155
+ for await (const chunk of sdk.ai.chat.parseSSEStream(stream)) {
156
+ // process chunk
157
+ }
158
+ ```
159
+
160
+ ## Query Parameters
161
+
162
+ The `IChatCompletionOptions` interface now includes an optional `queryParams` field for passing additional query parameters:
163
+
164
+ ```typescript
165
+ await sdk.ai.chat.stream('integration-id', {
166
+ messages: [{ role: 'user', content: 'Hello!' }],
167
+ queryParams: {
168
+ bypassAdmin: true,
169
+ customParam: 'value'
170
+ }
171
+ });
172
+ ```
package/dist/ai.d.ts DELETED
@@ -1,116 +0,0 @@
1
- import { QelosSDKOptions } from './types';
2
- import BaseSDK from './base-sdk';
3
- export interface IMessage {
4
- role: string;
5
- content: string;
6
- timestamp?: Date | string;
7
- tool_calls?: any[];
8
- name?: string;
9
- tool_call_id?: string;
10
- function_call?: any;
11
- message_id?: string;
12
- }
13
- export interface IMessageSummary {
14
- fromIndex: number;
15
- toIndex: number;
16
- summary: string;
17
- }
18
- export interface IThread {
19
- _id?: string;
20
- integration: string;
21
- title?: string;
22
- messages: IMessage[];
23
- messageSummaries: IMessageSummary[];
24
- created?: Date;
25
- updated?: Date;
26
- user?: string;
27
- workspace?: string;
28
- }
29
- export interface IChatCompletionOptions {
30
- messages: IMessage[];
31
- model?: string;
32
- temperature?: number;
33
- top_p?: number;
34
- frequency_penalty?: number;
35
- presence_penalty?: number;
36
- stop?: string | string[];
37
- max_tokens?: number;
38
- response_format?: any;
39
- context?: Record<string, any>;
40
- stream?: boolean;
41
- }
42
- export interface ISSEStreamProcessor extends AsyncIterable<any> {
43
- processManually(onData: (data: any) => void | boolean): Promise<void>;
44
- }
45
- export interface IChatCompletionResponse {
46
- id: string;
47
- object: string;
48
- created: number;
49
- model: string;
50
- choices: Array<{
51
- index: number;
52
- message: IMessage;
53
- finish_reason: string;
54
- }>;
55
- usage?: {
56
- prompt_tokens: number;
57
- completion_tokens: number;
58
- total_tokens: number;
59
- };
60
- }
61
- export interface ICreateThreadRequest {
62
- integration: string;
63
- title?: string;
64
- }
65
- export default class QlAI extends BaseSDK {
66
- private relativePath;
67
- constructor(options: QelosSDKOptions);
68
- /**
69
- * Create a new thread
70
- */
71
- createThread(data: ICreateThreadRequest): Promise<IThread>;
72
- /**
73
- * Get a specific thread by ID
74
- */
75
- getThread(threadId: string): Promise<IThread>;
76
- /**
77
- * List threads with optional filters
78
- */
79
- listThreads(options?: {
80
- integration?: string;
81
- limit?: number;
82
- page?: number;
83
- sort?: string;
84
- user?: string;
85
- workspace?: string;
86
- [key: string]: string | number;
87
- }): Promise<IThread[]>;
88
- /**
89
- * Delete a thread
90
- */
91
- deleteThread(threadId: string): Promise<{
92
- success: boolean;
93
- }>;
94
- /**
95
- * Create a chat completion without a thread
96
- */
97
- chat(integrationId: string, options: IChatCompletionOptions): Promise<IChatCompletionResponse>;
98
- /**
99
- * Create a chat completion with a thread
100
- */
101
- chatInThread(integrationId: string, threadId: string, options: IChatCompletionOptions): Promise<IChatCompletionResponse>;
102
- /**
103
- * Create a streaming chat completion without a thread
104
- * Returns a ReadableStream for Server-Sent Events
105
- */
106
- streamChat(integrationId: string, options: IChatCompletionOptions): Promise<ReadableStream<Uint8Array>>;
107
- /**
108
- * Create a streaming chat completion with a thread
109
- * Returns a ReadableStream for Server-Sent Events
110
- */
111
- streamChatInThread(integrationId: string, threadId: string, options: IChatCompletionOptions): Promise<ReadableStream<Uint8Array>>;
112
- /**
113
- * Helper method to parse Server-Sent Events stream
114
- */
115
- parseSSEStream(stream: ReadableStream<Uint8Array>): ISSEStreamProcessor;
116
- }
package/dist/ai.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai.js","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,YAAY,CAAC;AAuEjC,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,OAAO;IAC/B,YAAY,GAAG,SAAS,CAAC;IACjC,YAAY,OAAwB;QAClC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAED,yBAAyB;IAEzB;;OAEG;IACH,YAAY,CAAC,IAA0B;QACrC,OAAO,IAAI,CAAC,WAAW,CAAU,IAAI,CAAC,YAAY,GAAG,UAAU,EAAE;YAC/D,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAC3B,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,QAAgB;QACxB,OAAO,IAAI,CAAC,WAAW,CAAU,GAAG,IAAI,CAAC,YAAY,YAAY,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACzG,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,OAQX;QACC,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,C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