Debian Codegraph @

test/command/suite/language_model/centroid_column/offline_online.test

raw
1 #@require-env GRN_LANGUAGE_MODEL_DOWNLOAD_CACHE_DIR
2 #@require-feature llama.cpp
3
4 #@on-error omit
5 plugin_register language_model/knn
6 #@on-error default
7
8 table_create Data TABLE_NO_KEY
9 column_create Data text COLUMN_SCALAR ShortText
10 column_create Data rabitq_code COLUMN_SCALAR ShortBinary
11
12 load --table Data
13 [
14 {"text": "I am a boy."}
15 ]
16
17 table_create RaBitQ TABLE_HASH_KEY UInt32 \
18 --default_tokenizer \
19 'TokenLanguageModelKNN("model", "hf:///groonga/multilingual-e5-base-Q4_K_M-GGUF", \
20 "centroid_column", "centroid", \
21 "code_column", "rabitq_code", \
22 "passage_prefix", "passage: ", \
23 "query_prefix", "query: ")'
24 column_create RaBitQ centroid COLUMN_VECTOR Float32
25 # This is for waiting for downloading model.
26 #@timeout 300
27 column_create RaBitQ data_text COLUMN_INDEX Data text
28
29 load --table Data
30 [
31 {"text": "This is an apple."}
32 ]
33
34 select Data \
35 --filter 'language_model_knn(text, "male child")' \
36 --output_columns text
37
38 select Data \
39 --filter 'language_model_knn(text, "fruit")' \
40 --output_columns text