@gleanwork/api-client 0.1.0-beta.2 → 0.1.0-beta.4
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 +34 -28
- package/dist/commonjs/__tests__/chat.test.js +233 -414
- package/dist/commonjs/__tests__/chat.test.js.map +1 -1
- package/dist/commonjs/funcs/chatChatStream.d.ts +16 -0
- package/dist/commonjs/funcs/chatChatStream.d.ts.map +1 -0
- package/dist/commonjs/funcs/chatChatStream.js +121 -0
- package/dist/commonjs/funcs/chatChatStream.js.map +1 -0
- package/dist/commonjs/funcs/clientChatStart.d.ts +1 -1
- package/dist/commonjs/funcs/clientChatStart.d.ts.map +1 -1
- package/dist/commonjs/funcs/clientChatStart.js +3 -3
- package/dist/commonjs/funcs/clientChatStart.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/models/operations/chatstream.d.ts +38 -0
- package/dist/commonjs/models/operations/chatstream.d.ts.map +1 -0
- package/dist/commonjs/models/operations/chatstream.js +81 -0
- package/dist/commonjs/models/operations/chatstream.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +1 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +1 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/react-query/chatChatStream.d.ts +24 -0
- package/dist/commonjs/react-query/chatChatStream.d.ts.map +1 -0
- package/dist/commonjs/react-query/chatChatStream.js +47 -0
- package/dist/commonjs/react-query/chatChatStream.js.map +1 -0
- package/dist/commonjs/react-query/clientChatStart.d.ts +1 -1
- package/dist/commonjs/react-query/clientChatStart.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.d.ts +1 -0
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +1 -0
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/sdk/chat.d.ts +1 -57
- package/dist/commonjs/sdk/chat.d.ts.map +1 -1
- package/dist/commonjs/sdk/chat.js +3 -83
- package/dist/commonjs/sdk/chat.js.map +1 -1
- package/dist/commonjs/sdk/client.d.ts +2 -2
- package/dist/commonjs/sdk/client.d.ts.map +1 -1
- package/dist/commonjs/sdk/client.js +2 -2
- package/dist/commonjs/sdk/client.js.map +1 -1
- package/dist/commonjs/sdk/clientchat.d.ts +68 -0
- package/dist/commonjs/sdk/clientchat.d.ts.map +1 -0
- package/dist/commonjs/sdk/clientchat.js +102 -0
- package/dist/commonjs/sdk/clientchat.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +3 -0
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +4 -0
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/esm/__tests__/chat.test.js +234 -415
- package/dist/esm/__tests__/chat.test.js.map +1 -1
- package/dist/esm/funcs/chatChatStream.d.ts +16 -0
- package/dist/esm/funcs/chatChatStream.d.ts.map +1 -0
- package/dist/esm/funcs/chatChatStream.js +85 -0
- package/dist/esm/funcs/chatChatStream.js.map +1 -0
- package/dist/esm/funcs/clientChatStart.d.ts +1 -1
- package/dist/esm/funcs/clientChatStart.d.ts.map +1 -1
- package/dist/esm/funcs/clientChatStart.js +3 -3
- package/dist/esm/funcs/clientChatStart.js.map +1 -1
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/models/operations/chatstream.d.ts +38 -0
- package/dist/esm/models/operations/chatstream.d.ts.map +1 -0
- package/dist/esm/models/operations/chatstream.js +43 -0
- package/dist/esm/models/operations/chatstream.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +1 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +1 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/react-query/chatChatStream.d.ts +24 -0
- package/dist/esm/react-query/chatChatStream.d.ts.map +1 -0
- package/dist/esm/react-query/chatChatStream.js +42 -0
- package/dist/esm/react-query/chatChatStream.js.map +1 -0
- package/dist/esm/react-query/clientChatStart.d.ts +1 -1
- package/dist/esm/react-query/clientChatStart.d.ts.map +1 -1
- package/dist/esm/react-query/index.d.ts +1 -0
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +1 -0
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/sdk/chat.d.ts +1 -57
- package/dist/esm/sdk/chat.d.ts.map +1 -1
- package/dist/esm/sdk/chat.js +3 -83
- package/dist/esm/sdk/chat.js.map +1 -1
- package/dist/esm/sdk/client.d.ts +2 -2
- package/dist/esm/sdk/client.d.ts.map +1 -1
- package/dist/esm/sdk/client.js +2 -2
- package/dist/esm/sdk/client.js.map +1 -1
- package/dist/esm/sdk/clientchat.d.ts +68 -0
- package/dist/esm/sdk/clientchat.d.ts.map +1 -0
- package/dist/esm/sdk/clientchat.js +98 -0
- package/dist/esm/sdk/clientchat.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +3 -0
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +4 -0
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/docs/sdks/chat/README.md +8 -768
- package/docs/sdks/clientchat/README.md +878 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/__tests__/chat.test.ts +292 -457
- package/src/funcs/chatChatStream.ts +169 -0
- package/src/funcs/clientChatStart.ts +5 -6
- package/src/lib/config.ts +3 -3
- package/src/models/operations/chatstream.ts +86 -0
- package/src/models/operations/index.ts +1 -0
- package/src/react-query/chatChatStream.ts +91 -0
- package/src/react-query/clientChatStart.ts +1 -1
- package/src/react-query/index.ts +1 -0
- package/src/sdk/chat.ts +3 -159
- package/src/sdk/client.ts +4 -4
- package/src/sdk/clientchat.ts +185 -0
- package/src/sdk/sdk.ts +6 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { clientChatDelete } from "../funcs/clientChatDelete.js";
|
|
6
|
+
import { clientChatDeleteAll } from "../funcs/clientChatDeleteAll.js";
|
|
7
|
+
import { clientChatDeleteFiles } from "../funcs/clientChatDeleteFiles.js";
|
|
8
|
+
import { clientChatGet } from "../funcs/clientChatGet.js";
|
|
9
|
+
import { clientChatGetApplication } from "../funcs/clientChatGetApplication.js";
|
|
10
|
+
import { clientChatGetFiles } from "../funcs/clientChatGetFiles.js";
|
|
11
|
+
import { clientChatList } from "../funcs/clientChatList.js";
|
|
12
|
+
import { clientChatStart } from "../funcs/clientChatStart.js";
|
|
13
|
+
import { clientChatUploadFiles } from "../funcs/clientChatUploadFiles.js";
|
|
14
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
15
|
+
import * as components from "../models/components/index.js";
|
|
16
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
17
|
+
|
|
18
|
+
export class ClientChat extends ClientSDK {
|
|
19
|
+
/**
|
|
20
|
+
* Chat
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* Have a conversation with Glean AI.
|
|
24
|
+
*/
|
|
25
|
+
async start(
|
|
26
|
+
chatRequest: components.ChatRequest,
|
|
27
|
+
timezoneOffset?: number | undefined,
|
|
28
|
+
options?: RequestOptions,
|
|
29
|
+
): Promise<components.ChatResponse> {
|
|
30
|
+
return unwrapAsync(clientChatStart(
|
|
31
|
+
this,
|
|
32
|
+
chatRequest,
|
|
33
|
+
timezoneOffset,
|
|
34
|
+
options,
|
|
35
|
+
));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Deletes all saved Chats owned by a user
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* Deletes all saved Chats a user has had and all their contained conversational content.
|
|
43
|
+
*/
|
|
44
|
+
async deleteAll(
|
|
45
|
+
timezoneOffset?: number | undefined,
|
|
46
|
+
options?: RequestOptions,
|
|
47
|
+
): Promise<void> {
|
|
48
|
+
return unwrapAsync(clientChatDeleteAll(
|
|
49
|
+
this,
|
|
50
|
+
timezoneOffset,
|
|
51
|
+
options,
|
|
52
|
+
));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Deletes saved Chats
|
|
57
|
+
*
|
|
58
|
+
* @remarks
|
|
59
|
+
* Deletes saved Chats and all their contained conversational content.
|
|
60
|
+
*/
|
|
61
|
+
async delete(
|
|
62
|
+
deleteChatsRequest: components.DeleteChatsRequest,
|
|
63
|
+
timezoneOffset?: number | undefined,
|
|
64
|
+
options?: RequestOptions,
|
|
65
|
+
): Promise<void> {
|
|
66
|
+
return unwrapAsync(clientChatDelete(
|
|
67
|
+
this,
|
|
68
|
+
deleteChatsRequest,
|
|
69
|
+
timezoneOffset,
|
|
70
|
+
options,
|
|
71
|
+
));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Retrieves a Chat
|
|
76
|
+
*
|
|
77
|
+
* @remarks
|
|
78
|
+
* Retrieves the chat history between Glean Assistant and the user for a given Chat.
|
|
79
|
+
*/
|
|
80
|
+
async get(
|
|
81
|
+
getChatRequest: components.GetChatRequest,
|
|
82
|
+
timezoneOffset?: number | undefined,
|
|
83
|
+
options?: RequestOptions,
|
|
84
|
+
): Promise<components.GetChatResponse> {
|
|
85
|
+
return unwrapAsync(clientChatGet(
|
|
86
|
+
this,
|
|
87
|
+
getChatRequest,
|
|
88
|
+
timezoneOffset,
|
|
89
|
+
options,
|
|
90
|
+
));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Retrieves all saved Chats
|
|
95
|
+
*
|
|
96
|
+
* @remarks
|
|
97
|
+
* Retrieves all the saved Chats between Glean Assistant and the user. The returned Chats contain only metadata and no conversational content.
|
|
98
|
+
*/
|
|
99
|
+
async list(
|
|
100
|
+
timezoneOffset?: number | undefined,
|
|
101
|
+
options?: RequestOptions,
|
|
102
|
+
): Promise<components.ListChatsResponse> {
|
|
103
|
+
return unwrapAsync(clientChatList(
|
|
104
|
+
this,
|
|
105
|
+
timezoneOffset,
|
|
106
|
+
options,
|
|
107
|
+
));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Gets the metadata for a custom Chat application
|
|
112
|
+
*
|
|
113
|
+
* @remarks
|
|
114
|
+
* Gets the Chat application details for the specified application ID.
|
|
115
|
+
*/
|
|
116
|
+
async getApplication(
|
|
117
|
+
getChatApplicationRequest: components.GetChatApplicationRequest,
|
|
118
|
+
timezoneOffset?: number | undefined,
|
|
119
|
+
options?: RequestOptions,
|
|
120
|
+
): Promise<components.GetChatApplicationResponse> {
|
|
121
|
+
return unwrapAsync(clientChatGetApplication(
|
|
122
|
+
this,
|
|
123
|
+
getChatApplicationRequest,
|
|
124
|
+
timezoneOffset,
|
|
125
|
+
options,
|
|
126
|
+
));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Upload files for Chat.
|
|
131
|
+
*
|
|
132
|
+
* @remarks
|
|
133
|
+
* Upload files for Chat.
|
|
134
|
+
*/
|
|
135
|
+
async uploadFiles(
|
|
136
|
+
uploadChatFilesRequest: components.UploadChatFilesRequest,
|
|
137
|
+
timezoneOffset?: number | undefined,
|
|
138
|
+
options?: RequestOptions,
|
|
139
|
+
): Promise<components.UploadChatFilesResponse> {
|
|
140
|
+
return unwrapAsync(clientChatUploadFiles(
|
|
141
|
+
this,
|
|
142
|
+
uploadChatFilesRequest,
|
|
143
|
+
timezoneOffset,
|
|
144
|
+
options,
|
|
145
|
+
));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Get files uploaded by a user for Chat.
|
|
150
|
+
*
|
|
151
|
+
* @remarks
|
|
152
|
+
* Get files uploaded by a user for Chat.
|
|
153
|
+
*/
|
|
154
|
+
async getFiles(
|
|
155
|
+
getChatFilesRequest: components.GetChatFilesRequest,
|
|
156
|
+
timezoneOffset?: number | undefined,
|
|
157
|
+
options?: RequestOptions,
|
|
158
|
+
): Promise<components.GetChatFilesResponse> {
|
|
159
|
+
return unwrapAsync(clientChatGetFiles(
|
|
160
|
+
this,
|
|
161
|
+
getChatFilesRequest,
|
|
162
|
+
timezoneOffset,
|
|
163
|
+
options,
|
|
164
|
+
));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Delete files uploaded by a user for chat.
|
|
169
|
+
*
|
|
170
|
+
* @remarks
|
|
171
|
+
* Delete files uploaded by a user for Chat.
|
|
172
|
+
*/
|
|
173
|
+
async deleteFiles(
|
|
174
|
+
deleteChatFilesRequest: components.DeleteChatFilesRequest,
|
|
175
|
+
timezoneOffset?: number | undefined,
|
|
176
|
+
options?: RequestOptions,
|
|
177
|
+
): Promise<void> {
|
|
178
|
+
return unwrapAsync(clientChatDeleteFiles(
|
|
179
|
+
this,
|
|
180
|
+
deleteChatFilesRequest,
|
|
181
|
+
timezoneOffset,
|
|
182
|
+
options,
|
|
183
|
+
));
|
|
184
|
+
}
|
|
185
|
+
}
|
package/src/sdk/sdk.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { ClientSDK } from "../lib/sdks.js";
|
|
6
6
|
import { Agents } from "./agents.js";
|
|
7
|
+
import { Chat } from "./chat.js";
|
|
7
8
|
import { Client } from "./client.js";
|
|
8
9
|
import { Indexing } from "./indexing.js";
|
|
9
10
|
|
|
@@ -22,4 +23,9 @@ export class Glean extends ClientSDK {
|
|
|
22
23
|
get indexing(): Indexing {
|
|
23
24
|
return (this._indexing ??= new Indexing(this._options));
|
|
24
25
|
}
|
|
26
|
+
|
|
27
|
+
private _chat?: Chat;
|
|
28
|
+
get chat(): Chat {
|
|
29
|
+
return (this._chat ??= new Chat(this._options));
|
|
30
|
+
}
|
|
25
31
|
}
|