Skip to content

Commit

Permalink
feat: supported streaming with multiple candidates (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
adubovik committed Dec 18, 2024
1 parent 8b0de00 commit 2996c7e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
3 changes: 0 additions & 3 deletions aidial_adapter_vertexai/chat_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ async def chat_completion(self, request: Request, response: Response):
n = params.n or 1
params.n = None

if n > 1 and params.stream:
raise ValidationError("n>1 is not supported in streaming mode")

if params.max_prompt_tokens is None:
truncated_prompt = TruncatedPrompt(
prompt=prompt, discarded_messages=[]
Expand Down
12 changes: 2 additions & 10 deletions tests/integration_tests/test_chat_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,16 +227,8 @@ def test_case(
name="multiple candidates",
max_tokens=10,
n=5,
messages=[user("2+3=?")],
expected=(
ExpectedException(
type=UnprocessableEntityError,
message="n>1 is not supported in streaming mode",
status_code=422,
)
if streaming
else for_all_choices(lambda _: True, 5)
),
messages=[user("2+7=? Reply with a single number")],
expected=for_all_choices(lambda s: "9" in s, 5),
)

# Stop sequences do not work for some reason for CHAT_BISON_2_32K and streaming mode
Expand Down

0 comments on commit 2996c7e

Please sign in to comment.