Skip to content

Errors TS2307 and TS2322 (langchain, sap/cds and LLMType) #19

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

Open
barry91-acn opened this issue Oct 17, 2024 · 1 comment
Open

Errors TS2307 and TS2322 (langchain, sap/cds and LLMType) #19

barry91-acn opened this issue Oct 17, 2024 · 1 comment

Comments

@barry91-acn
Copy link

barry91-acn commented Oct 17, 2024

Unfortunately I'm facing the following issues.
I already updated langchain and sap-cloud-sdk libraries.

  • npm i -g sap-cloud-sdk
  • npm install @sap-cloud-sdk/openapi
  • pip install -U generative-ai-hub-sdk[langchain]

Do you face the same?

Just for your info: I already builded successfully without any issue a version of this repository of June/July. This is why I think something is changed around library. But honestly now I do not understand what's needed to update/change in order to complete the build.

.........

[email protected] build:ts
tsc

......srv/rag-service.ts(2,25): error TS2307: Cannot find module '@sap/cds/apis/services' or its corresponding type declarations.
srv/rag-service.ts(8,8): error TS2307: Cannot find module 'langchain/prompts' or its corresponding type declarations.
srv/rag-service.ts(111,13): error TS2322: Type 'BTPAzureOpenAIChatLLM' is not assignable to type 'LLMType'.
Type 'BTPAzureOpenAIChatLLM' is missing the following properties from type 'BaseLanguageModelInterface<any, BaseLanguageModelCallOptions>': callKeys, generatePrompt, predict, predictMessages, and 11 more.
srv/rag-service.ts(176,13): error TS2322: Type 'BTPAzureOpenAIChatLLM' is not assignable to type 'LLMType'.
Type 'BTPAzureOpenAIChatLLM' is missing the following properties from type 'BaseLanguageModelInterface<any, BaseLanguageModelCallOptions>': callKeys, generatePrompt, predict, predictMessages, and 11 more.
srv/utils/langchain/BTPAzureOpenAIChatLLM.ts(1,51): error TS2307: Cannot find module 'langchain/chat_models/openai' or its corresponding type declarations.
srv/utils/langchain/BTPAzureOpenAIChatLLM.ts(2,42): error TS2307: Cannot find module 'langchain/dist/types/openai-types' or its corresponding type declarations.
srv/utils/langchain/BTPEmbedding.ts(1,46): error TS2307: Cannot find module 'langchain/embeddings/base' or its corresponding type declarations.
.[2024-10-17 12:58:58] ERROR the "before-all"" build failed: could not execute the "npm run build:cf --prefix api" command: exit status 2
make: *** [Makefile_20241017125755.mta:28: pre_build] Error 1
[2024-10-17 12:58:58] ERROR could not build the MTA project: could not execute the "make -f Makefile_20241017125755.mta p=cf mtar=citizen-genai-rag_0.0.1.mtar strict=true mode= t="./mta_archives"" command: exit status 2

This is the section in which there are issues within the repository code:
image

Thanks in advance for the collaboration.
Best regards,
Andrea

@barry91-acn
Copy link
Author

I just find an relevant info for the issue about SAP CDS sub.modules

Imports from @sap/cds/apis/... are no longer supported!
As a consequence of the above, always only import @sap/cds APIs, while imports from @sap/cds/apis/... were always wrong and don't work any longer with cds8:
import { Service } from '@sap/cds'
import { Service } from '@sap/cds/apis/services' // WRONG!
As already rolled out in December 23, imports references to undocumented .d.ts files, as in line 2 above, was never documented, hence always wrong. While we still supported them for a grace period since then, this grace period ends with cds8.

So this first error disappeared after adjustments indicated here: https://cap.cloud.sap/docs/releases/jun24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant