@botpress/cognitive 0.1.9 → 0.1.10

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.
@@ -1,15 +1,28 @@
1
-
2
- 
3
- > @botpress/cognitive@0.1.9 build /Users/sly/botpress/packages/cognitive
4
- > pnpm build:type && pnpm build:neutral && size-limit
5
-
6
-
7
- > @botpress/cognitive@0.1.9 build:type /Users/sly/botpress/packages/cognitive
8
- > tsup --tsconfig tsconfig.build.json ./src/index.ts --dts-resolve --dts-only --clean
9
-
10
- CLI Building entry: ./src/index.ts
11
- CLI Using tsconfig: tsconfig.build.json
12
- CLI tsup v8.0.2
13
- DTS Build start
14
-  ELIFECYCLE  Command failed.
15
-  ELIFECYCLE  Command failed.
1
+
2
+ > @botpress/cognitive@0.1.10 build /home/runner/work/botpress/botpress/packages/cognitive
3
+ > pnpm build:type && pnpm build:neutral && size-limit
4
+
5
+
6
+ > @botpress/cognitive@0.1.10 build:type /home/runner/work/botpress/botpress/packages/cognitive
7
+ > tsup --tsconfig tsconfig.build.json ./src/index.ts --dts-resolve --dts-only --clean
8
+
9
+ CLI Building entry: ./src/index.ts
10
+ CLI Using tsconfig: tsconfig.build.json
11
+ CLI tsup v8.0.2
12
+ DTS Build start
13
+ DTS ⚡️ Build success in 9051ms
14
+ DTS dist/index.d.ts 501.77 KB
15
+
16
+ > @botpress/cognitive@0.1.10 build:neutral /home/runner/work/botpress/botpress/packages/cognitive
17
+ > ts-node -T ./build.ts --neutral
18
+
19
+ Done
20
+
21
+ dist/index.cjs
22
+ Size limit: 50 kB
23
+ Size: 6.86 kB brotlied
24
+
25
+ dist/index.mjs
26
+ Size limit: 50 kB
27
+ Size: 6.75 kB brotlied
28
+
package/dist/index.d.ts CHANGED
@@ -1958,6 +1958,12 @@ interface UpdateMessageRequestBody {
1958
1958
  tags: {
1959
1959
  [k: string]: string;
1960
1960
  };
1961
+ /**
1962
+ * Payload is the content type of the message. Accepted payload options: Text, Image, Choice, Dropdown, Card, Carousel, File, Audio, Video, Location
1963
+ */
1964
+ payload?: {
1965
+ [k: string]: any;
1966
+ };
1961
1967
  }
1962
1968
  type UpdateMessageInput = UpdateMessageRequestBody & UpdateMessageRequestHeaders & UpdateMessageRequestQuery & UpdateMessageRequestParams;
1963
1969
  interface UpdateMessageResponse {
@@ -12783,7 +12789,7 @@ interface SearchFilesResponse {
12783
12789
  /**
12784
12790
  * The subtype of passage, if available.
12785
12791
  */
12786
- subtype?: "title" | "subtitle" | "paragraph" | "blockquote" | "list" | "table" | "code" | "page";
12792
+ subtype?: "title" | "subtitle" | "paragraph" | "blockquote" | "list" | "table" | "code" | "image" | "page";
12787
12793
  /**
12788
12794
  * Page number the passage is located on. Only applicable if the passage was extracted from a PDF file.
12789
12795
  */
@@ -12861,7 +12867,7 @@ interface ListFilePassagesResponse {
12861
12867
  /**
12862
12868
  * The subtype of passage, if available.
12863
12869
  */
12864
- subtype?: "title" | "subtitle" | "paragraph" | "blockquote" | "list" | "table" | "code" | "page";
12870
+ subtype?: "title" | "subtitle" | "paragraph" | "blockquote" | "list" | "table" | "code" | "image" | "page";
12865
12871
  /**
12866
12872
  * Page number the passage is located on. Only applicable if the passage was extracted from a PDF file.
12867
12873
  */
@@ -15091,7 +15097,7 @@ declare class Lister {
15091
15097
  content: string;
15092
15098
  meta: {
15093
15099
  type?: "chunk" | "summary" | "consolidated" | "image";
15094
- subtype?: "title" | "subtitle" | "paragraph" | "blockquote" | "list" | "table" | "code" | "page";
15100
+ subtype?: "title" | "subtitle" | "paragraph" | "blockquote" | "list" | "table" | "code" | "image" | "page";
15095
15101
  pageNumber?: number;
15096
15102
  position?: number;
15097
15103
  sourceUrl?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/cognitive",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Wrapper around the Botpress Client to call LLMs",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -1,5 +0,0 @@
1
-
2
- 
3
- > @botpress/cognitive@0.1.1 generate /Users/sly/botpress/packages/cognitive
4
- > ts-node -T ./types.ts ./src/gen
5
-
@@ -1,14 +0,0 @@
1
- /* eslint-disable */
2
- /* tslint:disable */
3
- // This file is generated. Do not edit it manually.
4
- import * as input from "./input";
5
- export * as input from "./input";
6
- import * as output from "./output";
7
- export * as output from "./output";
8
-
9
- export const generateContent = {
10
- "input": input.input,
11
- "output": output.output,
12
- "billable": true,
13
- "cacheable": true,
14
- }
@@ -1,133 +0,0 @@
1
- /* eslint-disable */
2
- /* tslint:disable */
3
- // This file is generated. Do not edit it manually.
4
-
5
- import { z } from "@botpress/sdk";
6
- export const input = {
7
- schema: z.object({
8
- model: /** Model to use for content generation */ z.optional(
9
- /** Model to use for content generation */ z.ref("modelRef"),
10
- ),
11
- reasoningEffort:
12
- /** Reasoning effort level to use for models that support reasoning */ z.optional(
13
- /** Reasoning effort level to use for models that support reasoning */ z.enum(
14
- ["low", "medium", "high"],
15
- ),
16
- ),
17
- systemPrompt: /** Optional system prompt to guide the model */ z.optional(
18
- /** Optional system prompt to guide the model */ z.string(),
19
- ),
20
- messages: z.array(
21
- z.object({
22
- role: z.enum(["user", "assistant"]),
23
- type: z
24
- .enum(["text", "tool_calls", "tool_result", "multipart"])
25
- .default("text"),
26
- toolCalls: /** Required if `type` is "tool_calls" */ z.optional(
27
- z.array(
28
- z.object({
29
- id: z.string(),
30
- type: z.literal("function"),
31
- function: z.object({
32
- name: z.string(),
33
- arguments:
34
- /** Some LLMs may generate invalid JSON for a tool call, so this will be `null` when it happens. */ z.union(
35
- [z.record(z.string(), z.any()), z.null()],
36
- ),
37
- }),
38
- }),
39
- ),
40
- ),
41
- toolResultCallId: /** Required if `type` is "tool_result" */ z.optional(
42
- /** Required if `type` is "tool_result" */ z.string(),
43
- ),
44
- content:
45
- /** 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. */ z.union(
46
- [
47
- z.union([
48
- z.string(),
49
- z.array(
50
- z.object({
51
- type: z.enum(["text", "image"]),
52
- mimeType:
53
- /** Indicates the MIME type of the content. If not provided it will be detected from the content-type header of the provided URL. */ z.optional(
54
- /** Indicates the MIME type of the content. If not provided it will be detected from the content-type header of the provided URL. */ z.string(),
55
- ),
56
- text: /** Required if part type is "text" */ z.optional(
57
- /** Required if part type is "text" */ z.string(),
58
- ),
59
- url: /** Required if part type is "image" */ z.optional(
60
- /** Required if part type is "image" */ z.string(),
61
- ),
62
- }),
63
- ),
64
- ]),
65
- z.null(),
66
- ],
67
- ),
68
- }),
69
- ),
70
- responseFormat:
71
- /** 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. */ z.optional(
72
- /** 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. */ z.enum(
73
- ["text", "json_object"],
74
- ),
75
- ),
76
- maxTokens:
77
- /** Maximum number of tokens allowed in the generated response */ z.optional(
78
- /** Maximum number of tokens allowed in the generated response */ z.number(),
79
- ),
80
- temperature:
81
- /** Sampling temperature for the model. Higher values result in more random outputs. */ /** Sampling temperature for the model. Higher values result in more random outputs. */ z
82
- .number()
83
- .default(1),
84
- topP: /** Top-p sampling parameter. Limits sampling to the smallest set of tokens with a cumulative probability above the threshold. */ /** Top-p sampling parameter. Limits sampling to the smallest set of tokens with a cumulative probability above the threshold. */ z
85
- .number()
86
- .default(1),
87
- stopSequences:
88
- /** Sequences where the model should stop generating further tokens. */ z.optional(
89
- z.array(z.string()),
90
- ),
91
- tools: z.optional(
92
- z.array(
93
- z.object({
94
- type: z.literal("function"),
95
- function: z.object({
96
- name: /** Function name */ z.string(),
97
- description: z.optional(z.string()),
98
- argumentsSchema:
99
- /** JSON schema of the function arguments */ z.optional(
100
- /** JSON schema of the function arguments */ z.object({}),
101
- ),
102
- }),
103
- }),
104
- ),
105
- ),
106
- toolChoice: z.optional(
107
- z.object({
108
- type: z.optional(z.enum(["auto", "specific", "any", "none", ""])),
109
- functionName: /** Required if `type` is "specific" */ z.optional(
110
- /** Required if `type` is "specific" */ z.string(),
111
- ),
112
- }),
113
- ),
114
- userId: z.optional(z.string()),
115
- debug:
116
- /** Set to `true` to output debug information to the bot logs */ z.optional(
117
- /** Set to `true` to output debug information to the bot logs */ z.boolean(),
118
- ),
119
- meta: z.optional(
120
- z.object({
121
- promptSource:
122
- /** Source of the prompt, e.g. agent/:id/:version cards/ai-generate, cards/ai-task, nodes/autonomous, etc. */ z.optional(
123
- /** Source of the prompt, e.g. agent/:id/:version cards/ai-generate, cards/ai-task, nodes/autonomous, etc. */ z.string(),
124
- ),
125
- promptCategory: z.optional(z.string()),
126
- integrationName:
127
- /** Name of the integration that originally received the message that initiated this action */ z.optional(
128
- /** Name of the integration that originally received the message that initiated this action */ z.string(),
129
- ),
130
- }),
131
- ),
132
- }),
133
- };
@@ -1,81 +0,0 @@
1
- /* eslint-disable */
2
- /* tslint:disable */
3
- // This file is generated. Do not edit it manually.
4
-
5
- import { z } from "@botpress/sdk";
6
- export const output = {
7
- schema: z.object({
8
- id: /** Response ID from LLM provider */ z.string(),
9
- provider: /** LLM provider name */ z.string(),
10
- model: /** Model name */ z.string(),
11
- choices: z.array(
12
- z.object({
13
- type: z
14
- .enum(["text", "tool_calls", "tool_result", "multipart"])
15
- .default("text"),
16
- toolCalls: /** Required if `type` is "tool_calls" */ z.optional(
17
- z.array(
18
- z.object({
19
- id: z.string(),
20
- type: z.literal("function"),
21
- function: z.object({
22
- name: z.string(),
23
- arguments:
24
- /** Some LLMs may generate invalid JSON for a tool call, so this will be `null` when it happens. */ z.union(
25
- [z.record(z.string(), z.any()), z.null()],
26
- ),
27
- }),
28
- }),
29
- ),
30
- ),
31
- toolResultCallId: /** Required if `type` is "tool_result" */ z.optional(
32
- /** Required if `type` is "tool_result" */ z.string(),
33
- ),
34
- content:
35
- /** 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. */ z.union(
36
- [
37
- z.union([
38
- z.string(),
39
- z.array(
40
- z.object({
41
- type: z.enum(["text", "image"]),
42
- mimeType:
43
- /** Indicates the MIME type of the content. If not provided it will be detected from the content-type header of the provided URL. */ z.optional(
44
- /** Indicates the MIME type of the content. If not provided it will be detected from the content-type header of the provided URL. */ z.string(),
45
- ),
46
- text: /** Required if part type is "text" */ z.optional(
47
- /** Required if part type is "text" */ z.string(),
48
- ),
49
- url: /** Required if part type is "image" */ z.optional(
50
- /** Required if part type is "image" */ z.string(),
51
- ),
52
- }),
53
- ),
54
- ]),
55
- z.null(),
56
- ],
57
- ),
58
- role: z.literal("assistant"),
59
- index: z.number(),
60
- stopReason: z.enum([
61
- "stop",
62
- "max_tokens",
63
- "tool_calls",
64
- "content_filter",
65
- "other",
66
- ]),
67
- }),
68
- ),
69
- usage: z.object({
70
- inputTokens: /** Number of input tokens used by the model */ z.number(),
71
- inputCost:
72
- /** Cost of the input tokens received by the model, in U.S. dollars */ z.number(),
73
- outputTokens: /** Number of output tokens used by the model */ z.number(),
74
- outputCost:
75
- /** Cost of the output tokens generated by the model, in U.S. dollars */ z.number(),
76
- }),
77
- botpress: z.object({
78
- cost: /** Total cost of the content generation, in U.S. dollars */ z.number(),
79
- }),
80
- }),
81
- };
@@ -1,12 +0,0 @@
1
- /* eslint-disable */
2
- /* tslint:disable */
3
- // This file is generated. Do not edit it manually.
4
- import * as listLanguageModels from "./listLanguageModels/index";
5
- export * as listLanguageModels from "./listLanguageModels/index";
6
- import * as generateContent from "./generateContent/index";
7
- export * as generateContent from "./generateContent/index";
8
-
9
- export const actions = {
10
- "listLanguageModels": listLanguageModels.listLanguageModels,
11
- "generateContent": generateContent.generateContent,
12
- }
@@ -1,14 +0,0 @@
1
- /* eslint-disable */
2
- /* tslint:disable */
3
- // This file is generated. Do not edit it manually.
4
- import * as input from "./input";
5
- export * as input from "./input";
6
- import * as output from "./output";
7
- export * as output from "./output";
8
-
9
- export const listLanguageModels = {
10
- "input": input.input,
11
- "output": output.output,
12
- "billable": false,
13
- "cacheable": false,
14
- }
@@ -1,8 +0,0 @@
1
- /* eslint-disable */
2
- /* tslint:disable */
3
- // This file is generated. Do not edit it manually.
4
-
5
- import { z } from "@botpress/sdk";
6
- export const input = {
7
- schema: z.object({}),
8
- };
@@ -1,45 +0,0 @@
1
- /* eslint-disable */
2
- /* tslint:disable */
3
- // This file is generated. Do not edit it manually.
4
-
5
- import { z } from "@botpress/sdk";
6
- export const output = {
7
- schema: z.object({
8
- models: z.array(
9
- z.intersection(
10
- z.object({
11
- id: z.string(),
12
- name: z.string(),
13
- description: z.string(),
14
- tags: z.array(
15
- z.enum([
16
- "recommended",
17
- "deprecated",
18
- "general-purpose",
19
- "low-cost",
20
- "vision",
21
- "coding",
22
- "agents",
23
- "function-calling",
24
- "roleplay",
25
- "storytelling",
26
- "reasoning",
27
- "preview",
28
- ]),
29
- ),
30
- input: z.object({
31
- maxTokens: z.number(),
32
- costPer1MTokens:
33
- /** Cost per 1 million tokens, in U.S. dollars */ z.number(),
34
- }),
35
- output: z.object({
36
- maxTokens: z.number(),
37
- costPer1MTokens:
38
- /** Cost per 1 million tokens, in U.S. dollars */ z.number(),
39
- }),
40
- }),
41
- z.ref("modelRef"),
42
- ),
43
- ),
44
- }),
45
- };
@@ -1,6 +0,0 @@
1
- /* eslint-disable */
2
- /* tslint:disable */
3
- // This file is generated. Do not edit it manually.
4
-
5
- export const channels = {
6
- }
@@ -1,9 +0,0 @@
1
- /* eslint-disable */
2
- /* tslint:disable */
3
- // This file is generated. Do not edit it manually.
4
- import * as modelRef from "./modelRef";
5
- export * as modelRef from "./modelRef";
6
-
7
- export const entities = {
8
- "modelRef": modelRef.modelRef,
9
- }
@@ -1,10 +0,0 @@
1
- /* eslint-disable */
2
- /* tslint:disable */
3
- // This file is generated. Do not edit it manually.
4
-
5
- import { z } from "@botpress/sdk";
6
- export const modelRef = {
7
- schema: z.object({
8
- id: z.string(),
9
- }),
10
- };
@@ -1,6 +0,0 @@
1
- /* eslint-disable */
2
- /* tslint:disable */
3
- // This file is generated. Do not edit it manually.
4
-
5
- export const events = {
6
- }
@@ -1,23 +0,0 @@
1
- /* eslint-disable */
2
- /* tslint:disable */
3
- // This file is generated. Do not edit it manually.
4
-
5
- import * as sdk from "@botpress/sdk"
6
-
7
- import * as actions from "./actions/index"
8
- import * as channels from "./channels/index"
9
- import * as events from "./events/index"
10
- import * as entities from "./entities/index"
11
- export * as actions from "./actions/index"
12
- export * as channels from "./channels/index"
13
- export * as events from "./events/index"
14
- export * as entities from "./entities/index"
15
-
16
- export default {
17
- name: "llm",
18
- version: "8.0.0",
19
- actions: actions.actions,
20
- channels: channels.channels,
21
- events: events.events,
22
- entities: entities.entities,
23
- } satisfies sdk.InterfacePackage["definition"]
@@ -1,16 +0,0 @@
1
- /* eslint-disable */
2
- /* tslint:disable */
3
- // This file is generated. Do not edit it manually.
4
-
5
- import * as sdk from "@botpress/sdk"
6
-
7
- import definition from "./definition"
8
-
9
- export default {
10
- type: "interface",
11
- id: "b759e577-2ce7-451a-abff-68085b224985",
12
- uri: undefined,
13
- name: "llm",
14
- version: "8.0.0",
15
- definition,
16
- } satisfies sdk.InterfacePackage