You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test: add llm_chat_vtab test and improve test utilities
Introduces a new test, test_llm_chat_vtab, to verify the llm_chat virtual table functionality and memory usage. Adds the exec_select_rows helper for row-counting and verbose output. Updates test_llm_chat_respond_repeated to use varied prompts and more detailed context usage queries. Removes redundant SQLITE_ENABLE_LOAD_EXTENSION macro definition.
@@ -144,7 +184,7 @@ static int test_llm_chat_respond_repeated(const test_env *env) {
144
184
sqlite3_close(db);
145
185
return1;
146
186
}
147
-
if (exec_expect_ok(env, db, "SELECT llm_context_create('context_size=32000');") !=0) {
187
+
if (exec_expect_ok(env, db, "SELECT llm_context_create('context_size=1000');") !=0) {
148
188
sqlite3_close(db);
149
189
return1;
150
190
}
@@ -154,13 +194,18 @@ static int test_llm_chat_respond_repeated(const test_env *env) {
154
194
}
155
195
156
196
constintiterations=3;
197
+
char*prompts[] = {
198
+
"SELECT llm_chat_respond('Hi');",
199
+
"SELECT llm_chat_respond('How are you?');",
200
+
"SELECT llm_chat_respond('Again');"
201
+
};
157
202
for (inti=0; i<iterations; ++i) {
158
-
if (exec_expect_ok(env, db, "SELECT llm_chat_respond('Hello world');") !=0) {
203
+
if (exec_expect_ok(env, db, prompts[i]) !=0) {
159
204
sqlite3_close(db);
160
205
return1;
161
206
}
162
207
163
-
if (exec_expect_ok(env, db, "SELECT llm_context_usage();") !=0) {
208
+
if (exec_expect_ok(env, db, "SELECT llm_context_used() AS context_used, llm_context_size() AS context_size, CAST(llm_context_used() AS FLOAT)/CAST(llm_context_size() AS FLOAT) || '%' AS 'context_usage_percentage';") !=0) {
164
209
sqlite3_close(db);
165
210
return1;
166
211
}
@@ -199,9 +244,57 @@ static int test_llm_chat_respond_repeated(const test_env *env) {
0 commit comments