Skip to content

Commit

Permalink
fix base64 test
Browse files Browse the repository at this point in the history
  • Loading branch information
elk-cloner committed Dec 24, 2024
1 parent 0a753fb commit c66b1a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/server/tests/unit/test_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def test_embedding_openai_library_base64():
server.start()
test_input = "Test base64 embedding output"

res = server.make_request("POST", "/embeddings", data={
res = server.make_request("POST", "/v1/embeddings", data={
"input": test_input,
"encoding_format": "base64"
})
Expand Down
3 changes: 3 additions & 0 deletions examples/server/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "common.h"
#include "log.h"
#include "llama.h"
#include "common/base64.hpp"

#ifndef NDEBUG
// crash the server in debug mode, otherwise send an http 500 error
Expand Down Expand Up @@ -596,6 +597,8 @@ static json format_embeddings_response_oaicompat(const json & request, const jso
int32_t n_tokens = 0;
int i = 0;
for (const auto & elem : embeddings) {
json embedding_obj;

if (use_base64) {
const auto& vec = json_value(elem, "embedding", json::array()).get<std::vector<float>>();
const char* data_ptr = reinterpret_cast<const char*>(vec.data());
Expand Down

0 comments on commit c66b1a7

Please sign in to comment.