Bugfix: enable embeddings for fastapi server
This commit is contained in:
parent
c25b7dfc86
commit
f28bf3f13d
1 changed files with 4 additions and 1 deletions
|
@ -31,6 +31,7 @@ llama = llama_cpp.Llama(
|
||||||
settings.model,
|
settings.model,
|
||||||
f16_kv=True,
|
f16_kv=True,
|
||||||
use_mlock=True,
|
use_mlock=True,
|
||||||
|
embedding=True,
|
||||||
n_threads=6,
|
n_threads=6,
|
||||||
n_batch=2048,
|
n_batch=2048,
|
||||||
)
|
)
|
||||||
|
@ -93,4 +94,6 @@ CreateEmbeddingResponse = create_model_from_typeddict(llama_cpp.Embedding)
|
||||||
response_model=CreateEmbeddingResponse,
|
response_model=CreateEmbeddingResponse,
|
||||||
)
|
)
|
||||||
def create_embedding(request: CreateEmbeddingRequest):
|
def create_embedding(request: CreateEmbeddingRequest):
|
||||||
return llama.create_embedding(**request.dict())
|
# print(request)
|
||||||
|
# return llama.create_embedding(**request.dict(exclude={"model", "user"}))
|
||||||
|
return llama.create_embedding(request.input)
|
||||||
|
|
Loading…
Reference in a new issue