fix: stabilize provider sdk runtime surfaces

This commit is contained in:
Peter Steinberger
2026-03-28 09:35:29 +00:00
parent a955537a61
commit 6f6b55c072
2 changed files with 1 additions and 21 deletions

View File

@@ -70,27 +70,6 @@ import {
} from "./pi-embedded-runner.js";
import { log } from "./pi-embedded-runner/logger.js";
function createXaiFastModeWrapper(baseStreamFn: StreamFn | undefined, fastMode: boolean): StreamFn {
const fastModelIds = new Map<string, string>([
["grok-3", "grok-3-fast"],
["grok-3-mini", "grok-3-mini-fast"],
["grok-4", "grok-4-fast"],
["grok-4-0709", "grok-4-fast"],
]);
return (model, context, options) => {
if (!fastMode || model.api !== "openai-completions" || model.provider !== "xai") {
return (baseStreamFn as StreamFn)(model, context, options);
}
const fastModelId =
typeof model.id === "string" ? fastModelIds.get(model.id.trim()) : undefined;
return (baseStreamFn as StreamFn)(
fastModelId ? { ...model, id: fastModelId } : model,
context,
options,
);
};
}
beforeEach(() => {
extraParamsTesting.setProviderRuntimeDepsForTest({
prepareProviderExtraParams: (params) => {

View File

@@ -11,6 +11,7 @@ import {
import { __testing as loaderTesting } from "../plugins/loader.js";
import { loadPluginManifestRegistry } from "../plugins/manifest-registry.js";
import { createEmptyPluginRegistry } from "../plugins/registry.js";
import { setActivePluginRegistry } from "../plugins/runtime.js";
let describeImageFile: typeof import("./runtime.js").describeImageFile;
let runMediaUnderstandingFile: typeof import("./runtime.js").runMediaUnderstandingFile;