-
Notifications
You must be signed in to change notification settings - Fork 3
Remove unstructured-ingest as a dependency #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| __version__ = "0.0.41" # pragma: no cover | ||
| __version__ = "0.0.42" # pragma: no cover |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,10 +9,10 @@ | |
| from fastapi import FastAPI, HTTPException, status | ||
| from fastapi.responses import StreamingResponse | ||
| from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor | ||
| from pydantic import BaseModel, Field, create_model | ||
| from pydantic import BaseModel, Field, ValidationError, create_model | ||
| from starlette.responses import RedirectResponse | ||
| from unstructured_ingest.data_types.file_data import BatchFileData, FileData, file_data_from_dict | ||
| from unstructured_ingest.error import UnstructuredIngestError | ||
| from utic_public_types.plugins.file_data import BatchFileData, FileData | ||
| from utic_public_types.plugins.errors import UnstructuredIngestError | ||
| from uvicorn.config import LOG_LEVELS | ||
| from uvicorn.importer import import_from_string | ||
|
|
||
|
|
@@ -32,12 +32,19 @@ | |
|
|
||
| FileDataType = Union[FileData, BatchFileData] | ||
|
|
||
| logger = logging.getLogger("uvicorn.error") | ||
|
|
||
| class EtlApiException(Exception): | ||
| pass | ||
|
|
||
| def file_data_from_dict(data: dict) -> FileData: | ||
| try: | ||
| return BatchFileData.model_validate(data) | ||
| except ValidationError: | ||
| logger.debug(f"{data} not valid for batch file data") | ||
| return FileData.model_validate(data) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this might also need try-return approach.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I should have explained this better. I'm gonna remove this from here and just move it into the utic-public-types in file_data where it really belongs. :)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thats why i made the other PR. |
||
|
|
||
|
|
||
| logger = logging.getLogger("uvicorn.error") | ||
| class EtlApiException(Exception): | ||
| pass | ||
|
|
||
|
|
||
| class MessageChannels(BaseModel): | ||
|
|
||
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.