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

Issues with reading a .pdf file in GenAIScript with fs.readFile #374

Open
bzorn opened this issue Apr 23, 2024 · 2 comments
Open

Issues with reading a .pdf file in GenAIScript with fs.readFile #374

bzorn opened this issue Apr 23, 2024 · 2 comments
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@bzorn
Copy link
Collaborator

bzorn commented Apr 23, 2024

First, the documentation for Files says that the fs API is called readText but the actual function is called readFile.

Second, the docs say that readFile will automatically convert pdfs to text but when I try the following script it does not.

script({ title: "test1" })
const file = await fs.readFile("ex1.pdf")
def("FILE", file.content)
$Summarize FILE

Screen shot of what is passed to LLM:
image

Finally, the docs for Files show a used of "defFile" with using fs.findFiles. It doesn't seem that defFile is defined.

Also, the need to use "await" adds complexity. Can I instead just say:

def("FILE", fs.readFile("ex1.pdf"))

I'm worried that non-JavaScript users will not understand when and where to use await.

@bzorn bzorn added bug Something isn't working documentation Improvements or additions to documentation labels Apr 23, 2024
@pelikhan
Copy link
Member

This is fixed in the latest sources.

@pelikhan pelikhan reopened this Apr 23, 2024
@pelikhan
Copy link
Member

First, the documentation for Files says that the fs API is called readText but the actual function is called readFile.

The documentation is ahead of the release.

Finally, the docs for Files show a used of "defFile" with using fs.findFiles. It doesn't seem that defFile is defined.

Which page? @bzorn

@pelikhan pelikhan self-assigned this Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants