Skip to content

Commit

Permalink
support pdf based prompting in anthropic
Browse files Browse the repository at this point in the history
  • Loading branch information
narengogi committed Dec 19, 2024
1 parent f921bcb commit 9db1cee
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/providers/anthropic/chatComplete.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ANTHROPIC } from '../../globals';
import { ANTHROPIC, fileExtensionMimeTypeMap } from '../../globals';
import {
Params,
Message,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 9db1cee

Please sign in to comment.