mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-16 09:22:22 +00:00
Merge eafa64591e into e5aa3d32cd
This commit is contained in:
commit
33971a218b
4 changed files with 36 additions and 5 deletions
|
|
@ -1008,7 +1008,7 @@ class ModelResponseIterator:
|
|||
if self.current_content_block_type in _THINKING_BLOCK_TYPES:
|
||||
self.thinking_block_index += 1
|
||||
if content_block_start["content_block"]["type"] == "text":
|
||||
text = self._release_answer_close() + content_block_start["content_block"]["text"]
|
||||
text = self._release_answer_close() + (content_block_start["content_block"].get("text") or "")
|
||||
elif (
|
||||
content_block_start["content_block"]["type"] == "tool_use"
|
||||
or content_block_start["content_block"]["type"] == "server_tool_use"
|
||||
|
|
|
|||
|
|
@ -3660,6 +3660,22 @@ def test_streamed_end_turn_carries_no_stop_details():
|
|||
assert "stop_reason" not in provider_fields
|
||||
|
||||
|
||||
def test_streaming_text_block_start_without_text_field() -> None:
|
||||
"""Preserve text deltas when a gateway omits block-start text."""
|
||||
model_response_iterator: Final = ModelResponseIterator(
|
||||
streaming_response=iter(()), sync_stream=True, json_mode=False
|
||||
)
|
||||
chunks: Final = (
|
||||
{"type": "content_block_start", "index": 0, "content_block": {"type": "text"}},
|
||||
{"type": "content_block_delta", "index": 0, "delta": {"type": "text_delta", "text": "hello"}},
|
||||
)
|
||||
|
||||
parsed_chunks: Final = tuple(model_response_iterator.chunk_parser(chunk=chunk) for chunk in chunks)
|
||||
text: Final = "".join(chunk.choices[0].delta.content or "" for chunk in parsed_chunks)
|
||||
|
||||
assert text == "hello"
|
||||
|
||||
|
||||
def _anthropic_chat_request_for_bound_thinking(
|
||||
extra_headers: dict[str, str] | None, drop_params: bool | None = None
|
||||
) -> httpx.Request:
|
||||
|
|
|
|||
18
vscode-extension/package-lock.json
generated
18
vscode-extension/package-lock.json
generated
|
|
@ -189,19 +189,29 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@azure/msal-node": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-6.0.1.tgz",
|
||||
"integrity": "sha512-ixSO1Y/kCVRthRs+hSx/5qkwaunX1/RAePhlMN0wIpIQ4WEZ6AREGGnGd1AP0qspHVsAwzWQKGubpjh50JyJIQ==",
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-7.1.1.tgz",
|
||||
"integrity": "sha512-zHXTJB38XVrsNaXrPBCMqEUjeyQysFfgmKtUHRDsEKTRjNIPckJ/w6fE5wBXrmJXBim1D3C7O7LOag0msPTrgw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@azure/msal-common": "16.14.1",
|
||||
"@azure/msal-common": "16.14.3",
|
||||
"jsonwebtoken": "^9.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/msal-node/node_modules/@azure/msal-common": {
|
||||
"version": "16.14.3",
|
||||
"resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-16.14.3.tgz",
|
||||
"integrity": "sha512-tz3GvMrR9V/plb2lDdW8qaO8CPpfZevdExBKjltzzbAtyhK0eB2UIvji1aU+gkyHj3fxQ2ie+LNHyMXdmo8wOg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/aix-ppc64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz",
|
||||
|
|
|
|||
|
|
@ -76,6 +76,11 @@
|
|||
"dependencies": {
|
||||
"openai": "^7.18.0"
|
||||
},
|
||||
"overrides": {
|
||||
"@azure/identity": {
|
||||
"@azure/msal-node": "7.1.1"
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.20.3",
|
||||
"@types/vscode": "1.115.0",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue