Skip to content

Commit 3b205a1

Browse files
committed
Sanity check added for non-empty options
1 parent 61372d8 commit 3b205a1

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/sqlite-ai.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2312,7 +2312,7 @@ static bool llm_context_create_with_options (sqlite3_context *context, ai_contex
23122312

23132313
// sanity check embedding_type
23142314
if (ctx_params.embeddings && ai->options.embedding.type == 0) {
2315-
sqlite_context_result_error(context, SQLITE_ERROR, "Embedding type must be specified in the create context funtion");
2315+
sqlite_context_result_error(context, SQLITE_ERROR, "Embedding type (embedding_type) must be specified in the create context funtion");
23162316
return false;
23172317
}
23182318

@@ -2332,7 +2332,11 @@ static void llm_context_create (sqlite3_context *context, int argc, sqlite3_valu
23322332
// sanity check arguments
23332333
if (llm_common_args_check(context, "llm_context_create", argc, argv, true) == false) return;
23342334
const char *options = (const char *)sqlite3_value_text(argv[0]);
2335-
2335+
if ((options == NULL) || (strlen(options) == 0)) {
2336+
sqlite_context_result_error(context, SQLITE_ERROR, "Non empty options must be specified when calling llm_context_create");
2337+
return;
2338+
}
2339+
23362340
ai_context *ai = (ai_context *)sqlite3_user_data(context);
23372341
llm_context_create_with_options(context, ai, options, NULL);
23382342
}

src/sqlite-ai.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
extern "C" {
2525
#endif
2626

27-
#define SQLITE_AI_VERSION "0.7.0"
27+
#define SQLITE_AI_VERSION "0.7.1"
2828

2929
SQLITE_AI_API int sqlite3_ai_init (sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi);
3030

0 commit comments

Comments
 (0)