Skip to content

Commit 4b4665f

Browse files
committed
sqlite-lembed
1 parent 0d08588 commit 4b4665f

File tree

4 files changed

+1272
-5
lines changed

4 files changed

+1272
-5
lines changed

llama.cpp/embedr/BUILD.mk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ o/$(MODE)/llama.cpp/embedr/sqlite3.a: o/$(MODE)/llama.cpp/embedr/sqlite3.o
2222
o/$(MODE)/llama.cpp/embedr/sqlite-vec.o: llama.cpp/embedr/sqlite-vec.c
2323
o/$(MODE)/llama.cpp/embedr/sqlite-vec.a: o/$(MODE)/llama.cpp/embedr/sqlite-vec.o
2424

25+
o/$(MODE)/llama.cpp/embedr/sqlite-lembed.o: llama.cpp/embedr/sqlite-lembed.c
26+
o/$(MODE)/llama.cpp/embedr/sqlite-lembed.a: o/$(MODE)/llama.cpp/embedr/sqlite-lembed.o o/$(MODE)/llama.cpp/llama.cpp.a
27+
2528
o/$(MODE)/llama.cpp/embedr/shell.o: llama.cpp/embedr/shell.c
2629
o/$(MODE)/llama.cpp/embedr/shell.a: o/$(MODE)/llama.cpp/embedr/shell.o
2730

@@ -35,7 +38,8 @@ o/$(MODE)/llama.cpp/embedr/embedr: \
3538
o/$(MODE)/llama.cpp/embedr/embedr.1.asc.zip.o \
3639
o/$(MODE)/llama.cpp/llama.cpp.a \
3740
o/$(MODE)/llama.cpp/embedr/sqlite3.a \
38-
o/$(MODE)/llama.cpp/embedr/sqlite-vec.a
41+
o/$(MODE)/llama.cpp/embedr/sqlite-vec.a \
42+
o/$(MODE)/llama.cpp/embedr/sqlite-lembed.a
3943

4044
$(LLAMA_CPP_EMBEDR_OBJS): private CCFLAGS += -DSQLITE_CORE
4145

llama.cpp/embedr/embedr.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@
44
#include "llamafile/version.h"
55
#include "llama.cpp/embedr/sqlite3.h"
66
#include "llama.cpp/embedr/sqlite-vec.h"
7+
#include "llama.cpp/embedr/sqlite-lembed.h"
78
#include "llama.cpp/embedr/shell.h"
89
#include "string.h"
910
int main(int argc, char ** argv) {
1011
int rc;
1112
sqlite3* db;
1213
sqlite3_stmt* stmt;
1314
rc = sqlite3_auto_extension((void (*)())sqlite3_vec_init);
15+
rc = sqlite3_auto_extension((void (*)())sqlite3_lembed_init);
1416

1517
if(argc > 1 && (strcmp(argv[1], "sh") == 0)) {
16-
return mn(argc, argv);
18+
return mn(argc-1, argv+1);
1719
}
1820
printf("%d\n", argc);
1921
printf("llamafile-embed %s, SQLite %s, sqlite-vec=%s, %d\n", LLAMAFILE_VERSION_STRING, sqlite3_version, SQLITE_VEC_VERSION, LLAMA_FTYPE_MOSTLY_Q4_1);
@@ -24,9 +26,9 @@ int main(int argc, char ** argv) {
2426
return 1;
2527
}
2628

27-
rc = sqlite3_prepare_v2(db, "select vec_version()", -1, &stmt, NULL);
29+
rc = sqlite3_prepare_v2(db, "select sqlite_version(), vec_version(), lembed_version()", -1, &stmt, NULL);
2830
if(rc != SQLITE_OK) {
29-
printf("a\n");
31+
printf("a %s\n", sqlite3_errmsg(db));
3032
return 1;
3133
}
3234
rc = sqlite3_step(stmt);
@@ -35,7 +37,7 @@ int main(int argc, char ** argv) {
3537
sqlite3_finalize(stmt);
3638
return 1;
3739
}
38-
printf("x=%s\n", sqlite3_column_text(stmt, 0));
40+
printf("%s %s %s\n", sqlite3_column_text(stmt, 0), sqlite3_column_text(stmt, 1), sqlite3_column_text(stmt, 2));
3941

4042
sqlite3_finalize(stmt);
4143

0 commit comments

Comments
 (0)