Skip to content
Discussion options

You must be logged in to vote

✅ Update: Solved by wrapping the file in a hash with file: key
Hi everyone! I just wanted to post an update for anyone facing the same issue.

After trying multiple ways to pass the file using the with: parameter in chat.ask, I discovered that you need to wrap the file in a hash with a file: key, like this:

response = chat.ask("What is this document about?", with: { file: @source })

This works for both ActionDispatch::Http::UploadedFile objects and file paths (strings), as long as the file is wrapped properly:

response = chat.ask("What is this document about?", with: { file: "/tmp/myfile.pdf" })

🚫 What didn't work for me:
Passing the file directly, like this:

chat.ask("What is this docum…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@the-s-anton
Comment options

Answer selected by YanCarlos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants