Skip to content

Commit

Permalink
Catch validation errors (#12882)
Browse files Browse the repository at this point in the history
  • Loading branch information
logan-markewich committed Apr 17, 2024
1 parent 9e40a9d commit 483744d
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 30 deletions.
17 changes: 11 additions & 6 deletions llama-index-core/llama_index/core/ingestion/data_sinks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
from enum import Enum
from typing import Generic, Type, TypeVar

from llama_index.core.bridge.pydantic import BaseModel, Field, GenericModel
from llama_index.core.bridge.pydantic import (
BaseModel,
Field,
GenericModel,
ValidationError,
)
from llama_index.core.vector_stores.types import BasePydanticVectorStore


Expand Down Expand Up @@ -66,7 +71,7 @@ def build_configured_data_sink(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -83,7 +88,7 @@ def build_configured_data_sink(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -100,7 +105,7 @@ def build_configured_data_sink(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -117,7 +122,7 @@ def build_configured_data_sink(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -134,7 +139,7 @@ def build_configured_data_sink(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

return ConfigurableComponent("ConfigurableDataSinks", enum_members)
Expand Down
45 changes: 25 additions & 20 deletions llama-index-core/llama_index/core/ingestion/data_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
from pathlib import Path
from typing import Any, Generic, Iterable, List, Optional, Type, TypeVar, cast

from llama_index.core.bridge.pydantic import BaseModel, Field, GenericModel
from llama_index.core.bridge.pydantic import (
BaseModel,
Field,
GenericModel,
ValidationError,
)
from llama_index.core.readers.base import BasePydanticReader, ReaderConfig
from llama_index.core.schema import BaseComponent, Document, TextNode

Expand Down Expand Up @@ -103,7 +108,7 @@ def build_configured_data_source(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -120,7 +125,7 @@ def build_configured_data_source(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -135,7 +140,7 @@ def build_configured_data_source(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -150,7 +155,7 @@ def build_configured_data_source(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -167,7 +172,7 @@ def build_configured_data_source(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -182,7 +187,7 @@ def build_configured_data_source(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -197,7 +202,7 @@ def build_configured_data_source(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -214,7 +219,7 @@ def build_configured_data_source(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -229,7 +234,7 @@ def build_configured_data_source(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -244,7 +249,7 @@ def build_configured_data_source(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -261,7 +266,7 @@ def build_configured_data_source(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -276,7 +281,7 @@ def build_configured_data_source(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -291,7 +296,7 @@ def build_configured_data_source(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -306,7 +311,7 @@ def build_configured_data_source(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -323,7 +328,7 @@ def build_configured_data_source(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -338,7 +343,7 @@ def build_configured_data_source(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -353,7 +358,7 @@ def build_configured_data_source(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -370,7 +375,7 @@ def build_configured_data_source(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -387,7 +392,7 @@ def build_configured_data_source(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

enum_members.append(
Expand Down
13 changes: 9 additions & 4 deletions llama-index-core/llama_index/core/ingestion/transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
from enum import Enum
from typing import Generic, Sequence, Type, TypeVar

from llama_index.core.bridge.pydantic import BaseModel, Field, GenericModel
from llama_index.core.bridge.pydantic import (
BaseModel,
Field,
GenericModel,
ValidationError,
)
from llama_index.core.node_parser import (
CodeSplitter,
HTMLNodeParser,
Expand Down Expand Up @@ -222,7 +227,7 @@ def build_configured_transformation(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -240,7 +245,7 @@ def build_configured_transformation(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

try:
Expand All @@ -258,7 +263,7 @@ def build_configured_transformation(
),
)
)
except ImportError:
except (ImportError, ValidationError):
pass

return ConfigurableComponent("ConfigurableTransformations", enum_members)
Expand Down

0 comments on commit 483744d

Please sign in to comment.