mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-16 04:29:31 +00:00
test: expect the list-position index on streamed thinking blocks in the integration suite (#46618)
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
aa694f316d
commit
a9d6123a43
3 changed files with 6 additions and 5 deletions
|
|
@ -205,8 +205,8 @@ def thinking_block(thinking: str, signature: JsonValue) -> Event:
|
|||
return {"type": "thinking", "thinking": thinking, "signature": signature}
|
||||
|
||||
|
||||
def signature_only(signature: JsonValue = SIGNATURE) -> Event:
|
||||
return thinking_block("", signature)
|
||||
def signature_only(signature: JsonValue = SIGNATURE, index: int = 0) -> Event:
|
||||
return {**thinking_block("", signature), "index": index}
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ def test_two_signed_blocks_each_keep_their_own_text_through_a_replay(gateway: Ga
|
|||
first: Final = _stream_chat(gateway, _chat_body(model, marker))
|
||||
assert first.status_code == 200, first.text
|
||||
deltas: Final = deltas_of(chunks_of(first.text))
|
||||
assert signed_blocks(deltas) == (signature_only(SIGNATURE), signature_only(_SECOND_SIGNATURE)), deltas
|
||||
assert signed_blocks(deltas) == (signature_only(SIGNATURE), signature_only(_SECOND_SIGNATURE, index=1)), deltas
|
||||
assert accumulate(deltas) == (
|
||||
thinking_block("one two", SIGNATURE),
|
||||
thinking_block("three four", _SECOND_SIGNATURE),
|
||||
|
|
@ -465,7 +465,7 @@ def test_signature_only_block_without_thinking_deltas_is_relayed_as_is(gateway:
|
|||
assert response.status_code == 200, response.text
|
||||
deltas: Final = deltas_of(chunks_of(response.text))
|
||||
assert signed_blocks(deltas) == (signature_only(SIGNATURE),), deltas
|
||||
assert accumulate(deltas) == (signature_only(SIGNATURE),), deltas
|
||||
assert accumulate(deltas) == (thinking_block("", SIGNATURE),), deltas
|
||||
assert reasoning_text(deltas) == "", deltas
|
||||
assert content_text(deltas) == answer(marker), deltas
|
||||
assert len(wire.drain()) == 1
|
||||
|
|
|
|||
|
|
@ -219,7 +219,8 @@ def test_claude_redacted_thinking_round_trips_back_to_converse_as_redacted_conte
|
|||
)
|
||||
question: Final[dict[str, JsonValue]] = {"role": "user", "content": QUESTION}
|
||||
first: Final = send(gateway, {"model": model, "messages": [question], "thinking": THINKING, "max_tokens": 2048})
|
||||
assert first.thinking_blocks == ({"type": "redacted_thinking", "data": NATIVE_REDACTED},)
|
||||
streamed_position: Final[dict[str, JsonValue]] = {"index": 0} if stream else {}
|
||||
assert first.thinking_blocks == ({"type": "redacted_thinking", "data": NATIVE_REDACTED, **streamed_position},)
|
||||
|
||||
second: Final = send(
|
||||
gateway,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue