@botpress/zai 1.1.0 → 1.2.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/README.md +1 -1
- package/build.ts +9 -0
- package/dist/adapters/botpress-table.js +21 -21
- package/dist/index.d.ts +22 -521
- package/dist/operations/check.js +15 -3
- package/dist/operations/extract.js +28 -8
- package/dist/operations/filter.js +15 -3
- package/dist/operations/label.js +15 -3
- package/dist/operations/rewrite.js +18 -6
- package/dist/operations/summarize.js +6 -5
- package/dist/operations/text.js +4 -3
- package/dist/utils.js +0 -6
- package/dist/zai.js +28 -68
- package/e2e/data/cache.jsonl +107 -0
- package/{src/operations/__tests/index.ts → e2e/utils.ts} +18 -16
- package/package.json +23 -21
- package/src/adapters/adapter.ts +2 -2
- package/src/adapters/botpress-table.ts +36 -36
- package/src/adapters/memory.ts +3 -3
- package/src/operations/check.ts +31 -17
- package/src/operations/errors.ts +1 -1
- package/src/operations/extract.ts +49 -31
- package/src/operations/filter.ts +36 -23
- package/src/operations/label.ts +32 -19
- package/src/operations/rewrite.ts +28 -15
- package/src/operations/summarize.ts +11 -9
- package/src/operations/text.ts +7 -5
- package/src/utils.ts +5 -14
- package/src/zai.ts +45 -91
- package/tsconfig.json +2 -22
- package/dist/models.js +0 -387
- package/src/models.ts +0 -394
- package/src/operations/__tests/cache.jsonl +0 -101
- package/src/sdk-interfaces/llm/generateContent.ts +0 -127
- package/src/sdk-interfaces/llm/listLanguageModels.ts +0 -19
- /package/{src/operations/__tests → e2e/data}/botpress_docs.txt +0 -0
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// This file is generated. Do not edit it manually.
|
|
3
|
-
// See 'scripts/update-models.ts'
|
|
4
|
-
|
|
5
|
-
/* eslint-disable */
|
|
6
|
-
/* tslint:disable */
|
|
7
|
-
|
|
8
|
-
export namespace llm {
|
|
9
|
-
export namespace generateContent {
|
|
10
|
-
export type Input = {
|
|
11
|
-
/** Model to use for content generation */
|
|
12
|
-
model?: { id: string }
|
|
13
|
-
;
|
|
14
|
-
/** Optional system prompt to guide the model */
|
|
15
|
-
systemPrompt?: string
|
|
16
|
-
;
|
|
17
|
-
/** Array of messages for the model to process */
|
|
18
|
-
messages: Array<{ role: 'user' | 'assistant'; type?: 'text' | 'tool_calls' | 'tool_result' | 'multipart';
|
|
19
|
-
/** Required if `type` is "tool_calls" */
|
|
20
|
-
toolCalls?: Array<{ id: string; type: 'function'; function: { name: string;
|
|
21
|
-
/** Some LLMs may generate invalid JSON for a tool call, so this will be `null` when it happens. */
|
|
22
|
-
arguments:
|
|
23
|
-
{ [key: string]: any } | null
|
|
24
|
-
} }>
|
|
25
|
-
;
|
|
26
|
-
/** Required if `type` is "tool_result" */
|
|
27
|
-
toolResultCallId?: string
|
|
28
|
-
;
|
|
29
|
-
/** Required unless `type` is "tool_call". If `type` is "multipart", this field must be an array of content objects. If `type` is "tool_result" then this field should be the result of the tool call (a plain string or a JSON-encoded array or object). If `type` is "tool_call" then the `toolCalls` field should be used instead. */
|
|
30
|
-
content:
|
|
31
|
-
|
|
32
|
-
string | Array<{ type: 'text' | 'image';
|
|
33
|
-
/** Indicates the MIME type of the content. If not provided it will be detected from the content-type header of the provided URL. */
|
|
34
|
-
mimeType?: string
|
|
35
|
-
;
|
|
36
|
-
/** Required if part type is "text" */
|
|
37
|
-
text?: string
|
|
38
|
-
;
|
|
39
|
-
/** Required if part type is "image" */
|
|
40
|
-
url?: string
|
|
41
|
-
}> | null
|
|
42
|
-
}>
|
|
43
|
-
;
|
|
44
|
-
/** Response format expected from the model. If "json_object" is chosen, you must instruct the model to generate JSON either via the system prompt or a user message. */
|
|
45
|
-
responseFormat?: 'text' | 'json_object'
|
|
46
|
-
;
|
|
47
|
-
/** Maximum number of tokens allowed in the generated response */
|
|
48
|
-
maxTokens?: number
|
|
49
|
-
;
|
|
50
|
-
/** Sampling temperature for the model. Higher values result in more random outputs. */
|
|
51
|
-
temperature?: /** Sampling temperature for the model. Higher values result in more random outputs. */ number
|
|
52
|
-
;
|
|
53
|
-
/** Top-p sampling parameter. Limits sampling to the smallest set of tokens with a cumulative probability above the threshold. */
|
|
54
|
-
topP?: /** Top-p sampling parameter. Limits sampling to the smallest set of tokens with a cumulative probability above the threshold. */ number
|
|
55
|
-
;
|
|
56
|
-
/** Sequences where the model should stop generating further tokens. */
|
|
57
|
-
stopSequences?: string[]
|
|
58
|
-
; tools?: Array<{ type: 'function'; function: {
|
|
59
|
-
/** Function name */
|
|
60
|
-
name: string
|
|
61
|
-
; description?: string;
|
|
62
|
-
/** JSON schema of the function arguments */
|
|
63
|
-
argumentsSchema?: { }
|
|
64
|
-
} }>; toolChoice?: { type?: 'auto' | 'specific' | 'any' | 'none' | '';
|
|
65
|
-
/** Required if `type` is "specific" */
|
|
66
|
-
functionName?: string
|
|
67
|
-
}; userId?: string;
|
|
68
|
-
/** Set to `true` to output debug information to the bot logs */
|
|
69
|
-
debug?: boolean
|
|
70
|
-
; meta?: {
|
|
71
|
-
/** Source of the prompt, e.g. agent/:id/:version cards/ai-generate, cards/ai-task, nodes/autonomous, etc. */
|
|
72
|
-
promptSource?: string
|
|
73
|
-
; promptCategory?: string;
|
|
74
|
-
/** Name of the integration that originally received the message that initiated this action */
|
|
75
|
-
integrationName?: string
|
|
76
|
-
} };;
|
|
77
|
-
export type Output = {
|
|
78
|
-
/** Response ID from LLM provider */
|
|
79
|
-
id: string
|
|
80
|
-
;
|
|
81
|
-
/** LLM provider name */
|
|
82
|
-
provider: string
|
|
83
|
-
;
|
|
84
|
-
/** Model name */
|
|
85
|
-
model: string
|
|
86
|
-
; choices: Array<{ type?: 'text' | 'tool_calls' | 'tool_result' | 'multipart';
|
|
87
|
-
/** Required if `type` is "tool_calls" */
|
|
88
|
-
toolCalls?: Array<{ id: string; type: 'function'; function: { name: string;
|
|
89
|
-
/** Some LLMs may generate invalid JSON for a tool call, so this will be `null` when it happens. */
|
|
90
|
-
arguments:
|
|
91
|
-
{ [key: string]: any } | null
|
|
92
|
-
} }>
|
|
93
|
-
;
|
|
94
|
-
/** Required if `type` is "tool_result" */
|
|
95
|
-
toolResultCallId?: string
|
|
96
|
-
;
|
|
97
|
-
/** Required unless `type` is "tool_call". If `type` is "multipart", this field must be an array of content objects. If `type` is "tool_result" then this field should be the result of the tool call (a plain string or a JSON-encoded array or object). If `type` is "tool_call" then the `toolCalls` field should be used instead. */
|
|
98
|
-
content:
|
|
99
|
-
|
|
100
|
-
string | Array<{ type: 'text' | 'image';
|
|
101
|
-
/** Indicates the MIME type of the content. If not provided it will be detected from the content-type header of the provided URL. */
|
|
102
|
-
mimeType?: string
|
|
103
|
-
;
|
|
104
|
-
/** Required if part type is "text" */
|
|
105
|
-
text?: string
|
|
106
|
-
;
|
|
107
|
-
/** Required if part type is "image" */
|
|
108
|
-
url?: string
|
|
109
|
-
}> | null
|
|
110
|
-
; role: 'assistant'; index: number; stopReason: 'stop' | 'max_tokens' | 'tool_calls' | 'content_filter' | 'other' }>; usage: {
|
|
111
|
-
/** Number of input tokens used by the model */
|
|
112
|
-
inputTokens: number
|
|
113
|
-
;
|
|
114
|
-
/** Cost of the input tokens received by the model, in U.S. dollars */
|
|
115
|
-
inputCost: number
|
|
116
|
-
;
|
|
117
|
-
/** Number of output tokens used by the model */
|
|
118
|
-
outputTokens: number
|
|
119
|
-
;
|
|
120
|
-
/** Cost of the output tokens generated by the model, in U.S. dollars */
|
|
121
|
-
outputCost: number
|
|
122
|
-
}; botpress: {
|
|
123
|
-
/** Total cost of the content generation, in U.S. dollars */
|
|
124
|
-
cost: number
|
|
125
|
-
} };;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// This file is generated. Do not edit it manually.
|
|
3
|
-
// See 'scripts/update-models.ts'
|
|
4
|
-
|
|
5
|
-
/* eslint-disable */
|
|
6
|
-
/* tslint:disable */
|
|
7
|
-
|
|
8
|
-
export namespace llm {
|
|
9
|
-
export namespace listLanguageModels {
|
|
10
|
-
export type Input = { };;
|
|
11
|
-
export type Output = { models: Array<{ id: string; name: string; description: string; tags: Array<'recommended' | 'deprecated' | 'general-purpose' | 'low-cost' | 'vision' | 'coding' | 'agents' | 'function-calling' | 'roleplay' | 'storytelling' | 'reasoning'>; input: { maxTokens: number;
|
|
12
|
-
/** Cost per 1 million tokens, in U.S. dollars */
|
|
13
|
-
costPer1MTokens: number
|
|
14
|
-
}; output: { maxTokens: number;
|
|
15
|
-
/** Cost per 1 million tokens, in U.S. dollars */
|
|
16
|
-
costPer1MTokens: number
|
|
17
|
-
} } & { id: string }> };;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
File without changes
|