@squidcloud/client 1.0.150 → 1.0.152
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/dist/cjs/index.js
CHANGED
|
@@ -35514,7 +35514,13 @@ const AiChatbotChatRequestSchema = {
|
|
|
35514
35514
|
|
|
35515
35515
|
;// CONCATENATED MODULE: ../common/src/ai-chatbot.types.ts
|
|
35516
35516
|
/** The supported AI model names. */
|
|
35517
|
-
const AI_MODEL_NAMES = (/* unused pure expression or super */ null && ([
|
|
35517
|
+
const AI_MODEL_NAMES = (/* unused pure expression or super */ null && ([
|
|
35518
|
+
'gpt-3.5-turbo',
|
|
35519
|
+
'gpt-3.5-turbo-1106',
|
|
35520
|
+
'gpt-4',
|
|
35521
|
+
'claude-2',
|
|
35522
|
+
'gpt-4-1106-preview',
|
|
35523
|
+
]));
|
|
35518
35524
|
/** @internal */
|
|
35519
35525
|
const AiModelData = {
|
|
35520
35526
|
'gpt-4': {
|
|
@@ -35523,6 +35529,9 @@ const AiModelData = {
|
|
|
35523
35529
|
'gpt-3.5-turbo': {
|
|
35524
35530
|
tokens: 4096,
|
|
35525
35531
|
},
|
|
35532
|
+
'gpt-3.5-turbo-1106': {
|
|
35533
|
+
tokens: 16385,
|
|
35534
|
+
},
|
|
35526
35535
|
'claude-2': {
|
|
35527
35536
|
tokens: 100000,
|
|
35528
35537
|
},
|
|
@@ -41749,10 +41758,15 @@ class AuthManager {
|
|
|
41749
41758
|
async getAuthData() {
|
|
41750
41759
|
var _a;
|
|
41751
41760
|
return {
|
|
41752
|
-
token:
|
|
41761
|
+
token: await this.getTokenFromAuthProvider(),
|
|
41753
41762
|
integrationId: (_a = this.authProvider) === null || _a === void 0 ? void 0 : _a.integrationId,
|
|
41754
41763
|
};
|
|
41755
41764
|
}
|
|
41765
|
+
async getTokenFromAuthProvider() {
|
|
41766
|
+
var _a;
|
|
41767
|
+
const promiseOrPrimitive = (_a = this.authProvider) === null || _a === void 0 ? void 0 : _a.getToken();
|
|
41768
|
+
return typeof promiseOrPrimitive === 'object' ? await promiseOrPrimitive : promiseOrPrimitive;
|
|
41769
|
+
}
|
|
41756
41770
|
getApiKey() {
|
|
41757
41771
|
return this.apiKey;
|
|
41758
41772
|
}
|
|
@@ -41766,7 +41780,7 @@ class AuthManager {
|
|
|
41766
41780
|
if (this.apiKey) {
|
|
41767
41781
|
return { type: 'ApiKey', token: this.apiKey };
|
|
41768
41782
|
}
|
|
41769
|
-
const token =
|
|
41783
|
+
const token = await this.getTokenFromAuthProvider();
|
|
41770
41784
|
if (!token)
|
|
41771
41785
|
return undefined;
|
|
41772
41786
|
return { type: 'Bearer', token, integrationId: (_a = this.authProvider) === null || _a === void 0 ? void 0 : _a.integrationId };
|
|
@@ -57645,6 +57659,14 @@ class QuerySender {
|
|
|
57645
57659
|
}
|
|
57646
57660
|
async processQueryBatch() {
|
|
57647
57661
|
const queryRequestAndSubjects = this.pendingQueryRequests.splice(0);
|
|
57662
|
+
/**
|
|
57663
|
+
* There is a race condition where the batch timeout is triggered but the safeToSendQueriesToServer is not yet
|
|
57664
|
+
* true. In this case this function will be invoked again once the safeToSendQueriesToServer is true within the
|
|
57665
|
+
* setTimeout handler, and it may cause the queryRequestAndSubjects to be empty. In this case we do not want to send
|
|
57666
|
+
* an empty batch.
|
|
57667
|
+
*/
|
|
57668
|
+
if (!queryRequestAndSubjects.length)
|
|
57669
|
+
return;
|
|
57648
57670
|
const pendingQueryRequests = queryRequestAndSubjects.map(({ queryRequest }) => queryRequest);
|
|
57649
57671
|
const responseSubjects = queryRequestAndSubjects.map(({ responseSubject }) => responseSubject);
|
|
57650
57672
|
this.inflightQueriesCount.next(this.inflightQueriesCount.value + pendingQueryRequests.length);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The supported AI model names. */
|
|
2
|
-
export declare const AI_MODEL_NAMES: readonly ["gpt-3.5-turbo", "gpt-4", "claude-2", "gpt-4-1106-preview"];
|
|
2
|
+
export declare const AI_MODEL_NAMES: readonly ["gpt-3.5-turbo", "gpt-3.5-turbo-1106", "gpt-4", "claude-2", "gpt-4-1106-preview"];
|
|
3
3
|
export type AiModelName = (typeof AI_MODEL_NAMES)[number];
|
|
4
4
|
/** The possible sources for the LLM provider API key. */
|
|
5
5
|
export type ApiKeySource = 'user' | 'system';
|
|
@@ -18,10 +18,12 @@ export interface AiChatbotFileContext extends AiChatbotContextBase {
|
|
|
18
18
|
type: 'file';
|
|
19
19
|
}
|
|
20
20
|
export type AiChatbotContext = AiChatbotTextContext | AiChatbotUrlContext | AiChatbotFileContext;
|
|
21
|
+
export type OpenAiResponseFormat = 'text' | 'json_object';
|
|
21
22
|
export interface AiChatbotChatOptions {
|
|
22
23
|
maxTokens?: number;
|
|
23
24
|
chatId?: string;
|
|
24
25
|
disableHistory?: boolean;
|
|
25
26
|
includeReference?: boolean;
|
|
27
|
+
responseFormat?: OpenAiResponseFormat;
|
|
26
28
|
}
|
|
27
29
|
export {};
|
|
@@ -56,10 +56,10 @@ export interface SquidOptions {
|
|
|
56
56
|
/** Authentication data provider for Squid requests. */
|
|
57
57
|
export interface SquidAuthProvider {
|
|
58
58
|
/**
|
|
59
|
-
* Returns a valid AccessToken.
|
|
59
|
+
* Returns a valid AccessToken or undefined if there is no active authorized session.
|
|
60
60
|
* Called by Squid every time a Squid client makes requests to the Squid backend.
|
|
61
61
|
*/
|
|
62
|
-
getToken(): Promise<string | undefined
|
|
62
|
+
getToken(): Promise<string | undefined> | string | undefined;
|
|
63
63
|
/**
|
|
64
64
|
* Optional Auth integration id.
|
|
65
65
|
* Sent as a part of all Squid requests to the backend.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squidcloud/client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.152",
|
|
4
4
|
"description": "A typescript implementation of the Squid client",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"types": "dist/typescript-client/src/index.d.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"license": "ISC",
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@apollo/client": "^3.7.4",
|
|
36
|
-
"@squidcloud/common": "1.0.
|
|
36
|
+
"@squidcloud/common": "1.0.152",
|
|
37
37
|
"@supercharge/promise-pool": "^2.3.2",
|
|
38
38
|
"axios": "^1.6.2",
|
|
39
39
|
"cross-fetch": "^3.1.5",
|