Skip to content

Commit

Permalink
Merge pull request #828 from narengogi/chore/anthropic/pdf-support
Browse files Browse the repository at this point in the history
support pdf in input for anthropic
  • Loading branch information
VisargD authored Dec 19, 2024
2 parents fd31c42 + 9db1cee commit fd3e70a
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 fd3e70a

Please sign in to comment.