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.
- package/CHANGELOG.md +15 -0
- package/core/api/ApiFacade.cjs +20 -0
- package/core/api/ApiFacade.d.ts +4 -0
- package/core/api/ApiFacade.js +4 -0
- package/core/api/BaseUrlApiConfiguration.cjs +47 -5
- package/core/api/BaseUrlApiConfiguration.d.ts +23 -6
- package/core/api/BaseUrlApiConfiguration.js +45 -4
- package/core/api/BaseUrlApiConfiguration.test.cjs +11 -0
- package/core/api/BaseUrlApiConfiguration.test.d.ts +1 -0
- package/core/api/BaseUrlApiConfiguration.test.js +9 -0
- package/core/api/callWithRetryAndThrottle.cjs +3 -3
- package/core/api/callWithRetryAndThrottle.js +3 -3
- package/core/api/index.cjs +15 -2
- package/core/api/index.d.ts +2 -2
- package/core/api/index.js +2 -2
- package/core/api/postToApi.cjs +28 -5
- package/core/api/postToApi.d.ts +5 -4
- package/core/api/postToApi.js +26 -4
- package/core/api/throttleOff.cjs +8 -0
- package/core/api/throttleOff.d.ts +5 -0
- package/core/api/throttleOff.js +4 -0
- package/internal/index.cjs +2 -8
- package/internal/index.d.ts +1 -1
- package/internal/index.js +1 -1
- package/model-function/generate-structure/generateStructure.d.ts +1 -1
- package/model-provider/anthropic/AnthropicApiConfiguration.cjs +14 -6
- package/model-provider/anthropic/AnthropicApiConfiguration.d.ts +7 -8
- package/model-provider/anthropic/AnthropicApiConfiguration.js +15 -7
- package/model-provider/anthropic/AnthropicError.cjs +7 -27
- package/model-provider/anthropic/AnthropicError.d.ts +21 -16
- package/model-provider/anthropic/AnthropicError.js +7 -25
- package/model-provider/anthropic/AnthropicFacade.cjs +10 -1
- package/model-provider/anthropic/AnthropicFacade.d.ts +9 -0
- package/model-provider/anthropic/AnthropicFacade.js +8 -0
- package/model-provider/anthropic/AnthropicTextGenerationModel.cjs +22 -24
- package/model-provider/anthropic/AnthropicTextGenerationModel.js +23 -25
- package/model-provider/anthropic/index.cjs +1 -4
- package/model-provider/anthropic/index.d.ts +1 -1
- package/model-provider/anthropic/index.js +0 -1
- package/model-provider/automatic1111/Automatic1111ApiConfiguration.cjs +12 -4
- package/model-provider/automatic1111/Automatic1111ApiConfiguration.d.ts +3 -3
- package/model-provider/automatic1111/Automatic1111ApiConfiguration.js +12 -4
- package/model-provider/automatic1111/Automatic1111Error.cjs +3 -3
- package/model-provider/automatic1111/Automatic1111Error.d.ts +13 -3
- package/model-provider/automatic1111/Automatic1111Error.js +4 -4
- package/model-provider/automatic1111/Automatic1111Facade.cjs +9 -9
- package/model-provider/automatic1111/Automatic1111Facade.d.ts +6 -6
- package/model-provider/automatic1111/Automatic1111Facade.js +7 -7
- package/model-provider/automatic1111/Automatic1111ImageGenerationModel.cjs +11 -7
- package/model-provider/automatic1111/Automatic1111ImageGenerationModel.js +11 -7
- package/model-provider/cohere/CohereApiConfiguration.cjs +14 -6
- package/model-provider/cohere/CohereApiConfiguration.d.ts +7 -8
- package/model-provider/cohere/CohereApiConfiguration.js +15 -7
- package/model-provider/cohere/CohereError.cjs +8 -43
- package/model-provider/cohere/CohereError.d.ts +9 -16
- package/model-provider/cohere/CohereError.js +8 -41
- package/model-provider/cohere/CohereFacade.cjs +12 -3
- package/model-provider/cohere/CohereFacade.d.ts +11 -2
- package/model-provider/cohere/CohereFacade.js +10 -2
- package/model-provider/cohere/CohereTextEmbeddingModel.cjs +18 -22
- package/model-provider/cohere/CohereTextEmbeddingModel.js +18 -22
- package/model-provider/cohere/CohereTextGenerationModel.cjs +31 -39
- package/model-provider/cohere/CohereTextGenerationModel.d.ts +110 -8
- package/model-provider/cohere/CohereTextGenerationModel.js +31 -39
- package/model-provider/cohere/CohereTokenizer.cjs +32 -41
- package/model-provider/cohere/CohereTokenizer.d.ts +2 -2
- package/model-provider/cohere/CohereTokenizer.js +32 -41
- package/model-provider/cohere/index.cjs +1 -3
- package/model-provider/cohere/index.d.ts +1 -1
- package/model-provider/cohere/index.js +0 -1
- package/model-provider/elevenlabs/ElevenLabsApiConfiguration.cjs +14 -6
- package/model-provider/elevenlabs/ElevenLabsApiConfiguration.d.ts +7 -8
- package/model-provider/elevenlabs/ElevenLabsApiConfiguration.js +15 -7
- package/model-provider/elevenlabs/ElevenLabsFacade.cjs +10 -1
- package/model-provider/elevenlabs/ElevenLabsFacade.d.ts +9 -0
- package/model-provider/elevenlabs/ElevenLabsFacade.js +8 -0
- package/model-provider/elevenlabs/ElevenLabsSpeechModel.cjs +42 -53
- package/model-provider/elevenlabs/ElevenLabsSpeechModel.js +44 -55
- package/model-provider/huggingface/HuggingFaceApiConfiguration.cjs +14 -6
- package/model-provider/huggingface/HuggingFaceApiConfiguration.d.ts +7 -8
- package/model-provider/huggingface/HuggingFaceApiConfiguration.js +15 -7
- package/model-provider/huggingface/HuggingFaceError.cjs +7 -29
- package/model-provider/huggingface/HuggingFaceError.d.ts +9 -16
- package/model-provider/huggingface/HuggingFaceError.js +7 -27
- package/model-provider/huggingface/HuggingFaceFacade.cjs +10 -1
- package/model-provider/huggingface/HuggingFaceFacade.d.ts +9 -0
- package/model-provider/huggingface/HuggingFaceFacade.js +8 -0
- package/model-provider/huggingface/HuggingFaceTextEmbeddingModel.cjs +17 -27
- package/model-provider/huggingface/HuggingFaceTextEmbeddingModel.js +17 -27
- package/model-provider/huggingface/HuggingFaceTextGenerationModel.cjs +22 -23
- package/model-provider/huggingface/HuggingFaceTextGenerationModel.js +22 -23
- package/model-provider/huggingface/index.cjs +1 -3
- package/model-provider/huggingface/index.d.ts +1 -1
- package/model-provider/huggingface/index.js +0 -1
- package/model-provider/llamacpp/LlamaCppApiConfiguration.cjs +13 -6
- package/model-provider/llamacpp/LlamaCppApiConfiguration.d.ts +7 -9
- package/model-provider/llamacpp/LlamaCppApiConfiguration.js +14 -7
- package/model-provider/llamacpp/LlamaCppCompletionModel.cjs +4 -4
- package/model-provider/llamacpp/LlamaCppCompletionModel.d.ts +173 -5
- package/model-provider/llamacpp/LlamaCppCompletionModel.js +4 -4
- package/model-provider/llamacpp/LlamaCppError.cjs +7 -27
- package/model-provider/llamacpp/LlamaCppError.d.ts +9 -16
- package/model-provider/llamacpp/LlamaCppError.js +7 -25
- package/model-provider/llamacpp/LlamaCppFacade.cjs +10 -2
- package/model-provider/llamacpp/LlamaCppFacade.d.ts +8 -1
- package/model-provider/llamacpp/LlamaCppFacade.js +8 -1
- package/model-provider/llamacpp/LlamaCppTextEmbeddingModel.cjs +10 -14
- package/model-provider/llamacpp/LlamaCppTextEmbeddingModel.js +10 -14
- package/model-provider/llamacpp/LlamaCppTokenizer.cjs +14 -18
- package/model-provider/llamacpp/LlamaCppTokenizer.js +14 -18
- package/model-provider/llamacpp/index.cjs +1 -3
- package/model-provider/llamacpp/index.d.ts +1 -1
- package/model-provider/llamacpp/index.js +0 -1
- package/model-provider/lmnt/LmntApiConfiguration.cjs +14 -6
- package/model-provider/lmnt/LmntApiConfiguration.d.ts +7 -8
- package/model-provider/lmnt/LmntApiConfiguration.js +15 -7
- package/model-provider/lmnt/LmntFacade.cjs +11 -2
- package/model-provider/lmnt/LmntFacade.d.ts +10 -1
- package/model-provider/lmnt/LmntFacade.js +9 -1
- package/model-provider/lmnt/LmntSpeechModel.cjs +53 -41
- package/model-provider/lmnt/LmntSpeechModel.d.ts +51 -3
- package/model-provider/lmnt/LmntSpeechModel.js +54 -42
- package/model-provider/mistral/MistralApiConfiguration.cjs +14 -6
- package/model-provider/mistral/MistralApiConfiguration.d.ts +9 -11
- package/model-provider/mistral/MistralApiConfiguration.js +15 -7
- package/model-provider/mistral/MistralChatModel.cjs +4 -4
- package/model-provider/mistral/MistralChatModel.d.ts +48 -3
- package/model-provider/mistral/MistralChatModel.js +5 -5
- package/model-provider/mistral/MistralError.cjs +3 -3
- package/model-provider/mistral/MistralError.d.ts +15 -3
- package/model-provider/mistral/MistralError.js +4 -4
- package/model-provider/mistral/MistralFacade.cjs +5 -1
- package/model-provider/mistral/MistralFacade.d.ts +10 -3
- package/model-provider/mistral/MistralFacade.js +6 -2
- package/model-provider/mistral/MistralTextEmbeddingModel.cjs +2 -1
- package/model-provider/mistral/MistralTextEmbeddingModel.js +2 -1
- package/model-provider/ollama/OllamaApiConfiguration.cjs +13 -6
- package/model-provider/ollama/OllamaApiConfiguration.d.ts +7 -10
- package/model-provider/ollama/OllamaApiConfiguration.js +14 -7
- package/model-provider/ollama/OllamaChatModel.cjs +4 -4
- package/model-provider/ollama/OllamaChatModel.d.ts +46 -5
- package/model-provider/ollama/OllamaChatModel.js +5 -5
- package/model-provider/ollama/OllamaCompletionModel.cjs +4 -4
- package/model-provider/ollama/OllamaCompletionModel.d.ts +40 -5
- package/model-provider/ollama/OllamaCompletionModel.js +5 -5
- package/model-provider/ollama/OllamaError.cjs +3 -3
- package/model-provider/ollama/OllamaError.d.ts +7 -3
- package/model-provider/ollama/OllamaError.js +4 -4
- package/model-provider/ollama/OllamaFacade.cjs +6 -2
- package/model-provider/ollama/OllamaFacade.d.ts +8 -3
- package/model-provider/ollama/OllamaFacade.js +6 -2
- package/model-provider/ollama/OllamaTextEmbeddingModel.cjs +15 -16
- package/model-provider/ollama/OllamaTextEmbeddingModel.js +15 -16
- package/model-provider/openai/AbstractOpenAIChatModel.cjs +4 -4
- package/model-provider/openai/AbstractOpenAIChatModel.d.ts +148 -2
- package/model-provider/openai/AbstractOpenAIChatModel.js +4 -4
- package/model-provider/openai/AbstractOpenAICompletionModel.cjs +30 -32
- package/model-provider/openai/AbstractOpenAICompletionModel.js +30 -32
- package/model-provider/openai/AzureOpenAIApiConfiguration.d.ts +9 -8
- package/model-provider/openai/OpenAIApiConfiguration.cjs +14 -6
- package/model-provider/openai/OpenAIApiConfiguration.d.ts +7 -8
- package/model-provider/openai/OpenAIApiConfiguration.js +15 -7
- package/model-provider/openai/OpenAIError.cjs +8 -8
- package/model-provider/openai/OpenAIError.d.ts +27 -3
- package/model-provider/openai/OpenAIError.js +9 -9
- package/model-provider/openai/OpenAIFacade.cjs +23 -2
- package/model-provider/openai/OpenAIFacade.d.ts +20 -2
- package/model-provider/openai/OpenAIFacade.js +20 -1
- package/model-provider/openai/OpenAIImageGenerationModel.cjs +20 -21
- package/model-provider/openai/OpenAIImageGenerationModel.js +20 -21
- package/model-provider/openai/OpenAISpeechModel.cjs +17 -22
- package/model-provider/openai/OpenAISpeechModel.js +17 -22
- package/model-provider/openai/OpenAITextEmbeddingModel.cjs +18 -23
- package/model-provider/openai/OpenAITextEmbeddingModel.js +18 -23
- package/model-provider/openai/OpenAITranscriptionModel.cjs +42 -48
- package/model-provider/openai/OpenAITranscriptionModel.d.ts +14 -10
- package/model-provider/openai/OpenAITranscriptionModel.js +42 -48
- package/model-provider/openai-compatible/FireworksAIApiConfiguration.cjs +11 -7
- package/model-provider/openai-compatible/FireworksAIApiConfiguration.d.ts +4 -9
- package/model-provider/openai-compatible/FireworksAIApiConfiguration.js +12 -8
- package/model-provider/openai-compatible/OpenAICompatibleFacade.cjs +25 -1
- package/model-provider/openai-compatible/OpenAICompatibleFacade.d.ts +23 -0
- package/model-provider/openai-compatible/OpenAICompatibleFacade.js +22 -0
- package/model-provider/openai-compatible/TogetherAIApiConfiguration.cjs +11 -7
- package/model-provider/openai-compatible/TogetherAIApiConfiguration.d.ts +4 -9
- package/model-provider/openai-compatible/TogetherAIApiConfiguration.js +12 -8
- package/model-provider/stability/StabilityApiConfiguration.cjs +13 -12
- package/model-provider/stability/StabilityApiConfiguration.d.ts +4 -4
- package/model-provider/stability/StabilityApiConfiguration.js +13 -12
- package/model-provider/stability/StabilityError.cjs +3 -3
- package/model-provider/stability/StabilityError.d.ts +7 -3
- package/model-provider/stability/StabilityError.js +4 -4
- package/model-provider/stability/StabilityFacade.cjs +9 -9
- package/model-provider/stability/StabilityFacade.d.ts +8 -8
- package/model-provider/stability/StabilityFacade.js +7 -7
- package/model-provider/stability/StabilityImageGenerationModel.cjs +2 -1
- package/model-provider/stability/StabilityImageGenerationModel.js +2 -1
- package/model-provider/whispercpp/WhisperCppApiConfiguration.cjs +13 -6
- package/model-provider/whispercpp/WhisperCppApiConfiguration.d.ts +7 -10
- package/model-provider/whispercpp/WhisperCppApiConfiguration.js +14 -7
- package/model-provider/whispercpp/WhisperCppFacade.cjs +9 -5
- package/model-provider/whispercpp/WhisperCppFacade.d.ts +7 -2
- package/model-provider/whispercpp/WhisperCppFacade.js +8 -4
- package/model-provider/whispercpp/WhisperCppTranscriptionModel.cjs +5 -2
- package/model-provider/whispercpp/WhisperCppTranscriptionModel.js +6 -3
- package/package.json +1 -1
- package/tool/WebSearchTool.cjs +2 -2
- package/tool/WebSearchTool.d.ts +1 -2
- package/tool/WebSearchTool.js +3 -3
- package/vector-index/memory/MemoryVectorIndex.cjs +2 -2
- package/vector-index/memory/MemoryVectorIndex.js +3 -3
- package/core/api/BaseUrlPartsApiConfiguration.cjs +0 -53
- package/core/api/BaseUrlPartsApiConfiguration.d.ts +0 -26
- package/core/api/BaseUrlPartsApiConfiguration.js +0 -49
- package/core/api/throttleUnlimitedConcurrency.cjs +0 -8
- package/core/api/throttleUnlimitedConcurrency.d.ts +0 -5
- package/core/api/throttleUnlimitedConcurrency.js +0 -4
- package/model-provider/elevenlabs/ElevenLabsError.cjs +0 -30
- package/model-provider/elevenlabs/ElevenLabsError.d.ts +0 -3
- package/model-provider/elevenlabs/ElevenLabsError.js +0 -26
- package/model-provider/lmnt/LmntError.cjs +0 -30
- package/model-provider/lmnt/LmntError.d.ts +0 -3
- 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
|
-
|
7
|
-
|
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
|
-
|
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
|
-
|
18
|
-
|
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 {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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 {
|
1
|
+
import { BaseUrlApiConfigurationWithDefaults, } from "../../core/api/BaseUrlApiConfiguration.js";
|
2
2
|
import { loadApiKey } from "../../core/api/loadApiKey.js";
|
3
|
-
|
4
|
-
|
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
|
-
|
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
|
-
|
15
|
-
|
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:
|
66
|
-
throttle:
|
67
|
-
call: async () =>
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
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 {
|
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:
|
63
|
-
throttle:
|
64
|
-
call: async () =>
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
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
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
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
|
-
|
7
|
-
|
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
|
-
|
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
|
-
|
18
|
-
|
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 {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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 {
|
1
|
+
import { BaseUrlApiConfigurationWithDefaults, } from "../../core/api/BaseUrlApiConfiguration.js";
|
2
2
|
import { loadApiKey } from "../../core/api/loadApiKey.js";
|
3
|
-
|
4
|
-
|
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
|
-
|
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
|
-
|
15
|
-
|
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 =
|
3
|
+
exports.failedHuggingFaceCallResponseHandler = void 0;
|
4
4
|
const zod_1 = require("zod");
|
5
|
-
const
|
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
|
-
|
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 =
|
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 {
|
2
|
-
|
3
|
-
|
4
|
-
|
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 =
|
8
|
-
export declare
|
9
|
-
|
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 {
|
3
|
-
import {
|
4
|
-
|
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
|
9
|
-
|
10
|
-
|
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
|
*
|