At the end of this exercise, you'll have an environment to work in for the duration of this CodeJam, and your environment of choice will load the contents of this repository.
To prepare the building blocks for this CodeJam, you'll need to clone this CodeJam repository and make its contents available in the workspace you chose in the prerequisites. Your workspace will either be a Dev Space in the SAP Business Application Studio (the "primary environment") or VS Code with a dev container (the "alternative environment").
Follow one of the two subsections here, as appropriate: either for a primary environment or for an alternative environment.
Follow the Alternative environment subsection below if you want to use VS Code and a container image.
👉 Via your subscription to the SAP Business Application Studio, create a new Dev Space, choosing the Full Stack Cloud Application type, make sure to select SAP HANA Tools, and then make sure it's started up:
Choosing the Full Stack Cloud Application brings in some predefined extensions, as you can see from the screenshot, including a CDS Graphical Modeler and the CAP Tools. The SAP HANA Tools> will allow you to interact with, deploy, and observe the SAP HANA Cloud instance that you will be using for working with the SAP HANA Cloud Vector Engine.
Depending on your subscription access, you may need to stop using existing Dev Spaces to use this one.
👉 If the Dev Space is started and you're in it, use the Clone from Git option in the Get Started screen that appears to clone this repository. Follow the subsequent prompts to open the cloned repository; specify https://github.com/SAP-samples/codejam-cap-llm.git
as the URL.
At this point, your Dev Space will restart.
Follow the Primary environment section above if you want to use a Dev Space in the SAP Business Application Studio.
👉 At a command prompt on your local machine, clone this repository into a directory of your choice, and then open VS Code, pointing to that newly cloned repository's directory:
git clone https://github.com/SAP-samples/codejam-cap-llm
code codejam-cap-llm
Once VS Code has started and opened the directory, it should notice the dev container configuration file (in the .devcontainer/ directory) and ask you if you want to reopen everything in a container, as shown in the screenshot. Confirm that you wish to do so by selecting the default answer Reopen in Container.
If this doesn't happen, check that you have the Dev Containers extension in VS Code - see the corresponding prerequisites section section for details. You might also need to explicitly request this action, by opening the Command Palette and selecting Dev Containers: Reopen in container.
To work through the exercises make sure you are in the project folder. To do so, use the terminal to change directory into codejam-cap-llm/project/cap-documentation-ai-helper/
.
From the root of the Codejam repository change directory:
cd project/cap-documentation-ai-helper
This and subsequent steps apply to both the primary and alternative environments.
👉 Inside your dev container or your Dev Space, open a terminal using Terminal: Create New Terminal in the Command Palette, and at the prompt, check the version:
cds v
You should see that the CDS development kit is installed. Depending on your workspace, you'll see slightly different output, but it should generally look something like this:
@cap-js/cds-types: 0.2.0
@sap/cds: 7.6.1
@sap/cds-compiler: 4.4.4
@sap/cds-dk: 7.5.1
@sap/cds-dk (global): 7.5.1
@sap/cds-fiori: 1.2.2
@sap/cds-foss: 5.0.0
@sap/cds-mtxs: 1.15.0
@sap/eslint-plugin-cds: 2.6.5
Node.js: v18.14.2
home: /managed-content/globals/pnpm/5/.pnpm/@[email protected][email protected]/node_modules/@sap/cds
The CDS development kit is installed as part of any Full Stack Cloud Application type of Dev Space in the SAP Business Application Studio. For the alternative environment, a RUN command in the Dockerfile is installed into the dev container.
We'll work primarily within the project/cap-documentation-ai-helper
directory of this repo, which contains a starter CAP project with code already written to provide UI and some of the service functionalities to make the CodeJam experience more accessible. The package.json
file contains runtime and design time dependencies.
👉 Make sure you're in the project/cap-documentation-ai-helper
directory (where package.json
lives):
👉 Now install the dependencies thus:
npm install
You can double-check what's installed with npm list
, which should show you something similar to this:
[email protected] /Users/Developer/GitHub/codejam-cap-llm/project/cap-documentation-ai-helper
├── @cap-js/[email protected]
├── @sap-cloud-sdk/[email protected]
├── @sap/[email protected]
├── @sap/[email protected]
├── @sap/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
No worries, we will talk about these dependencies later.
At this point, you have an environment in which to work through the rest of the exercises in this CodeJam, the repository contents, and the CDS development kit installed and ready to use.
- Developing CAP in containers - three ways
- Developing inside a Container
- Cloning repositories in SAP Business Application Studio
- The @sap/cds-dk package on NPM