Add engine encode (#1995)
Co-authored-by: Byron Hsu <byronhsu1230@gmail.com>
This commit is contained in:
@@ -874,4 +874,12 @@ class Engine:
|
||||
else:
|
||||
return tokenizer_manager.tokenizer
|
||||
|
||||
# TODO (ByronHsu): encode
|
||||
def encode(
|
||||
self,
|
||||
prompt: Union[str, List[str], List[Dict], List[List[Dict]]],
|
||||
):
|
||||
obj = EmbeddingReqInput(text=prompt)
|
||||
|
||||
# get the current event loop
|
||||
loop = asyncio.get_event_loop()
|
||||
return loop.run_until_complete(encode_request(obj, None))
|
||||
|
||||
Reference in New Issue
Block a user