llm-exe 2.3.6 → 2.3.7

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/index.d.mts CHANGED
@@ -996,6 +996,10 @@ interface AmazonEmbeddingOptions extends GenericEmbeddingOptions {
996
996
  awsSecretKey?: string;
997
997
  awsAccessKey?: string;
998
998
  }
999
+ interface CohereBedrockEmbeddingOptions extends AmazonEmbeddingOptions {
1000
+ inputType?: "search_document" | "search_query" | "classification" | "clustering";
1001
+ truncate?: "NONE" | "START" | "END" | "LEFT" | "RIGHT";
1002
+ }
999
1003
  interface GenericLLm extends BaseLlmOptions {
1000
1004
  model?: string;
1001
1005
  system?: string;
@@ -1059,6 +1063,9 @@ type AllEmbedding = {
1059
1063
  "amazon.embedding.v1": {
1060
1064
  input: AmazonEmbeddingOptions;
1061
1065
  };
1066
+ "amazon:cohere.embedding.v1": {
1067
+ input: CohereBedrockEmbeddingOptions;
1068
+ };
1062
1069
  };
1063
1070
  type AllLlm = {
1064
1071
  "openai.chat.v1": {
@@ -1255,7 +1262,7 @@ interface BaseRequest<_T extends Record<string, any>> {
1255
1262
  interface BaseLlm<_T extends BaseLlCall = BaseLlCall> extends BaseRequest<_T> {
1256
1263
  }
1257
1264
 
1258
- type LlmProvider = "openai.chat" | "openai.embedding" | "google.embedding" | "openai.chat-mock" | "anthropic.chat" | "amazon:anthropic.chat" | "amazon:meta.chat" | "amazon:nova.chat" | "amazon.embedding" | "xai.chat" | "google.chat" | "ollama.chat" | "deepseek.chat";
1265
+ type LlmProvider = "openai.chat" | "openai.embedding" | "google.embedding" | "openai.chat-mock" | "anthropic.chat" | "amazon:anthropic.chat" | "amazon:meta.chat" | "amazon:nova.chat" | "amazon.embedding" | "amazon:cohere.embedding" | "xai.chat" | "google.chat" | "ollama.chat" | "deepseek.chat";
1259
1266
  interface Config<Pk = LlmProviderKey> {
1260
1267
  /**
1261
1268
  * Unique identifier for this configuration (e.g., "openai.chat.v1", "anthropic.claude-3-opus")
package/dist/index.d.ts CHANGED
@@ -996,6 +996,10 @@ interface AmazonEmbeddingOptions extends GenericEmbeddingOptions {
996
996
  awsSecretKey?: string;
997
997
  awsAccessKey?: string;
998
998
  }
999
+ interface CohereBedrockEmbeddingOptions extends AmazonEmbeddingOptions {
1000
+ inputType?: "search_document" | "search_query" | "classification" | "clustering";
1001
+ truncate?: "NONE" | "START" | "END" | "LEFT" | "RIGHT";
1002
+ }
999
1003
  interface GenericLLm extends BaseLlmOptions {
1000
1004
  model?: string;
1001
1005
  system?: string;
@@ -1059,6 +1063,9 @@ type AllEmbedding = {
1059
1063
  "amazon.embedding.v1": {
1060
1064
  input: AmazonEmbeddingOptions;
1061
1065
  };
1066
+ "amazon:cohere.embedding.v1": {
1067
+ input: CohereBedrockEmbeddingOptions;
1068
+ };
1062
1069
  };
1063
1070
  type AllLlm = {
1064
1071
  "openai.chat.v1": {
@@ -1255,7 +1262,7 @@ interface BaseRequest<_T extends Record<string, any>> {
1255
1262
  interface BaseLlm<_T extends BaseLlCall = BaseLlCall> extends BaseRequest<_T> {
1256
1263
  }
1257
1264
 
1258
- type LlmProvider = "openai.chat" | "openai.embedding" | "google.embedding" | "openai.chat-mock" | "anthropic.chat" | "amazon:anthropic.chat" | "amazon:meta.chat" | "amazon:nova.chat" | "amazon.embedding" | "xai.chat" | "google.chat" | "ollama.chat" | "deepseek.chat";
1265
+ type LlmProvider = "openai.chat" | "openai.embedding" | "google.embedding" | "openai.chat-mock" | "anthropic.chat" | "amazon:anthropic.chat" | "amazon:meta.chat" | "amazon:nova.chat" | "amazon.embedding" | "amazon:cohere.embedding" | "xai.chat" | "google.chat" | "ollama.chat" | "deepseek.chat";
1259
1266
  interface Config<Pk = LlmProviderKey> {
1260
1267
  /**
1261
1268
  * Unique identifier for this configuration (e.g., "openai.chat.v1", "anthropic.claude-3-opus")
package/dist/index.js CHANGED
@@ -3974,6 +3974,26 @@ function AmazonTitanEmbedding(result, config) {
3974
3974
  });
3975
3975
  }
3976
3976
 
3977
+ // src/embedding/output/CohereBedrockEmbedding.ts
3978
+ function CohereBedrockEmbedding(result, config) {
3979
+ const __result = deepClone(result);
3980
+ const model = config.model || "cohere.unknown";
3981
+ const created = (/* @__PURE__ */ new Date()).getTime();
3982
+ const embedding = Array.isArray(__result.embeddings) ? __result.embeddings : [];
3983
+ const usage = {
3984
+ output_tokens: 0,
3985
+ input_tokens: 0,
3986
+ total_tokens: 0
3987
+ };
3988
+ return BaseEmbeddingOutput({
3989
+ id: __result.id,
3990
+ model,
3991
+ created,
3992
+ usage,
3993
+ embedding
3994
+ });
3995
+ }
3996
+
3977
3997
  // src/embedding/config.ts
3978
3998
  var embeddingConfigs = {
3979
3999
  "openai.embedding.v1": {
@@ -4035,6 +4055,43 @@ var embeddingConfigs = {
4035
4055
  }
4036
4056
  },
4037
4057
  transformResponse: AmazonTitanEmbedding
4058
+ },
4059
+ "amazon:cohere.embedding.v1": {
4060
+ key: "amazon:cohere.embedding.v1",
4061
+ provider: "amazon:cohere.embedding",
4062
+ endpoint: `https://bedrock-runtime.{{awsRegion}}.amazonaws.com/model/{{model}}/invoke`,
4063
+ method: "POST",
4064
+ headers: `{"Content-Type": "application/json" }`,
4065
+ options: {
4066
+ input: {},
4067
+ inputType: {
4068
+ default: "search_document"
4069
+ },
4070
+ truncate: {},
4071
+ dimensions: {},
4072
+ awsRegion: {
4073
+ default: getEnvironmentVariable("AWS_REGION"),
4074
+ required: [true, "aws region is required"]
4075
+ },
4076
+ awsSecretKey: {},
4077
+ awsAccessKey: {}
4078
+ },
4079
+ mapBody: {
4080
+ input: {
4081
+ key: "texts",
4082
+ transform: (value) => Array.isArray(value) ? value : [value]
4083
+ },
4084
+ inputType: {
4085
+ key: "input_type"
4086
+ },
4087
+ truncate: {
4088
+ key: "truncate"
4089
+ },
4090
+ dimensions: {
4091
+ key: "output_dimension"
4092
+ }
4093
+ },
4094
+ transformResponse: CohereBedrockEmbedding
4038
4095
  }
4039
4096
  };
4040
4097
  function getEmbeddingConfig(provider) {
@@ -4055,6 +4112,8 @@ function getEmbeddingOutputParser(config, response) {
4055
4112
  return OpenAiEmbedding(response, config);
4056
4113
  case "amazon.embedding.v1":
4057
4114
  return AmazonTitanEmbedding(response, config);
4115
+ case "amazon:cohere.embedding.v1":
4116
+ return CohereBedrockEmbedding(response, config);
4058
4117
  default:
4059
4118
  throw new Error("Unsupported provider");
4060
4119
  }
package/dist/index.mjs CHANGED
@@ -3911,6 +3911,26 @@ function AmazonTitanEmbedding(result, config) {
3911
3911
  });
3912
3912
  }
3913
3913
 
3914
+ // src/embedding/output/CohereBedrockEmbedding.ts
3915
+ function CohereBedrockEmbedding(result, config) {
3916
+ const __result = deepClone(result);
3917
+ const model = config.model || "cohere.unknown";
3918
+ const created = (/* @__PURE__ */ new Date()).getTime();
3919
+ const embedding = Array.isArray(__result.embeddings) ? __result.embeddings : [];
3920
+ const usage = {
3921
+ output_tokens: 0,
3922
+ input_tokens: 0,
3923
+ total_tokens: 0
3924
+ };
3925
+ return BaseEmbeddingOutput({
3926
+ id: __result.id,
3927
+ model,
3928
+ created,
3929
+ usage,
3930
+ embedding
3931
+ });
3932
+ }
3933
+
3914
3934
  // src/embedding/config.ts
3915
3935
  var embeddingConfigs = {
3916
3936
  "openai.embedding.v1": {
@@ -3972,6 +3992,43 @@ var embeddingConfigs = {
3972
3992
  }
3973
3993
  },
3974
3994
  transformResponse: AmazonTitanEmbedding
3995
+ },
3996
+ "amazon:cohere.embedding.v1": {
3997
+ key: "amazon:cohere.embedding.v1",
3998
+ provider: "amazon:cohere.embedding",
3999
+ endpoint: `https://bedrock-runtime.{{awsRegion}}.amazonaws.com/model/{{model}}/invoke`,
4000
+ method: "POST",
4001
+ headers: `{"Content-Type": "application/json" }`,
4002
+ options: {
4003
+ input: {},
4004
+ inputType: {
4005
+ default: "search_document"
4006
+ },
4007
+ truncate: {},
4008
+ dimensions: {},
4009
+ awsRegion: {
4010
+ default: getEnvironmentVariable("AWS_REGION"),
4011
+ required: [true, "aws region is required"]
4012
+ },
4013
+ awsSecretKey: {},
4014
+ awsAccessKey: {}
4015
+ },
4016
+ mapBody: {
4017
+ input: {
4018
+ key: "texts",
4019
+ transform: (value) => Array.isArray(value) ? value : [value]
4020
+ },
4021
+ inputType: {
4022
+ key: "input_type"
4023
+ },
4024
+ truncate: {
4025
+ key: "truncate"
4026
+ },
4027
+ dimensions: {
4028
+ key: "output_dimension"
4029
+ }
4030
+ },
4031
+ transformResponse: CohereBedrockEmbedding
3975
4032
  }
3976
4033
  };
3977
4034
  function getEmbeddingConfig(provider) {
@@ -3992,6 +4049,8 @@ function getEmbeddingOutputParser(config, response) {
3992
4049
  return OpenAiEmbedding(response, config);
3993
4050
  case "amazon.embedding.v1":
3994
4051
  return AmazonTitanEmbedding(response, config);
4052
+ case "amazon:cohere.embedding.v1":
4053
+ return CohereBedrockEmbedding(response, config);
3995
4054
  default:
3996
4055
  throw new Error("Unsupported provider");
3997
4056
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "llm-exe",
3
- "version": "2.3.6",
3
+ "version": "2.3.7",
4
4
  "description": "Simplify building LLM-powered apps with easy-to-use base components, supporting text and chat-based prompts with handlebars template engine, output parsers, and flexible function calling capabilities.",
5
5
  "keywords": [
6
6
  "ai",