mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-11 19:46:42 +08:00
[Bugfix] Fix encoding_format in examples/openai_embedding_client.py (#6755)
This commit is contained in:
parent
0310029a2f
commit
316a41ac1d
@ -13,11 +13,14 @@ client = OpenAI(
|
|||||||
models = client.models.list()
|
models = client.models.list()
|
||||||
model = models.data[0].id
|
model = models.data[0].id
|
||||||
|
|
||||||
responses = client.embeddings.create(input=[
|
responses = client.embeddings.create(
|
||||||
"Hello my name is",
|
input=[
|
||||||
"The best thing about vLLM is that it supports many different models"
|
"Hello my name is",
|
||||||
],
|
"The best thing about vLLM is that it supports many different models"
|
||||||
model=model)
|
],
|
||||||
|
model=model,
|
||||||
|
encoding_format="float",
|
||||||
|
)
|
||||||
|
|
||||||
for data in responses.data:
|
for data in responses.data:
|
||||||
print(data.embedding) # list of float of len 4096
|
print(data.embedding) # list of float of len 4096
|
||||||
|
|||||||
@ -18,7 +18,6 @@ def embedding_server():
|
|||||||
"--enforce-eager",
|
"--enforce-eager",
|
||||||
"--max-model-len",
|
"--max-model-len",
|
||||||
"8192",
|
"8192",
|
||||||
"--enforce-eager",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
with RemoteOpenAIServer(EMBEDDING_MODEL_NAME, args) as remote_server:
|
with RemoteOpenAIServer(EMBEDDING_MODEL_NAME, args) as remote_server:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user