Skip to content

Commit 82e6b23

Browse files
committed
Improved example [skip ci]
1 parent e2754a4 commit 82e6b23

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/cohere/example.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ char ** embed(const char * const *texts, size_t texts_size, const char *input_ty
6565
char **embeddings = malloc(texts_size * sizeof(char *));
6666
for (size_t i = 0; i < texts_size; i++) {
6767
cJSON *embedding_json = cJSON_GetArrayItem(ubinary, i);
68-
char *embedding = malloc((1536 + 1) * sizeof(char));
68+
char *embedding = malloc((cJSON_GetArraySize(embedding_json) * 8 + 1) * sizeof(char));
6969
int pos = 0;
7070
cJSON *v;
7171
cJSON_ArrayForEach(v, embedding_json) {

0 commit comments

Comments
 (0)