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 bag: Add OCR file purpose and update OCR example #84

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

Conversation

suekou
Copy link

@suekou suekou commented Mar 7, 2025

Due to OCR not functioning in the SDK, I corrected the problematic section. I tested the modified part and confirmed that it works properly.

Modifications:

  • Added OCR to the purpose.
  • Fixed a typo in the example file. Consequently, the documentation was also updated PR.

@suekou suekou changed the title feat: Add OCR file purpose and update OCR example fix: Add OCR file purpose and update OCR example Mar 7, 2025
@suekou suekou changed the title fix: Add OCR file purpose and update OCR example fix bag: Add OCR file purpose and update OCR example Mar 7, 2025
@suekou
Copy link
Author

suekou commented Mar 7, 2025

Additional context:
According to this documentation, the 'purpose' is expected to be "ocr". However, in the actual implementation, it was not possible to assign "ocr" to the purpose field, so I added OCR: "ocr" to the FilePurpose.

Also, as you can see here, the expected field is includeImageBase64 rather than include_image_base64. Therefore, I have updated the relevant example accordingly.

@vicentematus
Copy link

vicentematus commented Mar 17, 2025

I was confused too when I implemented the Mistral AI SDK, because using purpose:'ocr' the language server was mad at me:
image

Example of the code snippet to reproduce it:

const uploaded_file = await Bun.file("example.pdf").arrayBuffer();
const uploaded_pdf = await mistral.files.upload({
  file: {
    fileName: PDF_NAME,
    content: uploaded_file,
  },
  purpose: "ocr",
});

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.

2 participants