Skip to content

pydantic.errors.PydanticUserError: GetAgentResponseModel is not fully defined #521

@nhoffmann

Description

@nhoffmann

Description

I was trying to get information about a conversational ai agent from the api in json format.
Calling the json() function on the response object results in a pydantic.errors.PydanticUserError

It looks like something is missing in the generated SDK code or am I doing it wrong?

Code example

import os

from dotenv import load_dotenv
from elevenlabs.client import ElevenLabs

load_dotenv()

ELEVENLABS_API_KEY = os.getenv("ELEVENLABS_API_KEY")

client = ElevenLabs(api_key=ELEVENLABS_API_KEY)

response = client.conversational_ai.get_agent("<insert-existing-agent-id>")

print(response.json())

Output

Traceback (most recent call last):
  File "src/my-package/test.py", line 14, in <module>
    print(response.json())
  File ".venv/lib/python3.9/site-packages/elevenlabs/core/pydantic_utilities.py", line 127, in json
    return super().model_dump_json(**kwargs_with_defaults)  # type: ignore # Pydantic v2
  File ".venv/lib/python3.9/site-packages/pydantic/main.py", line 519, in model_dump_json
    return self.__pydantic_serializer__.to_json(
  File ".venv/lib/python3.9/site-packages/pydantic/_internal/_mock_val_ser.py", line 100, in __getattr__
    raise PydanticUserError(self._error_message, code=self._code)
pydantic.errors.PydanticUserError: `GetAgentResponseModel` is not fully defined; you should define `ArrayJsonSchemaPropertyOutput`, then call `GetAgentResponseModel.model_rebuild()`.

For further information visit https://errors.pydantic.dev/2.11/u/class-not-fully-defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions