mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-16 23:41:43 +00:00
refactor(agentic-loop): narrow logging_obj before building the fake stream wrapper
Some checks failed
LiteLLM Rust / rustfmt, clippy, test (push) Has been cancelled
Terraform Modules / fmt, validate, test (aws) (push) Has been cancelled
Terraform Provider / gofmt, vet, build, test (push) Has been cancelled
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Has been cancelled
Some checks failed
LiteLLM Rust / rustfmt, clippy, test (push) Has been cancelled
Terraform Modules / fmt, validate, test (aws) (push) Has been cancelled
Terraform Provider / gofmt, vet, build, test (push) Has been cancelled
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Has been cancelled
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
d556a04286
commit
a14daf18d6
1 changed files with 3 additions and 2 deletions
|
|
@ -10,6 +10,8 @@ from litellm.litellm_core_utils.agentic_loop_settings import (
|
||||||
DEFAULT_MAX_AGENTIC_LOOPS,
|
DEFAULT_MAX_AGENTIC_LOOPS,
|
||||||
validated_max_agentic_loops,
|
validated_max_agentic_loops,
|
||||||
)
|
)
|
||||||
|
from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObject
|
||||||
|
from litellm.llms.base_llm.base_model_iterator import MockResponseIterator
|
||||||
from litellm.types.integrations.custom_logger import (
|
from litellm.types.integrations.custom_logger import (
|
||||||
CHAT_COMPLETION_AGENTIC_SURFACE,
|
CHAT_COMPLETION_AGENTIC_SURFACE,
|
||||||
HEADROOM_CONVERTED_STREAM_KEY,
|
HEADROOM_CONVERTED_STREAM_KEY,
|
||||||
|
|
@ -104,9 +106,8 @@ def _wrap_response_as_fake_stream(
|
||||||
) -> object:
|
) -> object:
|
||||||
if isinstance(response, CustomStreamWrapper):
|
if isinstance(response, CustomStreamWrapper):
|
||||||
return response
|
return response
|
||||||
if not isinstance(response, ModelResponse):
|
if not isinstance(response, ModelResponse) or not isinstance(logging_obj, LiteLLMLoggingObject):
|
||||||
return response
|
return response
|
||||||
from litellm.llms.base_llm.base_model_iterator import MockResponseIterator
|
|
||||||
|
|
||||||
return CustomStreamWrapper(
|
return CustomStreamWrapper(
|
||||||
completion_stream=MockResponseIterator(model_response=response),
|
completion_stream=MockResponseIterator(model_response=response),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue