chore: keep exception handling changes to instructor adapters
This commit is contained in:
parent
c81315d177
commit
ee079604f4
3 changed files with 9 additions and 5 deletions
4
.github/workflows/test_s3_file_storage.yml
vendored
4
.github/workflows/test_s3_file_storage.yml
vendored
|
|
@ -6,6 +6,10 @@ on:
|
|||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
RUNTIME__LOG_LEVEL: ERROR
|
||||
ENV: 'test'
|
||||
|
||||
jobs:
|
||||
test-gemini:
|
||||
name: Run S3 File Storage Test
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ class GenericAPIAdapter(LLMInterface):
|
|||
if not (self.fallback_model and self.fallback_api_key and self.fallback_endpoint):
|
||||
raise ContentPolicyFilterError(
|
||||
f"The provided input contains content that is not aligned with our content policy: {text_input}"
|
||||
)
|
||||
) from error
|
||||
|
||||
try:
|
||||
return await self.aclient.chat.completions.create(
|
||||
|
|
@ -151,4 +151,4 @@ class GenericAPIAdapter(LLMInterface):
|
|||
else:
|
||||
raise ContentPolicyFilterError(
|
||||
f"The provided input contains content that is not aligned with our content policy: {text_input}"
|
||||
)
|
||||
) from error
|
||||
|
|
|
|||
|
|
@ -146,11 +146,11 @@ class OpenAIAdapter(LLMInterface):
|
|||
ContentFilterFinishReasonError,
|
||||
ContentPolicyViolationError,
|
||||
InstructorRetryException,
|
||||
):
|
||||
) as e:
|
||||
if not (self.fallback_model and self.fallback_api_key):
|
||||
raise ContentPolicyFilterError(
|
||||
f"The provided input contains content that is not aligned with our content policy: {text_input}"
|
||||
)
|
||||
) from e
|
||||
|
||||
try:
|
||||
return await self.aclient.chat.completions.create(
|
||||
|
|
@ -183,7 +183,7 @@ class OpenAIAdapter(LLMInterface):
|
|||
else:
|
||||
raise ContentPolicyFilterError(
|
||||
f"The provided input contains content that is not aligned with our content policy: {text_input}"
|
||||
)
|
||||
) from error
|
||||
|
||||
@observe
|
||||
@sleep_and_retry_sync()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue