feat(providers): Add Anthropic extended thinking and adapt providers to new streaming/file APIs; bump dependencies and update docs, tests and configuration

This commit is contained in:
2026-01-18 16:26:16 +00:00
parent e8a2a3ff1b
commit b4ced080f2
27 changed files with 2262 additions and 3339 deletions

View File

@@ -1,6 +1,7 @@
import * as plugins from './plugins.js';
import * as paths from './paths.js';
import { Readable } from 'stream';
import { toFile } from 'openai';
// Custom type definition for chat completion messages
export type TChatCompletionRequestMessage = {
@@ -405,16 +406,19 @@ export class OpenAiProvider extends MultiModalModel {
const model = optionsArg.model || this.options.imageModel || 'gpt-image-1';
try {
// Convert Buffer to uploadable file format for OpenAI API
const imageFile = await toFile(optionsArg.image, 'image.png', { type: 'image/png' });
const requestParams: any = {
model,
image: optionsArg.image,
image: imageFile,
prompt: optionsArg.prompt,
n: optionsArg.n || 1,
};
// Add mask if provided
// Add mask if provided (also convert to file format)
if (optionsArg.mask) {
requestParams.mask = optionsArg.mask;
requestParams.mask = await toFile(optionsArg.mask, 'mask.png', { type: 'image/png' });
}
// Add gpt-image-1 specific parameters