SAP-samples / btp-cap-genai-rag

Explore this repository for GenAI samples on SAP Business Technology Platform (SAP BTP). We provide examples for single and multitenant versions, showcasing integration of LLMs via SAP AI Core, LangChain in SAP CAP, and advanced techniques like Retrieval Augmented Generation (RAG).
https://discovery-center.cloud.sap/refArchDetail/ref-arch-open-ai
Apache License 2.0
62 stars 24 forks source link

Where does all the AI Core code code from in the lightweight api sample? #27

Open js1972 opened 4 weeks ago

js1972 commented 4 weeks ago

There are a lot of typescript files includes in the srv folders for ai core and langchain - where do these come from? How did you create them? Are they generated or copied from somewhere? Lots of magic in here...

kay-schmitteckert commented 4 weeks ago

Hi @js1972,

Thanks for your request. The typescript files for interacting with SAP AI Core were generated using the SAP Cloud SDK following the steps from the SAP Business Accelerator Hub: https://api.sap.com/api/AI_CORE_API/cloud-sdk/JavaScript

The LangChain wrapper was implemented manually as a custom llm with the help of the base model for the OpenAI api: https://js.langchain.com/v0.1/docs/modules/model_io/llms/custom_llm/

Hope this helps.

Best Kay

js1972 commented 4 weeks ago

Thanks Kay - that makes sense now... As this is referenced from a Mission and Reference Architecture on the Discovery Centre would you consider this a best practice with how to interact with LLMs from a CAP app? Have you seen the CAP LLM plugin? https://github.com/SAP-samples/cap-llm-plugin-samples.