Skip to content

[Bug]: Pydantic UnsupportedFieldAttributeWarning #20144

@jeespinozamx

Description

@jeespinozamx

Bug Description

Hi, probably this is not a bug, but when import OpenAI class:

from llama_index.llms.openai import OpenAI

always throws the following warning message in the console:

lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py:2249: UnsupportedFieldAttributeWarning: The 'validate_default' attribute with value True was provided to the Field() function, which has no effect in the context it was used. 'validate_default' is field-specific metadata, and can only be attached to a model field using Annotated metadata or by assignment. This may have happened because an Annotated type alias using the type statement was used, or if the Field() function was attached to a single member of a union type.
warnings.warn(

Version

0.14.5

Steps to Reproduce

  1. Create .env file and add OPENAI_API_KEY=valid_key
  2. Create a script with the following lines:

from dotenv import load_dotenv
from llama_index.llms.openai import OpenAI

Relevant Logs/Tracbacks

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIssue needs to be triaged/prioritized

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions