Skip to content

Compatibility issue with Python 3.14 (caused by Pydantic v1) #36

@sghng

Description

@sghng

When importing voyageai in Python 3.14, this error occurs:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <module>:1                                                                                    │
│                                                                                                  │
│ ❱  1 import voyageai                                                                             │
│    2                                                                                             │
│    3 vo = voyageai.Client(api_key='**********************************************')              │
│    4                                                                                             │
│                                                                                                  │
│ /Users/sghuang/mamba/envs/ds/lib/python3.14/site-packages/voyageai/__init__.py:27 in <module>    │
│                                                                                                  │
│   24 )                                                                                           │
│   25 from voyageai.version import VERSION                                                        │
│   26 from voyageai.chunking import default_chunk_fn                                              │
│ ❱ 27 from voyageai.client import Client                                                          │
│   28 from voyageai.client_async import AsyncClient                                               │
│   29 from voyageai.embeddings_utils import (                                                     │
│   30 │   get_embedding,                                                                          │
│                                                                                                  │
│ /Users/sghuang/mamba/envs/ds/lib/python3.14/site-packages/voyageai/client.py:12 in <module>      │
│                                                                                                  │
│     9 from PIL.Image import Image                                                                │
│    10                                                                                            │
│    11 import voyageai                                                                            │
│ ❱  12 from voyageai._base import _BaseClient                                                     │
│    13 from voyageai.chunking import apply_chunking                                               │
│    14 import voyageai.error as error                                                             │
│    15 from voyageai.object.multimodal_embeddings import MultimodalInputRequest                   │
│                                                                                                  │
│ /Users/sghuang/mamba/envs/ds/lib/python3.14/site-packages/voyageai/_base.py:15 in <module>       │
│                                                                                                  │
│    12 import voyageai                                                                            │
│    13 import voyageai.error as error                                                             │
│    14 from voyageai.object.contextualized_embeddings import ContextualizedEmbeddingsObject       │
│ ❱  15 from voyageai.object.multimodal_embeddings import MultimodalInputRequest, MultimodalInpu   │
│    16 │   MultimodalInputSegmentImageURL, MultimodalInputSegmentImageBase64, MultimodalEmbeddi   │
│    17 from voyageai.util import default_api_key                                                  │
│    18 from voyageai.object import EmbeddingsObject, RerankingObject                              │
│                                                                                                  │
│ /Users/sghuang/mamba/envs/ds/lib/python3.14/site-packages/voyageai/object/__init__.py:4 in       │
│ <module>                                                                                         │
│                                                                                                  │
│   1 from voyageai.object.contextualized_embeddings import ContextualizedEmbeddingsObject         │
│   2 from voyageai.object.embeddings import EmbeddingsObject                                      │
│   3 from voyageai.object.reranking import RerankingObject                                        │
│ ❱ 4 from voyageai.object.multimodal_embeddings import MultimodalEmbeddingsObject                 │
│   5                                                                                              │
│                                                                                                  │
│ /Users/sghuang/mamba/envs/ds/lib/python3.14/site-packages/voyageai/object/multimodal_embeddings. │
│ py:70 in <module>                                                                                │
│                                                                                                  │
│    67 │   │   extra = Extra.forbid                                                               │
│    68                                                                                            │
│    69                                                                                            │
│ ❱  70 class MultimodalInput(BaseModel):                                                          │
│    71 │   content: List[                                                                         │
│    72 │   │   Annotated[                                                                         │
│    73 │   │   │   Union[                                                                         │
│                                                                                                  │
│ /Users/sghuang/mamba/envs/ds/lib/python3.14/site-packages/pydantic/v1/main.py:221 in __new__     │
│                                                                                                  │
│    218 │   │   │   │   │   private_attributes[var_name] = PrivateAttr(default=value)             │
│    219 │   │   │   │   elif is_valid_field(var_name) and var_name not in annotations and can_be  │
│    220 │   │   │   │   │   validate_field_name(bases, var_name)                                  │
│ ❱  221 │   │   │   │   │   inferred = ModelField.infer(                                          │
│    222 │   │   │   │   │   │   name=var_name,                                                    │
│    223 │   │   │   │   │   │   value=value,                                                      │
│    224 │   │   │   │   │   │   annotation=annotations.get(var_name, Undefined),                  │
│                                                                                                  │
│ /Users/sghuang/mamba/envs/ds/lib/python3.14/site-packages/pydantic/v1/fields.py:502 in infer     │
│                                                                                                  │
│    499 │   │   │   value = None                                                                  │
│    500 │   │   elif value is not Undefined:                                                      │
│    501 │   │   │   required = False                                                              │
│ ❱  502 │   │   annotation = get_annotation_from_field_info(annotation, field_info, name, config  │
│    503 │   │                                                                                     │
│    504 │   │   return cls(                                                                       │
│    505 │   │   │   name=name,                                                                    │
│                                                                                                  │
│ /Users/sghuang/mamba/envs/ds/lib/python3.14/site-packages/pydantic/v1/schema.py:1021 in          │
│ get_annotation_from_field_info                                                                   │
│                                                                                                  │
│   1018 │                                                                                         │
│   1019 │   unused_constraints = constraints - used_constraints                                   │
│   1020 │   if unused_constraints:                                                                │
│ ❱ 1021 │   │   raise ValueError(                                                                 │
│   1022 │   │   │   f'On field "{field_name}" the following field constraints are set but not en  │
│   1023 │   │   │   f'{", ".join(unused_constraints)}. '                                          │
│   1024 │   │   │   f'\nFor more details see https://docs.pydantic.dev/usage/schema/#unenforced-  │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: On field "content" the following field constraints are set but not enforced: min_items. 
For more details see https://docs.pydantic.dev/usage/schema/#unenforced-field-constraints
Saving

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions