You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using claude code from the CLI, I pass a PDF and it will summarize it just fine.
When doing the same thing using the Python SDK, it gives a JSON buffer error. Here's the code:
# Read PDFasyncdefmain():
messages: list[Message] = []
asyncformessageinquery(
prompt="Read the PDF document at 'y.pdf' and summarize its content",
options=ClaudeCodeOptions(max_turns=3, allowed_tools=["Read"])
):
messages.append(message)
print(messages)
result=anyio.run(main)
result
Here's the error:
CLIJSONDecodeError: Failed to decode JSON: JSON message exceeded maximum buffer size of 1048576 bytes...
I can call other requests where I'm not asking it to Read a file without issue. I was unable to find any documentation if I'm missing something about reading PDFs from within Python.