Closed ch-sap closed 3 weeks ago
Hi @ch-sap,
the reason you are encountering this issue is that the SAP Cloud SDK for AI is an ESM project, which means you have to be an ESM project as well to use it. This means, changing require
statements to import
and changing the project type to module
.
If you want the CAP wizard to natively support ESM, please approach the CAP team to update their wizard. If you want to see an example of a CAP-based project using our library, we do have a CAP sample application that you can use as a foundation to update your existing project.
Hi, thanks a lot for your respond. I created an issue for CAP. Newest version of CAP-LLM-PLUGIN can be used also with non-esm projects. Best regards, Christine
Hi @ch-sap,
Just want to make sure we are on the same page, you can use the SDK inside your CAP application, and you can check our CAP sample app, as mentioned by Tom.
Yes, but I do not have an ESM enabled CAP project and I do not want to change all imports now. So we first try the component, where we do not have to change our project an unstabilize our application.
Describe the Bug
Dear colleagues,
our Partner Reference Application is a CAP(NodeJS)/Fiori Elements project, which was created via CAP wizard. Per default, the CAP project was not created with type "module" in the package.json. Our CDS service implementation has therefore several require statements included to import files.
Unfortunately, the ai-sdk-js package does not support the "require" statement. It forces to use "import". At some places, like when using jest, we get the error "TypeError: A dynamic import callback was invoked without --experimental-vm-modules".
We would like to avoid changing our complete project to use this library, just to change the project to a module.
Could you please offer a solution for this? How shall a default CAP js application use your library?
Best regards, Christine
Steps to Reproduce
Expected Behavior
The project should be usable with a default CAP js project.
Screenshots
No response
Used Versions
node -v
: v20.12.0Code Examples
No response
Log File
No response
Affected Development Phase
Getting Started
Impact
Blocked
Timeline
No response
Additional Context
No response