triangle-utils 1.4.142 → 1.4.143

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.
@@ -42,23 +42,24 @@ export class UtilsBedrock {
42
42
  content: content
43
43
  });
44
44
  }
45
- const response = await this.anthropic_bedrock_mantle.messages.create({
45
+ const output_config = options.json_format !== undefined ? {
46
+ format: {
47
+ type: "json_schema",
48
+ schema: options.json_format
49
+ }
50
+ } : undefined;
51
+ const request = {
46
52
  model: model_id,
47
53
  messages: message_params,
48
54
  system: options.system_prompt,
49
55
  tools: options.web === true ? [{ name: "web_search", type: "web_search_20250305" }] : undefined,
50
56
  max_tokens: options.max_num_tokens || 1000,
51
- output_config: options.json_format !== undefined ? {
52
- format: {
53
- type: "json_schema",
54
- schema: options.json_format
55
- }
56
- } : undefined,
57
- // cache_control : {
58
- // type : "ephemeral",
59
- // ttl : options.cache_period
60
- // }
61
- });
57
+ output_config: output_config
58
+ };
59
+ if (verbosity > 1) {
60
+ console.log(request);
61
+ }
62
+ const response = await this.anthropic_bedrock_mantle.messages.create(request);
62
63
  const usage = response.usage;
63
64
  if (verbosity > 0) {
64
65
  console.log(usage);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-utils",
3
- "version": "1.4.142",
3
+ "version": "1.4.143",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
@@ -1,6 +1,6 @@
1
1
  import { BedrockRuntime } from "@aws-sdk/client-bedrock-runtime"
2
2
  import { AnthropicBedrockMantle } from "@anthropic-ai/bedrock-sdk"
3
- import { ContentBlockParam, MessageParam } from "@anthropic-ai/sdk/resources"
3
+ import { ContentBlockParam, MessageCreateParams, MessageParam, OutputConfig } from "@anthropic-ai/sdk/resources"
4
4
 
5
5
  const roles = ["user", "assistant", "system"] as const
6
6
 
@@ -63,23 +63,24 @@ export class UtilsBedrock {
63
63
  content : content
64
64
  })
65
65
  }
66
- const response = await this.anthropic_bedrock_mantle.messages.create({
66
+ const output_config : OutputConfig | undefined = options.json_format !== undefined ? {
67
+ format : {
68
+ type : "json_schema",
69
+ schema : options.json_format
70
+ }
71
+ } : undefined
72
+ const request : MessageCreateParams = {
67
73
  model : model_id,
68
74
  messages : message_params,
69
75
  system : options.system_prompt,
70
76
  tools : options.web === true ? [{ name : "web_search", type : "web_search_20250305" }] : undefined,
71
77
  max_tokens : options.max_num_tokens || 1000,
72
- output_config : options.json_format !== undefined ? {
73
- format : {
74
- type : "json_schema",
75
- schema : options.json_format
76
- }
77
- } : undefined,
78
- // cache_control : {
79
- // type : "ephemeral",
80
- // ttl : options.cache_period
81
- // }
82
- })
78
+ output_config : output_config
79
+ }
80
+ if (verbosity > 1) {
81
+ console.log(request)
82
+ }
83
+ const response = await this.anthropic_bedrock_mantle.messages.create(request)
83
84
 
84
85
  const usage = response.usage
85
86
  if (verbosity > 0) {