[Frontend] API support for beam search (#9087)

Co-authored-by: youkaichao <youkaichao@126.com>
This commit is contained in:
Brendan Wong
2024-10-05 23:39:03 -07:00
committed by GitHub
parent 23fea8714a
commit 168cab6bbf
12 changed files with 275 additions and 68 deletions

View File

@@ -504,6 +504,15 @@ async def merge_async_iterators(
await it.aclose()
async def collect_from_async_generator(
iterator: AsyncGenerator[T, None]) -> List[T]:
"""Collect all items from an async generator into a list."""
items = []
async for item in iterator:
items.append(item)
return items
def get_ip() -> str:
host_ip = envs.VLLM_HOST_IP
if host_ip: