modelfusion 0.109.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 +25 -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/{extension → internal}/index.cjs +2 -7
- package/{extension → internal}/index.d.ts +1 -1
- package/{extension → 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/OpenAICompletionModel.cjs +3 -91
- package/model-provider/openai/OpenAICompletionModel.d.ts +3 -71
- package/model-provider/openai/OpenAICompletionModel.js +3 -91
- 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.d.ts +1 -1
- 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/TikTokenTokenizer.cjs +0 -18
- package/model-provider/openai/TikTokenTokenizer.d.ts +3 -3
- package/model-provider/openai/TikTokenTokenizer.js +0 -18
- 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 +5 -5
- 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
@@ -1,9 +1,9 @@
|
|
1
1
|
import { FullTokenizer } from "../../model-function/tokenize-text/Tokenizer.js";
|
2
|
-
import { OpenAITextEmbeddingModelType } from "./OpenAITextEmbeddingModel.js";
|
3
|
-
import { OpenAICompletionBaseModelType } from "./OpenAICompletionModel.js";
|
4
2
|
import { OpenAIChatBaseModelType } from "./OpenAIChatModel.js";
|
3
|
+
import { OpenAICompletionModelType } from "./OpenAICompletionModel.js";
|
4
|
+
import { OpenAITextEmbeddingModelType } from "./OpenAITextEmbeddingModel.js";
|
5
5
|
export type TikTokenTokenizerSettings = {
|
6
|
-
model: OpenAIChatBaseModelType |
|
6
|
+
model: OpenAIChatBaseModelType | OpenAICompletionModelType | OpenAITextEmbeddingModelType;
|
7
7
|
};
|
8
8
|
/**
|
9
9
|
* TikToken tokenizer for OpenAI language models.
|
@@ -1,7 +1,5 @@
|
|
1
1
|
import { Tiktoken } from "js-tiktoken/lite";
|
2
2
|
import cl100k_base from "js-tiktoken/ranks/cl100k_base";
|
3
|
-
import p50k_base from "js-tiktoken/ranks/p50k_base";
|
4
|
-
import r50k_base from "js-tiktoken/ranks/r50k_base";
|
5
3
|
import { never } from "../../util/never.js";
|
6
4
|
/**
|
7
5
|
* TikToken tokenizer for OpenAI language models.
|
@@ -49,22 +47,6 @@ export class TikTokenTokenizer {
|
|
49
47
|
// when new models are released
|
50
48
|
function getTiktokenBPE(model) {
|
51
49
|
switch (model) {
|
52
|
-
case "code-davinci-002":
|
53
|
-
case "text-davinci-002":
|
54
|
-
case "text-davinci-003": {
|
55
|
-
return p50k_base;
|
56
|
-
}
|
57
|
-
case "ada":
|
58
|
-
case "babbage":
|
59
|
-
case "curie":
|
60
|
-
case "davinci":
|
61
|
-
case "text-ada-001":
|
62
|
-
case "text-babbage-001":
|
63
|
-
case "text-curie-001": {
|
64
|
-
return r50k_base;
|
65
|
-
}
|
66
|
-
case "babbage-002":
|
67
|
-
case "davinci-002":
|
68
50
|
case "gpt-3.5-turbo":
|
69
51
|
case "gpt-3.5-turbo-0301":
|
70
52
|
case "gpt-3.5-turbo-0613":
|
@@ -6,23 +6,27 @@ const loadApiKey_js_1 = require("../../core/api/loadApiKey.cjs");
|
|
6
6
|
/**
|
7
7
|
* Configuration for the Fireworks.ai API.
|
8
8
|
*
|
9
|
-
* It uses the `FIREWORKS_API_KEY` api key environment variable.
|
9
|
+
* It calls the API at https://api.fireworks.ai/inference/v1 and uses the `FIREWORKS_API_KEY` api key environment variable.
|
10
10
|
*
|
11
11
|
* @see https://readme.fireworks.ai/docs/openai-compatibility
|
12
12
|
*/
|
13
|
-
class FireworksAIApiConfiguration extends BaseUrlApiConfiguration_js_1.
|
14
|
-
constructor(
|
13
|
+
class FireworksAIApiConfiguration extends BaseUrlApiConfiguration_js_1.BaseUrlApiConfigurationWithDefaults {
|
14
|
+
constructor(settings = {}) {
|
15
15
|
super({
|
16
|
-
|
16
|
+
...settings,
|
17
17
|
headers: {
|
18
18
|
Authorization: `Bearer ${(0, loadApiKey_js_1.loadApiKey)({
|
19
|
-
apiKey,
|
19
|
+
apiKey: settings.apiKey,
|
20
20
|
environmentVariableName: "FIREWORKS_API_KEY",
|
21
21
|
description: "Fireworks AI",
|
22
22
|
})}`,
|
23
23
|
},
|
24
|
-
|
25
|
-
|
24
|
+
baseUrlDefaults: {
|
25
|
+
protocol: "https",
|
26
|
+
host: "api.fireworks.ai",
|
27
|
+
port: "443",
|
28
|
+
path: "/inference/v1",
|
29
|
+
},
|
26
30
|
});
|
27
31
|
}
|
28
32
|
}
|
@@ -1,18 +1,13 @@
|
|
1
|
-
import {
|
2
|
-
import { RetryFunction } from "../../core/api/RetryFunction.js";
|
3
|
-
import { ThrottleFunction } from "../../core/api/ThrottleFunction.js";
|
1
|
+
import { BaseUrlApiConfigurationWithDefaults, PartialBaseUrlPartsApiConfigurationOptions } from "../../core/api/BaseUrlApiConfiguration.js";
|
4
2
|
/**
|
5
3
|
* Configuration for the Fireworks.ai API.
|
6
4
|
*
|
7
|
-
* It uses the `FIREWORKS_API_KEY` api key environment variable.
|
5
|
+
* It calls the API at https://api.fireworks.ai/inference/v1 and uses the `FIREWORKS_API_KEY` api key environment variable.
|
8
6
|
*
|
9
7
|
* @see https://readme.fireworks.ai/docs/openai-compatibility
|
10
8
|
*/
|
11
|
-
export declare class FireworksAIApiConfiguration extends
|
12
|
-
constructor(
|
13
|
-
baseUrl?: string;
|
9
|
+
export declare class FireworksAIApiConfiguration extends BaseUrlApiConfigurationWithDefaults {
|
10
|
+
constructor(settings?: PartialBaseUrlPartsApiConfigurationOptions & {
|
14
11
|
apiKey?: string;
|
15
|
-
retry?: RetryFunction;
|
16
|
-
throttle?: ThrottleFunction;
|
17
12
|
});
|
18
13
|
}
|
@@ -1,25 +1,29 @@
|
|
1
|
-
import {
|
1
|
+
import { BaseUrlApiConfigurationWithDefaults, } from "../../core/api/BaseUrlApiConfiguration.js";
|
2
2
|
import { loadApiKey } from "../../core/api/loadApiKey.js";
|
3
3
|
/**
|
4
4
|
* Configuration for the Fireworks.ai API.
|
5
5
|
*
|
6
|
-
* It uses the `FIREWORKS_API_KEY` api key environment variable.
|
6
|
+
* It calls the API at https://api.fireworks.ai/inference/v1 and uses the `FIREWORKS_API_KEY` api key environment variable.
|
7
7
|
*
|
8
8
|
* @see https://readme.fireworks.ai/docs/openai-compatibility
|
9
9
|
*/
|
10
|
-
export class FireworksAIApiConfiguration extends
|
11
|
-
constructor(
|
10
|
+
export class FireworksAIApiConfiguration extends BaseUrlApiConfigurationWithDefaults {
|
11
|
+
constructor(settings = {}) {
|
12
12
|
super({
|
13
|
-
|
13
|
+
...settings,
|
14
14
|
headers: {
|
15
15
|
Authorization: `Bearer ${loadApiKey({
|
16
|
-
apiKey,
|
16
|
+
apiKey: settings.apiKey,
|
17
17
|
environmentVariableName: "FIREWORKS_API_KEY",
|
18
18
|
description: "Fireworks AI",
|
19
19
|
})}`,
|
20
20
|
},
|
21
|
-
|
22
|
-
|
21
|
+
baseUrlDefaults: {
|
22
|
+
protocol: "https",
|
23
|
+
host: "api.fireworks.ai",
|
24
|
+
port: "443",
|
25
|
+
path: "/inference/v1",
|
26
|
+
},
|
23
27
|
});
|
24
28
|
}
|
25
29
|
}
|
@@ -1,8 +1,32 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ChatTextGenerator = exports.CompletionTextGenerator = void 0;
|
3
|
+
exports.ChatTextGenerator = exports.CompletionTextGenerator = exports.TogetherAIApi = exports.FireworksAIApi = void 0;
|
4
|
+
const FireworksAIApiConfiguration_js_1 = require("./FireworksAIApiConfiguration.cjs");
|
4
5
|
const OpenAICompatibleChatModel_js_1 = require("./OpenAICompatibleChatModel.cjs");
|
5
6
|
const OpenAICompatibleCompletionModel_js_1 = require("./OpenAICompatibleCompletionModel.cjs");
|
7
|
+
const TogetherAIApiConfiguration_js_1 = require("./TogetherAIApiConfiguration.cjs");
|
8
|
+
/**
|
9
|
+
* Configuration for the Fireworks.ai API.
|
10
|
+
*
|
11
|
+
* It calls the API at https://api.fireworks.ai/inference/v1 and uses the `FIREWORKS_API_KEY` api key environment variable.
|
12
|
+
*
|
13
|
+
* @see https://readme.fireworks.ai/docs/openai-compatibility
|
14
|
+
*/
|
15
|
+
function FireworksAIApi(settings = {}) {
|
16
|
+
return new FireworksAIApiConfiguration_js_1.FireworksAIApiConfiguration(settings);
|
17
|
+
}
|
18
|
+
exports.FireworksAIApi = FireworksAIApi;
|
19
|
+
/**
|
20
|
+
* Configuration for the Together.ai API.
|
21
|
+
*
|
22
|
+
* It calls the API at https://api.together.xyz/v1 and uses the `TOGETHER_API_KEY` api key environment variable.
|
23
|
+
*
|
24
|
+
* @see https://docs.together.ai/docs/openai-api-compatibility
|
25
|
+
*/
|
26
|
+
function TogetherAIApi(settings = {}) {
|
27
|
+
return new TogetherAIApiConfiguration_js_1.TogetherAIApiConfiguration(settings);
|
28
|
+
}
|
29
|
+
exports.TogetherAIApi = TogetherAIApi;
|
6
30
|
/**
|
7
31
|
* Create a text generation model that calls an API that is compatible with OpenAI's completion API.
|
8
32
|
*
|
@@ -1,5 +1,28 @@
|
|
1
|
+
import { PartialBaseUrlPartsApiConfigurationOptions } from "../../core/api/BaseUrlApiConfiguration.js";
|
2
|
+
import { FireworksAIApiConfiguration } from "./FireworksAIApiConfiguration.js";
|
1
3
|
import { OpenAICompatibleChatModel, OpenAICompatibleChatSettings } from "./OpenAICompatibleChatModel.js";
|
2
4
|
import { OpenAICompatibleCompletionModel } from "./OpenAICompatibleCompletionModel.js";
|
5
|
+
import { TogetherAIApiConfiguration } from "./TogetherAIApiConfiguration.js";
|
6
|
+
/**
|
7
|
+
* Configuration for the Fireworks.ai API.
|
8
|
+
*
|
9
|
+
* It calls the API at https://api.fireworks.ai/inference/v1 and uses the `FIREWORKS_API_KEY` api key environment variable.
|
10
|
+
*
|
11
|
+
* @see https://readme.fireworks.ai/docs/openai-compatibility
|
12
|
+
*/
|
13
|
+
export declare function FireworksAIApi(settings?: PartialBaseUrlPartsApiConfigurationOptions & {
|
14
|
+
apiKey?: string;
|
15
|
+
}): FireworksAIApiConfiguration;
|
16
|
+
/**
|
17
|
+
* Configuration for the Together.ai API.
|
18
|
+
*
|
19
|
+
* It calls the API at https://api.together.xyz/v1 and uses the `TOGETHER_API_KEY` api key environment variable.
|
20
|
+
*
|
21
|
+
* @see https://docs.together.ai/docs/openai-api-compatibility
|
22
|
+
*/
|
23
|
+
export declare function TogetherAIApi(settings?: PartialBaseUrlPartsApiConfigurationOptions & {
|
24
|
+
apiKey?: string;
|
25
|
+
}): TogetherAIApiConfiguration;
|
3
26
|
/**
|
4
27
|
* Create a text generation model that calls an API that is compatible with OpenAI's completion API.
|
5
28
|
*
|
@@ -1,5 +1,27 @@
|
|
1
|
+
import { FireworksAIApiConfiguration } from "./FireworksAIApiConfiguration.js";
|
1
2
|
import { OpenAICompatibleChatModel, } from "./OpenAICompatibleChatModel.js";
|
2
3
|
import { OpenAICompatibleCompletionModel } from "./OpenAICompatibleCompletionModel.js";
|
4
|
+
import { TogetherAIApiConfiguration } from "./TogetherAIApiConfiguration.js";
|
5
|
+
/**
|
6
|
+
* Configuration for the Fireworks.ai API.
|
7
|
+
*
|
8
|
+
* It calls the API at https://api.fireworks.ai/inference/v1 and uses the `FIREWORKS_API_KEY` api key environment variable.
|
9
|
+
*
|
10
|
+
* @see https://readme.fireworks.ai/docs/openai-compatibility
|
11
|
+
*/
|
12
|
+
export function FireworksAIApi(settings = {}) {
|
13
|
+
return new FireworksAIApiConfiguration(settings);
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* Configuration for the Together.ai API.
|
17
|
+
*
|
18
|
+
* It calls the API at https://api.together.xyz/v1 and uses the `TOGETHER_API_KEY` api key environment variable.
|
19
|
+
*
|
20
|
+
* @see https://docs.together.ai/docs/openai-api-compatibility
|
21
|
+
*/
|
22
|
+
export function TogetherAIApi(settings = {}) {
|
23
|
+
return new TogetherAIApiConfiguration(settings);
|
24
|
+
}
|
3
25
|
/**
|
4
26
|
* Create a text generation model that calls an API that is compatible with OpenAI's completion API.
|
5
27
|
*
|
@@ -6,23 +6,27 @@ const loadApiKey_js_1 = require("../../core/api/loadApiKey.cjs");
|
|
6
6
|
/**
|
7
7
|
* Configuration for the Together.ai API.
|
8
8
|
*
|
9
|
-
* It uses the `TOGETHER_API_KEY` api key environment variable.
|
9
|
+
* It calls the API at https://api.together.xyz/v1 and uses the `TOGETHER_API_KEY` api key environment variable.
|
10
10
|
*
|
11
11
|
* @see https://docs.together.ai/docs/openai-api-compatibility
|
12
12
|
*/
|
13
|
-
class TogetherAIApiConfiguration extends BaseUrlApiConfiguration_js_1.
|
14
|
-
constructor(
|
13
|
+
class TogetherAIApiConfiguration extends BaseUrlApiConfiguration_js_1.BaseUrlApiConfigurationWithDefaults {
|
14
|
+
constructor(settings = {}) {
|
15
15
|
super({
|
16
|
-
|
16
|
+
...settings,
|
17
17
|
headers: {
|
18
18
|
Authorization: `Bearer ${(0, loadApiKey_js_1.loadApiKey)({
|
19
|
-
apiKey,
|
19
|
+
apiKey: settings.apiKey,
|
20
20
|
environmentVariableName: "TOGETHER_API_KEY",
|
21
21
|
description: "Together AI",
|
22
22
|
})}`,
|
23
23
|
},
|
24
|
-
|
25
|
-
|
24
|
+
baseUrlDefaults: {
|
25
|
+
protocol: "https",
|
26
|
+
host: "api.together.xyz",
|
27
|
+
port: "443",
|
28
|
+
path: "/v1",
|
29
|
+
},
|
26
30
|
});
|
27
31
|
}
|
28
32
|
}
|
@@ -1,18 +1,13 @@
|
|
1
|
-
import {
|
2
|
-
import { RetryFunction } from "../../core/api/RetryFunction.js";
|
3
|
-
import { ThrottleFunction } from "../../core/api/ThrottleFunction.js";
|
1
|
+
import { BaseUrlApiConfigurationWithDefaults, PartialBaseUrlPartsApiConfigurationOptions } from "../../core/api/BaseUrlApiConfiguration.js";
|
4
2
|
/**
|
5
3
|
* Configuration for the Together.ai API.
|
6
4
|
*
|
7
|
-
* It uses the `TOGETHER_API_KEY` api key environment variable.
|
5
|
+
* It calls the API at https://api.together.xyz/v1 and uses the `TOGETHER_API_KEY` api key environment variable.
|
8
6
|
*
|
9
7
|
* @see https://docs.together.ai/docs/openai-api-compatibility
|
10
8
|
*/
|
11
|
-
export declare class TogetherAIApiConfiguration extends
|
12
|
-
constructor(
|
13
|
-
baseUrl?: string;
|
9
|
+
export declare class TogetherAIApiConfiguration extends BaseUrlApiConfigurationWithDefaults {
|
10
|
+
constructor(settings?: PartialBaseUrlPartsApiConfigurationOptions & {
|
14
11
|
apiKey?: string;
|
15
|
-
retry?: RetryFunction;
|
16
|
-
throttle?: ThrottleFunction;
|
17
12
|
});
|
18
13
|
}
|
@@ -1,25 +1,29 @@
|
|
1
|
-
import {
|
1
|
+
import { BaseUrlApiConfigurationWithDefaults, } from "../../core/api/BaseUrlApiConfiguration.js";
|
2
2
|
import { loadApiKey } from "../../core/api/loadApiKey.js";
|
3
3
|
/**
|
4
4
|
* Configuration for the Together.ai API.
|
5
5
|
*
|
6
|
-
* It uses the `TOGETHER_API_KEY` api key environment variable.
|
6
|
+
* It calls the API at https://api.together.xyz/v1 and uses the `TOGETHER_API_KEY` api key environment variable.
|
7
7
|
*
|
8
8
|
* @see https://docs.together.ai/docs/openai-api-compatibility
|
9
9
|
*/
|
10
|
-
export class TogetherAIApiConfiguration extends
|
11
|
-
constructor(
|
10
|
+
export class TogetherAIApiConfiguration extends BaseUrlApiConfigurationWithDefaults {
|
11
|
+
constructor(settings = {}) {
|
12
12
|
super({
|
13
|
-
|
13
|
+
...settings,
|
14
14
|
headers: {
|
15
15
|
Authorization: `Bearer ${loadApiKey({
|
16
|
-
apiKey,
|
16
|
+
apiKey: settings.apiKey,
|
17
17
|
environmentVariableName: "TOGETHER_API_KEY",
|
18
18
|
description: "Together AI",
|
19
19
|
})}`,
|
20
20
|
},
|
21
|
-
|
22
|
-
|
21
|
+
baseUrlDefaults: {
|
22
|
+
protocol: "https",
|
23
|
+
host: "api.together.xyz",
|
24
|
+
port: "443",
|
25
|
+
path: "/v1",
|
26
|
+
},
|
23
27
|
});
|
24
28
|
}
|
25
29
|
}
|
@@ -1,28 +1,29 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.StabilityApiConfiguration = void 0;
|
4
|
-
const
|
4
|
+
const BaseUrlApiConfiguration_js_1 = require("../../core/api/BaseUrlApiConfiguration.cjs");
|
5
5
|
const loadApiKey_js_1 = require("../../core/api/loadApiKey.cjs");
|
6
6
|
/**
|
7
7
|
* Creates an API configuration for the Stability AI API.
|
8
|
-
* It calls the API at https://api.stability.ai/v1 by default.
|
8
|
+
* It calls the API at https://api.stability.ai/v1 by default and uses the `STABILITY_API_KEY` environment variable.
|
9
9
|
*/
|
10
|
-
class StabilityApiConfiguration extends
|
11
|
-
constructor(
|
10
|
+
class StabilityApiConfiguration extends BaseUrlApiConfiguration_js_1.BaseUrlApiConfigurationWithDefaults {
|
11
|
+
constructor(settings = {}) {
|
12
12
|
super({
|
13
|
-
|
14
|
-
|
15
|
-
port,
|
16
|
-
path,
|
17
|
-
headers: headers ?? {
|
13
|
+
...settings,
|
14
|
+
headers: settings.headers ?? {
|
18
15
|
Authorization: `Bearer ${(0, loadApiKey_js_1.loadApiKey)({
|
19
|
-
apiKey,
|
16
|
+
apiKey: settings.apiKey,
|
20
17
|
environmentVariableName: "STABILITY_API_KEY",
|
21
18
|
description: "Stability",
|
22
19
|
})}`,
|
23
20
|
},
|
24
|
-
|
25
|
-
|
21
|
+
baseUrlDefaults: {
|
22
|
+
protocol: "https",
|
23
|
+
host: "api.stability.ai",
|
24
|
+
port: "443",
|
25
|
+
path: "/v1",
|
26
|
+
},
|
26
27
|
});
|
27
28
|
}
|
28
29
|
}
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import {
|
1
|
+
import { BaseUrlApiConfigurationWithDefaults, PartialBaseUrlPartsApiConfigurationOptions } from "../../core/api/BaseUrlApiConfiguration.js";
|
2
2
|
/**
|
3
3
|
* Creates an API configuration for the Stability AI API.
|
4
|
-
* It calls the API at https://api.stability.ai/v1 by default.
|
4
|
+
* It calls the API at https://api.stability.ai/v1 by default and uses the `STABILITY_API_KEY` environment variable.
|
5
5
|
*/
|
6
|
-
export declare class StabilityApiConfiguration extends
|
7
|
-
constructor(
|
6
|
+
export declare class StabilityApiConfiguration extends BaseUrlApiConfigurationWithDefaults {
|
7
|
+
constructor(settings?: PartialBaseUrlPartsApiConfigurationOptions & {
|
8
8
|
apiKey?: string;
|
9
9
|
});
|
10
10
|
}
|
@@ -1,25 +1,26 @@
|
|
1
|
-
import {
|
1
|
+
import { BaseUrlApiConfigurationWithDefaults, } from "../../core/api/BaseUrlApiConfiguration.js";
|
2
2
|
import { loadApiKey } from "../../core/api/loadApiKey.js";
|
3
3
|
/**
|
4
4
|
* Creates an API configuration for the Stability AI API.
|
5
|
-
* It calls the API at https://api.stability.ai/v1 by default.
|
5
|
+
* It calls the API at https://api.stability.ai/v1 by default and uses the `STABILITY_API_KEY` environment variable.
|
6
6
|
*/
|
7
|
-
export class StabilityApiConfiguration extends
|
8
|
-
constructor(
|
7
|
+
export class StabilityApiConfiguration extends BaseUrlApiConfigurationWithDefaults {
|
8
|
+
constructor(settings = {}) {
|
9
9
|
super({
|
10
|
-
|
11
|
-
|
12
|
-
port,
|
13
|
-
path,
|
14
|
-
headers: headers ?? {
|
10
|
+
...settings,
|
11
|
+
headers: settings.headers ?? {
|
15
12
|
Authorization: `Bearer ${loadApiKey({
|
16
|
-
apiKey,
|
13
|
+
apiKey: settings.apiKey,
|
17
14
|
environmentVariableName: "STABILITY_API_KEY",
|
18
15
|
description: "Stability",
|
19
16
|
})}`,
|
20
17
|
},
|
21
|
-
|
22
|
-
|
18
|
+
baseUrlDefaults: {
|
19
|
+
protocol: "https",
|
20
|
+
host: "api.stability.ai",
|
21
|
+
port: "443",
|
22
|
+
path: "/v1",
|
23
|
+
},
|
23
24
|
});
|
24
25
|
}
|
25
26
|
}
|
@@ -4,10 +4,10 @@ exports.failedStabilityCallResponseHandler = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
5
5
|
const postToApi_js_1 = require("../../core/api/postToApi.cjs");
|
6
6
|
const ZodSchema_js_1 = require("../../core/schema/ZodSchema.cjs");
|
7
|
-
const stabilityErrorDataSchema =
|
7
|
+
const stabilityErrorDataSchema = zod_1.z.object({
|
8
8
|
message: zod_1.z.string(),
|
9
|
-
})
|
9
|
+
});
|
10
10
|
exports.failedStabilityCallResponseHandler = (0, postToApi_js_1.createJsonErrorResponseHandler)({
|
11
|
-
errorSchema: stabilityErrorDataSchema,
|
11
|
+
errorSchema: (0, ZodSchema_js_1.zodSchema)(stabilityErrorDataSchema),
|
12
12
|
errorToMessage: (error) => error.message,
|
13
13
|
});
|
@@ -1,9 +1,13 @@
|
|
1
|
+
import { z } from "zod";
|
1
2
|
import { ApiCallError } from "../../core/api/ApiCallError.js";
|
2
3
|
import { ResponseHandler } from "../../core/api/postToApi.js";
|
3
|
-
|
4
|
-
|
4
|
+
declare const stabilityErrorDataSchema: z.ZodObject<{
|
5
|
+
message: z.ZodString;
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
7
|
+
message: string;
|
8
|
+
}, {
|
5
9
|
message: string;
|
6
10
|
}>;
|
7
|
-
export type StabilityErrorData =
|
11
|
+
export type StabilityErrorData = z.infer<typeof stabilityErrorDataSchema>;
|
8
12
|
export declare const failedStabilityCallResponseHandler: ResponseHandler<ApiCallError>;
|
9
13
|
export {};
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { z } from "zod";
|
2
2
|
import { createJsonErrorResponseHandler, } from "../../core/api/postToApi.js";
|
3
|
-
import {
|
4
|
-
const stabilityErrorDataSchema =
|
3
|
+
import { zodSchema } from "../../core/schema/ZodSchema.js";
|
4
|
+
const stabilityErrorDataSchema = z.object({
|
5
5
|
message: z.string(),
|
6
|
-
})
|
6
|
+
});
|
7
7
|
export const failedStabilityCallResponseHandler = createJsonErrorResponseHandler({
|
8
|
-
errorSchema: stabilityErrorDataSchema,
|
8
|
+
errorSchema: zodSchema(stabilityErrorDataSchema),
|
9
9
|
errorToMessage: (error) => error.message,
|
10
10
|
});
|
@@ -1,8 +1,16 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.ImageGenerator = exports.Api = void 0;
|
4
4
|
const StabilityApiConfiguration_js_1 = require("./StabilityApiConfiguration.cjs");
|
5
5
|
const StabilityImageGenerationModel_js_1 = require("./StabilityImageGenerationModel.cjs");
|
6
|
+
/**
|
7
|
+
* Creates an API configuration for the Stability AI API.
|
8
|
+
* It calls the API at https://api.stability.ai/v1 by default and uses the `STABILITY_API_KEY` environment variable.
|
9
|
+
*/
|
10
|
+
function Api(settings) {
|
11
|
+
return new StabilityApiConfiguration_js_1.StabilityApiConfiguration(settings);
|
12
|
+
}
|
13
|
+
exports.Api = Api;
|
6
14
|
/**
|
7
15
|
* Create an image generation model that calls the Stability AI image generation API.
|
8
16
|
*
|
@@ -30,11 +38,3 @@ function ImageGenerator(settings) {
|
|
30
38
|
return new StabilityImageGenerationModel_js_1.StabilityImageGenerationModel(settings);
|
31
39
|
}
|
32
40
|
exports.ImageGenerator = ImageGenerator;
|
33
|
-
/**
|
34
|
-
* Creates an API configuration for the Stability AI API.
|
35
|
-
* It calls the API at https://api.stability.ai/v1 by default.
|
36
|
-
*/
|
37
|
-
function Api(settings) {
|
38
|
-
return new StabilityApiConfiguration_js_1.StabilityApiConfiguration(settings);
|
39
|
-
}
|
40
|
-
exports.Api = Api;
|
@@ -1,6 +1,13 @@
|
|
1
|
-
import { BaseUrlPartsApiConfigurationOptions } from "../../core/api/
|
1
|
+
import { BaseUrlPartsApiConfigurationOptions } from "../../core/api/BaseUrlApiConfiguration.js";
|
2
2
|
import { StabilityApiConfiguration } from "./StabilityApiConfiguration.js";
|
3
3
|
import { StabilityImageGenerationModel, StabilityImageGenerationSettings } from "./StabilityImageGenerationModel.js";
|
4
|
+
/**
|
5
|
+
* Creates an API configuration for the Stability AI API.
|
6
|
+
* It calls the API at https://api.stability.ai/v1 by default and uses the `STABILITY_API_KEY` environment variable.
|
7
|
+
*/
|
8
|
+
export declare function Api(settings: Partial<BaseUrlPartsApiConfigurationOptions> & {
|
9
|
+
apiKey?: string;
|
10
|
+
}): StabilityApiConfiguration;
|
4
11
|
/**
|
5
12
|
* Create an image generation model that calls the Stability AI image generation API.
|
6
13
|
*
|
@@ -25,10 +32,3 @@ import { StabilityImageGenerationModel, StabilityImageGenerationSettings } from
|
|
25
32
|
* @returns A new instance of {@link StabilityImageGenerationModel}.
|
26
33
|
*/
|
27
34
|
export declare function ImageGenerator(settings: StabilityImageGenerationSettings): StabilityImageGenerationModel;
|
28
|
-
/**
|
29
|
-
* Creates an API configuration for the Stability AI API.
|
30
|
-
* It calls the API at https://api.stability.ai/v1 by default.
|
31
|
-
*/
|
32
|
-
export declare function Api(settings: Partial<BaseUrlPartsApiConfigurationOptions> & {
|
33
|
-
apiKey?: string;
|
34
|
-
}): StabilityApiConfiguration;
|
@@ -1,5 +1,12 @@
|
|
1
1
|
import { StabilityApiConfiguration } from "./StabilityApiConfiguration.js";
|
2
2
|
import { StabilityImageGenerationModel, } from "./StabilityImageGenerationModel.js";
|
3
|
+
/**
|
4
|
+
* Creates an API configuration for the Stability AI API.
|
5
|
+
* It calls the API at https://api.stability.ai/v1 by default and uses the `STABILITY_API_KEY` environment variable.
|
6
|
+
*/
|
7
|
+
export function Api(settings) {
|
8
|
+
return new StabilityApiConfiguration(settings);
|
9
|
+
}
|
3
10
|
/**
|
4
11
|
* Create an image generation model that calls the Stability AI image generation API.
|
5
12
|
*
|
@@ -26,10 +33,3 @@ import { StabilityImageGenerationModel, } from "./StabilityImageGenerationModel.
|
|
26
33
|
export function ImageGenerator(settings) {
|
27
34
|
return new StabilityImageGenerationModel(settings);
|
28
35
|
}
|
29
|
-
/**
|
30
|
-
* Creates an API configuration for the Stability AI API.
|
31
|
-
* It calls the API at https://api.stability.ai/v1 by default.
|
32
|
-
*/
|
33
|
-
export function Api(settings) {
|
34
|
-
return new StabilityApiConfiguration(settings);
|
35
|
-
}
|
@@ -4,6 +4,7 @@ exports.StabilityImageGenerationModel = void 0;
|
|
4
4
|
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
|
+
const ZodSchema_js_1 = require("../../core/schema/ZodSchema.cjs");
|
7
8
|
const AbstractModel_js_1 = require("../../model-function/AbstractModel.cjs");
|
8
9
|
const PromptTemplateImageGenerationModel_js_1 = require("../../model-function/generate-image/PromptTemplateImageGenerationModel.cjs");
|
9
10
|
const StabilityApiConfiguration_js_1 = require("./StabilityApiConfiguration.cjs");
|
@@ -69,7 +70,7 @@ class StabilityImageGenerationModel extends AbstractModel_js_1.AbstractModel {
|
|
69
70
|
style_preset: this.settings.stylePreset,
|
70
71
|
},
|
71
72
|
failedResponseHandler: StabilityError_js_1.failedStabilityCallResponseHandler,
|
72
|
-
successfulResponseHandler: (0, postToApi_js_1.createJsonResponseHandler)(stabilityImageGenerationResponseSchema),
|
73
|
+
successfulResponseHandler: (0, postToApi_js_1.createJsonResponseHandler)((0, ZodSchema_js_1.zodSchema)(stabilityImageGenerationResponseSchema)),
|
73
74
|
abortSignal,
|
74
75
|
}),
|
75
76
|
});
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { z } from "zod";
|
2
2
|
import { callWithRetryAndThrottle } from "../../core/api/callWithRetryAndThrottle.js";
|
3
3
|
import { createJsonResponseHandler, postJsonToApi, } from "../../core/api/postToApi.js";
|
4
|
+
import { zodSchema } from "../../core/schema/ZodSchema.js";
|
4
5
|
import { AbstractModel } from "../../model-function/AbstractModel.js";
|
5
6
|
import { PromptTemplateImageGenerationModel } from "../../model-function/generate-image/PromptTemplateImageGenerationModel.js";
|
6
7
|
import { StabilityApiConfiguration } from "./StabilityApiConfiguration.js";
|
@@ -66,7 +67,7 @@ export class StabilityImageGenerationModel extends AbstractModel {
|
|
66
67
|
style_preset: this.settings.stylePreset,
|
67
68
|
},
|
68
69
|
failedResponseHandler: failedStabilityCallResponseHandler,
|
69
|
-
successfulResponseHandler: createJsonResponseHandler(stabilityImageGenerationResponseSchema),
|
70
|
+
successfulResponseHandler: createJsonResponseHandler(zodSchema(stabilityImageGenerationResponseSchema)),
|
70
71
|
abortSignal,
|
71
72
|
}),
|
72
73
|
});
|
@@ -2,13 +2,20 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.WhisperCppApiConfiguration = void 0;
|
4
4
|
const BaseUrlApiConfiguration_js_1 = require("../../core/api/BaseUrlApiConfiguration.cjs");
|
5
|
-
|
6
|
-
|
5
|
+
/**
|
6
|
+
* Creates an API configuration for the Whisper.cpp server.
|
7
|
+
* It calls the API at http://127.0.0.1:8080 by default.
|
8
|
+
*/
|
9
|
+
class WhisperCppApiConfiguration extends BaseUrlApiConfiguration_js_1.BaseUrlApiConfigurationWithDefaults {
|
10
|
+
constructor(settings = {}) {
|
7
11
|
super({
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
+
...settings,
|
13
|
+
baseUrlDefaults: {
|
14
|
+
protocol: "http",
|
15
|
+
host: "127.0.0.1",
|
16
|
+
port: "8080",
|
17
|
+
path: "",
|
18
|
+
},
|
12
19
|
});
|
13
20
|
}
|
14
21
|
}
|