@inkeep/cxkit-types 0.5.36 → 0.5.38
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/index.d.ts +141 -46
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { ChatCompletionMessageToolCall } from 'openai/resources/chat/completions';
|
|
1
2
|
import { ComponentType } from 'react';
|
|
2
3
|
import { HTMLProps } from 'react';
|
|
3
4
|
import { ReactNode } from 'react';
|
|
5
|
+
import { RunnableToolFunction } from 'openai/lib/RunnableFunction';
|
|
4
6
|
|
|
5
7
|
export declare interface AIChatDisclaimerSettings {
|
|
6
8
|
/**
|
|
@@ -174,6 +176,21 @@ export declare interface BaseFormField {
|
|
|
174
176
|
description?: string;
|
|
175
177
|
}
|
|
176
178
|
|
|
179
|
+
export declare interface BaseToolFunction<Args extends object | string> {
|
|
180
|
+
/**
|
|
181
|
+
* Function that takes the tool arguments and execution result and returns buttons
|
|
182
|
+
* that can be displayed in the chat message
|
|
183
|
+
* @param params Object containing the tool arguments and execution result
|
|
184
|
+
* @param params.args The parsed arguments passed to the tool function
|
|
185
|
+
* @param params.execution The result returned by executing the tool function
|
|
186
|
+
* @returns Array of actions that will be exposed to the user interface
|
|
187
|
+
*/
|
|
188
|
+
renderMessageButtons?: (params: {
|
|
189
|
+
args: Args;
|
|
190
|
+
execution: unknown;
|
|
191
|
+
}) => ToolCallAction[];
|
|
192
|
+
}
|
|
193
|
+
|
|
177
194
|
declare type ChatAction = InvokeCallbackAction | OpenFormAction | OpenUrlAction;
|
|
178
195
|
|
|
179
196
|
export declare type ChatActionType = ChatAction['type'];
|
|
@@ -294,7 +311,7 @@ export declare interface ConversationMessage {
|
|
|
294
311
|
links: SourceItem[];
|
|
295
312
|
properties: Record<string, unknown>;
|
|
296
313
|
userProperties: Record<string, unknown>;
|
|
297
|
-
tool_calls:
|
|
314
|
+
tool_calls: ChatCompletionMessageToolCall[] | null | undefined;
|
|
298
315
|
}
|
|
299
316
|
|
|
300
317
|
export declare interface ConversationResponse {
|
|
@@ -419,7 +436,7 @@ export declare interface IncludeChatSessionField extends BaseFormField {
|
|
|
419
436
|
defaultValue?: boolean;
|
|
420
437
|
}
|
|
421
438
|
|
|
422
|
-
export declare interface InkeepAIChatSettings {
|
|
439
|
+
export declare interface InkeepAIChatSettings extends ToolConfig {
|
|
423
440
|
/**
|
|
424
441
|
* The placeholder text to display in the chat input field when empty.
|
|
425
442
|
* Use this to provide guidance on what kind of questions users can ask.
|
|
@@ -974,6 +991,118 @@ declare interface InvokeCallbackArgs {
|
|
|
974
991
|
conversation: ConversationResponse;
|
|
975
992
|
}
|
|
976
993
|
|
|
994
|
+
export declare interface JSONSchema {
|
|
995
|
+
$id?: string | undefined;
|
|
996
|
+
$comment?: string | undefined;
|
|
997
|
+
/**
|
|
998
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
|
|
999
|
+
*/
|
|
1000
|
+
type?: JSONSchemaTypeName | JSONSchemaTypeName[] | undefined;
|
|
1001
|
+
enum?: JSONSchemaType[] | undefined;
|
|
1002
|
+
const?: JSONSchemaType | undefined;
|
|
1003
|
+
/**
|
|
1004
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
|
|
1005
|
+
*/
|
|
1006
|
+
multipleOf?: number | undefined;
|
|
1007
|
+
maximum?: number | undefined;
|
|
1008
|
+
exclusiveMaximum?: number | undefined;
|
|
1009
|
+
minimum?: number | undefined;
|
|
1010
|
+
exclusiveMinimum?: number | undefined;
|
|
1011
|
+
/**
|
|
1012
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
|
|
1013
|
+
*/
|
|
1014
|
+
maxLength?: number | undefined;
|
|
1015
|
+
minLength?: number | undefined;
|
|
1016
|
+
pattern?: string | undefined;
|
|
1017
|
+
/**
|
|
1018
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
|
|
1019
|
+
*/
|
|
1020
|
+
items?: JSONSchemaDefinition | JSONSchemaDefinition[] | undefined;
|
|
1021
|
+
additionalItems?: JSONSchemaDefinition | undefined;
|
|
1022
|
+
maxItems?: number | undefined;
|
|
1023
|
+
minItems?: number | undefined;
|
|
1024
|
+
uniqueItems?: boolean | undefined;
|
|
1025
|
+
contains?: JSONSchemaDefinition | undefined;
|
|
1026
|
+
/**
|
|
1027
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
|
|
1028
|
+
*/
|
|
1029
|
+
maxProperties?: number | undefined;
|
|
1030
|
+
minProperties?: number | undefined;
|
|
1031
|
+
required?: string[] | undefined;
|
|
1032
|
+
properties?: {
|
|
1033
|
+
[key: string]: JSONSchemaDefinition;
|
|
1034
|
+
} | undefined;
|
|
1035
|
+
patternProperties?: {
|
|
1036
|
+
[key: string]: JSONSchemaDefinition;
|
|
1037
|
+
} | undefined;
|
|
1038
|
+
additionalProperties?: JSONSchemaDefinition | undefined;
|
|
1039
|
+
propertyNames?: JSONSchemaDefinition | undefined;
|
|
1040
|
+
/**
|
|
1041
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
|
|
1042
|
+
*/
|
|
1043
|
+
if?: JSONSchemaDefinition | undefined;
|
|
1044
|
+
then?: JSONSchemaDefinition | undefined;
|
|
1045
|
+
else?: JSONSchemaDefinition | undefined;
|
|
1046
|
+
/**
|
|
1047
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
|
|
1048
|
+
*/
|
|
1049
|
+
allOf?: JSONSchemaDefinition[] | undefined;
|
|
1050
|
+
anyOf?: JSONSchemaDefinition[] | undefined;
|
|
1051
|
+
oneOf?: JSONSchemaDefinition[] | undefined;
|
|
1052
|
+
not?: JSONSchemaDefinition | undefined;
|
|
1053
|
+
/**
|
|
1054
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
|
|
1055
|
+
*/
|
|
1056
|
+
format?: string | undefined;
|
|
1057
|
+
/**
|
|
1058
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
|
|
1059
|
+
*/
|
|
1060
|
+
title?: string | undefined;
|
|
1061
|
+
description?: string | undefined;
|
|
1062
|
+
default?: JSONSchemaType | undefined;
|
|
1063
|
+
readOnly?: boolean | undefined;
|
|
1064
|
+
writeOnly?: boolean | undefined;
|
|
1065
|
+
examples?: JSONSchemaType | undefined;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
export declare interface JSONSchemaArray extends Array<JSONSchemaType> {
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
/**
|
|
1072
|
+
* JSON Schema v7
|
|
1073
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
1074
|
+
*/
|
|
1075
|
+
export declare type JSONSchemaDefinition = JSONSchema | boolean;
|
|
1076
|
+
|
|
1077
|
+
export declare interface JSONSchemaObject {
|
|
1078
|
+
[key: string]: JSONSchemaType;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* Primitive type
|
|
1083
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
1084
|
+
*/
|
|
1085
|
+
export declare type JSONSchemaType = string | number | boolean | JSONSchemaObject | JSONSchemaArray | null;
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* Primitive type
|
|
1089
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
1090
|
+
*/
|
|
1091
|
+
export declare type JSONSchemaTypeName = ({} & string) | 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
|
|
1092
|
+
|
|
1093
|
+
/**
|
|
1094
|
+
* Meta schema
|
|
1095
|
+
*
|
|
1096
|
+
* Recommended values:
|
|
1097
|
+
* - 'http://json-schema.org/schema#'
|
|
1098
|
+
* - 'http://json-schema.org/hyper-schema#'
|
|
1099
|
+
* - 'http://json-schema.org/draft-07/schema#'
|
|
1100
|
+
* - 'http://json-schema.org/draft-07/hyper-schema#'
|
|
1101
|
+
*
|
|
1102
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
|
1103
|
+
*/
|
|
1104
|
+
export declare type JSONSchemaVersion = string;
|
|
1105
|
+
|
|
977
1106
|
export declare type Message = AssistantMessage | UserMessage | SystemMessage;
|
|
978
1107
|
|
|
979
1108
|
export declare type MessageAction = 'copy' | 'upvote' | 'downvote';
|
|
@@ -1000,6 +1129,7 @@ declare interface MessageBase {
|
|
|
1000
1129
|
content: ConversationResponse['messages'][number]['content'];
|
|
1001
1130
|
id: string;
|
|
1002
1131
|
metadata?: MessageMetadata;
|
|
1132
|
+
toolCalls?: ConversationMessage['tool_calls'];
|
|
1003
1133
|
}
|
|
1004
1134
|
|
|
1005
1135
|
export declare interface MessageFeedback {
|
|
@@ -1365,21 +1495,6 @@ declare interface TextField extends BaseFormField {
|
|
|
1365
1495
|
placeholder?: string;
|
|
1366
1496
|
}
|
|
1367
1497
|
|
|
1368
|
-
export declare interface Tool {
|
|
1369
|
-
type: 'function';
|
|
1370
|
-
function: {
|
|
1371
|
-
name: string;
|
|
1372
|
-
description: string;
|
|
1373
|
-
parameters: ToolsJSONSchema | unknown;
|
|
1374
|
-
};
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1377
|
-
export declare interface ToolCall {
|
|
1378
|
-
name: string;
|
|
1379
|
-
arguments: string;
|
|
1380
|
-
index: number;
|
|
1381
|
-
}
|
|
1382
|
-
|
|
1383
1498
|
export declare interface ToolCallAction {
|
|
1384
1499
|
label?: string;
|
|
1385
1500
|
icon?: InkeepCustomIcon;
|
|
@@ -1388,38 +1503,18 @@ export declare interface ToolCallAction {
|
|
|
1388
1503
|
|
|
1389
1504
|
export declare interface ToolConfig {
|
|
1390
1505
|
/**
|
|
1391
|
-
*
|
|
1392
|
-
*
|
|
1393
|
-
*
|
|
1394
|
-
* based on its responses, such as opening forms, links, or performing callbacks.
|
|
1395
|
-
*/
|
|
1396
|
-
tools?: Tool[];
|
|
1397
|
-
/**
|
|
1398
|
-
* Callback function that handles tool calls triggered by the AI assistant.
|
|
1399
|
-
* @param toolCall - Object containing the tool call details:
|
|
1400
|
-
* - name: The name of the function being called
|
|
1401
|
-
* - arguments: JSON string containing the arguments passed to the function
|
|
1402
|
-
* - index: The index of the tool call
|
|
1403
|
-
* @returns A ToolCallAction object defining the action to perform (e.g., opening a link, displaying a form),
|
|
1404
|
-
* or undefined if no action should be taken
|
|
1506
|
+
* Function that allows dynamic generation of tools based on the current conversation context.
|
|
1507
|
+
* @param conversation - Array of messages representing the current chat conversation
|
|
1508
|
+
* @returns An array of Tool objects that will be available to the AI assistant
|
|
1405
1509
|
*/
|
|
1406
|
-
|
|
1510
|
+
getTools?: (ctx: ToolContext) => ToolFunction<any>[];
|
|
1407
1511
|
}
|
|
1408
1512
|
|
|
1409
|
-
export declare
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
description?: string;
|
|
1415
|
-
enum?: unknown[];
|
|
1416
|
-
const?: unknown;
|
|
1417
|
-
anyOf?: unknown[];
|
|
1418
|
-
allOf?: unknown[];
|
|
1419
|
-
oneOf?: unknown[];
|
|
1420
|
-
not?: unknown;
|
|
1421
|
-
[key: string]: unknown;
|
|
1422
|
-
};
|
|
1513
|
+
export declare interface ToolContext {
|
|
1514
|
+
conversation: ConversationResponse;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
export declare type ToolFunction<Args extends object | string> = RunnableToolFunction<Args> extends never ? never : RunnableToolFunction<Args> & BaseToolFunction<Args>;
|
|
1423
1518
|
|
|
1424
1519
|
export declare interface TopLevelHeading {
|
|
1425
1520
|
anchor?: string | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/cxkit-types",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.38",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Inkeep, Inc. Customer License (IICL) v1.1",
|
|
6
6
|
"homepage": "",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"chokidar": "4.0.3",
|
|
26
26
|
"clean-package": "2.2.0",
|
|
27
27
|
"globby": "14.0.2",
|
|
28
|
+
"openai": "4.78.1",
|
|
28
29
|
"react": "^19.0.0",
|
|
29
30
|
"typescript": "5.7.3",
|
|
30
31
|
"vite": "5.4.11",
|