Skip to content

Commit ec66c52

Browse files
committed
Add same errors to file strategy
1 parent 400d313 commit ec66c52

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

app/backend/prepdocslib/filestrategy.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import logging
22
from typing import List, Optional
33

4+
from azure.core.credentials import AzureKeyCredential
5+
46
from .blobmanager import BlobManager
57
from .embeddings import ImageEmbeddings, OpenAIEmbeddings
68
from .fileprocessor import FileProcessor
@@ -79,6 +81,12 @@ async def setup(self):
7981
await search_manager.create_index()
8082

8183
if self.use_content_understanding:
84+
if self.content_understanding_endpoint is None:
85+
raise ValueError("Content Understanding is enabled but no endpoint was provided")
86+
if isinstance(self.search_info.credential, AzureKeyCredential):
87+
raise ValueError(
88+
"AzureKeyCredential is not supported for Content Understanding, use keyless auth instead"
89+
)
8290
cu_manager = ContentUnderstandingDescriber(self.content_understanding_endpoint, self.search_info.credential)
8391
await cu_manager.create_analyzer()
8492

app/backend/prepdocslib/pdfparser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ async def parse(self, content: IO) -> AsyncGenerator[Page, None]:
7373
content_bytes = content.read()
7474
if self.use_content_understanding:
7575
if self.content_understanding_endpoint is None:
76-
raise ValueError("content_understanding_endpoint should not be None")
76+
raise ValueError("Content Understanding is enabled but no endpoint was provided")
7777
if isinstance(self.credential, AzureKeyCredential):
7878
raise ValueError(
7979
"AzureKeyCredential is not supported for Content Understanding, use keyless auth instead"

0 commit comments

Comments
 (0)