Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ OMIT_LOCAL_ENGINE ?= 0
OMIT_REMOTE_ENGINE ?= 0
OMIT_IO ?= 0
OMIT_CURL ?= 0
REMOTE_ENGINE_API_URL ?= https://api.vectors.space/v1/embeddings
LLAMA ?=
CURL_VERSION ?= 8.12.1
MBEDTLS_VERSION ?= 3.6.5
Expand Down Expand Up @@ -277,6 +278,7 @@ endif

ifeq ($(OMIT_REMOTE_ENGINE),0)
C_SOURCES += $(SRC_DIR)/dbmem-rembed.c
override DEFINES += -DDBMEM_REMOTE_API_URL=\"$(REMOTE_ENGINE_API_URL)\"
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line starts with a tab character while in a top-level ifeq block (not inside a recipe). In GNU Make, a leading tab is treated as a recipe line and will error with “recipe commences before first target”. Remove the leading tab and align indentation with the surrounding variable assignments (spaces only).

Suggested change
override DEFINES += -DDBMEM_REMOTE_API_URL=\"$(REMOTE_ENGINE_API_URL)\"
override DEFINES += -DDBMEM_REMOTE_API_URL=\"$(REMOTE_ENGINE_API_URL)\"

Copilot uses AI. Check for mistakes.
ifeq ($(OMIT_CURL),1)
override DEFINES += -DDBMEM_OMIT_CURL
OBJC_SOURCES := $(SRC_DIR)/dbmem-http.m
Expand Down Expand Up @@ -770,6 +772,7 @@ help:
@echo "Build options:"
@echo " OMIT_LOCAL_ENGINE=1 - Build without llama.cpp (local embeddings)"
@echo " OMIT_REMOTE_ENGINE=1 - Build without remote embedding support"
@echo " REMOTE_ENGINE_API_URL=<url> - Remote embedding endpoint (default: $(REMOTE_ENGINE_API_URL))"
@echo " OMIT_IO=1 - Build without file/directory functions"
@echo ""
@echo "Examples:"
Expand All @@ -788,6 +791,7 @@ help:
@echo " OMIT_LOCAL_ENGINE=$(OMIT_LOCAL_ENGINE)"
@echo " OMIT_REMOTE_ENGINE=$(OMIT_REMOTE_ENGINE)"
@echo " OMIT_IO=$(OMIT_IO)"
@echo " REMOTE_ENGINE_API_URL=$(REMOTE_ENGINE_API_URL)"

.PHONY: debug
debug: CFLAGS += -g -O0 -DENABLE_DBMEM_DEBUG=1
Expand All @@ -813,3 +817,4 @@ vars:
@echo "OMIT_LOCAL_ENGINE = $(OMIT_LOCAL_ENGINE)"
@echo "OMIT_REMOTE_ENGINE= $(OMIT_REMOTE_ENGINE)"
@echo "OMIT_IO = $(OMIT_IO)"
@echo "REMOTE_ENGINE_API_URL = $(REMOTE_ENGINE_API_URL)"
8 changes: 5 additions & 3 deletions src/dbmem-rembed.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
static size_t cacert_len = sizeof(cacert_pem) - 1;
#endif

#define API_URL "https://api.vectors.space/v1/embeddings"
#ifndef DBMEM_REMOTE_API_URL
#define DBMEM_REMOTE_API_URL "https://api.vectors.space/v1/embeddings"
#endif
#define DEFAULT_BUFFER_SIZE (100*1024) //100KB, enough for 4096 embedding dimension without reallocation

#ifndef DBMEM_OMIT_CURL
Expand Down Expand Up @@ -324,7 +326,7 @@ dbmem_remote_engine_t *dbmem_remote_engine_init (void *ctx, const char *provider

#ifndef DBMEM_OMIT_CURL
// set static curl options (only POSTFIELDS changes per call)
curl_easy_setopt(curl, CURLOPT_URL, API_URL);
curl_easy_setopt(curl, CURLOPT_URL, DBMEM_REMOTE_API_URL);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, dbmem_remote_receive_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)engine);
Expand Down Expand Up @@ -423,7 +425,7 @@ int dbmem_remote_compute_embedding (dbmem_remote_engine_t *engine, const char *t
long http_code = 0;
char http_err[DBMEM_ERRBUF_SIZE];

int rc = dbmem_http_post(API_URL, engine->api_key, engine->request,
int rc = dbmem_http_post(DBMEM_REMOTE_API_URL, engine->api_key, engine->request,
&response_data, &response_size, &http_code,
http_err, sizeof(http_err));
if (rc != 0) {
Expand Down
Loading