Closed duccdev closed 1 month ago
Thanks for the report, I looked into it and it seems like the name format in node_modules/@google/generative-ai/files/package.json
is incorrect, but not what's causing the issue. The issue is the paths further down in the file are wrong - should begin with../
and not ./
. You can actually get around this by changing your tsconfig "module" field to "node16" or similar instead of "commonjs" (which makes it rely on the top-level package.json instead, which has the right paths) but I should be able to fix this quickly.
For those who are trying to do that recently and getting the same error. I found that Google made some changes and doesn't update some of the documentations.
You doesn't import anymore like:
import { GoogleAIFileManager } from "@google/generative-ai/files";
use
import { GoogleAIFileManager } from "@google/generative-ai/server";
instead.
Heres the only place they announced it:
Description of the bug:
Hi everyone, I'm trying to import the
GoogleAIFileManager
class from@google/generative-ai/files
However, VSCode and the TypeScript compiler itself throws errors about the module not existing I can import everything from@google/generative-ai
but not@google/generative-ai/files
Actual vs expected behavior:
This should import the GoogleAIFileManager class:
I get this error:
Any other information you'd like to share?
I peeked into the
node_modules
(specificallynode_modules/@google/generative-ai/files/package.json
) On this specific line:I get this warning from VSCode:
Could this be an issue when importing?