mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-06-06 04:59:24 +02:00
don't spam the logs with texts on auth errors (#4085)
* don't spam the logs with texts on auth errors * refactor the logging a bit --------- Co-authored-by: Richard Kuo (Danswer) <rkuo@onyx.app>
This commit is contained in:
parent
6de53ebf60
commit
fe8a5d671a
@ -98,12 +98,17 @@ class CloudEmbedding:
|
|||||||
return final_embeddings
|
return final_embeddings
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error_string = (
|
error_string = (
|
||||||
f"Error embedding text with OpenAI: {str(e)} \n"
|
f"Exception embedding text with OpenAI - {type(e)}: "
|
||||||
f"Model: {model} \n"
|
f"Model: {model} "
|
||||||
f"Provider: {self.provider} \n"
|
f"Provider: {self.provider} "
|
||||||
f"Texts: {texts}"
|
f"Exception: {e}"
|
||||||
)
|
)
|
||||||
logger.error(error_string)
|
logger.error(error_string)
|
||||||
|
|
||||||
|
# only log text when it's not an authentication error.
|
||||||
|
if not isinstance(e, openai.AuthenticationError):
|
||||||
|
logger.debug(f"Exception texts: {texts}")
|
||||||
|
|
||||||
raise RuntimeError(error_string)
|
raise RuntimeError(error_string)
|
||||||
|
|
||||||
async def _embed_cohere(
|
async def _embed_cohere(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user