cancel
Showing results for 
Search instead for 
Did you mean: 

How to create the cds entity Vector column in CAP?

minjie_lao
Product and Topic Expert
Product and Topic Expert

Hi,

Am trying to create entity view contains a embedding vector columns.

our HANA CLOUD instance has been upgraded to QRC01/2024 version, also able to create vector column table within db instance with REAL_VECTOR  data type without any issue

but when i try to create my cds entity

 

 

 

entity Books { 
  title         : String(111);
  embedding     : Vector(3072); 
}

 

 

 

 

i am not able to compile the entity with following error
 
[ERROR] db/rxxxai.cds:34:19-25: No artifact has been found with name “Vector” (in entity:“Books”/element:“embedding”)
 
I've tried to upgrade my following node modules, but doesn't help
 

"@sap/cds": "^7.8.2",
"sap-hdbext-promisfied": "^2.202404.2"
"hdb": "^0.19.8"

Can anyone give some hints?

minjie_lao
Product and Topic Expert
Product and Topic Expert
0 Kudos
i've installed all following dependencies, and working now..

Accepted Solutions (1)

Accepted Solutions (1)

Willem_Pardaens
Product and Topic Expert
Product and Topic Expert

The new vector implementation in CAP, which is still marked as beta, is only available when using the new HANA database service `@cap-js/hana`. You should only have the `@cap-js/hana` in your dependencies, not `hdb` or `@sap/cds-hana`. Note that also this database service is currently still in beta (v0.x.x).

minjie_lao
Product and Topic Expert
Product and Topic Expert
0 Kudos
am facing some error when using @cap-js/hana module, and seems the vector engine not require this module for now (maybe wrong)?
Willem_Pardaens
Product and Topic Expert
Product and Topic Expert
0 Kudos
both @cap-js/hana and the vector capabilities in CAP are beta only, so you'll have to navigate around the limitations it has for the moment.

Answers (4)

Answers (4)

adrian_goerler
Advisor
Advisor

The data type `cds.Vector` is supported by CAP since the Match 2024 release. Please ensure that you are using the following minimum versions:

  • @Sap/cds-dk: 7.8.0
  • CAP Node.js (@sap/cds): 7.8.0
  • CAP Java (cds-services): 2.8.1

Please note that if you are using a globally installed cds-dk you will have to upgrade this installation as well.

For CAP Node.js Vector support is only available with the "new" HANA driver @cap-js/hana.

 

 

 

ArthurYang
Product and Topic Expert
Product and Topic Expert
0 Kudos
When I try to do mbt build, it reminds me "Type “cds.Vector” is not supported for OData", how can I avoid using Odata interface of Vector directly?
adrian_goerler
Advisor
Advisor
0 Kudos
You need to exclude the element of type "cds.Vector" in the entity on service level.
adrian_goerler
Advisor
Advisor
0 Kudos
You need to exclude the element of type "cds.Vector" in the entity on service level. See: https://cap.cloud.sap/docs/cds/cql#excluding-clause
minjie_lao
Product and Topic Expert
Product and Topic Expert
0 Kudos

I've installed following dependencies, 

"@cap-js/hana": "^0.2.0",
"@Sap/cds": "^7.8.2",
"@Sap/cds-compiler": "^4.9.0",

it's working now 

Thanks all of your comments...

 

 

 

cwedler
Advisor
Advisor
0 Kudos

Upgrade the CDS compiler: you need at least v4.8.0