triangle-utils 1.4.168 → 1.4.170
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/src/UtilsBedrock.d.ts +5 -11
- package/dist/src/UtilsBedrock.js +87 -92
- package/dist/src/UtilsBrave.js +2 -2
- package/dist/src/f.js +18 -2
- package/package.json +1 -1
- package/src/UtilsBedrock.ts +92 -97
- package/src/UtilsBrave.ts +2 -2
- package/src/f.ts +21 -2
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export type
|
|
3
|
-
export declare function
|
|
1
|
+
declare const message_roles: readonly ["user", "assistant", "system"];
|
|
2
|
+
export type MessageRole = typeof message_roles[number];
|
|
3
|
+
export declare function is_message_role(message_role: any): message_role is MessageRole;
|
|
4
4
|
export declare class UtilsBedrock {
|
|
5
5
|
private readonly bedrock_runtime;
|
|
6
6
|
private readonly anthropic_bedrock_mantle;
|
|
7
7
|
private readonly text_decoder;
|
|
8
8
|
constructor(region: string);
|
|
9
9
|
claude_converse(model_id: string, messages: {
|
|
10
|
-
role:
|
|
10
|
+
role: MessageRole;
|
|
11
11
|
text: string;
|
|
12
12
|
pdf?: string;
|
|
13
13
|
}[], options?: {
|
|
@@ -15,10 +15,9 @@ export declare class UtilsBedrock {
|
|
|
15
15
|
max_num_tokens?: number;
|
|
16
16
|
verbosity?: number;
|
|
17
17
|
json_format?: Record<string, any>;
|
|
18
|
-
cache_period?: "5m" | "1h";
|
|
19
18
|
}): Promise<string | undefined>;
|
|
20
19
|
claude_invoke(model_id: string, messages: {
|
|
21
|
-
role:
|
|
20
|
+
role: MessageRole;
|
|
22
21
|
text: string;
|
|
23
22
|
pdf?: string;
|
|
24
23
|
}[], options?: {
|
|
@@ -26,12 +25,7 @@ export declare class UtilsBedrock {
|
|
|
26
25
|
max_num_tokens?: number;
|
|
27
26
|
verbosity?: number;
|
|
28
27
|
json_format?: Record<string, any>;
|
|
29
|
-
web?: boolean;
|
|
30
|
-
cache_period?: "5m" | "1h";
|
|
31
28
|
}): Promise<string | undefined>;
|
|
32
|
-
nova_invoke(model_id: string, prompt: string): Promise<string | undefined>;
|
|
33
|
-
llama_invoke(model_id: string, prompt: string, temperature?: number, max_gen_len?: number, top_p?: number): Promise<string | undefined>;
|
|
34
|
-
gpt_converse(model_id: string, prompt: string, temperature?: number, max_gen_len?: number, top_p?: number): Promise<string | undefined>;
|
|
35
29
|
titan_invoke(text: string): Promise<number[] | undefined>;
|
|
36
30
|
cohere_invoke(model_id: string, text: string, options?: {
|
|
37
31
|
input_type_id?: string;
|
package/dist/src/UtilsBedrock.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BedrockRuntime } from "@aws-sdk/client-bedrock-runtime";
|
|
2
2
|
import { AnthropicBedrockMantle } from "@anthropic-ai/bedrock-sdk";
|
|
3
|
-
const
|
|
4
|
-
export function
|
|
5
|
-
return
|
|
3
|
+
const message_roles = ["user", "assistant", "system"];
|
|
4
|
+
export function is_message_role(message_role) {
|
|
5
|
+
return message_roles.includes(message_role);
|
|
6
6
|
}
|
|
7
7
|
export class UtilsBedrock {
|
|
8
8
|
bedrock_runtime;
|
|
@@ -33,8 +33,7 @@ export class UtilsBedrock {
|
|
|
33
33
|
data: message.pdf
|
|
34
34
|
},
|
|
35
35
|
title: "Attachment",
|
|
36
|
-
citations: { "enabled": false }
|
|
37
|
-
cache_control: { "type": "ephemeral" }
|
|
36
|
+
citations: { "enabled": false }
|
|
38
37
|
});
|
|
39
38
|
}
|
|
40
39
|
message_params.push({
|
|
@@ -97,8 +96,7 @@ export class UtilsBedrock {
|
|
|
97
96
|
data: message.pdf
|
|
98
97
|
},
|
|
99
98
|
title: "Attachment",
|
|
100
|
-
citations: { "enabled": false }
|
|
101
|
-
cache_control: { "type": "ephemeral" }
|
|
99
|
+
citations: { "enabled": false }
|
|
102
100
|
});
|
|
103
101
|
}
|
|
104
102
|
message_params.push({
|
|
@@ -145,91 +143,88 @@ export class UtilsBedrock {
|
|
|
145
143
|
}
|
|
146
144
|
return undefined;
|
|
147
145
|
}
|
|
148
|
-
async nova_invoke(model_id, prompt) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
console.log("Failed to get from Bedrock, quitting.");
|
|
231
|
-
return undefined;
|
|
232
|
-
}
|
|
146
|
+
// async nova_invoke(model_id : string, prompt : string) : Promise<string | undefined> {
|
|
147
|
+
// for (let i = 0; i < 3; i++) {
|
|
148
|
+
// try {
|
|
149
|
+
// const response = await this.bedrock_runtime.invokeModel({
|
|
150
|
+
// modelId : model_id,
|
|
151
|
+
// body : JSON.stringify({
|
|
152
|
+
// messages : [{
|
|
153
|
+
// role : "user",
|
|
154
|
+
// content : [{ text : prompt }]
|
|
155
|
+
// }]
|
|
156
|
+
// })
|
|
157
|
+
// })
|
|
158
|
+
// const body = JSON.parse(this.text_decoder.decode(response.body))
|
|
159
|
+
// return body.output.message.content[0].text
|
|
160
|
+
// } catch (error) {
|
|
161
|
+
// if (error instanceof Error) {
|
|
162
|
+
// console.log(error.stack)
|
|
163
|
+
// }
|
|
164
|
+
// console.log("Failed to get from Bedrock.")
|
|
165
|
+
// }
|
|
166
|
+
// }
|
|
167
|
+
// console.log("Failed to get from Bedrock, quitting.")
|
|
168
|
+
// return undefined
|
|
169
|
+
// }
|
|
170
|
+
// async llama_invoke(model_id : string, prompt : string, temperature : number = 0.5, max_gen_len : number = 512, top_p : number = 0.9) : Promise<string | undefined> {
|
|
171
|
+
// for (let i = 0; i < 3; i++) {
|
|
172
|
+
// try {
|
|
173
|
+
// const output = await this.bedrock_runtime.invokeModel({
|
|
174
|
+
// modelId : model_id,
|
|
175
|
+
// body : JSON.stringify({
|
|
176
|
+
// prompt : prompt,
|
|
177
|
+
// temperature : temperature,
|
|
178
|
+
// top_p : top_p,
|
|
179
|
+
// max_gen_len : max_gen_len
|
|
180
|
+
// }),
|
|
181
|
+
// contentType : "application/json"
|
|
182
|
+
// })
|
|
183
|
+
// const response = JSON.parse(this.text_decoder.decode(output.body))
|
|
184
|
+
// return response.generation
|
|
185
|
+
// } catch (error) {
|
|
186
|
+
// if (error instanceof Error) {
|
|
187
|
+
// console.log(error.stack)
|
|
188
|
+
// }
|
|
189
|
+
// console.log("Failed to get from Bedrock.")
|
|
190
|
+
// }
|
|
191
|
+
// }
|
|
192
|
+
// console.log("Failed to get from Bedrock, quitting.")
|
|
193
|
+
// return undefined
|
|
194
|
+
// }
|
|
195
|
+
// async gpt_converse(model_id : string, prompt : string, temperature : number = 0.5, max_gen_len : number = 512, top_p : number = 0.9) : Promise<string | undefined> {
|
|
196
|
+
// for (let i = 0; i < 3; i++) {
|
|
197
|
+
// try {
|
|
198
|
+
// const response = await this.bedrock_runtime.converse({
|
|
199
|
+
// modelId : model_id,
|
|
200
|
+
// messages : [
|
|
201
|
+
// { role : "user", content : [ { text : prompt } ] }
|
|
202
|
+
// ],
|
|
203
|
+
// inferenceConfig : {
|
|
204
|
+
// temperature : temperature,
|
|
205
|
+
// topP : top_p,
|
|
206
|
+
// maxTokens : max_gen_len
|
|
207
|
+
// }
|
|
208
|
+
// })
|
|
209
|
+
// const output = response.output
|
|
210
|
+
// if (output === undefined || output.message === undefined || output.message.content === undefined) {
|
|
211
|
+
// continue
|
|
212
|
+
// }
|
|
213
|
+
// for (const c of output.message.content) {
|
|
214
|
+
// if (c.text !== undefined) {
|
|
215
|
+
// return c.text
|
|
216
|
+
// }
|
|
217
|
+
// }
|
|
218
|
+
// } catch (error) {
|
|
219
|
+
// if (error instanceof Error) {
|
|
220
|
+
// console.log(error.stack)
|
|
221
|
+
// }
|
|
222
|
+
// console.log("Failed to get from Bedrock.")
|
|
223
|
+
// }
|
|
224
|
+
// }
|
|
225
|
+
// console.log("Failed to get from Bedrock, quitting.")
|
|
226
|
+
// return undefined
|
|
227
|
+
// }
|
|
233
228
|
async titan_invoke(text) {
|
|
234
229
|
for (let i = 0; i < 3; i++) {
|
|
235
230
|
try {
|
package/dist/src/UtilsBrave.js
CHANGED
|
@@ -31,7 +31,7 @@ export class UtilsBrave {
|
|
|
31
31
|
if (!Array.isArray(results)) {
|
|
32
32
|
return undefined;
|
|
33
33
|
}
|
|
34
|
-
return
|
|
34
|
+
return results;
|
|
35
35
|
}
|
|
36
36
|
catch (error) {
|
|
37
37
|
console.log("Failed to Brave:", error.stack);
|
|
@@ -66,7 +66,7 @@ export class UtilsBrave {
|
|
|
66
66
|
if (!Array.isArray(results)) {
|
|
67
67
|
return undefined;
|
|
68
68
|
}
|
|
69
|
-
return
|
|
69
|
+
return results;
|
|
70
70
|
}
|
|
71
71
|
catch (error) {
|
|
72
72
|
console.log("Failed to Brave:", error.stack);
|
package/dist/src/f.js
CHANGED
|
@@ -83,5 +83,21 @@ const utils = new TriangleUtils(config);
|
|
|
83
83
|
// .then(response => console.log(response))
|
|
84
84
|
// await utils.s3.get_download_url("s3://triangle-675045717295-us-east-1-an/tenant_documents/a3a9627f-a94d-4d47-a110-307a6f5563af/a146d789-da40-4e3c-a132-8b7110f3f7df.pdf", { name : "hye.pdf" })
|
|
85
85
|
// .then(response => console.log(response))
|
|
86
|
-
await utils.
|
|
87
|
-
|
|
86
|
+
await utils.bedrock.claude_invoke("global.anthropic.claude-haiku-4-5-20251001-v1:0", [
|
|
87
|
+
{
|
|
88
|
+
role: "user",
|
|
89
|
+
text: "ayo"
|
|
90
|
+
}
|
|
91
|
+
], {
|
|
92
|
+
json_format: {
|
|
93
|
+
type: "object",
|
|
94
|
+
properties: {
|
|
95
|
+
relevance: {
|
|
96
|
+
type: "string"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
required: ["relevance"],
|
|
100
|
+
additionalProperties: false
|
|
101
|
+
},
|
|
102
|
+
verbosity: 5
|
|
103
|
+
});
|
package/package.json
CHANGED
package/src/UtilsBedrock.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { BedrockRuntime, InvokeModelCommandInput } from "@aws-sdk/client-bedrock
|
|
|
2
2
|
import { AnthropicBedrockMantle } from "@anthropic-ai/bedrock-sdk"
|
|
3
3
|
import { ContentBlockParam, MessageCreateParams, MessageParam, OutputConfig } from "@anthropic-ai/sdk/resources"
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const message_roles = ["user", "assistant", "system"] as const
|
|
6
6
|
|
|
7
|
-
export type
|
|
7
|
+
export type MessageRole = typeof message_roles[number]
|
|
8
8
|
|
|
9
|
-
export function
|
|
10
|
-
return
|
|
9
|
+
export function is_message_role(message_role : any) : message_role is MessageRole {
|
|
10
|
+
return message_roles.includes(message_role)
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export class UtilsBedrock {
|
|
@@ -25,13 +25,12 @@ export class UtilsBedrock {
|
|
|
25
25
|
|
|
26
26
|
async claude_converse(
|
|
27
27
|
model_id : string,
|
|
28
|
-
messages : { role :
|
|
28
|
+
messages : { role : MessageRole, text : string, pdf? : string }[],
|
|
29
29
|
options : {
|
|
30
30
|
system_prompt? : string,
|
|
31
31
|
max_num_tokens? : number,
|
|
32
32
|
verbosity? : number,
|
|
33
|
-
json_format? : Record<string, any
|
|
34
|
-
cache_period? : "5m" | "1h"
|
|
33
|
+
json_format? : Record<string, any>
|
|
35
34
|
} = {}
|
|
36
35
|
) {
|
|
37
36
|
const verbosity = options.verbosity || 0
|
|
@@ -53,8 +52,7 @@ export class UtilsBedrock {
|
|
|
53
52
|
data: message.pdf
|
|
54
53
|
},
|
|
55
54
|
title: "Attachment",
|
|
56
|
-
citations: { "enabled": false }
|
|
57
|
-
cache_control: {"type": "ephemeral"}
|
|
55
|
+
citations: { "enabled" : false }
|
|
58
56
|
})
|
|
59
57
|
}
|
|
60
58
|
message_params.push({
|
|
@@ -100,14 +98,12 @@ export class UtilsBedrock {
|
|
|
100
98
|
|
|
101
99
|
async claude_invoke(
|
|
102
100
|
model_id : string,
|
|
103
|
-
messages : { role :
|
|
101
|
+
messages : { role : MessageRole, text : string, pdf? : string }[],
|
|
104
102
|
options : {
|
|
105
103
|
system_prompt? : string,
|
|
106
104
|
max_num_tokens? : number,
|
|
107
105
|
verbosity? : number,
|
|
108
|
-
json_format? : Record<string, any
|
|
109
|
-
web? : boolean,
|
|
110
|
-
cache_period? : "5m" | "1h"
|
|
106
|
+
json_format? : Record<string, any>
|
|
111
107
|
} = {}
|
|
112
108
|
) : Promise<string | undefined> {
|
|
113
109
|
const verbosity = options.verbosity || 0
|
|
@@ -129,8 +125,7 @@ export class UtilsBedrock {
|
|
|
129
125
|
data: message.pdf
|
|
130
126
|
},
|
|
131
127
|
title: "Attachment",
|
|
132
|
-
citations: { "enabled": false }
|
|
133
|
-
cache_control: {"type": "ephemeral"}
|
|
128
|
+
citations: { "enabled" : false }
|
|
134
129
|
})
|
|
135
130
|
}
|
|
136
131
|
message_params.push({
|
|
@@ -177,90 +172,90 @@ export class UtilsBedrock {
|
|
|
177
172
|
return undefined
|
|
178
173
|
}
|
|
179
174
|
|
|
180
|
-
async nova_invoke(model_id : string, prompt : string) : Promise<string | undefined> {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
175
|
+
// async nova_invoke(model_id : string, prompt : string) : Promise<string | undefined> {
|
|
176
|
+
// for (let i = 0; i < 3; i++) {
|
|
177
|
+
// try {
|
|
178
|
+
// const response = await this.bedrock_runtime.invokeModel({
|
|
179
|
+
// modelId : model_id,
|
|
180
|
+
// body : JSON.stringify({
|
|
181
|
+
// messages : [{
|
|
182
|
+
// role : "user",
|
|
183
|
+
// content : [{ text : prompt }]
|
|
184
|
+
// }]
|
|
185
|
+
// })
|
|
186
|
+
// })
|
|
187
|
+
// const body = JSON.parse(this.text_decoder.decode(response.body))
|
|
188
|
+
// return body.output.message.content[0].text
|
|
189
|
+
// } catch (error) {
|
|
190
|
+
// if (error instanceof Error) {
|
|
191
|
+
// console.log(error.stack)
|
|
192
|
+
// }
|
|
193
|
+
// console.log("Failed to get from Bedrock.")
|
|
194
|
+
// }
|
|
195
|
+
// }
|
|
196
|
+
// console.log("Failed to get from Bedrock, quitting.")
|
|
197
|
+
// return undefined
|
|
198
|
+
// }
|
|
204
199
|
|
|
205
|
-
async llama_invoke(model_id : string, prompt : string, temperature : number = 0.5, max_gen_len : number = 512, top_p : number = 0.9) : Promise<string | undefined> {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}
|
|
200
|
+
// async llama_invoke(model_id : string, prompt : string, temperature : number = 0.5, max_gen_len : number = 512, top_p : number = 0.9) : Promise<string | undefined> {
|
|
201
|
+
// for (let i = 0; i < 3; i++) {
|
|
202
|
+
// try {
|
|
203
|
+
// const output = await this.bedrock_runtime.invokeModel({
|
|
204
|
+
// modelId : model_id,
|
|
205
|
+
// body : JSON.stringify({
|
|
206
|
+
// prompt : prompt,
|
|
207
|
+
// temperature : temperature,
|
|
208
|
+
// top_p : top_p,
|
|
209
|
+
// max_gen_len : max_gen_len
|
|
210
|
+
// }),
|
|
211
|
+
// contentType : "application/json"
|
|
212
|
+
// })
|
|
213
|
+
// const response = JSON.parse(this.text_decoder.decode(output.body))
|
|
214
|
+
// return response.generation
|
|
215
|
+
// } catch (error) {
|
|
216
|
+
// if (error instanceof Error) {
|
|
217
|
+
// console.log(error.stack)
|
|
218
|
+
// }
|
|
219
|
+
// console.log("Failed to get from Bedrock.")
|
|
220
|
+
// }
|
|
221
|
+
// }
|
|
222
|
+
// console.log("Failed to get from Bedrock, quitting.")
|
|
223
|
+
// return undefined
|
|
224
|
+
// }
|
|
230
225
|
|
|
231
|
-
async gpt_converse(model_id : string, prompt : string, temperature : number = 0.5, max_gen_len : number = 512, top_p : number = 0.9) : Promise<string | undefined> {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
226
|
+
// async gpt_converse(model_id : string, prompt : string, temperature : number = 0.5, max_gen_len : number = 512, top_p : number = 0.9) : Promise<string | undefined> {
|
|
227
|
+
// for (let i = 0; i < 3; i++) {
|
|
228
|
+
// try {
|
|
229
|
+
// const response = await this.bedrock_runtime.converse({
|
|
230
|
+
// modelId : model_id,
|
|
231
|
+
// messages : [
|
|
232
|
+
// { role : "user", content : [ { text : prompt } ] }
|
|
233
|
+
// ],
|
|
234
|
+
// inferenceConfig : {
|
|
235
|
+
// temperature : temperature,
|
|
236
|
+
// topP : top_p,
|
|
237
|
+
// maxTokens : max_gen_len
|
|
238
|
+
// }
|
|
239
|
+
// })
|
|
240
|
+
// const output = response.output
|
|
241
|
+
// if (output === undefined || output.message === undefined || output.message.content === undefined) {
|
|
242
|
+
// continue
|
|
243
|
+
// }
|
|
244
|
+
// for (const c of output.message.content) {
|
|
245
|
+
// if (c.text !== undefined) {
|
|
246
|
+
// return c.text
|
|
247
|
+
// }
|
|
248
|
+
// }
|
|
249
|
+
// } catch (error) {
|
|
250
|
+
// if (error instanceof Error) {
|
|
251
|
+
// console.log(error.stack)
|
|
252
|
+
// }
|
|
253
|
+
// console.log("Failed to get from Bedrock.")
|
|
254
|
+
// }
|
|
255
|
+
// }
|
|
256
|
+
// console.log("Failed to get from Bedrock, quitting.")
|
|
257
|
+
// return undefined
|
|
258
|
+
// }
|
|
264
259
|
|
|
265
260
|
async titan_invoke(text : string) : Promise<number[] | undefined> {
|
|
266
261
|
for (let i = 0; i < 3; i++) {
|
package/src/UtilsBrave.ts
CHANGED
|
@@ -38,7 +38,7 @@ export class UtilsBrave {
|
|
|
38
38
|
if (!Array.isArray(results)) {
|
|
39
39
|
return undefined
|
|
40
40
|
}
|
|
41
|
-
return
|
|
41
|
+
return results
|
|
42
42
|
} catch (error : any) {
|
|
43
43
|
console.log("Failed to Brave:", error.stack)
|
|
44
44
|
}
|
|
@@ -77,7 +77,7 @@ export class UtilsBrave {
|
|
|
77
77
|
if (!Array.isArray(results)) {
|
|
78
78
|
return undefined
|
|
79
79
|
}
|
|
80
|
-
return
|
|
80
|
+
return results
|
|
81
81
|
} catch (error : any) {
|
|
82
82
|
console.log("Failed to Brave:", error.stack)
|
|
83
83
|
}
|
package/src/f.ts
CHANGED
|
@@ -107,5 +107,24 @@ const utils = new TriangleUtils(config)
|
|
|
107
107
|
// .then(response => console.log(response))
|
|
108
108
|
|
|
109
109
|
|
|
110
|
-
await utils.
|
|
111
|
-
|
|
110
|
+
await utils.bedrock.claude_invoke("global.anthropic.claude-haiku-4-5-20251001-v1:0",
|
|
111
|
+
[
|
|
112
|
+
{
|
|
113
|
+
role : "user",
|
|
114
|
+
text : "ayo"
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
{
|
|
118
|
+
json_format : {
|
|
119
|
+
type : "object",
|
|
120
|
+
properties : {
|
|
121
|
+
relevance : {
|
|
122
|
+
type : "string"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
required : ["relevance"],
|
|
126
|
+
additionalProperties : false
|
|
127
|
+
},
|
|
128
|
+
verbosity : 5
|
|
129
|
+
}
|
|
130
|
+
)
|