elevenlabs / elevenlabs-python

The official Python API for ElevenLabs Text to Speech.
https://elevenlabs.io/docs/api-reference/getting-started
MIT License
2k stars 225 forks source link

Error: __root__ -> voices -> 46 -> sharing -> .... #222

Closed RevelryMedia closed 3 months ago

RevelryMedia commented 4 months ago

Tried installing the 1.0.0 and running the basic example (w/key) in the docs and I'm getting the below error: (The only issue I had in the old version was when I forgot to shut my vpn off.)

Sample code used:

`from elevenlabs import play from elevenlabs.client import ElevenLabs

client = ElevenLabs( api_key="YOUR_API_KEY", # Defaults to ELEVEN_API_KEY )

audio = client.generate( text="Hello! 你好! Hola! नमस्ते! Bonjour! こんにちは! مرحبا! 안녕하세요! Ciao! Cześć! Привіт! வணக்கம்!", voice="Rachel", model="eleven_multilingual_v2" ) play(audio)`

Error:

Traceback (most recent call last): File "c:\dev\aiVideoStream\elevenlabscontrol.py", line 16, in <module> audio = client.generate( ^^^^^^^^^^^^^^^^ File "C:\dev\Environments\aivideo\Lib\site-packages\elevenlabs\client.py", line 179, in generate voices_response = self.voices.get_all(request_options=request_options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\dev\Environments\aivideo\Lib\site-packages\elevenlabs\voices\client.py", line 69, in get_all return pydantic.parse_obj_as(GetVoicesResponse, _response.json()) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\dev\Environments\aivideo\Lib\site-packages\pydantic\v1\tools.py", line 38, in parse_obj_as return model_type(__root__=obj).__root__ ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\dev\Environments\aivideo\Lib\site-packages\pydantic\v1\main.py", line 341, in __init__ raise validation_error pydantic.v1.error_wrappers.ValidationError: 32 validation errors for ParsingModel[GetVoicesResponse] __root__ -> voices -> 46 -> sharing -> history_item_sample_id none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 46 -> sharing -> disable_at_unix none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 46 -> sharing -> instagram_username none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 46 -> sharing -> twitter_username none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 46 -> sharing -> youtube_username none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 46 -> sharing -> tiktok_username none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 46 -> sharing -> ban_reason none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 46 -> sharing -> review_message none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 47 -> sharing -> history_item_sample_id none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 47 -> sharing -> disable_at_unix none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 47 -> sharing -> instagram_username none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 47 -> sharing -> twitter_username none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 47 -> sharing -> youtube_username none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 47 -> sharing -> tiktok_username none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 47 -> sharing -> ban_reason none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 47 -> sharing -> review_message none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 48 -> sharing -> history_item_sample_id none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 48 -> sharing -> disable_at_unix none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 48 -> sharing -> instagram_username none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 48 -> sharing -> twitter_username none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 48 -> sharing -> youtube_username none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 48 -> sharing -> tiktok_username none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 48 -> sharing -> ban_reason none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 48 -> sharing -> review_message none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 49 -> sharing -> history_item_sample_id none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 49 -> sharing -> disable_at_unix none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 49 -> sharing -> instagram_username none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 49 -> sharing -> twitter_username none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 49 -> sharing -> youtube_username none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 49 -> sharing -> tiktok_username none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 49 -> sharing -> ban_reason none is not an allowed value (type=type_error.none.not_allowed) __root__ -> voices -> 49 -> sharing -> review_message none is not an allowed value (type=type_error.none.not_allowed)

satouani commented 4 months ago

Hi, I had the same problem before and I fixed it by removing voices I added from Voice Library

RevelryMedia commented 4 months ago

Hi, I had the same problem before and I fixed it by removing voices I added from Voice Library

Wow, that actually worked!!! Thanks! Definitely a bug.

ishaangandhi commented 3 months ago

Try downgrading the library:

pip install elevenlabs==0.3.0b0
C0rn3j commented 3 months ago

https://github.com/elevenlabs/elevenlabs-python/blob/87027740319e6ea303112f273fc7d0c89a5dc0d5/src/elevenlabs/types/voice_sharing_response.py

Pydantic types are broken.

Replacing the class like this was good enough for my purposes at least:

# /usr/lib/python3.11/site-packages/elevenlabs/types/voice_sharing_response.py
class VoiceSharingResponse(pydantic.BaseModel):
    status: VoiceSharingState
    history_item_sample_id: typing.Optional[str] = None
    date_unix: int
    whitelisted_emails: typing.List[str]
    public_owner_id: str
    original_voice_id: str
    financial_rewards_enabled: bool
    free_users_allowed: bool
    live_moderation_enabled: bool
    rate: float
    notice_period: int
    disable_at_unix: typing.Optional[int] = None
    voice_mixing_allowed: bool
    instagram_username: typing.Optional[str] = None
    twitter_username: typing.Optional[str] = None
    youtube_username: typing.Optional[str] = None
    tiktok_username: typing.Optional[str] = None
    featured: bool
    ban_reason: typing.Optional[str] = None
    liked_by_count: int
    cloned_by_count: int
    name: str
    description: typing.Optional[str] = None
    labels: typing.Dict[str, str]
    review_status: ReviewStatus
    review_message: typing.Optional[str] = None
    enabled_in_library: bool
dsinghvi commented 3 months ago

Hey folks -- thanks for reporting this error. We will be releasing a fix shortly!

fern-bot commented 3 months ago

This is fixed in v1.0.1!