fix: modalities from openrouter
This commit is contained in:
@@ -575,6 +575,10 @@ function buildParams(
|
||||
prompt_cache_retention: cacheRetention === "long" && compat.supportsLongCacheRetention ? "24h" : undefined,
|
||||
};
|
||||
|
||||
if (isOpenRouterImageGenerationModel(model)) {
|
||||
Reflect.set(params, "modalities", ["image"]);
|
||||
}
|
||||
|
||||
if (compat.supportsUsageInStreaming !== false) {
|
||||
(params as any).stream_options = { include_usage: true };
|
||||
}
|
||||
|
||||
@@ -92,8 +92,9 @@ describe("openai-completions image output", () => {
|
||||
data: "ZmFrZS1wbmc=",
|
||||
});
|
||||
|
||||
const params = mockState.lastParams as { stream?: boolean; stream_options?: unknown };
|
||||
const params = mockState.lastParams as { stream?: boolean; stream_options?: unknown; modalities?: string[] };
|
||||
expect(params.stream).toBe(false);
|
||||
expect("stream_options" in (params as object)).toBe(false);
|
||||
expect(params.modalities).toEqual(["image"]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user