fix: Conversation creation accessing secret without unwrapping (#6335)

Co-authored-by: Calvin Smith <calvin@all-hands.dev>
This commit is contained in:
Calvin Smith
2025-01-17 15:16:57 -07:00
committed by GitHub
parent b1fa6301f0
commit f07ec7a09c
2 changed files with 10 additions and 7 deletions

View File

@@ -51,7 +51,10 @@ async def _create_new_conversation(
session_init_args = {**settings.__dict__, **session_init_args}
# We could use litellm.check_valid_key for a more accurate check,
# but that would run a tiny inference.
if not settings.llm_api_key or settings.llm_api_key.isspace():
if (
not settings.llm_api_key
or settings.llm_api_key.get_secret_value().isspace()
):
logger.warn(f'Missing api key for model {settings.llm_model}')
raise LLMAuthenticationError(
'Error authenticating with the LLM provider. Please check your API key'