pika-shared 1.0.2

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.
Files changed (75) hide show
  1. package/LICENSE +9 -0
  2. package/dist/index.d.mts +15 -0
  3. package/dist/index.d.ts +15 -0
  4. package/dist/index.js +11 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.mjs +9 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/dist/types/chatbot/bedrock-lambda-error.d.mts +12 -0
  9. package/dist/types/chatbot/bedrock-lambda-error.d.ts +12 -0
  10. package/dist/types/chatbot/bedrock-lambda-error.js +12 -0
  11. package/dist/types/chatbot/bedrock-lambda-error.js.map +1 -0
  12. package/dist/types/chatbot/bedrock-lambda-error.mjs +10 -0
  13. package/dist/types/chatbot/bedrock-lambda-error.mjs.map +1 -0
  14. package/dist/types/chatbot/bedrock.d.mts +489 -0
  15. package/dist/types/chatbot/bedrock.d.ts +489 -0
  16. package/dist/types/chatbot/bedrock.js +4 -0
  17. package/dist/types/chatbot/bedrock.js.map +1 -0
  18. package/dist/types/chatbot/bedrock.mjs +3 -0
  19. package/dist/types/chatbot/bedrock.mjs.map +1 -0
  20. package/dist/types/chatbot/chatbot-types.d.mts +2240 -0
  21. package/dist/types/chatbot/chatbot-types.d.ts +2240 -0
  22. package/dist/types/chatbot/chatbot-types.js +358 -0
  23. package/dist/types/chatbot/chatbot-types.js.map +1 -0
  24. package/dist/types/chatbot/chatbot-types.mjs +301 -0
  25. package/dist/types/chatbot/chatbot-types.mjs.map +1 -0
  26. package/dist/types/upload-types.d.mts +29 -0
  27. package/dist/types/upload-types.d.ts +29 -0
  28. package/dist/types/upload-types.js +4 -0
  29. package/dist/types/upload-types.js.map +1 -0
  30. package/dist/types/upload-types.mjs +3 -0
  31. package/dist/types/upload-types.mjs.map +1 -0
  32. package/dist/util/api-gateway-utils.d.mts +133 -0
  33. package/dist/util/api-gateway-utils.d.ts +133 -0
  34. package/dist/util/api-gateway-utils.js +77 -0
  35. package/dist/util/api-gateway-utils.js.map +1 -0
  36. package/dist/util/api-gateway-utils.mjs +73 -0
  37. package/dist/util/api-gateway-utils.mjs.map +1 -0
  38. package/dist/util/bedrock.d.mts +53 -0
  39. package/dist/util/bedrock.d.ts +53 -0
  40. package/dist/util/bedrock.js +80 -0
  41. package/dist/util/bedrock.js.map +1 -0
  42. package/dist/util/bedrock.mjs +74 -0
  43. package/dist/util/bedrock.mjs.map +1 -0
  44. package/dist/util/chatbot-shared-utils.d.mts +42 -0
  45. package/dist/util/chatbot-shared-utils.d.ts +42 -0
  46. package/dist/util/chatbot-shared-utils.js +44 -0
  47. package/dist/util/chatbot-shared-utils.js.map +1 -0
  48. package/dist/util/chatbot-shared-utils.mjs +33 -0
  49. package/dist/util/chatbot-shared-utils.mjs.map +1 -0
  50. package/dist/util/http-status-error.d.mts +9 -0
  51. package/dist/util/http-status-error.d.ts +9 -0
  52. package/dist/util/http-status-error.js +13 -0
  53. package/dist/util/http-status-error.js.map +1 -0
  54. package/dist/util/http-status-error.mjs +11 -0
  55. package/dist/util/http-status-error.mjs.map +1 -0
  56. package/dist/util/jwt.d.mts +24 -0
  57. package/dist/util/jwt.d.ts +24 -0
  58. package/dist/util/jwt.js +54 -0
  59. package/dist/util/jwt.js.map +1 -0
  60. package/dist/util/jwt.mjs +31 -0
  61. package/dist/util/jwt.mjs.map +1 -0
  62. package/dist/util/server-client-utils.d.mts +15 -0
  63. package/dist/util/server-client-utils.d.ts +15 -0
  64. package/dist/util/server-client-utils.js +37 -0
  65. package/dist/util/server-client-utils.js.map +1 -0
  66. package/dist/util/server-client-utils.mjs +34 -0
  67. package/dist/util/server-client-utils.mjs.map +1 -0
  68. package/dist/util/server-utils.d.mts +4 -0
  69. package/dist/util/server-utils.d.ts +4 -0
  70. package/dist/util/server-utils.js +20 -0
  71. package/dist/util/server-utils.js.map +1 -0
  72. package/dist/util/server-utils.mjs +17 -0
  73. package/dist/util/server-utils.mjs.map +1 -0
  74. package/package.json +70 -0
  75. package/readme.md +3 -0
package/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Rithum Holdings, Inc., together with its affiliates
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,15 @@
1
+ /**
2
+ * pika-shared package
3
+ *
4
+ * This package contains shared types, utilities, and other code used across the Pika project.
5
+ *
6
+ * You can import specific modules using direct paths:
7
+ * import { ChatUser } from 'pika-shared/types/chatbot/chatbot';
8
+ * import { apiGatewayFunctionDecorator } from 'pika-shared/util/api-gateway-utils';
9
+ */
10
+ declare const packageInfo: {
11
+ name: string;
12
+ description: string;
13
+ };
14
+
15
+ export { packageInfo };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * pika-shared package
3
+ *
4
+ * This package contains shared types, utilities, and other code used across the Pika project.
5
+ *
6
+ * You can import specific modules using direct paths:
7
+ * import { ChatUser } from 'pika-shared/types/chatbot/chatbot';
8
+ * import { apiGatewayFunctionDecorator } from 'pika-shared/util/api-gateway-utils';
9
+ */
10
+ declare const packageInfo: {
11
+ name: string;
12
+ description: string;
13
+ };
14
+
15
+ export { packageInfo };
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ // src/index.ts
4
+ var packageInfo = {
5
+ name: "pika-shared",
6
+ description: "Shared utilities and types for Pika project"
7
+ };
8
+
9
+ exports.packageInfo = packageInfo;
10
+ //# sourceMappingURL=index.js.map
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AAUO,IAAM,WAAc,GAAA;AAAA,EACvB,IAAM,EAAA,aAAA;AAAA,EACN,WAAa,EAAA;AACjB","file":"index.js","sourcesContent":["/**\n * pika-shared package\n *\n * This package contains shared types, utilities, and other code used across the Pika project.\n *\n * You can import specific modules using direct paths:\n * import { ChatUser } from 'pika-shared/types/chatbot/chatbot';\n * import { apiGatewayFunctionDecorator } from 'pika-shared/util/api-gateway-utils';\n */\n\nexport const packageInfo = {\n name: 'pika-shared',\n description: 'Shared utilities and types for Pika project'\n};\n"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,9 @@
1
+ // src/index.ts
2
+ var packageInfo = {
3
+ name: "pika-shared",
4
+ description: "Shared utilities and types for Pika project"
5
+ };
6
+
7
+ export { packageInfo };
8
+ //# sourceMappingURL=index.mjs.map
9
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";AAUO,IAAM,WAAc,GAAA;AAAA,EACvB,IAAM,EAAA,aAAA;AAAA,EACN,WAAa,EAAA;AACjB","file":"index.mjs","sourcesContent":["/**\n * pika-shared package\n *\n * This package contains shared types, utilities, and other code used across the Pika project.\n *\n * You can import specific modules using direct paths:\n * import { ChatUser } from 'pika-shared/types/chatbot/chatbot';\n * import { apiGatewayFunctionDecorator } from 'pika-shared/util/api-gateway-utils';\n */\n\nexport const packageInfo = {\n name: 'pika-shared',\n description: 'Shared utilities and types for Pika project'\n};\n"]}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This error is used to allow us to distinguish between errors that are
3
+ * expected to be returned to the user and errors that are unexpected.
4
+ *
5
+ * These errors are caught in the Bedrock Lambda and converted into a
6
+ * BedrockLambdaResponse object using the message as the body.
7
+ */
8
+ declare class BedrockLambdaError extends Error {
9
+ constructor(message: string);
10
+ }
11
+
12
+ export { BedrockLambdaError };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This error is used to allow us to distinguish between errors that are
3
+ * expected to be returned to the user and errors that are unexpected.
4
+ *
5
+ * These errors are caught in the Bedrock Lambda and converted into a
6
+ * BedrockLambdaResponse object using the message as the body.
7
+ */
8
+ declare class BedrockLambdaError extends Error {
9
+ constructor(message: string);
10
+ }
11
+
12
+ export { BedrockLambdaError };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ // src/types/chatbot/bedrock-lambda-error.ts
4
+ var BedrockLambdaError = class extends Error {
5
+ constructor(message) {
6
+ super(message);
7
+ }
8
+ };
9
+
10
+ exports.BedrockLambdaError = BedrockLambdaError;
11
+ //# sourceMappingURL=bedrock-lambda-error.js.map
12
+ //# sourceMappingURL=bedrock-lambda-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/chatbot/bedrock-lambda-error.ts"],"names":[],"mappings":";;;AAOa,IAAA,kBAAA,GAAN,cAAiC,KAAM,CAAA;AAAA,EAC1C,YAAY,OAAiB,EAAA;AACzB,IAAA,KAAA,CAAM,OAAO,CAAA;AAAA;AAErB","file":"bedrock-lambda-error.js","sourcesContent":["/**\n * This error is used to allow us to distinguish between errors that are\n * expected to be returned to the user and errors that are unexpected.\n *\n * These errors are caught in the Bedrock Lambda and converted into a\n * BedrockLambdaResponse object using the message as the body.\n */\nexport class BedrockLambdaError extends Error {\n constructor(message: string) {\n super(message);\n }\n}\n"]}
@@ -0,0 +1,10 @@
1
+ // src/types/chatbot/bedrock-lambda-error.ts
2
+ var BedrockLambdaError = class extends Error {
3
+ constructor(message) {
4
+ super(message);
5
+ }
6
+ };
7
+
8
+ export { BedrockLambdaError };
9
+ //# sourceMappingURL=bedrock-lambda-error.mjs.map
10
+ //# sourceMappingURL=bedrock-lambda-error.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/chatbot/bedrock-lambda-error.ts"],"names":[],"mappings":";AAOa,IAAA,kBAAA,GAAN,cAAiC,KAAM,CAAA;AAAA,EAC1C,YAAY,OAAiB,EAAA;AACzB,IAAA,KAAA,CAAM,OAAO,CAAA;AAAA;AAErB","file":"bedrock-lambda-error.mjs","sourcesContent":["/**\n * This error is used to allow us to distinguish between errors that are\n * expected to be returned to the user and errors that are unexpected.\n *\n * These errors are caught in the Bedrock Lambda and converted into a\n * BedrockLambdaResponse object using the message as the body.\n */\nexport class BedrockLambdaError extends Error {\n constructor(message: string) {\n super(message);\n }\n}\n"]}
@@ -0,0 +1,489 @@
1
+ import { SessionDataWithChatUserCustomDataSpreadIn, RecordOrUndef } from './chatbot-types.mjs';
2
+ import '@aws-sdk/client-bedrock-agent-runtime';
3
+
4
+ /**
5
+ * Represents the input event structure passed to a Lambda function by an Amazon Bedrock Agent Action Group.
6
+ */
7
+ interface BedrockActionGroupLambdaEvent {
8
+ /** The version of the message format. Currently only "1.0" is supported by Amazon Bedrock. */
9
+ messageVersion: string;
10
+ /** Information about the Bedrock agent invoking the action group. */
11
+ agent: {
12
+ /** The name of the agent. */
13
+ name: string;
14
+ /** The unique identifier of the agent. */
15
+ id: string;
16
+ /** The alias used to invoke the agent. */
17
+ alias: string;
18
+ /** The version of the agent. */
19
+ version: string;
20
+ };
21
+ /** The user input message for the current conversation turn. */
22
+ inputText: string;
23
+ /** The unique identifier for the session with the agent. */
24
+ sessionId: string;
25
+ /** The name of the action group. */
26
+ actionGroup: string;
27
+ /**
28
+ * Present only when the action group is defined using function details.
29
+ * The name of the function to call.
30
+ *
31
+ * Note an action group may only define 11 operations (functions) at the
32
+ * time of this writing.
33
+ */
34
+ function?: string;
35
+ /**
36
+ * A list of input parameters provided to the function or API call.
37
+ * These are derived from the OpenAPI schema or the function definition.
38
+ */
39
+ parameters: Array<{
40
+ /** The name of the parameter. */
41
+ name: string;
42
+ /** The type of the parameter (e.g., string, number). */
43
+ type: string;
44
+ /** The value of the parameter. */
45
+ value: any;
46
+ }>;
47
+ /**
48
+ * Present only when the action group is defined using an OpenAPI schema.
49
+ * The HTTP method (e.g., GET, POST) of the API operation.
50
+ */
51
+ httpMethod?: string;
52
+ /**
53
+ * Present only when the action group is defined using an OpenAPI schema.
54
+ * The path to the API operation.
55
+ */
56
+ apiPath?: string;
57
+ /**
58
+ * Present only when the action group is defined using an OpenAPI schema.
59
+ * The request body defined in the OpenAPI schema for the action group.
60
+ */
61
+ requestBody?: Record<string, any>;
62
+ /**
63
+ * Session attributes that persist for the duration of the session and provide context to the agent.
64
+ * Each time you return these, it updates the session attributes for the current session.
65
+ *
66
+ * Our session attributes are a combination of SessionData and ChatUser.customData, which if present, is spread into the sessionAttributes.
67
+ *
68
+ * These are made available to the tools of the agent (your lambda functions).
69
+ */
70
+ sessionAttributes?: SessionDataWithChatUserCustomDataSpreadIn<RecordOrUndef>;
71
+ /**
72
+ * Prompt session attributes that persist for a single turn and provide short-term context to the agent.
73
+ * Each time you return these, it updates the prompt context for the current session.
74
+ *
75
+ * Attributes that persist over a single turn (one InvokeAgent call). You can use the
76
+ * $prompt_session_attributes$ placeholder when you edit the orchestration base prompt template.
77
+ * This placeholder will be populated at runtime with the attributes that you specify in the promptSessionAttributes field.
78
+ *
79
+ * https://docs.aws.amazon.com/bedrock/latest/userguide/agents-session-state.html#session-state-attributes
80
+ *
81
+ * These are made availabe to the agent itself.
82
+ */
83
+ promptSessionAttributes?: Record<string, any>;
84
+ }
85
+ /**
86
+ * Represents the response structure returned from a Lambda function to an Amazon Bedrock Agent Action Group.
87
+ *
88
+ * The maximum Lambda payload response size is 25 KB.
89
+ *
90
+ * https://docs.aws.amazon.com/bedrock/latest/userguide/agents-lambda.html#agents-lambda-response
91
+ */
92
+ interface BedrockActionGroupLambdaResponse {
93
+ /** The version of the message format. Currently only "1.0" is supported by Amazon Bedrock. */
94
+ messageVersion: string;
95
+ /** Contains the response information from the action group execution. */
96
+ response: ApiSchemaResponse | FunctionResponse;
97
+ /**
98
+ * Optional. Session attributes that persist for the duration of the session and provide context to the agent.
99
+ * These attributes can be modified and returned to update the session state.
100
+ */
101
+ sessionAttributes?: SessionDataWithChatUserCustomDataSpreadIn<RecordOrUndef>;
102
+ /**
103
+ * Optional. Prompt session attributes that persist for a single turn and provide short-term context to the agent.
104
+ * These attributes can be modified and returned to update the prompt context.
105
+ */
106
+ promptSessionAttributes?: Record<string, any>;
107
+ /**
108
+ * Optional. Contains a list of query configurations for knowledge bases attached to the agent.
109
+ */
110
+ knowledgeBasesConfiguration?: Array<{
111
+ /** The ID of the knowledge base to configure. */
112
+ knowledgeBaseId: string;
113
+ /** Configuration for the knowledge base retrieval. */
114
+ retrievalConfiguration: {
115
+ /** Configuration for vector search. */
116
+ vectorSearchConfiguration: {
117
+ /** Number of results to return from the knowledge base. */
118
+ numberOfResults?: number;
119
+ /** Optional override for the search type. */
120
+ overrideSearchType?: 'HYBRID' | 'SEMANTIC';
121
+ /** Optional filter for retrieval. */
122
+ filter?: Record<string, any>;
123
+ };
124
+ };
125
+ }>;
126
+ }
127
+ /**
128
+ * Response structure for action groups defined with an OpenAPI schema.
129
+ */
130
+ interface ApiSchemaResponse {
131
+ /** The name of the action group. */
132
+ actionGroup: string;
133
+ /** The path to the API operation, as defined in the OpenAPI schema. */
134
+ apiPath: string;
135
+ /** The method of the API operation, as defined in the OpenAPI schema. */
136
+ httpMethod: string;
137
+ /** The HTTP status code returned from the API operation. */
138
+ httpStatusCode: number;
139
+ /** Contains the response body, as defined in the OpenAPI schema. */
140
+ responseBody: {
141
+ /** The key is the content type (e.g., 'application/json') */
142
+ [contentType: string]: {
143
+ /** The response body content as a JSON-formatted string. */
144
+ body: string;
145
+ };
146
+ };
147
+ }
148
+ /**
149
+ * Response structure for action groups defined with function details.
150
+ */
151
+ interface FunctionResponse {
152
+ /** The name of the action group. */
153
+ actionGroup: string;
154
+ /** The name of the function as defined in the function details. */
155
+ function: string;
156
+ /** Contains details about the function execution response. */
157
+ functionResponse: {
158
+ /**
159
+ * Optional. Set to one of the following states to define the agent's behavior after processing:
160
+ * - FAILURE: The agent throws a DependencyFailedException for the current session.
161
+ * Applies when the function execution fails because of a dependency failure.
162
+ * - REPROMPT: The agent passes a response string to the model to reprompt it.
163
+ * Applies when the function execution fails because of invalid input.
164
+ */
165
+ responseState?: 'FAILURE' | 'REPROMPT';
166
+ /** Contains the response from execution of the function. */
167
+ responseBody: {
168
+ /** The key is the content type (currently only 'TEXT' is supported) */
169
+ [functionContentType: string]: {
170
+ /** The response body content as a JSON-formatted string. */
171
+ body: string;
172
+ };
173
+ };
174
+ };
175
+ }
176
+ /**
177
+ * Note: each description below should be just detailed enough to achieve the desired goal of the description attribute.
178
+ *
179
+ * Even though parameters isn't required, always set to `{}` if no parameters needed for the function.
180
+ *
181
+ * Explicitly include requireConfirmation even though not required and set to false
182
+ */
183
+ interface BedrockActionGroupFunctionSchema {
184
+ name: string;
185
+ description: string;
186
+ parameters?: Record<string, BedrockActionGroupFunctionSchemaParameterDetail>;
187
+ requireConfirmation?: 'ENABLED' | 'DISABLED';
188
+ }
189
+ interface BedrockActionGroupFunctionSchemaParameterDetail {
190
+ required?: boolean;
191
+ type: 'string' | 'integer' | 'array' | 'number' | 'boolean';
192
+ description?: string;
193
+ }
194
+ /** Contains details about the results from looking up the knowledge base. */
195
+ /**
196
+ * Represents the ReasoningContentBlock object from the AWS Bedrock Agent Runtime.
197
+ /**
198
+ * Represents the InvocationInput object from the AWS Bedrock Agent Runtime.
199
+ * Contains information pertaining to the action group or knowledge base that is being invoked.
200
+ *
201
+ * Based on: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvocationInput.html
202
+ */
203
+ interface InvocationInput {
204
+ /**
205
+ * Contains information about the action group to be invoked.
206
+ */
207
+ actionGroupInvocationInput?: ActionGroupInvocationInput;
208
+ /**
209
+ * The collaborator's invocation input.
210
+ */
211
+ agentCollaboratorInvocationInput?: AgentCollaboratorInvocationInput;
212
+ /**
213
+ * Contains information about the code interpreter to be invoked.
214
+ */
215
+ codeInterpreterInvocationInput?: CodeInterpreterInvocationInput;
216
+ /**
217
+ * Specifies whether the agent is invoking an action group or a knowledge base.
218
+ * Valid values: 'ACTION_GROUP' | 'KNOWLEDGE_BASE' | 'FINISH' | 'ACTION_GROUP_CODE_INTERPRETER' | 'AGENT_COLLABORATOR'
219
+ */
220
+ invocationType?: 'ACTION_GROUP' | 'KNOWLEDGE_BASE' | 'FINISH' | 'ACTION_GROUP_CODE_INTERPRETER' | 'AGENT_COLLABORATOR';
221
+ /**
222
+ * Contains details about the knowledge base to look up and the query to be made.
223
+ */
224
+ knowledgeBaseLookupInput?: KnowledgeBaseLookupInput;
225
+ /**
226
+ * The unique identifier of the trace.
227
+ * Length Constraints: Minimum length of 2. Maximum length of 16.
228
+ */
229
+ traceId?: string;
230
+ }
231
+ /**
232
+ * Represents the KnowledgeBaseLookupInput object from the AWS Bedrock Agent Runtime.
233
+ * Contains details about the knowledge base to look up and the query to be made.
234
+ *
235
+ * Based on: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_KnowledgeBaseLookupInput.html
236
+ */
237
+ interface KnowledgeBaseLookupInput {
238
+ /**
239
+ * The unique identifier of the knowledge base to look up.
240
+ */
241
+ knowledgeBaseId?: string;
242
+ /**
243
+ * The query made to the knowledge base.
244
+ */
245
+ text?: string;
246
+ }
247
+ /**
248
+ * Represents the CodeInterpreterInvocationInput object from the AWS Bedrock Agent Runtime.
249
+ * Contains information about the code interpreter being invoked.
250
+ *
251
+ * Based on: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_CodeInterpreterInvocationInput.html
252
+ */
253
+ interface CodeInterpreterInvocationInput {
254
+ /**
255
+ * The code for the code interpreter to use.
256
+ */
257
+ code?: string;
258
+ /**
259
+ * Files that are uploaded for the code interpreter to use.
260
+ */
261
+ files?: string[];
262
+ }
263
+ /**
264
+ * Represents the AgentCollaboratorInvocationInput object from the AWS Bedrock Agent Runtime.
265
+ * Contains information about the agent collaborator being invoked.
266
+ *
267
+ * Based on: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_AgentCollaboratorInvocationInput.html
268
+ */
269
+ interface AgentCollaboratorInvocationInput {
270
+ /**
271
+ * The collaborator's alias ARN.
272
+ * Pattern: ^arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:agent-alias/[0-9a-zA-Z]{10}/[0-9a-zA-Z]{10}$
273
+ */
274
+ agentCollaboratorAliasArn?: string;
275
+ /**
276
+ * The collaborator's name.
277
+ */
278
+ agentCollaboratorName?: string;
279
+ /**
280
+ * Text or action invocation result input for the collaborator.
281
+ */
282
+ input?: AgentCollaboratorInputPayload;
283
+ }
284
+ /**
285
+ * Represents the input payload for an agent collaborator in the AWS Bedrock Agent Runtime.
286
+ * The input can be either plain text or an action invocation result.
287
+ */
288
+ interface AgentCollaboratorInputPayload {
289
+ /**
290
+ * An action invocation result.
291
+ */
292
+ returnControlResults?: ReturnControlResults;
293
+ /**
294
+ * Input text.
295
+ */
296
+ text?: string;
297
+ /**
298
+ * The input type.
299
+ * Valid values: 'TEXT' | 'RETURN_CONTROL'
300
+ */
301
+ type?: 'TEXT' | 'RETURN_CONTROL';
302
+ }
303
+ /**
304
+ * Represents the result of returning control to the agent developer.
305
+ */
306
+ interface ReturnControlResults {
307
+ /**
308
+ * The action's invocation ID.
309
+ */
310
+ invocationId?: string;
311
+ /**
312
+ * The action invocation result.
313
+ * Minimum items: 1
314
+ * Maximum items: 5
315
+ */
316
+ returnControlInvocationResults?: InvocationResultMember[];
317
+ }
318
+ /**
319
+ * Represents a single invocation result member.
320
+ */
321
+ interface InvocationResultMember {
322
+ /**
323
+ * The function result.
324
+ */
325
+ functionResult?: FunctionResult;
326
+ /**
327
+ * The API result.
328
+ */
329
+ apiResult?: ApiResult;
330
+ }
331
+ /**
332
+ * Represents the result of a function invocation.
333
+ */
334
+ interface FunctionResult {
335
+ /**
336
+ * The name of the action group.
337
+ */
338
+ actionGroup?: string;
339
+ /**
340
+ * The name of the function.
341
+ */
342
+ function?: string;
343
+ /**
344
+ * The response body from the function invocation.
345
+ * The keys are content types (e.g., 'TEXT'), and the values are response content.
346
+ */
347
+ responseBody?: Record<string, ResponseContent>;
348
+ }
349
+ /**
350
+ * Represents the result of an API invocation.
351
+ */
352
+ interface ApiResult {
353
+ /**
354
+ * The name of the action group.
355
+ */
356
+ actionGroup?: string;
357
+ /**
358
+ * The HTTP method used in the API invocation.
359
+ */
360
+ httpMethod?: string;
361
+ /**
362
+ * The API path invoked.
363
+ */
364
+ apiPath?: string;
365
+ /**
366
+ * The response body from the API invocation.
367
+ * The keys are content types (e.g., 'application/json'), and the values are response content.
368
+ */
369
+ responseBody?: Record<string, ResponseContent>;
370
+ }
371
+ /**
372
+ * Represents the content of a response.
373
+ */
374
+ interface ResponseContent {
375
+ /**
376
+ * The body of the response.
377
+ */
378
+ body?: string;
379
+ }
380
+ /**
381
+ * Represents the ActionGroupInvocationInput object from the AWS Bedrock Agent Runtime.
382
+ * Contains information about the action group being invoked.
383
+ *
384
+ * Based on: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_ActionGroupInvocationInput.html
385
+ */
386
+ interface ActionGroupInvocationInput {
387
+ /**
388
+ * The name of the action group.
389
+ */
390
+ actionGroupName?: string;
391
+ /**
392
+ * The path to the API to call, based off the action group.
393
+ */
394
+ apiPath?: string;
395
+ /**
396
+ * How fulfillment of the action is handled.
397
+ * Valid values: 'LAMBDA' | 'RETURN_CONTROL'
398
+ */
399
+ executionType?: 'LAMBDA' | 'RETURN_CONTROL';
400
+ /**
401
+ * The function in the action group to call.
402
+ */
403
+ function?: string;
404
+ /**
405
+ * The unique identifier of the invocation.
406
+ * Only returned if the executionType is RETURN_CONTROL.
407
+ */
408
+ invocationId?: string;
409
+ /**
410
+ * The parameters in the Lambda input event.
411
+ */
412
+ parameters?: Parameter[];
413
+ /**
414
+ * The parameters in the request body for the Lambda input event.
415
+ */
416
+ requestBody?: RequestBody;
417
+ /**
418
+ * The API method being used, based off the action group.
419
+ */
420
+ verb?: string;
421
+ }
422
+ /**
423
+ * Represents a parameter in the Lambda input event.
424
+ */
425
+ interface Parameter {
426
+ /**
427
+ * The name of the parameter.
428
+ */
429
+ name: string;
430
+ /**
431
+ * The type of the parameter.
432
+ */
433
+ type: string;
434
+ /**
435
+ * The value of the parameter.
436
+ */
437
+ value: string;
438
+ }
439
+ /**
440
+ * Represents the request body for the Lambda input event.
441
+ */
442
+ interface RequestBody {
443
+ /**
444
+ * A map of content types to their respective parameters.
445
+ */
446
+ content: Record<string, Parameter[]>;
447
+ }
448
+ /**
449
+ * ModelInvocationInput
450
+ * --------------------
451
+ * The prompt + model-level settings the agent sends to the foundation model
452
+ * during a given step (pre-processing, orchestration, KB-response-gen, etc.).
453
+ *
454
+ * Docs: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_ModelInvocationInput.html
455
+ */
456
+ interface ModelInvocationInput {
457
+ /** ARN or name of the model (custom or FM). */
458
+ foundationModel?: string;
459
+ /** Temperature, top-p, max-tokens, stop sequences, … */
460
+ inferenceConfiguration?: InferenceConfiguration;
461
+ /** ARN of a Lambda that post-parses the raw FM output (optional override). */
462
+ overrideLambda?: string;
463
+ /** Whether the default parser Lambda is used. */
464
+ parserMode?: 'DEFAULT' | 'OVERRIDDEN';
465
+ /** Whether the default prompt template was overridden. */
466
+ promptCreationMode?: 'DEFAULT' | 'OVERRIDDEN';
467
+ /** The actual prompt text that was sent to the model. */
468
+ text?: string;
469
+ /** Unique ID that ties this record to the overall trace. */
470
+ traceId?: string;
471
+ /** Which step of the agent sequence this relates to. */
472
+ type?: 'PRE_PROCESSING' | 'ORCHESTRATION' | 'KNOWLEDGE_BASE_RESPONSE_GENERATION' | 'POST_PROCESSING' | 'ROUTING_CLASSIFIER';
473
+ }
474
+ /**
475
+ * A light version of the InferenceConfiguration object.
476
+ * Only the fields documented under ModelInvocationInput are included here;
477
+ * add any others you need.
478
+ *
479
+ * Docs: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InferenceConfiguration.html
480
+ */
481
+ interface InferenceConfiguration {
482
+ maximumLength?: number;
483
+ stopSequences?: string[];
484
+ temperature?: number;
485
+ topK?: number;
486
+ topP?: number;
487
+ }
488
+
489
+ export type { ActionGroupInvocationInput, AgentCollaboratorInputPayload, AgentCollaboratorInvocationInput, ApiResult, ApiSchemaResponse, BedrockActionGroupFunctionSchema, BedrockActionGroupFunctionSchemaParameterDetail, BedrockActionGroupLambdaEvent, BedrockActionGroupLambdaResponse, CodeInterpreterInvocationInput, FunctionResponse, FunctionResult, InferenceConfiguration, InvocationInput, InvocationResultMember, KnowledgeBaseLookupInput, ModelInvocationInput, Parameter, RequestBody, ResponseContent, ReturnControlResults };