From 9db1cee85ff3344ab30f10a9f034d57be3302cb5 Mon Sep 17 00:00:00 2001 From: Narendranath Gogineni Date: Thu, 19 Dec 2024 12:50:26 +0530 Subject: [PATCH] support pdf based prompting in anthropic --- src/providers/anthropic/chatComplete.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/providers/anthropic/chatComplete.ts b/src/providers/anthropic/chatComplete.ts index 6113ad821..540aeef3e 100644 --- a/src/providers/anthropic/chatComplete.ts +++ b/src/providers/anthropic/chatComplete.ts @@ -1,4 +1,4 @@ -import { ANTHROPIC } from '../../globals'; +import { ANTHROPIC, fileExtensionMimeTypeMap } from '../../globals'; import { Params, Message, @@ -146,7 +146,10 @@ export const AnthropicChatCompleteConfig: ProviderConfig = { if (mediaTypeParts.length === 2 && base64Image) { const mediaType = mediaTypeParts[1]; transformedMessage.content.push({ - type: 'image', + type: + mediaType === fileExtensionMimeTypeMap.pdf + ? 'document' + : 'image', source: { type: 'base64', media_type: mediaType,