Skip to content

Commit 2ffd3e6

Browse files
committed
fix: address review - add error types, remove top_p filter, proxy warning
1 parent b71591c commit 2ffd3e6

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

openlrc/chatbot.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,11 @@ def __init__(
795795
self.api_key = api_key
796796
self.api_base = (base_url_config or {}).get("litellm")
797797
self.extra_body = dict(extra_body) if extra_body else {}
798+
if proxy:
799+
logger.warning(
800+
"LiteLLMBot does not support per-instance proxy. "
801+
"Set HTTP_PROXY/HTTPS_PROXY environment variables instead."
802+
)
798803

799804
def update_fee(self, response):
800805
usage = getattr(response, "usage", None)
@@ -835,8 +840,7 @@ def _create_chat(
835840
"max_tokens": self._compute_max_tokens(messages),
836841
"drop_params": True,
837842
}
838-
if effective_temperature == 1.0:
839-
completion_kwargs["top_p"] = effective_top_p
843+
completion_kwargs["top_p"] = effective_top_p
840844
if stop_sequences:
841845
completion_kwargs["stop"] = stop_sequences
842846
if self.api_key:
@@ -870,7 +874,12 @@ def _create_chat(
870874
break
871875
except litellm.AuthenticationError as e:
872876
raise ChatBotException(f"Authentication failed: {e}") from e
873-
except (litellm.BadRequestError, litellm.NotFoundError) as e:
877+
except (
878+
litellm.BadRequestError,
879+
litellm.NotFoundError,
880+
litellm.PermissionDeniedError,
881+
litellm.UnprocessableEntityError,
882+
) as e:
874883
raise ChatBotException(f"Client error: {e}") from e
875884
except (
876885
litellm.RateLimitError,

0 commit comments

Comments
 (0)