Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: anthropic documents in prompt #184

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

milancermak
Copy link

Resolves #183

@milancermak milancermak force-pushed the fix/anthropic-documents-in-prompt branch from 531bd39 to 0466515 Compare January 8, 2025 10:41
@milancermak
Copy link
Author

Rebased with main

@0xMochan
Copy link
Contributor

0xMochan commented Jan 9, 2025

This form of document serialization sorta bypasses the general pattern that is used via the Display trait for all Documents, tbh, it might make sense to use anthropic's patterns as the way to serialize for all providers. I chose the current method arbitrarily.

Specifically for anthropic, it seems like you can (now?) pass documents as a type of content in a user message. It might be more suitable to use this method (albeit, contradicting with it's own user guides?) for passing documents to anthropic? Curious if you saw this and had thoughts?

@milancermak
Copy link
Author

milancermak commented Jan 9, 2025

pass documents as a type of content in a user message

It seems that the API only supports PDFs in this case - the API docs only show application/pdf as the available option for messages.content.source.media_type

Screenshot 2025-01-09 at 12 19 27

BTW I watched this video on prompting Claude yesterday. The guy mentions that Claude understand XML better (because apparently it has been trained on a lot of XML 🤷 ) and it doesn't necessarily matter what tags you use as long as they are meaningful and separate stuff in the prompt (so it's also a good idea to use sth like ). I'm writing all that just to say that the original you used isn't bad at all 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: document formatting when using Anthropic
2 participants