llm-exe 2.1.6 → 2.1.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
@@ -934,6 +934,12 @@ interface GeminiRequest extends GenericLLm {
934
934
  model: string;
935
935
  geminiApiKey?: string;
936
936
  }
937
+ interface DeepseekRequest extends GenericLLm {
938
+ model: string;
939
+ responseFormat?: Record<string, any>;
940
+ deepseekApiKey?: string;
941
+ useJson?: boolean;
942
+ }
937
943
  type AllEmbedding = {
938
944
  "openai.embedding.v1": {
939
945
  input: OpenAiEmbeddingOptions;
@@ -967,6 +973,9 @@ type AllLlm = {
967
973
  "google.chat.v1": {
968
974
  input: GeminiRequest;
969
975
  };
976
+ "deepseek.chat.v1": {
977
+ input: DeepseekRequest;
978
+ };
970
979
  };
971
980
  type AllUseLlmOptions = AllLlm & {
972
981
  "openai.gpt-4": {
@@ -1023,6 +1032,9 @@ type AllUseLlmOptions = AllLlm & {
1023
1032
  "ollama.qwq": {
1024
1033
  input: GenericLLm;
1025
1034
  };
1035
+ "deepseek.chat": {
1036
+ input: DeepseekRequest;
1037
+ };
1026
1038
  };
1027
1039
  type LlmProviderKey = keyof AllLlm;
1028
1040
  type EmbeddingProviderKey = keyof AllEmbedding;
@@ -1040,7 +1052,7 @@ interface BaseRequest<_T extends Record<string, any>> {
1040
1052
  interface BaseLlm<_T extends BaseLlCall = BaseLlCall> extends BaseRequest<_T> {
1041
1053
  }
1042
1054
 
1043
- 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";
1055
+ 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";
1044
1056
  interface Config<Pk = LlmProviderKey> {
1045
1057
  key: Pk;
1046
1058
  provider: LlmProvider;
@@ -1219,6 +1231,8 @@ declare namespace index {
1219
1231
  }
1220
1232
 
1221
1233
  declare const configs: {
1234
+ "deepseek.chat.v1": Config<keyof AllLlm>;
1235
+ "deepseek.chat": Config<keyof AllLlm>;
1222
1236
  "google.chat.v1": Config<keyof AllLlm>;
1223
1237
  "google.gemini-2.0-flash": Config<keyof AllLlm>;
1224
1238
  "google.gemini-2.0-flash-lite": Config<keyof AllLlm>;
package/dist/index.d.ts CHANGED
@@ -934,6 +934,12 @@ interface GeminiRequest extends GenericLLm {
934
934
  model: string;
935
935
  geminiApiKey?: string;
936
936
  }
937
+ interface DeepseekRequest extends GenericLLm {
938
+ model: string;
939
+ responseFormat?: Record<string, any>;
940
+ deepseekApiKey?: string;
941
+ useJson?: boolean;
942
+ }
937
943
  type AllEmbedding = {
938
944
  "openai.embedding.v1": {
939
945
  input: OpenAiEmbeddingOptions;
@@ -967,6 +973,9 @@ type AllLlm = {
967
973
  "google.chat.v1": {
968
974
  input: GeminiRequest;
969
975
  };
976
+ "deepseek.chat.v1": {
977
+ input: DeepseekRequest;
978
+ };
970
979
  };
971
980
  type AllUseLlmOptions = AllLlm & {
972
981
  "openai.gpt-4": {
@@ -1023,6 +1032,9 @@ type AllUseLlmOptions = AllLlm & {
1023
1032
  "ollama.qwq": {
1024
1033
  input: GenericLLm;
1025
1034
  };
1035
+ "deepseek.chat": {
1036
+ input: DeepseekRequest;
1037
+ };
1026
1038
  };
1027
1039
  type LlmProviderKey = keyof AllLlm;
1028
1040
  type EmbeddingProviderKey = keyof AllEmbedding;
@@ -1040,7 +1052,7 @@ interface BaseRequest<_T extends Record<string, any>> {
1040
1052
  interface BaseLlm<_T extends BaseLlCall = BaseLlCall> extends BaseRequest<_T> {
1041
1053
  }
1042
1054
 
1043
- 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";
1055
+ 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";
1044
1056
  interface Config<Pk = LlmProviderKey> {
1045
1057
  key: Pk;
1046
1058
  provider: LlmProvider;
@@ -1219,6 +1231,8 @@ declare namespace index {
1219
1231
  }
1220
1232
 
1221
1233
  declare const configs: {
1234
+ "deepseek.chat.v1": Config<keyof AllLlm>;
1235
+ "deepseek.chat": Config<keyof AllLlm>;
1222
1236
  "google.chat.v1": Config<keyof AllLlm>;
1223
1237
  "google.gemini-2.0-flash": Config<keyof AllLlm>;
1224
1238
  "google.gemini-2.0-flash-lite": Config<keyof AllLlm>;
package/dist/index.js CHANGED
@@ -2587,6 +2587,53 @@ var google = {
2587
2587
  "google.gemini-1.5-pro": withDefaultModel(googleGeminiChatV1, "gemini-1.5-pro")
2588
2588
  };
2589
2589
 
2590
+ // src/llm/config/deepseek/index.ts
2591
+ var deepseekChatV1 = {
2592
+ key: "deepseek.chat.v1",
2593
+ provider: "deepseek.chat",
2594
+ endpoint: `https://api.deepseek.com/v1/chat/completions`,
2595
+ options: {
2596
+ prompt: {},
2597
+ topP: {},
2598
+ useJson: {},
2599
+ deepseekApiKey: {
2600
+ default: getEnvironmentVariable("DEEPSEEK_API_KEY")
2601
+ }
2602
+ },
2603
+ method: "POST",
2604
+ headers: `{"Authorization":"Bearer {{deepseekApiKey}}", "Content-Type": "application/json" }`,
2605
+ mapBody: {
2606
+ prompt: {
2607
+ key: "messages",
2608
+ sanitize: /* @__PURE__ */ __name((v) => {
2609
+ if (typeof v === "string") {
2610
+ return [
2611
+ {
2612
+ role: "user",
2613
+ content: v
2614
+ }
2615
+ ];
2616
+ }
2617
+ return v;
2618
+ }, "sanitize")
2619
+ },
2620
+ model: {
2621
+ key: "model"
2622
+ },
2623
+ topP: {
2624
+ key: "top_p"
2625
+ },
2626
+ useJson: {
2627
+ key: "response_format.type",
2628
+ sanitize: /* @__PURE__ */ __name((v) => v ? "json_object" : "text", "sanitize")
2629
+ }
2630
+ }
2631
+ };
2632
+ var deepseek = {
2633
+ "deepseek.chat.v1": deepseekChatV1,
2634
+ "deepseek.chat": withDefaultModel(deepseekChatV1, "deepseek-chat")
2635
+ };
2636
+
2590
2637
  // src/llm/config.ts
2591
2638
  var configs = {
2592
2639
  ...openai,
@@ -2594,7 +2641,8 @@ var configs = {
2594
2641
  ...bedrock,
2595
2642
  ...xai,
2596
2643
  ...ollama,
2597
- ...google
2644
+ ...google,
2645
+ ...deepseek
2598
2646
  };
2599
2647
  function getLlmConfig(provider) {
2600
2648
  if (!provider) {
@@ -3027,6 +3075,9 @@ function getOutputParser(config, response) {
3027
3075
  return OutputOllamaChat(response, config);
3028
3076
  case "google.chat.v1":
3029
3077
  return OutputGoogleGeminiChat(response, config);
3078
+ case "deepseek.chat.v1":
3079
+ return OutputOpenAIChat(response, config);
3080
+ // use oai for now
3030
3081
  default: {
3031
3082
  if (config?.key?.startsWith("custom:")) {
3032
3083
  return OutputDefault(response, config);
package/dist/index.mjs CHANGED
@@ -2539,6 +2539,53 @@ var google = {
2539
2539
  "google.gemini-1.5-pro": withDefaultModel(googleGeminiChatV1, "gemini-1.5-pro")
2540
2540
  };
2541
2541
 
2542
+ // src/llm/config/deepseek/index.ts
2543
+ var deepseekChatV1 = {
2544
+ key: "deepseek.chat.v1",
2545
+ provider: "deepseek.chat",
2546
+ endpoint: `https://api.deepseek.com/v1/chat/completions`,
2547
+ options: {
2548
+ prompt: {},
2549
+ topP: {},
2550
+ useJson: {},
2551
+ deepseekApiKey: {
2552
+ default: getEnvironmentVariable("DEEPSEEK_API_KEY")
2553
+ }
2554
+ },
2555
+ method: "POST",
2556
+ headers: `{"Authorization":"Bearer {{deepseekApiKey}}", "Content-Type": "application/json" }`,
2557
+ mapBody: {
2558
+ prompt: {
2559
+ key: "messages",
2560
+ sanitize: /* @__PURE__ */ __name((v) => {
2561
+ if (typeof v === "string") {
2562
+ return [
2563
+ {
2564
+ role: "user",
2565
+ content: v
2566
+ }
2567
+ ];
2568
+ }
2569
+ return v;
2570
+ }, "sanitize")
2571
+ },
2572
+ model: {
2573
+ key: "model"
2574
+ },
2575
+ topP: {
2576
+ key: "top_p"
2577
+ },
2578
+ useJson: {
2579
+ key: "response_format.type",
2580
+ sanitize: /* @__PURE__ */ __name((v) => v ? "json_object" : "text", "sanitize")
2581
+ }
2582
+ }
2583
+ };
2584
+ var deepseek = {
2585
+ "deepseek.chat.v1": deepseekChatV1,
2586
+ "deepseek.chat": withDefaultModel(deepseekChatV1, "deepseek-chat")
2587
+ };
2588
+
2542
2589
  // src/llm/config.ts
2543
2590
  var configs = {
2544
2591
  ...openai,
@@ -2546,7 +2593,8 @@ var configs = {
2546
2593
  ...bedrock,
2547
2594
  ...xai,
2548
2595
  ...ollama,
2549
- ...google
2596
+ ...google,
2597
+ ...deepseek
2550
2598
  };
2551
2599
  function getLlmConfig(provider) {
2552
2600
  if (!provider) {
@@ -2979,6 +3027,9 @@ function getOutputParser(config, response) {
2979
3027
  return OutputOllamaChat(response, config);
2980
3028
  case "google.chat.v1":
2981
3029
  return OutputGoogleGeminiChat(response, config);
3030
+ case "deepseek.chat.v1":
3031
+ return OutputOpenAIChat(response, config);
3032
+ // use oai for now
2982
3033
  default: {
2983
3034
  if (config?.key?.startsWith("custom:")) {
2984
3035
  return OutputDefault(response, config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "llm-exe",
3
- "version": "2.1.6",
3
+ "version": "2.1.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",
package/readme.md CHANGED
@@ -7,7 +7,7 @@ A package that provides simplified base components to make building and maintain
7
7
  - Write functions powered by LLM's with easy to use building blocks.
8
8
  - Pure Javascript and Typescript. Allows you to pass and infer types.
9
9
  - Support for text-based (llama-3) and chat-based prompts. (gpt-4o, claude-3.5, grok-3, Gemini, Bedrock, Ollama, etc)
10
- - Call LLM's from different providers without changing your code. (OpenAi/Anthropic/xAI/Google/AWS Bedrock/Ollama)
10
+ - Call LLM's from different providers without changing your code. (OpenAi/Anthropic/xAI/Google/AWS Bedrock/Ollama/Deepseek)
11
11
  - Supercharge your prompts by using handlebars within prompt template.
12
12
  - Allow LLM's to call functions (or call other LLM executors).
13
13
  - Not very opinionated. You have control on how you use it.