triangle-utils 1.4.100 → 1.4.101

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.
@@ -26,8 +26,7 @@ export declare class UtilsBedrock {
26
26
  }[], options?: {
27
27
  system_prompt?: string;
28
28
  max_tokens?: number;
29
- print_usage?: boolean;
30
- print_content?: boolean;
29
+ print?: boolean;
31
30
  json_format?: Record<string, any>;
32
31
  web?: boolean;
33
32
  cache_period?: "5m" | "1h";
@@ -104,7 +104,10 @@ export class UtilsBedrock {
104
104
  content: content
105
105
  });
106
106
  }
107
- const response = await this.bedrock_runtime.invokeModel({
107
+ if (options.print) {
108
+ console.log("Constructed messages.");
109
+ }
110
+ const request = {
108
111
  modelId: model_id,
109
112
  body: JSON.stringify({
110
113
  messages: message_params,
@@ -114,12 +117,16 @@ export class UtilsBedrock {
114
117
  temperature: 0,
115
118
  anthropic_version: "bedrock-2023-05-31"
116
119
  })
117
- });
120
+ };
121
+ if (options.print) {
122
+ console.log("Constructed request.");
123
+ }
124
+ const response = await this.bedrock_runtime.invokeModel(request);
118
125
  const body = JSON.parse(this.text_decoder.decode(response.body));
119
- if (options.print_usage !== undefined && options.print_usage) {
126
+ if (options.print) {
120
127
  console.log(body.usage);
121
128
  }
122
- if (options.print_content !== undefined && options.print_content) {
129
+ if (options.print) {
123
130
  console.log(body.content);
124
131
  }
125
132
  const text = body.content.filter((content) => content.type === "text")[0].text;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-utils",
3
- "version": "1.4.100",
3
+ "version": "1.4.101",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
@@ -106,8 +106,7 @@ export class UtilsBedrock {
106
106
  options : {
107
107
  system_prompt? : string,
108
108
  max_tokens? : number,
109
- print_usage? : boolean,
110
- print_content? : boolean,
109
+ print? : boolean,
111
110
  json_format? : Record<string, any>,
112
111
  web? : boolean,
113
112
  cache_period? : "5m" | "1h"
@@ -141,7 +140,10 @@ export class UtilsBedrock {
141
140
  })
142
141
 
143
142
  }
144
- const response = await this.bedrock_runtime.invokeModel({
143
+ if (options.print) {
144
+ console.log("Constructed messages.")
145
+ }
146
+ const request = {
145
147
  modelId : model_id,
146
148
  body : JSON.stringify({
147
149
  messages : message_params,
@@ -151,12 +153,16 @@ export class UtilsBedrock {
151
153
  temperature: 0,
152
154
  anthropic_version: "bedrock-2023-05-31"
153
155
  })
154
- })
156
+ }
157
+ if (options.print) {
158
+ console.log("Constructed request.")
159
+ }
160
+ const response = await this.bedrock_runtime.invokeModel(request)
155
161
  const body = JSON.parse(this.text_decoder.decode(response.body))
156
- if (options.print_usage !== undefined && options.print_usage) {
162
+ if (options.print) {
157
163
  console.log(body.usage)
158
164
  }
159
- if (options.print_content !== undefined && options.print_content) {
165
+ if (options.print) {
160
166
  console.log(body.content)
161
167
  }
162
168
  const text = body.content.filter((content : any) => content.type === "text")[0].text