Skip to content

Commit c66b1a7

Browse files
committed
fix base64 test
1 parent 0a753fb commit c66b1a7

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

examples/server/tests/unit/test_embedding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def test_embedding_openai_library_base64():
202202
server.start()
203203
test_input = "Test base64 embedding output"
204204

205-
res = server.make_request("POST", "/embeddings", data={
205+
res = server.make_request("POST", "/v1/embeddings", data={
206206
"input": test_input,
207207
"encoding_format": "base64"
208208
})

examples/server/utils.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "common.h"
44
#include "log.h"
55
#include "llama.h"
6+
#include "common/base64.hpp"
67

78
#ifndef NDEBUG
89
// crash the server in debug mode, otherwise send an http 500 error
@@ -596,6 +597,8 @@ static json format_embeddings_response_oaicompat(const json & request, const jso
596597
int32_t n_tokens = 0;
597598
int i = 0;
598599
for (const auto & elem : embeddings) {
600+
json embedding_obj;
601+
599602
if (use_base64) {
600603
const auto& vec = json_value(elem, "embedding", json::array()).get<std::vector<float>>();
601604
const char* data_ptr = reinterpret_cast<const char*>(vec.data());

0 commit comments

Comments
 (0)