modelfusion 0.27.3 → 0.28.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/README.md +6 -5
- package/{model-function/BasicApiConfiguration.js → core/api/AbstractApiConfiguration.cjs} +6 -15
- package/core/api/AbstractApiConfiguration.d.ts +13 -0
- package/core/api/AbstractApiConfiguration.js +18 -0
- package/core/api/ApiConfiguration.d.ts +32 -0
- package/core/api/BaseUrlApiConfiguration.cjs +32 -0
- package/core/api/BaseUrlApiConfiguration.d.ts +19 -0
- package/core/api/BaseUrlApiConfiguration.js +28 -0
- package/core/api/index.cjs +27 -0
- package/core/api/index.d.ts +11 -0
- package/core/api/index.js +11 -0
- package/core/index.cjs +1 -0
- package/core/index.d.ts +1 -0
- package/core/index.js +1 -0
- package/model-function/executeCall.cjs +1 -1
- package/model-function/executeCall.js +1 -1
- package/model-function/generate-text/streamText.cjs +1 -1
- package/model-function/generate-text/streamText.js +1 -1
- package/model-function/index.cjs +0 -2
- package/model-function/index.d.ts +0 -2
- package/model-function/index.js +0 -2
- package/model-provider/automatic1111/Automatic1111ApiConfiguration.cjs +3 -2
- package/model-provider/automatic1111/Automatic1111ApiConfiguration.d.ts +4 -4
- package/model-provider/automatic1111/Automatic1111ApiConfiguration.js +3 -2
- package/model-provider/automatic1111/Automatic1111Error.cjs +1 -1
- package/model-provider/automatic1111/Automatic1111Error.d.ts +2 -2
- package/model-provider/automatic1111/Automatic1111Error.js +1 -1
- package/model-provider/automatic1111/Automatic1111ImageGenerationModel.cjs +2 -2
- package/model-provider/automatic1111/Automatic1111ImageGenerationModel.d.ts +1 -1
- package/model-provider/automatic1111/Automatic1111ImageGenerationModel.js +2 -2
- package/model-provider/cohere/CohereApiConfiguration.cjs +10 -17
- package/model-provider/cohere/CohereApiConfiguration.d.ts +4 -6
- package/model-provider/cohere/CohereApiConfiguration.js +10 -17
- package/model-provider/cohere/CohereError.cjs +1 -1
- package/model-provider/cohere/CohereError.d.ts +2 -2
- package/model-provider/cohere/CohereError.js +1 -1
- package/model-provider/cohere/CohereTextEmbeddingModel.cjs +2 -2
- package/model-provider/cohere/CohereTextEmbeddingModel.d.ts +1 -1
- package/model-provider/cohere/CohereTextEmbeddingModel.js +2 -2
- package/model-provider/cohere/CohereTextGenerationModel.cjs +2 -2
- package/model-provider/cohere/CohereTextGenerationModel.d.ts +2 -2
- package/model-provider/cohere/CohereTextGenerationModel.js +2 -2
- package/model-provider/cohere/CohereTokenizer.cjs +2 -2
- package/model-provider/cohere/CohereTokenizer.d.ts +1 -1
- package/model-provider/cohere/CohereTokenizer.js +2 -2
- package/model-provider/elevenlabs/ElevenLabsApiConfiguration.cjs +10 -17
- package/model-provider/elevenlabs/ElevenLabsApiConfiguration.d.ts +4 -6
- package/model-provider/elevenlabs/ElevenLabsApiConfiguration.js +10 -17
- package/model-provider/elevenlabs/ElevenLabsError.cjs +1 -1
- package/model-provider/elevenlabs/ElevenLabsError.d.ts +2 -2
- package/model-provider/elevenlabs/ElevenLabsError.js +1 -1
- package/model-provider/elevenlabs/ElevenLabsSpeechSynthesisModel.cjs +2 -2
- package/model-provider/elevenlabs/ElevenLabsSpeechSynthesisModel.d.ts +1 -1
- package/model-provider/elevenlabs/ElevenLabsSpeechSynthesisModel.js +2 -2
- package/model-provider/huggingface/HuggingFaceApiConfiguration.cjs +10 -17
- package/model-provider/huggingface/HuggingFaceApiConfiguration.d.ts +4 -6
- package/model-provider/huggingface/HuggingFaceApiConfiguration.js +10 -17
- package/model-provider/huggingface/HuggingFaceError.cjs +1 -1
- package/model-provider/huggingface/HuggingFaceError.d.ts +2 -2
- package/model-provider/huggingface/HuggingFaceError.js +1 -1
- package/model-provider/huggingface/HuggingFaceTextEmbeddingModel.cjs +2 -2
- package/model-provider/huggingface/HuggingFaceTextEmbeddingModel.d.ts +1 -1
- package/model-provider/huggingface/HuggingFaceTextEmbeddingModel.js +2 -2
- package/model-provider/huggingface/HuggingFaceTextGenerationModel.cjs +2 -2
- package/model-provider/huggingface/HuggingFaceTextGenerationModel.d.ts +1 -1
- package/model-provider/huggingface/HuggingFaceTextGenerationModel.js +2 -2
- package/model-provider/llamacpp/LlamaCppApiConfiguration.cjs +3 -2
- package/model-provider/llamacpp/LlamaCppApiConfiguration.d.ts +4 -4
- package/model-provider/llamacpp/LlamaCppApiConfiguration.js +3 -2
- package/model-provider/llamacpp/LlamaCppError.cjs +1 -1
- package/model-provider/llamacpp/LlamaCppError.d.ts +2 -2
- package/model-provider/llamacpp/LlamaCppError.js +1 -1
- package/model-provider/llamacpp/LlamaCppTextEmbeddingModel.cjs +2 -2
- package/model-provider/llamacpp/LlamaCppTextEmbeddingModel.d.ts +1 -1
- package/model-provider/llamacpp/LlamaCppTextEmbeddingModel.js +2 -2
- package/model-provider/llamacpp/LlamaCppTextGenerationModel.cjs +2 -2
- package/model-provider/llamacpp/LlamaCppTextGenerationModel.d.ts +2 -2
- package/model-provider/llamacpp/LlamaCppTextGenerationModel.js +2 -2
- package/model-provider/llamacpp/LlamaCppTokenizer.cjs +2 -2
- package/model-provider/llamacpp/LlamaCppTokenizer.d.ts +1 -1
- package/model-provider/llamacpp/LlamaCppTokenizer.js +2 -2
- package/model-provider/lmnt/LmntApiConfiguration.cjs +10 -17
- package/model-provider/lmnt/LmntApiConfiguration.d.ts +4 -6
- package/model-provider/lmnt/LmntApiConfiguration.js +10 -17
- package/model-provider/lmnt/LmntError.cjs +1 -1
- package/model-provider/lmnt/LmntError.d.ts +2 -2
- package/model-provider/lmnt/LmntError.js +1 -1
- package/model-provider/lmnt/LmntSpeechSynthesisModel.cjs +2 -2
- package/model-provider/lmnt/LmntSpeechSynthesisModel.d.ts +1 -1
- package/model-provider/lmnt/LmntSpeechSynthesisModel.js +2 -2
- package/model-provider/openai/AzureOpenAIApiConfiguration.cjs +13 -20
- package/model-provider/openai/AzureOpenAIApiConfiguration.d.ts +5 -6
- package/model-provider/openai/AzureOpenAIApiConfiguration.js +13 -20
- package/model-provider/openai/OpenAIApiConfiguration.cjs +10 -19
- package/model-provider/openai/OpenAIApiConfiguration.d.ts +4 -6
- package/model-provider/openai/OpenAIApiConfiguration.js +10 -19
- package/model-provider/openai/OpenAIError.cjs +1 -1
- package/model-provider/openai/OpenAIError.d.ts +6 -6
- package/model-provider/openai/OpenAIError.js +1 -1
- package/model-provider/openai/OpenAIImageGenerationModel.cjs +2 -2
- package/model-provider/openai/OpenAIImageGenerationModel.d.ts +2 -2
- package/model-provider/openai/OpenAIImageGenerationModel.js +2 -2
- package/model-provider/openai/OpenAITextEmbeddingModel.cjs +2 -2
- package/model-provider/openai/OpenAITextEmbeddingModel.d.ts +1 -1
- package/model-provider/openai/OpenAITextEmbeddingModel.js +2 -2
- package/model-provider/openai/OpenAITextGenerationModel.cjs +2 -2
- package/model-provider/openai/OpenAITextGenerationModel.d.ts +2 -2
- package/model-provider/openai/OpenAITextGenerationModel.js +2 -2
- package/model-provider/openai/OpenAITranscriptionModel.cjs +2 -2
- package/model-provider/openai/OpenAITranscriptionModel.d.ts +2 -2
- package/model-provider/openai/OpenAITranscriptionModel.js +2 -2
- package/model-provider/openai/chat/OpenAIChatModel.cjs +2 -2
- package/model-provider/openai/chat/OpenAIChatModel.d.ts +2 -2
- package/model-provider/openai/chat/OpenAIChatModel.js +2 -2
- package/model-provider/stability/StabilityApiConfiguration.cjs +10 -19
- package/model-provider/stability/StabilityApiConfiguration.d.ts +4 -6
- package/model-provider/stability/StabilityApiConfiguration.js +10 -19
- package/model-provider/stability/StabilityError.cjs +1 -1
- package/model-provider/stability/StabilityError.d.ts +2 -2
- package/model-provider/stability/StabilityError.js +1 -1
- package/model-provider/stability/StabilityImageGenerationModel.cjs +2 -2
- package/model-provider/stability/StabilityImageGenerationModel.d.ts +1 -1
- package/model-provider/stability/StabilityImageGenerationModel.js +2 -2
- package/observability/helicone/HeliconeOpenAIApiConfiguration.cjs +17 -33
- package/observability/helicone/HeliconeOpenAIApiConfiguration.d.ts +4 -7
- package/observability/helicone/HeliconeOpenAIApiConfiguration.js +17 -33
- package/package.json +1 -1
- package/tool/executeTool.cjs +1 -1
- package/tool/executeTool.js +1 -1
- package/util/index.cjs +0 -9
- package/util/index.d.ts +0 -9
- package/util/index.js +0 -9
- package/model-function/ApiConfiguration.d.ts +0 -14
- package/model-function/BasicApiConfiguration.cjs +0 -35
- package/model-function/BasicApiConfiguration.d.ts +0 -15
- /package/{util → core}/api/AbortError.cjs +0 -0
- /package/{util → core}/api/AbortError.d.ts +0 -0
- /package/{util → core}/api/AbortError.js +0 -0
- /package/{util → core}/api/ApiCallError.cjs +0 -0
- /package/{util → core}/api/ApiCallError.d.ts +0 -0
- /package/{util → core}/api/ApiCallError.js +0 -0
- /package/{model-function → core/api}/ApiConfiguration.cjs +0 -0
- /package/{model-function → core/api}/ApiConfiguration.js +0 -0
- /package/{util → core}/api/RetryError.cjs +0 -0
- /package/{util → core}/api/RetryError.d.ts +0 -0
- /package/{util → core}/api/RetryError.js +0 -0
- /package/{util → core}/api/RetryFunction.cjs +0 -0
- /package/{util → core}/api/RetryFunction.d.ts +0 -0
- /package/{util → core}/api/RetryFunction.js +0 -0
- /package/{util → core}/api/ThrottleFunction.cjs +0 -0
- /package/{util → core}/api/ThrottleFunction.d.ts +0 -0
- /package/{util → core}/api/ThrottleFunction.js +0 -0
- /package/{util → core}/api/callWithRetryAndThrottle.cjs +0 -0
- /package/{util → core}/api/callWithRetryAndThrottle.d.ts +0 -0
- /package/{util → core}/api/callWithRetryAndThrottle.js +0 -0
- /package/{util → core}/api/loadApiKey.cjs +0 -0
- /package/{util → core}/api/loadApiKey.d.ts +0 -0
- /package/{util → core}/api/loadApiKey.js +0 -0
- /package/{util → core}/api/postToApi.cjs +0 -0
- /package/{util → core}/api/postToApi.d.ts +0 -0
- /package/{util → core}/api/postToApi.js +0 -0
- /package/{util → core}/api/retryNever.cjs +0 -0
- /package/{util → core}/api/retryNever.d.ts +0 -0
- /package/{util → core}/api/retryNever.js +0 -0
- /package/{util → core}/api/retryWithExponentialBackoff.cjs +0 -0
- /package/{util → core}/api/retryWithExponentialBackoff.d.ts +0 -0
- /package/{util → core}/api/retryWithExponentialBackoff.js +0 -0
- /package/{util → core}/api/throttleMaxConcurrency.cjs +0 -0
- /package/{util → core}/api/throttleMaxConcurrency.d.ts +0 -0
- /package/{util → core}/api/throttleMaxConcurrency.js +0 -0
- /package/{util → core}/api/throttleUnlimitedConcurrency.cjs +0 -0
- /package/{util → core}/api/throttleUnlimitedConcurrency.d.ts +0 -0
- /package/{util → core}/api/throttleUnlimitedConcurrency.js +0 -0
@@ -8,8 +8,8 @@ const secure_json_parse_1 = __importDefault(require("secure-json-parse"));
|
|
8
8
|
const zod_1 = __importDefault(require("zod"));
|
9
9
|
const AbstractModel_js_1 = require("../../../model-function/AbstractModel.cjs");
|
10
10
|
const PromptFormatTextGenerationModel_js_1 = require("../../../prompt/PromptFormatTextGenerationModel.cjs");
|
11
|
-
const callWithRetryAndThrottle_js_1 = require("../../../
|
12
|
-
const postToApi_js_1 = require("../../../
|
11
|
+
const callWithRetryAndThrottle_js_1 = require("../../../core/api/callWithRetryAndThrottle.cjs");
|
12
|
+
const postToApi_js_1 = require("../../../core/api/postToApi.cjs");
|
13
13
|
const OpenAIApiConfiguration_js_1 = require("../OpenAIApiConfiguration.cjs");
|
14
14
|
const OpenAIError_js_1 = require("../OpenAIError.cjs");
|
15
15
|
const TikTokenTokenizer_js_1 = require("../TikTokenTokenizer.cjs");
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import z from "zod";
|
2
2
|
import { AbstractModel } from "../../../model-function/AbstractModel.js";
|
3
3
|
import { ModelFunctionOptions } from "../../../model-function/ModelFunctionOptions.js";
|
4
|
-
import { ApiConfiguration } from "../../../
|
4
|
+
import { ApiConfiguration } from "../../../core/api/ApiConfiguration.js";
|
5
5
|
import { JsonGenerationModel } from "../../../model-function/generate-json/JsonGenerationModel.js";
|
6
6
|
import { JsonOrTextGenerationModel } from "../../../model-function/generate-json/JsonOrTextGenerationModel.js";
|
7
7
|
import { DeltaEvent } from "../../../model-function/generate-text/DeltaEvent.js";
|
8
8
|
import { TextGenerationModel, TextGenerationModelSettings } from "../../../model-function/generate-text/TextGenerationModel.js";
|
9
9
|
import { PromptFormat } from "../../../prompt/PromptFormat.js";
|
10
10
|
import { PromptFormatTextGenerationModel } from "../../../prompt/PromptFormatTextGenerationModel.js";
|
11
|
-
import { ResponseHandler } from "../../../
|
11
|
+
import { ResponseHandler } from "../../../core/api/postToApi.js";
|
12
12
|
import { TikTokenTokenizer } from "../TikTokenTokenizer.js";
|
13
13
|
import { OpenAIChatMessage } from "./OpenAIChatMessage.js";
|
14
14
|
import { OpenAIChatAutoFunctionPrompt, OpenAIChatSingleFunctionPrompt, OpenAIFunctionDescription } from "./OpenAIChatPrompt.js";
|
@@ -2,8 +2,8 @@ import SecureJSON from "secure-json-parse";
|
|
2
2
|
import z from "zod";
|
3
3
|
import { AbstractModel } from "../../../model-function/AbstractModel.js";
|
4
4
|
import { PromptFormatTextGenerationModel } from "../../../prompt/PromptFormatTextGenerationModel.js";
|
5
|
-
import { callWithRetryAndThrottle } from "../../../
|
6
|
-
import { createJsonResponseHandler, postJsonToApi, } from "../../../
|
5
|
+
import { callWithRetryAndThrottle } from "../../../core/api/callWithRetryAndThrottle.js";
|
6
|
+
import { createJsonResponseHandler, postJsonToApi, } from "../../../core/api/postToApi.js";
|
7
7
|
import { OpenAIApiConfiguration } from "../OpenAIApiConfiguration.js";
|
8
8
|
import { failedOpenAICallResponseHandler } from "../OpenAIError.js";
|
9
9
|
import { TikTokenTokenizer } from "../TikTokenTokenizer.js";
|
@@ -1,31 +1,22 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.StabilityApiConfiguration = void 0;
|
4
|
-
const
|
5
|
-
const loadApiKey_js_1 = require("../../
|
6
|
-
class StabilityApiConfiguration extends
|
4
|
+
const BaseUrlApiConfiguration_js_1 = require("../../core/api/BaseUrlApiConfiguration.cjs");
|
5
|
+
const loadApiKey_js_1 = require("../../core/api/loadApiKey.cjs");
|
6
|
+
class StabilityApiConfiguration extends BaseUrlApiConfiguration_js_1.BaseUrlApiConfiguration {
|
7
7
|
constructor({ baseUrl = "https://api.stability.ai/v1", apiKey, retry, throttle, } = {}) {
|
8
8
|
super({
|
9
9
|
baseUrl,
|
10
|
+
headers: {
|
11
|
+
Authorization: `Bearer ${(0, loadApiKey_js_1.loadApiKey)({
|
12
|
+
apiKey,
|
13
|
+
environmentVariableName: "STABILITY_API_KEY",
|
14
|
+
description: "Stability",
|
15
|
+
})}`,
|
16
|
+
},
|
10
17
|
retry,
|
11
18
|
throttle,
|
12
19
|
});
|
13
|
-
Object.defineProperty(this, "apiKey", {
|
14
|
-
enumerable: true,
|
15
|
-
configurable: true,
|
16
|
-
writable: true,
|
17
|
-
value: void 0
|
18
|
-
});
|
19
|
-
this.apiKey = (0, loadApiKey_js_1.loadApiKey)({
|
20
|
-
apiKey,
|
21
|
-
environmentVariableName: "STABILITY_API_KEY",
|
22
|
-
description: "Stability",
|
23
|
-
});
|
24
|
-
}
|
25
|
-
get headers() {
|
26
|
-
return {
|
27
|
-
Authorization: `Bearer ${this.apiKey}`,
|
28
|
-
};
|
29
20
|
}
|
30
21
|
}
|
31
22
|
exports.StabilityApiConfiguration = StabilityApiConfiguration;
|
@@ -1,13 +1,11 @@
|
|
1
|
-
import {
|
2
|
-
import { RetryFunction } from "../../
|
3
|
-
import { ThrottleFunction } from "../../
|
4
|
-
export declare class StabilityApiConfiguration extends
|
5
|
-
readonly apiKey: string;
|
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 StabilityApiConfiguration extends BaseUrlApiConfiguration {
|
6
5
|
constructor({ baseUrl, apiKey, retry, throttle, }?: {
|
7
6
|
baseUrl?: string;
|
8
7
|
apiKey?: string;
|
9
8
|
retry?: RetryFunction;
|
10
9
|
throttle?: ThrottleFunction;
|
11
10
|
});
|
12
|
-
get headers(): Record<string, string>;
|
13
11
|
}
|
@@ -1,27 +1,18 @@
|
|
1
|
-
import {
|
2
|
-
import { loadApiKey } from "../../
|
3
|
-
export class StabilityApiConfiguration extends
|
1
|
+
import { BaseUrlApiConfiguration } from "../../core/api/BaseUrlApiConfiguration.js";
|
2
|
+
import { loadApiKey } from "../../core/api/loadApiKey.js";
|
3
|
+
export class StabilityApiConfiguration extends BaseUrlApiConfiguration {
|
4
4
|
constructor({ baseUrl = "https://api.stability.ai/v1", apiKey, retry, throttle, } = {}) {
|
5
5
|
super({
|
6
6
|
baseUrl,
|
7
|
+
headers: {
|
8
|
+
Authorization: `Bearer ${loadApiKey({
|
9
|
+
apiKey,
|
10
|
+
environmentVariableName: "STABILITY_API_KEY",
|
11
|
+
description: "Stability",
|
12
|
+
})}`,
|
13
|
+
},
|
7
14
|
retry,
|
8
15
|
throttle,
|
9
16
|
});
|
10
|
-
Object.defineProperty(this, "apiKey", {
|
11
|
-
enumerable: true,
|
12
|
-
configurable: true,
|
13
|
-
writable: true,
|
14
|
-
value: void 0
|
15
|
-
});
|
16
|
-
this.apiKey = loadApiKey({
|
17
|
-
apiKey,
|
18
|
-
environmentVariableName: "STABILITY_API_KEY",
|
19
|
-
description: "Stability",
|
20
|
-
});
|
21
|
-
}
|
22
|
-
get headers() {
|
23
|
-
return {
|
24
|
-
Authorization: `Bearer ${this.apiKey}`,
|
25
|
-
};
|
26
17
|
}
|
27
18
|
}
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.failedStabilityCallResponseHandler = exports.StabilityError = exports.stabilityErrorDataSchema = void 0;
|
7
7
|
const secure_json_parse_1 = __importDefault(require("secure-json-parse"));
|
8
8
|
const zod_1 = require("zod");
|
9
|
-
const ApiCallError_js_1 = require("../../
|
9
|
+
const ApiCallError_js_1 = require("../../core/api/ApiCallError.cjs");
|
10
10
|
exports.stabilityErrorDataSchema = zod_1.z.object({
|
11
11
|
message: zod_1.z.string(),
|
12
12
|
});
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { z } from "zod";
|
2
|
-
import { ApiCallError } from "../../
|
3
|
-
import { ResponseHandler } from "../../
|
2
|
+
import { ApiCallError } from "../../core/api/ApiCallError.js";
|
3
|
+
import { ResponseHandler } from "../../core/api/postToApi.js";
|
4
4
|
export declare const stabilityErrorDataSchema: z.ZodObject<{
|
5
5
|
message: z.ZodString;
|
6
6
|
}, "strip", z.ZodTypeAny, {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import SecureJSON from "secure-json-parse";
|
2
2
|
import { z } from "zod";
|
3
|
-
import { ApiCallError } from "../../
|
3
|
+
import { ApiCallError } from "../../core/api/ApiCallError.js";
|
4
4
|
export const stabilityErrorDataSchema = z.object({
|
5
5
|
message: z.string(),
|
6
6
|
});
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StabilityImageGenerationModel = void 0;
|
4
4
|
const zod_1 = require("zod");
|
5
5
|
const AbstractModel_js_1 = require("../../model-function/AbstractModel.cjs");
|
6
|
-
const callWithRetryAndThrottle_js_1 = require("../../
|
7
|
-
const postToApi_js_1 = require("../../
|
6
|
+
const callWithRetryAndThrottle_js_1 = require("../../core/api/callWithRetryAndThrottle.cjs");
|
7
|
+
const postToApi_js_1 = require("../../core/api/postToApi.cjs");
|
8
8
|
const StabilityError_js_1 = require("./StabilityError.cjs");
|
9
9
|
const StabilityApiConfiguration_js_1 = require("./StabilityApiConfiguration.cjs");
|
10
10
|
/**
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { z } from "zod";
|
2
2
|
import { AbstractModel } from "../../model-function/AbstractModel.js";
|
3
3
|
import { ModelFunctionOptions } from "../../model-function/ModelFunctionOptions.js";
|
4
|
-
import { ApiConfiguration } from "../../
|
4
|
+
import { ApiConfiguration } from "../../core/api/ApiConfiguration.js";
|
5
5
|
import { ImageGenerationModel, ImageGenerationModelSettings } from "../../model-function/generate-image/ImageGenerationModel.js";
|
6
6
|
/**
|
7
7
|
* Create an image generation model that calls the Stability AI image generation API.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { z } from "zod";
|
2
2
|
import { AbstractModel } from "../../model-function/AbstractModel.js";
|
3
|
-
import { callWithRetryAndThrottle } from "../../
|
4
|
-
import { createJsonResponseHandler, postJsonToApi, } from "../../
|
3
|
+
import { callWithRetryAndThrottle } from "../../core/api/callWithRetryAndThrottle.js";
|
4
|
+
import { createJsonResponseHandler, postJsonToApi, } from "../../core/api/postToApi.js";
|
5
5
|
import { failedStabilityCallResponseHandler } from "./StabilityError.js";
|
6
6
|
import { StabilityApiConfiguration } from "./StabilityApiConfiguration.js";
|
7
7
|
/**
|
@@ -1,45 +1,29 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.HeliconeOpenAIApiConfiguration = void 0;
|
4
|
-
const
|
5
|
-
const loadApiKey_js_1 = require("../../
|
6
|
-
class HeliconeOpenAIApiConfiguration extends
|
4
|
+
const BaseUrlApiConfiguration_js_1 = require("../../core/api/BaseUrlApiConfiguration.cjs");
|
5
|
+
const loadApiKey_js_1 = require("../../core/api/loadApiKey.cjs");
|
6
|
+
class HeliconeOpenAIApiConfiguration extends BaseUrlApiConfiguration_js_1.BaseUrlApiConfiguration {
|
7
7
|
constructor({ baseUrl = "https://oai.hconeai.com/v1", openAIApiKey, heliconeApiKey, retry, throttle, } = {}) {
|
8
8
|
super({
|
9
9
|
baseUrl,
|
10
|
+
headers: {
|
11
|
+
Authorization: `Bearer ${(0, loadApiKey_js_1.loadApiKey)({
|
12
|
+
apiKey: openAIApiKey,
|
13
|
+
environmentVariableName: "OPENAI_API_KEY",
|
14
|
+
apiKeyParameterName: "openAIApiKey",
|
15
|
+
description: "OpenAI",
|
16
|
+
})}`,
|
17
|
+
"Helicone-Auth": `Bearer ${(0, loadApiKey_js_1.loadApiKey)({
|
18
|
+
apiKey: heliconeApiKey,
|
19
|
+
environmentVariableName: "HELICONE_API_KEY",
|
20
|
+
apiKeyParameterName: "heliconeApiKey",
|
21
|
+
description: "Helicone",
|
22
|
+
})}`,
|
23
|
+
},
|
10
24
|
retry,
|
11
25
|
throttle,
|
12
26
|
});
|
13
|
-
Object.defineProperty(this, "openAIApiKey", {
|
14
|
-
enumerable: true,
|
15
|
-
configurable: true,
|
16
|
-
writable: true,
|
17
|
-
value: void 0
|
18
|
-
});
|
19
|
-
Object.defineProperty(this, "heliconeApiKey", {
|
20
|
-
enumerable: true,
|
21
|
-
configurable: true,
|
22
|
-
writable: true,
|
23
|
-
value: void 0
|
24
|
-
});
|
25
|
-
this.openAIApiKey = (0, loadApiKey_js_1.loadApiKey)({
|
26
|
-
apiKey: openAIApiKey,
|
27
|
-
environmentVariableName: "OPENAI_API_KEY",
|
28
|
-
apiKeyParameterName: "openAIApiKey",
|
29
|
-
description: "OpenAI",
|
30
|
-
});
|
31
|
-
this.heliconeApiKey = (0, loadApiKey_js_1.loadApiKey)({
|
32
|
-
apiKey: heliconeApiKey,
|
33
|
-
environmentVariableName: "HELICONE_API_KEY",
|
34
|
-
apiKeyParameterName: "heliconeApiKey",
|
35
|
-
description: "Helicone",
|
36
|
-
});
|
37
|
-
}
|
38
|
-
get headers() {
|
39
|
-
return {
|
40
|
-
Authorization: `Bearer ${this.openAIApiKey}`,
|
41
|
-
"Helicone-Auth": `Bearer ${this.heliconeApiKey}`,
|
42
|
-
};
|
43
27
|
}
|
44
28
|
}
|
45
29
|
exports.HeliconeOpenAIApiConfiguration = HeliconeOpenAIApiConfiguration;
|
@@ -1,9 +1,7 @@
|
|
1
|
-
import {
|
2
|
-
import { RetryFunction } from "../../
|
3
|
-
import { ThrottleFunction } from "../../
|
4
|
-
export declare class HeliconeOpenAIApiConfiguration extends
|
5
|
-
readonly openAIApiKey: string;
|
6
|
-
readonly heliconeApiKey: string;
|
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 HeliconeOpenAIApiConfiguration extends BaseUrlApiConfiguration {
|
7
5
|
constructor({ baseUrl, openAIApiKey, heliconeApiKey, retry, throttle, }?: {
|
8
6
|
baseUrl?: string;
|
9
7
|
openAIApiKey?: string;
|
@@ -11,5 +9,4 @@ export declare class HeliconeOpenAIApiConfiguration extends BasicApiConfiguratio
|
|
11
9
|
retry?: RetryFunction;
|
12
10
|
throttle?: ThrottleFunction;
|
13
11
|
});
|
14
|
-
get headers(): Record<string, string>;
|
15
12
|
}
|
@@ -1,41 +1,25 @@
|
|
1
|
-
import {
|
2
|
-
import { loadApiKey } from "../../
|
3
|
-
export class HeliconeOpenAIApiConfiguration extends
|
1
|
+
import { BaseUrlApiConfiguration } from "../../core/api/BaseUrlApiConfiguration.js";
|
2
|
+
import { loadApiKey } from "../../core/api/loadApiKey.js";
|
3
|
+
export class HeliconeOpenAIApiConfiguration extends BaseUrlApiConfiguration {
|
4
4
|
constructor({ baseUrl = "https://oai.hconeai.com/v1", openAIApiKey, heliconeApiKey, retry, throttle, } = {}) {
|
5
5
|
super({
|
6
6
|
baseUrl,
|
7
|
+
headers: {
|
8
|
+
Authorization: `Bearer ${loadApiKey({
|
9
|
+
apiKey: openAIApiKey,
|
10
|
+
environmentVariableName: "OPENAI_API_KEY",
|
11
|
+
apiKeyParameterName: "openAIApiKey",
|
12
|
+
description: "OpenAI",
|
13
|
+
})}`,
|
14
|
+
"Helicone-Auth": `Bearer ${loadApiKey({
|
15
|
+
apiKey: heliconeApiKey,
|
16
|
+
environmentVariableName: "HELICONE_API_KEY",
|
17
|
+
apiKeyParameterName: "heliconeApiKey",
|
18
|
+
description: "Helicone",
|
19
|
+
})}`,
|
20
|
+
},
|
7
21
|
retry,
|
8
22
|
throttle,
|
9
23
|
});
|
10
|
-
Object.defineProperty(this, "openAIApiKey", {
|
11
|
-
enumerable: true,
|
12
|
-
configurable: true,
|
13
|
-
writable: true,
|
14
|
-
value: void 0
|
15
|
-
});
|
16
|
-
Object.defineProperty(this, "heliconeApiKey", {
|
17
|
-
enumerable: true,
|
18
|
-
configurable: true,
|
19
|
-
writable: true,
|
20
|
-
value: void 0
|
21
|
-
});
|
22
|
-
this.openAIApiKey = loadApiKey({
|
23
|
-
apiKey: openAIApiKey,
|
24
|
-
environmentVariableName: "OPENAI_API_KEY",
|
25
|
-
apiKeyParameterName: "openAIApiKey",
|
26
|
-
description: "OpenAI",
|
27
|
-
});
|
28
|
-
this.heliconeApiKey = loadApiKey({
|
29
|
-
apiKey: heliconeApiKey,
|
30
|
-
environmentVariableName: "HELICONE_API_KEY",
|
31
|
-
apiKeyParameterName: "heliconeApiKey",
|
32
|
-
description: "Helicone",
|
33
|
-
});
|
34
|
-
}
|
35
|
-
get headers() {
|
36
|
-
return {
|
37
|
-
Authorization: `Bearer ${this.openAIApiKey}`,
|
38
|
-
"Helicone-Auth": `Bearer ${this.heliconeApiKey}`,
|
39
|
-
};
|
40
24
|
}
|
41
25
|
}
|
package/package.json
CHANGED
package/tool/executeTool.cjs
CHANGED
@@ -7,7 +7,7 @@ const GlobalFunctionLogging_js_1 = require("../core/GlobalFunctionLogging.cjs");
|
|
7
7
|
const GlobalFunctionObservers_js_1 = require("../core/GlobalFunctionObservers.cjs");
|
8
8
|
const getFunctionCallLogger_js_1 = require("../core/getFunctionCallLogger.cjs");
|
9
9
|
const DurationMeasurement_js_1 = require("../util/DurationMeasurement.cjs");
|
10
|
-
const AbortError_js_1 = require("../
|
10
|
+
const AbortError_js_1 = require("../core/api/AbortError.cjs");
|
11
11
|
const runSafe_js_1 = require("../util/runSafe.cjs");
|
12
12
|
const ToolExecutionError_js_1 = require("./ToolExecutionError.cjs");
|
13
13
|
class ExecuteToolPromise extends Promise {
|
package/tool/executeTool.js
CHANGED
@@ -4,7 +4,7 @@ import { getGlobalFunctionLogging } from "../core/GlobalFunctionLogging.js";
|
|
4
4
|
import { getGlobalFunctionObservers } from "../core/GlobalFunctionObservers.js";
|
5
5
|
import { getFunctionCallLogger } from "../core/getFunctionCallLogger.js";
|
6
6
|
import { startDurationMeasurement } from "../util/DurationMeasurement.js";
|
7
|
-
import { AbortError } from "../
|
7
|
+
import { AbortError } from "../core/api/AbortError.js";
|
8
8
|
import { runSafe } from "../util/runSafe.js";
|
9
9
|
import { ToolExecutionError } from "./ToolExecutionError.js";
|
10
10
|
export class ExecuteToolPromise extends Promise {
|
package/util/index.cjs
CHANGED
@@ -14,13 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
__exportStar(require("./api/AbortError.cjs"), exports);
|
18
|
-
__exportStar(require("./api/ApiCallError.cjs"), exports);
|
19
|
-
__exportStar(require("./api/RetryError.cjs"), exports);
|
20
|
-
__exportStar(require("./api/RetryFunction.cjs"), exports);
|
21
|
-
__exportStar(require("./api/ThrottleFunction.cjs"), exports);
|
22
|
-
__exportStar(require("./api/retryNever.cjs"), exports);
|
23
|
-
__exportStar(require("./api/retryWithExponentialBackoff.cjs"), exports);
|
24
|
-
__exportStar(require("./api/throttleMaxConcurrency.cjs"), exports);
|
25
|
-
__exportStar(require("./api/throttleUnlimitedConcurrency.cjs"), exports);
|
26
17
|
__exportStar(require("./cosineSimilarity.cjs"), exports);
|
package/util/index.d.ts
CHANGED
@@ -1,10 +1 @@
|
|
1
|
-
export * from "./api/AbortError.js";
|
2
|
-
export * from "./api/ApiCallError.js";
|
3
|
-
export * from "./api/RetryError.js";
|
4
|
-
export * from "./api/RetryFunction.js";
|
5
|
-
export * from "./api/ThrottleFunction.js";
|
6
|
-
export * from "./api/retryNever.js";
|
7
|
-
export * from "./api/retryWithExponentialBackoff.js";
|
8
|
-
export * from "./api/throttleMaxConcurrency.js";
|
9
|
-
export * from "./api/throttleUnlimitedConcurrency.js";
|
10
1
|
export * from "./cosineSimilarity.js";
|
package/util/index.js
CHANGED
@@ -1,10 +1 @@
|
|
1
|
-
export * from "./api/AbortError.js";
|
2
|
-
export * from "./api/ApiCallError.js";
|
3
|
-
export * from "./api/RetryError.js";
|
4
|
-
export * from "./api/RetryFunction.js";
|
5
|
-
export * from "./api/ThrottleFunction.js";
|
6
|
-
export * from "./api/retryNever.js";
|
7
|
-
export * from "./api/retryWithExponentialBackoff.js";
|
8
|
-
export * from "./api/throttleMaxConcurrency.js";
|
9
|
-
export * from "./api/throttleUnlimitedConcurrency.js";
|
10
1
|
export * from "./cosineSimilarity.js";
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import { RetryFunction } from "../util/api/RetryFunction.js";
|
2
|
-
import { ThrottleFunction } from "../util/api/ThrottleFunction.js";
|
3
|
-
/**
|
4
|
-
* Settings for a REST provider, e.g. OpenAI or Lmnt.
|
5
|
-
*/
|
6
|
-
export interface ApiConfiguration {
|
7
|
-
/**
|
8
|
-
* Creates a full URL given a inner path.
|
9
|
-
*/
|
10
|
-
assembleUrl(path: string): string;
|
11
|
-
readonly headers: Record<string, string>;
|
12
|
-
readonly retry?: RetryFunction;
|
13
|
-
readonly throttle?: ThrottleFunction;
|
14
|
-
}
|
@@ -1,35 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.BasicApiConfiguration = void 0;
|
4
|
-
class BasicApiConfiguration {
|
5
|
-
constructor({ baseUrl, retry, throttle, }) {
|
6
|
-
Object.defineProperty(this, "baseUrl", {
|
7
|
-
enumerable: true,
|
8
|
-
configurable: true,
|
9
|
-
writable: true,
|
10
|
-
value: void 0
|
11
|
-
});
|
12
|
-
Object.defineProperty(this, "retry", {
|
13
|
-
enumerable: true,
|
14
|
-
configurable: true,
|
15
|
-
writable: true,
|
16
|
-
value: void 0
|
17
|
-
});
|
18
|
-
Object.defineProperty(this, "throttle", {
|
19
|
-
enumerable: true,
|
20
|
-
configurable: true,
|
21
|
-
writable: true,
|
22
|
-
value: void 0
|
23
|
-
});
|
24
|
-
this.baseUrl = baseUrl;
|
25
|
-
this.retry = retry;
|
26
|
-
this.throttle = throttle;
|
27
|
-
}
|
28
|
-
get headers() {
|
29
|
-
return {};
|
30
|
-
}
|
31
|
-
assembleUrl(path) {
|
32
|
-
return `${this.baseUrl}${path}`;
|
33
|
-
}
|
34
|
-
}
|
35
|
-
exports.BasicApiConfiguration = BasicApiConfiguration;
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { RetryFunction } from "../util/api/RetryFunction.js";
|
2
|
-
import { ThrottleFunction } from "../util/api/ThrottleFunction.js";
|
3
|
-
import { ApiConfiguration } from "./ApiConfiguration.js";
|
4
|
-
export declare class BasicApiConfiguration implements ApiConfiguration {
|
5
|
-
readonly baseUrl: string;
|
6
|
-
readonly retry?: RetryFunction;
|
7
|
-
readonly throttle?: ThrottleFunction;
|
8
|
-
constructor({ baseUrl, retry, throttle, }: {
|
9
|
-
baseUrl: string;
|
10
|
-
retry?: RetryFunction;
|
11
|
-
throttle?: ThrottleFunction;
|
12
|
-
});
|
13
|
-
get headers(): Record<string, string>;
|
14
|
-
assembleUrl(path: string): string;
|
15
|
-
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|