triangle-utils 1.4.84 → 1.4.85
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,10 +1,13 @@
|
|
|
1
|
+
declare const role_ids: readonly ["user", "assistant", "system"];
|
|
2
|
+
export type RoleID = typeof role_ids[number];
|
|
3
|
+
export declare function is_role_id(role_id: any): role_id is RoleID;
|
|
1
4
|
export declare class UtilsBedrock {
|
|
2
5
|
private readonly bedrock_runtime;
|
|
3
6
|
private readonly anthropic_bedrock_mantle;
|
|
4
7
|
private readonly text_decoder;
|
|
5
8
|
constructor(region: string);
|
|
6
9
|
claude_converse(model_id: string, messages: {
|
|
7
|
-
role:
|
|
10
|
+
role: RoleID;
|
|
8
11
|
text: string;
|
|
9
12
|
}[], options?: {
|
|
10
13
|
system_prompt?: string;
|
|
@@ -23,3 +26,4 @@ export declare class UtilsBedrock {
|
|
|
23
26
|
gpt_converse(model_id: string, prompt: string, temperature?: number, max_gen_len?: number, top_p?: number): Promise<string | undefined>;
|
|
24
27
|
titan_invoke(text: string): Promise<number[] | undefined>;
|
|
25
28
|
}
|
|
29
|
+
export {};
|
package/dist/src/UtilsBedrock.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { BedrockRuntime } from "@aws-sdk/client-bedrock-runtime";
|
|
2
2
|
import { AnthropicBedrockMantle } from "@anthropic-ai/bedrock-sdk";
|
|
3
|
+
const role_ids = ["user", "assistant", "system"];
|
|
4
|
+
export function is_role_id(role_id) {
|
|
5
|
+
return role_ids.includes(role_id);
|
|
6
|
+
}
|
|
3
7
|
export class UtilsBedrock {
|
|
4
8
|
bedrock_runtime;
|
|
5
9
|
anthropic_bedrock_mantle;
|
package/package.json
CHANGED
package/src/UtilsBedrock.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { BedrockRuntime } from "@aws-sdk/client-bedrock-runtime"
|
|
2
2
|
import { AnthropicBedrockMantle } from "@anthropic-ai/bedrock-sdk"
|
|
3
3
|
|
|
4
|
+
const role_ids = ["user", "assistant", "system"] as const
|
|
5
|
+
|
|
6
|
+
export type RoleID = typeof role_ids[number]
|
|
7
|
+
|
|
8
|
+
export function is_role_id(role_id : any) : role_id is RoleID {
|
|
9
|
+
return role_ids.includes(role_id)
|
|
10
|
+
}
|
|
11
|
+
|
|
4
12
|
export class UtilsBedrock {
|
|
5
13
|
|
|
6
14
|
private readonly bedrock_runtime : BedrockRuntime
|
|
@@ -16,7 +24,7 @@ export class UtilsBedrock {
|
|
|
16
24
|
|
|
17
25
|
async claude_converse(
|
|
18
26
|
model_id : string,
|
|
19
|
-
messages : { role :
|
|
27
|
+
messages : { role : RoleID, text : string }[],
|
|
20
28
|
options : {
|
|
21
29
|
system_prompt? : string,
|
|
22
30
|
max_tokens? : number,
|