diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index 417498de9..dd65cc2d9 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -66,6 +66,7 @@ const PROVIDER_HANDLES_TEMPLATING: string[] = [ const PROVIDER_SUPPORTS_IMAGES: string[] = [ "openai", "ollama", + "cohere", "gemini", "msty", "anthropic", @@ -90,6 +91,8 @@ const MODEL_SUPPORTS_IMAGES: string[] = [ "gpt-4o-mini", "gpt-4-vision", "claude-3", + "c4ai-aya-vision-8b", + "c4ai-aya-vision-32b", "gemini-ultra", "gemini-1.5-pro", "gemini-1.5-flash", diff --git a/core/llm/llms/Cohere.ts b/core/llm/llms/Cohere.ts index 5a6e3b646..ca12161ad 100644 --- a/core/llm/llms/Cohere.ts +++ b/core/llm/llms/Cohere.ts @@ -26,9 +26,25 @@ class Cohere extends BaseLLM { } switch (m.role) { case "user": + if (typeof m.content === "string") { + messages.push({ + role: m.role, + content: m.content, + }); + break; + } + messages.push({ role: m.role, - content: m.content, + content: m.content.map((part) => { + if (part.type === "imageUrl") { + return { + type: "image_url", + image_url: { url: part.imageUrl.url }, + }; + } + return part; + }), }); break; case "thinking":