Skip to content

Commit 22e9c26

Browse files
neottyCopilot
andcommitted
fix: handle missing output_dimension in embedding computation
Co-authored-by: Copilot <copilot@github.com>
1 parent fd4d390 commit 22e9c26

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/dbmem-rembed.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,11 @@ int dbmem_remote_compute_embedding (dbmem_remote_engine_t *engine, const char *t
506506
}
507507
}
508508

509+
// Some providers do not return output_dimension; fallback to embedding array length.
510+
if (n_embd == 0 && emb_count > 0) {
511+
n_embd = (int)emb_count;
512+
}
513+
509514
if (emb_start < 0 || emb_count == 0 || n_embd == 0) {
510515
dbmem_context_set_error(engine->context, "Missing embedding data in API response");
511516
return -1;

0 commit comments

Comments
 (0)