mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
refactor(batches): declare credential transport attribute on Logging
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
8aca0c37fd
commit
ff9d30bc79
3 changed files with 3 additions and 8 deletions
|
|
@ -867,11 +867,7 @@ class CheckBatchCost:
|
|||
optional_params={},
|
||||
custom_llm_provider=str(llm_provider) if llm_provider else None,
|
||||
)
|
||||
# deployment credentials stay off litellm_params because every callback sees those; the
|
||||
# line-item logger reads them back off this private attribute to fetch the batch files
|
||||
setattr( # noqa: B010 # Logging has no declared attribute for trusted credentials transport
|
||||
logging_obj, "_litellm_internal_model_credentials", MappingProxyType(dict(credentials))
|
||||
)
|
||||
logging_obj._litellm_internal_model_credentials = MappingProxyType(dict(credentials)) # pyright: ignore[reportPrivateUsage] # trusted credentials transport, consumed by batch_line_item_logging
|
||||
|
||||
if not await self._claim_job_for_costing(job):
|
||||
verbose_proxy_logger.info(
|
||||
|
|
|
|||
|
|
@ -299,9 +299,7 @@ async def log_batch_line_items(
|
|||
is logged and swallowed: aggregate accounting must be unaffected."""
|
||||
emitted = 0 # rebind-ok: loop accumulator for emitted line count
|
||||
try:
|
||||
internal_credentials: Final = getattr(parent, "_litellm_internal_model_credentials", None) or (
|
||||
litellm_params.get("_litellm_internal_model_credentials") if litellm_params else None
|
||||
)
|
||||
internal_credentials: Final = parent._litellm_internal_model_credentials # pyright: ignore[reportPrivateUsage] # declared transport attribute on Logging
|
||||
internal_mapping: Final = _as_object_mapping(internal_credentials)
|
||||
fetch_params: Final[dict[str, object] | None] = ( # mutable-ok: file fetcher requires a plain dict
|
||||
dict(internal_mapping) # mutable-ok: the file fetcher reads credential kwargs off a plain dict
|
||||
|
|
|
|||
|
|
@ -574,6 +574,7 @@ class Logging(LiteLLMLoggingBaseClass):
|
|||
self.sync_streaming_chunks: list[Any] = [] # for generating complete stream response
|
||||
self.log_raw_request_response = log_raw_request_response
|
||||
self._native_callback_fast_path: bool = False
|
||||
self._litellm_internal_model_credentials: Mapping[str, object] | None = None
|
||||
|
||||
# Initialize dynamic callbacks
|
||||
self.dynamic_input_callbacks: list[str | Callable | CustomLogger] | None = dynamic_input_callbacks
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue