modelfusion 0.110.0 → 0.111.0

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.
Files changed (223) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/core/api/ApiFacade.cjs +20 -0
  3. package/core/api/ApiFacade.d.ts +4 -0
  4. package/core/api/ApiFacade.js +4 -0
  5. package/core/api/BaseUrlApiConfiguration.cjs +47 -5
  6. package/core/api/BaseUrlApiConfiguration.d.ts +23 -6
  7. package/core/api/BaseUrlApiConfiguration.js +45 -4
  8. package/core/api/BaseUrlApiConfiguration.test.cjs +11 -0
  9. package/core/api/BaseUrlApiConfiguration.test.d.ts +1 -0
  10. package/core/api/BaseUrlApiConfiguration.test.js +9 -0
  11. package/core/api/callWithRetryAndThrottle.cjs +3 -3
  12. package/core/api/callWithRetryAndThrottle.js +3 -3
  13. package/core/api/index.cjs +15 -2
  14. package/core/api/index.d.ts +2 -2
  15. package/core/api/index.js +2 -2
  16. package/core/api/postToApi.cjs +28 -5
  17. package/core/api/postToApi.d.ts +5 -4
  18. package/core/api/postToApi.js +26 -4
  19. package/core/api/throttleOff.cjs +8 -0
  20. package/core/api/throttleOff.d.ts +5 -0
  21. package/core/api/throttleOff.js +4 -0
  22. package/internal/index.cjs +2 -8
  23. package/internal/index.d.ts +1 -1
  24. package/internal/index.js +1 -1
  25. package/model-function/generate-structure/generateStructure.d.ts +1 -1
  26. package/model-provider/anthropic/AnthropicApiConfiguration.cjs +14 -6
  27. package/model-provider/anthropic/AnthropicApiConfiguration.d.ts +7 -8
  28. package/model-provider/anthropic/AnthropicApiConfiguration.js +15 -7
  29. package/model-provider/anthropic/AnthropicError.cjs +7 -27
  30. package/model-provider/anthropic/AnthropicError.d.ts +21 -16
  31. package/model-provider/anthropic/AnthropicError.js +7 -25
  32. package/model-provider/anthropic/AnthropicFacade.cjs +10 -1
  33. package/model-provider/anthropic/AnthropicFacade.d.ts +9 -0
  34. package/model-provider/anthropic/AnthropicFacade.js +8 -0
  35. package/model-provider/anthropic/AnthropicTextGenerationModel.cjs +22 -24
  36. package/model-provider/anthropic/AnthropicTextGenerationModel.js +23 -25
  37. package/model-provider/anthropic/index.cjs +1 -4
  38. package/model-provider/anthropic/index.d.ts +1 -1
  39. package/model-provider/anthropic/index.js +0 -1
  40. package/model-provider/automatic1111/Automatic1111ApiConfiguration.cjs +12 -4
  41. package/model-provider/automatic1111/Automatic1111ApiConfiguration.d.ts +3 -3
  42. package/model-provider/automatic1111/Automatic1111ApiConfiguration.js +12 -4
  43. package/model-provider/automatic1111/Automatic1111Error.cjs +3 -3
  44. package/model-provider/automatic1111/Automatic1111Error.d.ts +13 -3
  45. package/model-provider/automatic1111/Automatic1111Error.js +4 -4
  46. package/model-provider/automatic1111/Automatic1111Facade.cjs +9 -9
  47. package/model-provider/automatic1111/Automatic1111Facade.d.ts +6 -6
  48. package/model-provider/automatic1111/Automatic1111Facade.js +7 -7
  49. package/model-provider/automatic1111/Automatic1111ImageGenerationModel.cjs +11 -7
  50. package/model-provider/automatic1111/Automatic1111ImageGenerationModel.js +11 -7
  51. package/model-provider/cohere/CohereApiConfiguration.cjs +14 -6
  52. package/model-provider/cohere/CohereApiConfiguration.d.ts +7 -8
  53. package/model-provider/cohere/CohereApiConfiguration.js +15 -7
  54. package/model-provider/cohere/CohereError.cjs +8 -43
  55. package/model-provider/cohere/CohereError.d.ts +9 -16
  56. package/model-provider/cohere/CohereError.js +8 -41
  57. package/model-provider/cohere/CohereFacade.cjs +12 -3
  58. package/model-provider/cohere/CohereFacade.d.ts +11 -2
  59. package/model-provider/cohere/CohereFacade.js +10 -2
  60. package/model-provider/cohere/CohereTextEmbeddingModel.cjs +18 -22
  61. package/model-provider/cohere/CohereTextEmbeddingModel.js +18 -22
  62. package/model-provider/cohere/CohereTextGenerationModel.cjs +31 -39
  63. package/model-provider/cohere/CohereTextGenerationModel.d.ts +110 -8
  64. package/model-provider/cohere/CohereTextGenerationModel.js +31 -39
  65. package/model-provider/cohere/CohereTokenizer.cjs +32 -41
  66. package/model-provider/cohere/CohereTokenizer.d.ts +2 -2
  67. package/model-provider/cohere/CohereTokenizer.js +32 -41
  68. package/model-provider/cohere/index.cjs +1 -3
  69. package/model-provider/cohere/index.d.ts +1 -1
  70. package/model-provider/cohere/index.js +0 -1
  71. package/model-provider/elevenlabs/ElevenLabsApiConfiguration.cjs +14 -6
  72. package/model-provider/elevenlabs/ElevenLabsApiConfiguration.d.ts +7 -8
  73. package/model-provider/elevenlabs/ElevenLabsApiConfiguration.js +15 -7
  74. package/model-provider/elevenlabs/ElevenLabsFacade.cjs +10 -1
  75. package/model-provider/elevenlabs/ElevenLabsFacade.d.ts +9 -0
  76. package/model-provider/elevenlabs/ElevenLabsFacade.js +8 -0
  77. package/model-provider/elevenlabs/ElevenLabsSpeechModel.cjs +42 -53
  78. package/model-provider/elevenlabs/ElevenLabsSpeechModel.js +44 -55
  79. package/model-provider/huggingface/HuggingFaceApiConfiguration.cjs +14 -6
  80. package/model-provider/huggingface/HuggingFaceApiConfiguration.d.ts +7 -8
  81. package/model-provider/huggingface/HuggingFaceApiConfiguration.js +15 -7
  82. package/model-provider/huggingface/HuggingFaceError.cjs +7 -29
  83. package/model-provider/huggingface/HuggingFaceError.d.ts +9 -16
  84. package/model-provider/huggingface/HuggingFaceError.js +7 -27
  85. package/model-provider/huggingface/HuggingFaceFacade.cjs +10 -1
  86. package/model-provider/huggingface/HuggingFaceFacade.d.ts +9 -0
  87. package/model-provider/huggingface/HuggingFaceFacade.js +8 -0
  88. package/model-provider/huggingface/HuggingFaceTextEmbeddingModel.cjs +17 -27
  89. package/model-provider/huggingface/HuggingFaceTextEmbeddingModel.js +17 -27
  90. package/model-provider/huggingface/HuggingFaceTextGenerationModel.cjs +22 -23
  91. package/model-provider/huggingface/HuggingFaceTextGenerationModel.js +22 -23
  92. package/model-provider/huggingface/index.cjs +1 -3
  93. package/model-provider/huggingface/index.d.ts +1 -1
  94. package/model-provider/huggingface/index.js +0 -1
  95. package/model-provider/llamacpp/LlamaCppApiConfiguration.cjs +13 -6
  96. package/model-provider/llamacpp/LlamaCppApiConfiguration.d.ts +7 -9
  97. package/model-provider/llamacpp/LlamaCppApiConfiguration.js +14 -7
  98. package/model-provider/llamacpp/LlamaCppCompletionModel.cjs +4 -4
  99. package/model-provider/llamacpp/LlamaCppCompletionModel.d.ts +173 -5
  100. package/model-provider/llamacpp/LlamaCppCompletionModel.js +4 -4
  101. package/model-provider/llamacpp/LlamaCppError.cjs +7 -27
  102. package/model-provider/llamacpp/LlamaCppError.d.ts +9 -16
  103. package/model-provider/llamacpp/LlamaCppError.js +7 -25
  104. package/model-provider/llamacpp/LlamaCppFacade.cjs +10 -2
  105. package/model-provider/llamacpp/LlamaCppFacade.d.ts +8 -1
  106. package/model-provider/llamacpp/LlamaCppFacade.js +8 -1
  107. package/model-provider/llamacpp/LlamaCppTextEmbeddingModel.cjs +10 -14
  108. package/model-provider/llamacpp/LlamaCppTextEmbeddingModel.js +10 -14
  109. package/model-provider/llamacpp/LlamaCppTokenizer.cjs +14 -18
  110. package/model-provider/llamacpp/LlamaCppTokenizer.js +14 -18
  111. package/model-provider/llamacpp/index.cjs +1 -3
  112. package/model-provider/llamacpp/index.d.ts +1 -1
  113. package/model-provider/llamacpp/index.js +0 -1
  114. package/model-provider/lmnt/LmntApiConfiguration.cjs +14 -6
  115. package/model-provider/lmnt/LmntApiConfiguration.d.ts +7 -8
  116. package/model-provider/lmnt/LmntApiConfiguration.js +15 -7
  117. package/model-provider/lmnt/LmntFacade.cjs +11 -2
  118. package/model-provider/lmnt/LmntFacade.d.ts +10 -1
  119. package/model-provider/lmnt/LmntFacade.js +9 -1
  120. package/model-provider/lmnt/LmntSpeechModel.cjs +53 -41
  121. package/model-provider/lmnt/LmntSpeechModel.d.ts +51 -3
  122. package/model-provider/lmnt/LmntSpeechModel.js +54 -42
  123. package/model-provider/mistral/MistralApiConfiguration.cjs +14 -6
  124. package/model-provider/mistral/MistralApiConfiguration.d.ts +9 -11
  125. package/model-provider/mistral/MistralApiConfiguration.js +15 -7
  126. package/model-provider/mistral/MistralChatModel.cjs +4 -4
  127. package/model-provider/mistral/MistralChatModel.d.ts +48 -3
  128. package/model-provider/mistral/MistralChatModel.js +5 -5
  129. package/model-provider/mistral/MistralError.cjs +3 -3
  130. package/model-provider/mistral/MistralError.d.ts +15 -3
  131. package/model-provider/mistral/MistralError.js +4 -4
  132. package/model-provider/mistral/MistralFacade.cjs +5 -1
  133. package/model-provider/mistral/MistralFacade.d.ts +10 -3
  134. package/model-provider/mistral/MistralFacade.js +6 -2
  135. package/model-provider/mistral/MistralTextEmbeddingModel.cjs +2 -1
  136. package/model-provider/mistral/MistralTextEmbeddingModel.js +2 -1
  137. package/model-provider/ollama/OllamaApiConfiguration.cjs +13 -6
  138. package/model-provider/ollama/OllamaApiConfiguration.d.ts +7 -10
  139. package/model-provider/ollama/OllamaApiConfiguration.js +14 -7
  140. package/model-provider/ollama/OllamaChatModel.cjs +4 -4
  141. package/model-provider/ollama/OllamaChatModel.d.ts +46 -5
  142. package/model-provider/ollama/OllamaChatModel.js +5 -5
  143. package/model-provider/ollama/OllamaCompletionModel.cjs +4 -4
  144. package/model-provider/ollama/OllamaCompletionModel.d.ts +40 -5
  145. package/model-provider/ollama/OllamaCompletionModel.js +5 -5
  146. package/model-provider/ollama/OllamaError.cjs +3 -3
  147. package/model-provider/ollama/OllamaError.d.ts +7 -3
  148. package/model-provider/ollama/OllamaError.js +4 -4
  149. package/model-provider/ollama/OllamaFacade.cjs +6 -2
  150. package/model-provider/ollama/OllamaFacade.d.ts +8 -3
  151. package/model-provider/ollama/OllamaFacade.js +6 -2
  152. package/model-provider/ollama/OllamaTextEmbeddingModel.cjs +15 -16
  153. package/model-provider/ollama/OllamaTextEmbeddingModel.js +15 -16
  154. package/model-provider/openai/AbstractOpenAIChatModel.cjs +4 -4
  155. package/model-provider/openai/AbstractOpenAIChatModel.d.ts +148 -2
  156. package/model-provider/openai/AbstractOpenAIChatModel.js +4 -4
  157. package/model-provider/openai/AbstractOpenAICompletionModel.cjs +30 -32
  158. package/model-provider/openai/AbstractOpenAICompletionModel.js +30 -32
  159. package/model-provider/openai/AzureOpenAIApiConfiguration.d.ts +9 -8
  160. package/model-provider/openai/OpenAIApiConfiguration.cjs +14 -6
  161. package/model-provider/openai/OpenAIApiConfiguration.d.ts +7 -8
  162. package/model-provider/openai/OpenAIApiConfiguration.js +15 -7
  163. package/model-provider/openai/OpenAIError.cjs +8 -8
  164. package/model-provider/openai/OpenAIError.d.ts +27 -3
  165. package/model-provider/openai/OpenAIError.js +9 -9
  166. package/model-provider/openai/OpenAIFacade.cjs +23 -2
  167. package/model-provider/openai/OpenAIFacade.d.ts +20 -2
  168. package/model-provider/openai/OpenAIFacade.js +20 -1
  169. package/model-provider/openai/OpenAIImageGenerationModel.cjs +20 -21
  170. package/model-provider/openai/OpenAIImageGenerationModel.js +20 -21
  171. package/model-provider/openai/OpenAISpeechModel.cjs +17 -22
  172. package/model-provider/openai/OpenAISpeechModel.js +17 -22
  173. package/model-provider/openai/OpenAITextEmbeddingModel.cjs +18 -23
  174. package/model-provider/openai/OpenAITextEmbeddingModel.js +18 -23
  175. package/model-provider/openai/OpenAITranscriptionModel.cjs +42 -48
  176. package/model-provider/openai/OpenAITranscriptionModel.d.ts +14 -10
  177. package/model-provider/openai/OpenAITranscriptionModel.js +42 -48
  178. package/model-provider/openai-compatible/FireworksAIApiConfiguration.cjs +11 -7
  179. package/model-provider/openai-compatible/FireworksAIApiConfiguration.d.ts +4 -9
  180. package/model-provider/openai-compatible/FireworksAIApiConfiguration.js +12 -8
  181. package/model-provider/openai-compatible/OpenAICompatibleFacade.cjs +25 -1
  182. package/model-provider/openai-compatible/OpenAICompatibleFacade.d.ts +23 -0
  183. package/model-provider/openai-compatible/OpenAICompatibleFacade.js +22 -0
  184. package/model-provider/openai-compatible/TogetherAIApiConfiguration.cjs +11 -7
  185. package/model-provider/openai-compatible/TogetherAIApiConfiguration.d.ts +4 -9
  186. package/model-provider/openai-compatible/TogetherAIApiConfiguration.js +12 -8
  187. package/model-provider/stability/StabilityApiConfiguration.cjs +13 -12
  188. package/model-provider/stability/StabilityApiConfiguration.d.ts +4 -4
  189. package/model-provider/stability/StabilityApiConfiguration.js +13 -12
  190. package/model-provider/stability/StabilityError.cjs +3 -3
  191. package/model-provider/stability/StabilityError.d.ts +7 -3
  192. package/model-provider/stability/StabilityError.js +4 -4
  193. package/model-provider/stability/StabilityFacade.cjs +9 -9
  194. package/model-provider/stability/StabilityFacade.d.ts +8 -8
  195. package/model-provider/stability/StabilityFacade.js +7 -7
  196. package/model-provider/stability/StabilityImageGenerationModel.cjs +2 -1
  197. package/model-provider/stability/StabilityImageGenerationModel.js +2 -1
  198. package/model-provider/whispercpp/WhisperCppApiConfiguration.cjs +13 -6
  199. package/model-provider/whispercpp/WhisperCppApiConfiguration.d.ts +7 -10
  200. package/model-provider/whispercpp/WhisperCppApiConfiguration.js +14 -7
  201. package/model-provider/whispercpp/WhisperCppFacade.cjs +9 -5
  202. package/model-provider/whispercpp/WhisperCppFacade.d.ts +7 -2
  203. package/model-provider/whispercpp/WhisperCppFacade.js +8 -4
  204. package/model-provider/whispercpp/WhisperCppTranscriptionModel.cjs +5 -2
  205. package/model-provider/whispercpp/WhisperCppTranscriptionModel.js +6 -3
  206. package/package.json +1 -1
  207. package/tool/WebSearchTool.cjs +2 -2
  208. package/tool/WebSearchTool.d.ts +1 -2
  209. package/tool/WebSearchTool.js +3 -3
  210. package/vector-index/memory/MemoryVectorIndex.cjs +2 -2
  211. package/vector-index/memory/MemoryVectorIndex.js +3 -3
  212. package/core/api/BaseUrlPartsApiConfiguration.cjs +0 -53
  213. package/core/api/BaseUrlPartsApiConfiguration.d.ts +0 -26
  214. package/core/api/BaseUrlPartsApiConfiguration.js +0 -49
  215. package/core/api/throttleUnlimitedConcurrency.cjs +0 -8
  216. package/core/api/throttleUnlimitedConcurrency.d.ts +0 -5
  217. package/core/api/throttleUnlimitedConcurrency.js +0 -4
  218. package/model-provider/elevenlabs/ElevenLabsError.cjs +0 -30
  219. package/model-provider/elevenlabs/ElevenLabsError.d.ts +0 -3
  220. package/model-provider/elevenlabs/ElevenLabsError.js +0 -26
  221. package/model-provider/lmnt/LmntError.cjs +0 -30
  222. package/model-provider/lmnt/LmntError.d.ts +0 -3
  223. package/model-provider/lmnt/LmntError.js +0 -26
@@ -3,19 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ElevenLabsApiConfiguration = void 0;
4
4
  const BaseUrlApiConfiguration_js_1 = require("../../core/api/BaseUrlApiConfiguration.cjs");
5
5
  const loadApiKey_js_1 = require("../../core/api/loadApiKey.cjs");
6
- class ElevenLabsApiConfiguration extends BaseUrlApiConfiguration_js_1.BaseUrlApiConfiguration {
7
- constructor({ baseUrl = "https://api.elevenlabs.io/v1", apiKey, retry, throttle, } = {}) {
6
+ /**
7
+ * Creates an API configuration for ElevenLabs API.
8
+ * It calls the API at https://api.elevenlabs.io/v1 and uses the `ELEVENLABS_API_KEY` env variable by default.
9
+ */
10
+ class ElevenLabsApiConfiguration extends BaseUrlApiConfiguration_js_1.BaseUrlApiConfigurationWithDefaults {
11
+ constructor(settings = {}) {
8
12
  super({
9
- baseUrl,
13
+ ...settings,
10
14
  headers: {
11
15
  "xi-api-key": (0, loadApiKey_js_1.loadApiKey)({
12
- apiKey,
16
+ apiKey: settings.apiKey,
13
17
  environmentVariableName: "ELEVENLABS_API_KEY",
14
18
  description: "ElevenLabs",
15
19
  }),
16
20
  },
17
- retry,
18
- throttle,
21
+ baseUrlDefaults: {
22
+ protocol: "https",
23
+ host: "api.elevenlabs.io",
24
+ port: "443",
25
+ path: "/v1",
26
+ },
19
27
  });
20
28
  }
21
29
  get apiKey() {
@@ -1,12 +1,11 @@
1
- import { BaseUrlApiConfiguration } from "../../core/api/BaseUrlApiConfiguration.js";
2
- import { RetryFunction } from "../../core/api/RetryFunction.js";
3
- import { ThrottleFunction } from "../../core/api/ThrottleFunction.js";
4
- export declare class ElevenLabsApiConfiguration extends BaseUrlApiConfiguration {
5
- constructor({ baseUrl, apiKey, retry, throttle, }?: {
6
- baseUrl?: string;
1
+ import { BaseUrlApiConfigurationWithDefaults, PartialBaseUrlPartsApiConfigurationOptions } from "../../core/api/BaseUrlApiConfiguration.js";
2
+ /**
3
+ * Creates an API configuration for ElevenLabs API.
4
+ * It calls the API at https://api.elevenlabs.io/v1 and uses the `ELEVENLABS_API_KEY` env variable by default.
5
+ */
6
+ export declare class ElevenLabsApiConfiguration extends BaseUrlApiConfigurationWithDefaults {
7
+ constructor(settings?: PartialBaseUrlPartsApiConfigurationOptions & {
7
8
  apiKey?: string;
8
- retry?: RetryFunction;
9
- throttle?: ThrottleFunction;
10
9
  });
11
10
  get apiKey(): string;
12
11
  }
@@ -1,18 +1,26 @@
1
- import { BaseUrlApiConfiguration } from "../../core/api/BaseUrlApiConfiguration.js";
1
+ import { BaseUrlApiConfigurationWithDefaults, } from "../../core/api/BaseUrlApiConfiguration.js";
2
2
  import { loadApiKey } from "../../core/api/loadApiKey.js";
3
- export class ElevenLabsApiConfiguration extends BaseUrlApiConfiguration {
4
- constructor({ baseUrl = "https://api.elevenlabs.io/v1", apiKey, retry, throttle, } = {}) {
3
+ /**
4
+ * Creates an API configuration for ElevenLabs API.
5
+ * It calls the API at https://api.elevenlabs.io/v1 and uses the `ELEVENLABS_API_KEY` env variable by default.
6
+ */
7
+ export class ElevenLabsApiConfiguration extends BaseUrlApiConfigurationWithDefaults {
8
+ constructor(settings = {}) {
5
9
  super({
6
- baseUrl,
10
+ ...settings,
7
11
  headers: {
8
12
  "xi-api-key": loadApiKey({
9
- apiKey,
13
+ apiKey: settings.apiKey,
10
14
  environmentVariableName: "ELEVENLABS_API_KEY",
11
15
  description: "ElevenLabs",
12
16
  }),
13
17
  },
14
- retry,
15
- throttle,
18
+ baseUrlDefaults: {
19
+ protocol: "https",
20
+ host: "api.elevenlabs.io",
21
+ port: "443",
22
+ path: "/v1",
23
+ },
16
24
  });
17
25
  }
18
26
  get apiKey() {
@@ -1,7 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SpeechGenerator = void 0;
3
+ exports.SpeechGenerator = exports.Api = void 0;
4
+ const ElevenLabsApiConfiguration_js_1 = require("./ElevenLabsApiConfiguration.cjs");
4
5
  const ElevenLabsSpeechModel_js_1 = require("./ElevenLabsSpeechModel.cjs");
6
+ /**
7
+ * Creates an API configuration for the ElevenLabs API.
8
+ * It calls the API at https://api.elevenlabs.io/v1 and uses the `ELEVENLABS_API_KEY` env variable by default.
9
+ */
10
+ function Api(settings) {
11
+ return new ElevenLabsApiConfiguration_js_1.ElevenLabsApiConfiguration(settings);
12
+ }
13
+ exports.Api = Api;
5
14
  /**
6
15
  * Synthesize speech using the ElevenLabs Text to Speech API.
7
16
  *
@@ -1,4 +1,13 @@
1
+ import { PartialBaseUrlPartsApiConfigurationOptions } from "../../core/api/BaseUrlApiConfiguration.js";
2
+ import { ElevenLabsApiConfiguration } from "./ElevenLabsApiConfiguration.js";
1
3
  import { ElevenLabsSpeechModel, ElevenLabsSpeechModelSettings } from "./ElevenLabsSpeechModel.js";
4
+ /**
5
+ * Creates an API configuration for the ElevenLabs API.
6
+ * It calls the API at https://api.elevenlabs.io/v1 and uses the `ELEVENLABS_API_KEY` env variable by default.
7
+ */
8
+ export declare function Api(settings: PartialBaseUrlPartsApiConfigurationOptions & {
9
+ apiKey?: string;
10
+ }): ElevenLabsApiConfiguration;
2
11
  /**
3
12
  * Synthesize speech using the ElevenLabs Text to Speech API.
4
13
  *
@@ -1,4 +1,12 @@
1
+ import { ElevenLabsApiConfiguration } from "./ElevenLabsApiConfiguration.js";
1
2
  import { ElevenLabsSpeechModel, } from "./ElevenLabsSpeechModel.js";
3
+ /**
4
+ * Creates an API configuration for the ElevenLabs API.
5
+ * It calls the API at https://api.elevenlabs.io/v1 and uses the `ELEVENLABS_API_KEY` env variable by default.
6
+ */
7
+ export function Api(settings) {
8
+ return new ElevenLabsApiConfiguration(settings);
9
+ }
2
10
  /**
3
11
  * Synthesize speech using the ElevenLabs Text to Speech API.
4
12
  *
@@ -5,12 +5,11 @@ const zod_1 = require("zod");
5
5
  const callWithRetryAndThrottle_js_1 = require("../../core/api/callWithRetryAndThrottle.cjs");
6
6
  const postToApi_js_1 = require("../../core/api/postToApi.cjs");
7
7
  const ZodSchema_js_1 = require("../../core/schema/ZodSchema.cjs");
8
+ const parseJSON_js_1 = require("../../core/schema/parseJSON.cjs");
8
9
  const AbstractModel_js_1 = require("../../model-function/AbstractModel.cjs");
9
10
  const AsyncQueue_js_1 = require("../../util/AsyncQueue.cjs");
10
11
  const SimpleWebSocket_js_1 = require("../../util/SimpleWebSocket.cjs");
11
- const parseJSON_js_1 = require("../../core/schema/parseJSON.cjs");
12
12
  const ElevenLabsApiConfiguration_js_1 = require("./ElevenLabsApiConfiguration.cjs");
13
- const ElevenLabsError_js_1 = require("./ElevenLabsError.cjs");
14
13
  const elevenLabsModels = [
15
14
  "eleven_multilingual_v2",
16
15
  "eleven_multilingual_v1",
@@ -18,27 +17,6 @@ const elevenLabsModels = [
18
17
  "eleven_turbo_v2",
19
18
  ];
20
19
  const defaultModel = "eleven_monolingual_v1";
21
- const streamingResponseSchema = new ZodSchema_js_1.ZodSchema(zod_1.z.union([
22
- zod_1.z.object({
23
- audio: zod_1.z.string(),
24
- isFinal: zod_1.z.literal(false).nullable(),
25
- normalizedAlignment: zod_1.z
26
- .object({
27
- chars: zod_1.z.array(zod_1.z.string()),
28
- charStartTimesMs: zod_1.z.array(zod_1.z.number()),
29
- charDurationsMs: zod_1.z.array(zod_1.z.number()),
30
- })
31
- .nullable(),
32
- }),
33
- zod_1.z.object({
34
- isFinal: zod_1.z.literal(true),
35
- }),
36
- zod_1.z.object({
37
- message: zod_1.z.string(),
38
- error: zod_1.z.string(),
39
- code: zod_1.z.number(),
40
- }),
41
- ]));
42
20
  /**
43
21
  * Synthesize speech using the ElevenLabs Text to Speech API.
44
22
  *
@@ -61,16 +39,25 @@ class ElevenLabsSpeechModel extends AbstractModel_js_1.AbstractModel {
61
39
  return this.settings.voice;
62
40
  }
63
41
  async callAPI(text, options) {
42
+ const api = this.settings.api ?? new ElevenLabsApiConfiguration_js_1.ElevenLabsApiConfiguration();
43
+ const abortSignal = options?.run?.abortSignal;
64
44
  return (0, callWithRetryAndThrottle_js_1.callWithRetryAndThrottle)({
65
- retry: this.settings.api?.retry,
66
- throttle: this.settings.api?.throttle,
67
- call: async () => callElevenLabsTextToSpeechAPI({
68
- api: this.settings.api,
69
- abortSignal: options?.run?.abortSignal,
70
- text,
71
- voiceId: this.settings.voice,
72
- modelId: this.settings.model,
73
- voiceSettings: this.settings.voiceSettings,
45
+ retry: api.retry,
46
+ throttle: api.throttle,
47
+ call: async () => (0, postToApi_js_1.postJsonToApi)({
48
+ url: api.assembleUrl(`/text-to-speech/${this.settings.voice}${assembleQuery({
49
+ optimize_streaming_latency: this.settings.optimizeStreamingLatency,
50
+ output_format: this.settings.outputFormat,
51
+ })}`),
52
+ headers: api.headers,
53
+ body: {
54
+ text,
55
+ model_id: this.settings.model ?? defaultModel,
56
+ voice_settings: toApiVoiceSettings(this.settings.voiceSettings),
57
+ },
58
+ failedResponseHandler: (0, postToApi_js_1.createTextErrorResponseHandler)(),
59
+ successfulResponseHandler: (0, postToApi_js_1.createAudioMpegResponseHandler)(),
60
+ abortSignal,
74
61
  }),
75
62
  });
76
63
  }
@@ -135,7 +122,7 @@ class ElevenLabsSpeechModel extends AbstractModel_js_1.AbstractModel {
135
122
  socket.onmessage = (event) => {
136
123
  const parseResult = (0, parseJSON_js_1.safeParseJSON)({
137
124
  text: event.data,
138
- schema: streamingResponseSchema,
125
+ schema: (0, ZodSchema_js_1.zodSchema)(streamingResponseSchema),
139
126
  });
140
127
  if (!parseResult.success) {
141
128
  queue.push({ type: "error", error: parseResult.error });
@@ -169,23 +156,27 @@ class ElevenLabsSpeechModel extends AbstractModel_js_1.AbstractModel {
169
156
  }
170
157
  }
171
158
  exports.ElevenLabsSpeechModel = ElevenLabsSpeechModel;
172
- async function callElevenLabsTextToSpeechAPI({ api = new ElevenLabsApiConfiguration_js_1.ElevenLabsApiConfiguration(), abortSignal, text, voiceId, modelId, optimizeStreamingLatency, outputFormat, voiceSettings, }) {
173
- return (0, postToApi_js_1.postJsonToApi)({
174
- url: api.assembleUrl(`/text-to-speech/${voiceId}${assembleQuery({
175
- optimize_streaming_latency: optimizeStreamingLatency,
176
- output_format: outputFormat,
177
- })}`),
178
- headers: api.headers,
179
- body: {
180
- text,
181
- model_id: modelId ?? defaultModel,
182
- voice_settings: toApiVoiceSettings(voiceSettings),
183
- },
184
- failedResponseHandler: ElevenLabsError_js_1.failedElevenLabsCallResponseHandler,
185
- successfulResponseHandler: (0, postToApi_js_1.createAudioMpegResponseHandler)(),
186
- abortSignal,
187
- });
188
- }
159
+ const streamingResponseSchema = zod_1.z.union([
160
+ zod_1.z.object({
161
+ audio: zod_1.z.string(),
162
+ isFinal: zod_1.z.literal(false).nullable(),
163
+ normalizedAlignment: zod_1.z
164
+ .object({
165
+ chars: zod_1.z.array(zod_1.z.string()),
166
+ charStartTimesMs: zod_1.z.array(zod_1.z.number()),
167
+ charDurationsMs: zod_1.z.array(zod_1.z.number()),
168
+ })
169
+ .nullable(),
170
+ }),
171
+ zod_1.z.object({
172
+ isFinal: zod_1.z.literal(true),
173
+ }),
174
+ zod_1.z.object({
175
+ message: zod_1.z.string(),
176
+ error: zod_1.z.string(),
177
+ code: zod_1.z.number(),
178
+ }),
179
+ ]);
189
180
  function assembleQuery(parameters) {
190
181
  let query = "";
191
182
  let hasQuestionMark = false;
@@ -216,8 +207,6 @@ function toApiVoiceSettings(voiceSettings) {
216
207
  }
217
208
  function toGenerationConfig(generationConfig) {
218
209
  return generationConfig != null
219
- ? {
220
- chunk_length_schedule: generationConfig.chunkLengthSchedule,
221
- }
210
+ ? { chunk_length_schedule: generationConfig.chunkLengthSchedule }
222
211
  : undefined;
223
212
  }
@@ -1,13 +1,12 @@
1
1
  import { z } from "zod";
2
2
  import { callWithRetryAndThrottle } from "../../core/api/callWithRetryAndThrottle.js";
3
- import { createAudioMpegResponseHandler, postJsonToApi, } from "../../core/api/postToApi.js";
4
- import { ZodSchema } from "../../core/schema/ZodSchema.js";
3
+ import { createAudioMpegResponseHandler, createTextErrorResponseHandler, postJsonToApi, } from "../../core/api/postToApi.js";
4
+ import { zodSchema } from "../../core/schema/ZodSchema.js";
5
+ import { safeParseJSON } from "../../core/schema/parseJSON.js";
5
6
  import { AbstractModel } from "../../model-function/AbstractModel.js";
6
7
  import { AsyncQueue } from "../../util/AsyncQueue.js";
7
8
  import { createSimpleWebSocket } from "../../util/SimpleWebSocket.js";
8
- import { safeParseJSON } from "../../core/schema/parseJSON.js";
9
9
  import { ElevenLabsApiConfiguration } from "./ElevenLabsApiConfiguration.js";
10
- import { failedElevenLabsCallResponseHandler } from "./ElevenLabsError.js";
11
10
  const elevenLabsModels = [
12
11
  "eleven_multilingual_v2",
13
12
  "eleven_multilingual_v1",
@@ -15,27 +14,6 @@ const elevenLabsModels = [
15
14
  "eleven_turbo_v2",
16
15
  ];
17
16
  const defaultModel = "eleven_monolingual_v1";
18
- const streamingResponseSchema = new ZodSchema(z.union([
19
- z.object({
20
- audio: z.string(),
21
- isFinal: z.literal(false).nullable(),
22
- normalizedAlignment: z
23
- .object({
24
- chars: z.array(z.string()),
25
- charStartTimesMs: z.array(z.number()),
26
- charDurationsMs: z.array(z.number()),
27
- })
28
- .nullable(),
29
- }),
30
- z.object({
31
- isFinal: z.literal(true),
32
- }),
33
- z.object({
34
- message: z.string(),
35
- error: z.string(),
36
- code: z.number(),
37
- }),
38
- ]));
39
17
  /**
40
18
  * Synthesize speech using the ElevenLabs Text to Speech API.
41
19
  *
@@ -58,16 +36,25 @@ export class ElevenLabsSpeechModel extends AbstractModel {
58
36
  return this.settings.voice;
59
37
  }
60
38
  async callAPI(text, options) {
39
+ const api = this.settings.api ?? new ElevenLabsApiConfiguration();
40
+ const abortSignal = options?.run?.abortSignal;
61
41
  return callWithRetryAndThrottle({
62
- retry: this.settings.api?.retry,
63
- throttle: this.settings.api?.throttle,
64
- call: async () => callElevenLabsTextToSpeechAPI({
65
- api: this.settings.api,
66
- abortSignal: options?.run?.abortSignal,
67
- text,
68
- voiceId: this.settings.voice,
69
- modelId: this.settings.model,
70
- voiceSettings: this.settings.voiceSettings,
42
+ retry: api.retry,
43
+ throttle: api.throttle,
44
+ call: async () => postJsonToApi({
45
+ url: api.assembleUrl(`/text-to-speech/${this.settings.voice}${assembleQuery({
46
+ optimize_streaming_latency: this.settings.optimizeStreamingLatency,
47
+ output_format: this.settings.outputFormat,
48
+ })}`),
49
+ headers: api.headers,
50
+ body: {
51
+ text,
52
+ model_id: this.settings.model ?? defaultModel,
53
+ voice_settings: toApiVoiceSettings(this.settings.voiceSettings),
54
+ },
55
+ failedResponseHandler: createTextErrorResponseHandler(),
56
+ successfulResponseHandler: createAudioMpegResponseHandler(),
57
+ abortSignal,
71
58
  }),
72
59
  });
73
60
  }
@@ -132,7 +119,7 @@ export class ElevenLabsSpeechModel extends AbstractModel {
132
119
  socket.onmessage = (event) => {
133
120
  const parseResult = safeParseJSON({
134
121
  text: event.data,
135
- schema: streamingResponseSchema,
122
+ schema: zodSchema(streamingResponseSchema),
136
123
  });
137
124
  if (!parseResult.success) {
138
125
  queue.push({ type: "error", error: parseResult.error });
@@ -165,23 +152,27 @@ export class ElevenLabsSpeechModel extends AbstractModel {
165
152
  });
166
153
  }
167
154
  }
168
- async function callElevenLabsTextToSpeechAPI({ api = new ElevenLabsApiConfiguration(), abortSignal, text, voiceId, modelId, optimizeStreamingLatency, outputFormat, voiceSettings, }) {
169
- return postJsonToApi({
170
- url: api.assembleUrl(`/text-to-speech/${voiceId}${assembleQuery({
171
- optimize_streaming_latency: optimizeStreamingLatency,
172
- output_format: outputFormat,
173
- })}`),
174
- headers: api.headers,
175
- body: {
176
- text,
177
- model_id: modelId ?? defaultModel,
178
- voice_settings: toApiVoiceSettings(voiceSettings),
179
- },
180
- failedResponseHandler: failedElevenLabsCallResponseHandler,
181
- successfulResponseHandler: createAudioMpegResponseHandler(),
182
- abortSignal,
183
- });
184
- }
155
+ const streamingResponseSchema = z.union([
156
+ z.object({
157
+ audio: z.string(),
158
+ isFinal: z.literal(false).nullable(),
159
+ normalizedAlignment: z
160
+ .object({
161
+ chars: z.array(z.string()),
162
+ charStartTimesMs: z.array(z.number()),
163
+ charDurationsMs: z.array(z.number()),
164
+ })
165
+ .nullable(),
166
+ }),
167
+ z.object({
168
+ isFinal: z.literal(true),
169
+ }),
170
+ z.object({
171
+ message: z.string(),
172
+ error: z.string(),
173
+ code: z.number(),
174
+ }),
175
+ ]);
185
176
  function assembleQuery(parameters) {
186
177
  let query = "";
187
178
  let hasQuestionMark = false;
@@ -212,8 +203,6 @@ function toApiVoiceSettings(voiceSettings) {
212
203
  }
213
204
  function toGenerationConfig(generationConfig) {
214
205
  return generationConfig != null
215
- ? {
216
- chunk_length_schedule: generationConfig.chunkLengthSchedule,
217
- }
206
+ ? { chunk_length_schedule: generationConfig.chunkLengthSchedule }
218
207
  : undefined;
219
208
  }
@@ -3,19 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HuggingFaceApiConfiguration = void 0;
4
4
  const BaseUrlApiConfiguration_js_1 = require("../../core/api/BaseUrlApiConfiguration.cjs");
5
5
  const loadApiKey_js_1 = require("../../core/api/loadApiKey.cjs");
6
- class HuggingFaceApiConfiguration extends BaseUrlApiConfiguration_js_1.BaseUrlApiConfiguration {
7
- constructor({ baseUrl = "https://api-inference.huggingface.co/models", apiKey, retry, throttle, } = {}) {
6
+ /**
7
+ * Creates an API configuration for the HuggingFace API.
8
+ * It calls the API at https://api-inference.huggingface.co/models and uses the `HUGGINGFACE_API_KEY` env variable by default.
9
+ */
10
+ class HuggingFaceApiConfiguration extends BaseUrlApiConfiguration_js_1.BaseUrlApiConfigurationWithDefaults {
11
+ constructor(settings = {}) {
8
12
  super({
9
- baseUrl,
13
+ ...settings,
10
14
  headers: {
11
15
  Authorization: `Bearer ${(0, loadApiKey_js_1.loadApiKey)({
12
- apiKey,
16
+ apiKey: settings.apiKey,
13
17
  environmentVariableName: "HUGGINGFACE_API_KEY",
14
18
  description: "Hugging Face",
15
19
  })}`,
16
20
  },
17
- retry,
18
- throttle,
21
+ baseUrlDefaults: {
22
+ protocol: "https",
23
+ host: "api-inference.huggingface.co",
24
+ port: "443",
25
+ path: "/models",
26
+ },
19
27
  });
20
28
  }
21
29
  }
@@ -1,11 +1,10 @@
1
- import { BaseUrlApiConfiguration } from "../../core/api/BaseUrlApiConfiguration.js";
2
- import { RetryFunction } from "../../core/api/RetryFunction.js";
3
- import { ThrottleFunction } from "../../core/api/ThrottleFunction.js";
4
- export declare class HuggingFaceApiConfiguration extends BaseUrlApiConfiguration {
5
- constructor({ baseUrl, apiKey, retry, throttle, }?: {
6
- baseUrl?: string;
1
+ import { BaseUrlApiConfigurationWithDefaults, PartialBaseUrlPartsApiConfigurationOptions } from "../../core/api/BaseUrlApiConfiguration.js";
2
+ /**
3
+ * Creates an API configuration for the HuggingFace API.
4
+ * It calls the API at https://api-inference.huggingface.co/models and uses the `HUGGINGFACE_API_KEY` env variable by default.
5
+ */
6
+ export declare class HuggingFaceApiConfiguration extends BaseUrlApiConfigurationWithDefaults {
7
+ constructor(settings?: PartialBaseUrlPartsApiConfigurationOptions & {
7
8
  apiKey?: string;
8
- retry?: RetryFunction;
9
- throttle?: ThrottleFunction;
10
9
  });
11
10
  }
@@ -1,18 +1,26 @@
1
- import { BaseUrlApiConfiguration } from "../../core/api/BaseUrlApiConfiguration.js";
1
+ import { BaseUrlApiConfigurationWithDefaults, } from "../../core/api/BaseUrlApiConfiguration.js";
2
2
  import { loadApiKey } from "../../core/api/loadApiKey.js";
3
- export class HuggingFaceApiConfiguration extends BaseUrlApiConfiguration {
4
- constructor({ baseUrl = "https://api-inference.huggingface.co/models", apiKey, retry, throttle, } = {}) {
3
+ /**
4
+ * Creates an API configuration for the HuggingFace API.
5
+ * It calls the API at https://api-inference.huggingface.co/models and uses the `HUGGINGFACE_API_KEY` env variable by default.
6
+ */
7
+ export class HuggingFaceApiConfiguration extends BaseUrlApiConfigurationWithDefaults {
8
+ constructor(settings = {}) {
5
9
  super({
6
- baseUrl,
10
+ ...settings,
7
11
  headers: {
8
12
  Authorization: `Bearer ${loadApiKey({
9
- apiKey,
13
+ apiKey: settings.apiKey,
10
14
  environmentVariableName: "HUGGINGFACE_API_KEY",
11
15
  description: "Hugging Face",
12
16
  })}`,
13
17
  },
14
- retry,
15
- throttle,
18
+ baseUrlDefaults: {
19
+ protocol: "https",
20
+ host: "api-inference.huggingface.co",
21
+ port: "443",
22
+ path: "/models",
23
+ },
16
24
  });
17
25
  }
18
26
  }
@@ -1,35 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.failedHuggingFaceCallResponseHandler = exports.HuggingFaceError = exports.huggingFaceErrorDataSchema = void 0;
3
+ exports.failedHuggingFaceCallResponseHandler = void 0;
4
4
  const zod_1 = require("zod");
5
- const ApiCallError_js_1 = require("../../core/api/ApiCallError.cjs");
6
- const parseJSON_js_1 = require("../../core/schema/parseJSON.cjs");
5
+ const postToApi_js_1 = require("../../core/api/postToApi.cjs");
7
6
  const ZodSchema_js_1 = require("../../core/schema/ZodSchema.cjs");
8
- exports.huggingFaceErrorDataSchema = new ZodSchema_js_1.ZodSchema(zod_1.z.object({
7
+ const huggingFaceErrorDataSchema = zod_1.z.object({
9
8
  error: zod_1.z.array(zod_1.z.string()).or(zod_1.z.string()),
10
- }));
11
- class HuggingFaceError extends ApiCallError_js_1.ApiCallError {
12
- constructor({ data, statusCode, url, requestBodyValues, message = typeof data.error === "string"
13
- ? data.error
14
- : data.error.join("\n\n"), }) {
15
- super({ message, statusCode, requestBodyValues, url });
16
- Object.defineProperty(this, "data", {
17
- enumerable: true,
18
- configurable: true,
19
- writable: true,
20
- value: void 0
21
- });
22
- this.data = data;
23
- }
24
- }
25
- exports.HuggingFaceError = HuggingFaceError;
26
- const failedHuggingFaceCallResponseHandler = async ({ response, url, requestBodyValues }) => new HuggingFaceError({
27
- url,
28
- requestBodyValues,
29
- statusCode: response.status,
30
- data: (0, parseJSON_js_1.parseJSON)({
31
- text: await response.text(),
32
- schema: exports.huggingFaceErrorDataSchema,
33
- }),
34
9
  });
35
- exports.failedHuggingFaceCallResponseHandler = failedHuggingFaceCallResponseHandler;
10
+ exports.failedHuggingFaceCallResponseHandler = (0, postToApi_js_1.createJsonErrorResponseHandler)({
11
+ errorSchema: (0, ZodSchema_js_1.zodSchema)(huggingFaceErrorDataSchema),
12
+ errorToMessage: (data) => typeof data.error === "string" ? data.error : data.error.join("\n\n"),
13
+ });
@@ -1,18 +1,11 @@
1
- import { ApiCallError } from "../../core/api/ApiCallError.js";
2
- import { ResponseHandler } from "../../core/api/postToApi.js";
3
- import { ZodSchema } from "../../core/schema/ZodSchema.js";
4
- export declare const huggingFaceErrorDataSchema: ZodSchema<{
1
+ import { z } from "zod";
2
+ declare const huggingFaceErrorDataSchema: z.ZodObject<{
3
+ error: z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString]>;
4
+ }, "strip", z.ZodTypeAny, {
5
+ error: (string | string[]) & (string | string[] | undefined);
6
+ }, {
5
7
  error: (string | string[]) & (string | string[] | undefined);
6
8
  }>;
7
- export type HuggingFaceErrorData = (typeof huggingFaceErrorDataSchema)["_type"];
8
- export declare class HuggingFaceError extends ApiCallError {
9
- readonly data: HuggingFaceErrorData;
10
- constructor({ data, statusCode, url, requestBodyValues, message, }: {
11
- message?: string;
12
- statusCode: number;
13
- url: string;
14
- requestBodyValues: unknown;
15
- data: HuggingFaceErrorData;
16
- });
17
- }
18
- export declare const failedHuggingFaceCallResponseHandler: ResponseHandler<ApiCallError>;
9
+ export type HuggingFaceErrorData = z.infer<typeof huggingFaceErrorDataSchema>;
10
+ export declare const failedHuggingFaceCallResponseHandler: import("../../core/api/postToApi.js").ResponseHandler<import("../../index.js").ApiCallError>;
11
+ export {};
@@ -1,30 +1,10 @@
1
1
  import { z } from "zod";
2
- import { ApiCallError } from "../../core/api/ApiCallError.js";
3
- import { parseJSON } from "../../core/schema/parseJSON.js";
4
- import { ZodSchema } from "../../core/schema/ZodSchema.js";
5
- export const huggingFaceErrorDataSchema = new ZodSchema(z.object({
2
+ import { createJsonErrorResponseHandler } from "../../core/api/postToApi.js";
3
+ import { zodSchema } from "../../core/schema/ZodSchema.js";
4
+ const huggingFaceErrorDataSchema = z.object({
6
5
  error: z.array(z.string()).or(z.string()),
7
- }));
8
- export class HuggingFaceError extends ApiCallError {
9
- constructor({ data, statusCode, url, requestBodyValues, message = typeof data.error === "string"
10
- ? data.error
11
- : data.error.join("\n\n"), }) {
12
- super({ message, statusCode, requestBodyValues, url });
13
- Object.defineProperty(this, "data", {
14
- enumerable: true,
15
- configurable: true,
16
- writable: true,
17
- value: void 0
18
- });
19
- this.data = data;
20
- }
21
- }
22
- export const failedHuggingFaceCallResponseHandler = async ({ response, url, requestBodyValues }) => new HuggingFaceError({
23
- url,
24
- requestBodyValues,
25
- statusCode: response.status,
26
- data: parseJSON({
27
- text: await response.text(),
28
- schema: huggingFaceErrorDataSchema,
29
- }),
6
+ });
7
+ export const failedHuggingFaceCallResponseHandler = createJsonErrorResponseHandler({
8
+ errorSchema: zodSchema(huggingFaceErrorDataSchema),
9
+ errorToMessage: (data) => typeof data.error === "string" ? data.error : data.error.join("\n\n"),
30
10
  });
@@ -1,8 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TextEmbedder = exports.TextGenerator = void 0;
3
+ exports.TextEmbedder = exports.TextGenerator = exports.Api = void 0;
4
+ const HuggingFaceApiConfiguration_js_1 = require("./HuggingFaceApiConfiguration.cjs");
4
5
  const HuggingFaceTextEmbeddingModel_js_1 = require("./HuggingFaceTextEmbeddingModel.cjs");
5
6
  const HuggingFaceTextGenerationModel_js_1 = require("./HuggingFaceTextGenerationModel.cjs");
7
+ /**
8
+ * Creates an API configuration for the HuggingFace API.
9
+ * It calls the API at https://api-inference.huggingface.co/models and uses the `HUGGINGFACE_API_KEY` env variable by default.
10
+ */
11
+ function Api(settings) {
12
+ return new HuggingFaceApiConfiguration_js_1.HuggingFaceApiConfiguration(settings);
13
+ }
14
+ exports.Api = Api;
6
15
  /**
7
16
  * Create a text generation model that calls a Hugging Face Inference API Text Generation Task.
8
17
  *