✨ add image support to Cohere
This commit is contained in:
parent
c0174b6074
commit
6cf992e03b
2 changed files with 20 additions and 1 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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":
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue