Skip to content

Commit 8957b9c

Browse files
committed
fix: pass embed_dim to openai sdk
1 parent 4782f59 commit 8957b9c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/server/api/memobase_server/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.0.41"
1+
__version__ = "0.0.42"
22

33
__author__ = "memobase.io"
44
__url__ = "https://github.com/memodb-io/memobase"

src/server/api/memobase_server/llms/embeddings/openai_embedding.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
import numpy as np
22
from typing import Literal
33
from .utils import get_openai_async_client_instance
4-
from ...env import LOG
4+
from ...env import LOG, CONFIG
55

66

77
async def openai_embedding(
88
model: str, texts: list[str], phase: Literal["query", "document"] = "document"
99
) -> np.ndarray:
1010
openai_async_client = get_openai_async_client_instance()
1111
response = await openai_async_client.embeddings.create(
12-
model=model, input=texts, encoding_format="float"
12+
model=model,
13+
input=texts,
14+
encoding_format="float",
15+
dimensions=CONFIG.embedding_dim,
1316
)
1417

1518
prompt_tokens = getattr(response.usage, "prompt_tokens", None)

0 commit comments

Comments
 (0)