code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def create( self, *, name: str, value: str, request_options: typing.Optional[RequestOptions] = None ) -> HttpResponse[PostWorkspaceSecretResponseModel]: """ Create a new secret for the workspace Parameters ---------- name : str value : str request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[PostWorkspaceSecretResponseModel] Successful Response """ _response = self._client_wrapper.httpx_client.request( "v1/convai/secrets", base_url=self._client_wrapper.get_environment().base, method="POST", json={ "name": name, "value": value, "type": "new", }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( PostWorkspaceSecretResponseModel, construct_type( type_=PostWorkspaceSecretResponseModel, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Create a new secret for the workspace Parameters ---------- name : str value : str request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[PostWorkspaceSecretResponseModel] Successful Response
create
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/secrets/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/secrets/raw_client.py
MIT
def delete(self, secret_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]: """ Delete a workspace secret if it's not in use Parameters ---------- secret_id : str request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[None] """ _response = self._client_wrapper.httpx_client.request( f"v1/convai/secrets/{jsonable_encoder(secret_id)}", base_url=self._client_wrapper.get_environment().base, method="DELETE", request_options=request_options, ) try: if 200 <= _response.status_code < 300: return HttpResponse(response=_response, data=None) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Delete a workspace secret if it's not in use Parameters ---------- secret_id : str request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[None]
delete
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/secrets/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/secrets/raw_client.py
MIT
async def list( self, *, request_options: typing.Optional[RequestOptions] = None ) -> AsyncHttpResponse[GetWorkspaceSecretsResponseModel]: """ Get all workspace secrets for the user Parameters ---------- request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[GetWorkspaceSecretsResponseModel] Successful Response """ _response = await self._client_wrapper.httpx_client.request( "v1/convai/secrets", base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( GetWorkspaceSecretsResponseModel, construct_type( type_=GetWorkspaceSecretsResponseModel, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Get all workspace secrets for the user Parameters ---------- request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[GetWorkspaceSecretsResponseModel] Successful Response
list
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/secrets/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/secrets/raw_client.py
MIT
async def create( self, *, name: str, value: str, request_options: typing.Optional[RequestOptions] = None ) -> AsyncHttpResponse[PostWorkspaceSecretResponseModel]: """ Create a new secret for the workspace Parameters ---------- name : str value : str request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[PostWorkspaceSecretResponseModel] Successful Response """ _response = await self._client_wrapper.httpx_client.request( "v1/convai/secrets", base_url=self._client_wrapper.get_environment().base, method="POST", json={ "name": name, "value": value, "type": "new", }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( PostWorkspaceSecretResponseModel, construct_type( type_=PostWorkspaceSecretResponseModel, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Create a new secret for the workspace Parameters ---------- name : str value : str request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[PostWorkspaceSecretResponseModel] Successful Response
create
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/secrets/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/secrets/raw_client.py
MIT
async def delete( self, secret_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> AsyncHttpResponse[None]: """ Delete a workspace secret if it's not in use Parameters ---------- secret_id : str request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[None] """ _response = await self._client_wrapper.httpx_client.request( f"v1/convai/secrets/{jsonable_encoder(secret_id)}", base_url=self._client_wrapper.get_environment().base, method="DELETE", request_options=request_options, ) try: if 200 <= _response.status_code < 300: return AsyncHttpResponse(response=_response, data=None) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Delete a workspace secret if it's not in use Parameters ---------- secret_id : str request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[None]
delete
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/secrets/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/secrets/raw_client.py
MIT
def update( self, *, conversation_initiation_client_data_webhook: typing.Optional[ConversationInitiationClientDataWebhook] = OMIT, webhooks: typing.Optional[ConvAiWebhooks] = OMIT, can_use_mcp_servers: typing.Optional[bool] = OMIT, rag_retention_period_days: typing.Optional[int] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> GetConvAiSettingsResponseModel: """ Update Convai settings for the workspace Parameters ---------- conversation_initiation_client_data_webhook : typing.Optional[ConversationInitiationClientDataWebhook] webhooks : typing.Optional[ConvAiWebhooks] can_use_mcp_servers : typing.Optional[bool] Whether the workspace can use MCP servers rag_retention_period_days : typing.Optional[int] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- GetConvAiSettingsResponseModel Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.conversational_ai.settings.update() """ _response = self._raw_client.update( conversation_initiation_client_data_webhook=conversation_initiation_client_data_webhook, webhooks=webhooks, can_use_mcp_servers=can_use_mcp_servers, rag_retention_period_days=rag_retention_period_days, request_options=request_options, ) return _response.data
Update Convai settings for the workspace Parameters ---------- conversation_initiation_client_data_webhook : typing.Optional[ConversationInitiationClientDataWebhook] webhooks : typing.Optional[ConvAiWebhooks] can_use_mcp_servers : typing.Optional[bool] Whether the workspace can use MCP servers rag_retention_period_days : typing.Optional[int] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- GetConvAiSettingsResponseModel Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.conversational_ai.settings.update()
update
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/settings/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/settings/client.py
MIT
async def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetConvAiSettingsResponseModel: """ Retrieve Convai settings for the workspace Parameters ---------- request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- GetConvAiSettingsResponseModel Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.conversational_ai.settings.get() asyncio.run(main()) """ _response = await self._raw_client.get(request_options=request_options) return _response.data
Retrieve Convai settings for the workspace Parameters ---------- request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- GetConvAiSettingsResponseModel Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.conversational_ai.settings.get() asyncio.run(main())
get
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/settings/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/settings/client.py
MIT
async def update( self, *, conversation_initiation_client_data_webhook: typing.Optional[ConversationInitiationClientDataWebhook] = OMIT, webhooks: typing.Optional[ConvAiWebhooks] = OMIT, can_use_mcp_servers: typing.Optional[bool] = OMIT, rag_retention_period_days: typing.Optional[int] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> GetConvAiSettingsResponseModel: """ Update Convai settings for the workspace Parameters ---------- conversation_initiation_client_data_webhook : typing.Optional[ConversationInitiationClientDataWebhook] webhooks : typing.Optional[ConvAiWebhooks] can_use_mcp_servers : typing.Optional[bool] Whether the workspace can use MCP servers rag_retention_period_days : typing.Optional[int] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- GetConvAiSettingsResponseModel Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.conversational_ai.settings.update() asyncio.run(main()) """ _response = await self._raw_client.update( conversation_initiation_client_data_webhook=conversation_initiation_client_data_webhook, webhooks=webhooks, can_use_mcp_servers=can_use_mcp_servers, rag_retention_period_days=rag_retention_period_days, request_options=request_options, ) return _response.data
Update Convai settings for the workspace Parameters ---------- conversation_initiation_client_data_webhook : typing.Optional[ConversationInitiationClientDataWebhook] webhooks : typing.Optional[ConvAiWebhooks] can_use_mcp_servers : typing.Optional[bool] Whether the workspace can use MCP servers rag_retention_period_days : typing.Optional[int] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- GetConvAiSettingsResponseModel Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.conversational_ai.settings.update() asyncio.run(main())
update
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/settings/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/settings/client.py
MIT
def get( self, *, request_options: typing.Optional[RequestOptions] = None ) -> HttpResponse[GetConvAiSettingsResponseModel]: """ Retrieve Convai settings for the workspace Parameters ---------- request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[GetConvAiSettingsResponseModel] Successful Response """ _response = self._client_wrapper.httpx_client.request( "v1/convai/settings", base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( GetConvAiSettingsResponseModel, construct_type( type_=GetConvAiSettingsResponseModel, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Retrieve Convai settings for the workspace Parameters ---------- request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[GetConvAiSettingsResponseModel] Successful Response
get
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/settings/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/settings/raw_client.py
MIT
def update( self, *, conversation_initiation_client_data_webhook: typing.Optional[ConversationInitiationClientDataWebhook] = OMIT, webhooks: typing.Optional[ConvAiWebhooks] = OMIT, can_use_mcp_servers: typing.Optional[bool] = OMIT, rag_retention_period_days: typing.Optional[int] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[GetConvAiSettingsResponseModel]: """ Update Convai settings for the workspace Parameters ---------- conversation_initiation_client_data_webhook : typing.Optional[ConversationInitiationClientDataWebhook] webhooks : typing.Optional[ConvAiWebhooks] can_use_mcp_servers : typing.Optional[bool] Whether the workspace can use MCP servers rag_retention_period_days : typing.Optional[int] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[GetConvAiSettingsResponseModel] Successful Response """ _response = self._client_wrapper.httpx_client.request( "v1/convai/settings", base_url=self._client_wrapper.get_environment().base, method="PATCH", json={ "conversation_initiation_client_data_webhook": convert_and_respect_annotation_metadata( object_=conversation_initiation_client_data_webhook, annotation=ConversationInitiationClientDataWebhook, direction="write", ), "webhooks": convert_and_respect_annotation_metadata( object_=webhooks, annotation=ConvAiWebhooks, direction="write" ), "can_use_mcp_servers": can_use_mcp_servers, "rag_retention_period_days": rag_retention_period_days, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( GetConvAiSettingsResponseModel, construct_type( type_=GetConvAiSettingsResponseModel, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Update Convai settings for the workspace Parameters ---------- conversation_initiation_client_data_webhook : typing.Optional[ConversationInitiationClientDataWebhook] webhooks : typing.Optional[ConvAiWebhooks] can_use_mcp_servers : typing.Optional[bool] Whether the workspace can use MCP servers rag_retention_period_days : typing.Optional[int] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[GetConvAiSettingsResponseModel] Successful Response
update
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/settings/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/settings/raw_client.py
MIT
async def get( self, *, request_options: typing.Optional[RequestOptions] = None ) -> AsyncHttpResponse[GetConvAiSettingsResponseModel]: """ Retrieve Convai settings for the workspace Parameters ---------- request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[GetConvAiSettingsResponseModel] Successful Response """ _response = await self._client_wrapper.httpx_client.request( "v1/convai/settings", base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( GetConvAiSettingsResponseModel, construct_type( type_=GetConvAiSettingsResponseModel, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Retrieve Convai settings for the workspace Parameters ---------- request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[GetConvAiSettingsResponseModel] Successful Response
get
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/settings/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/settings/raw_client.py
MIT
async def update( self, *, conversation_initiation_client_data_webhook: typing.Optional[ConversationInitiationClientDataWebhook] = OMIT, webhooks: typing.Optional[ConvAiWebhooks] = OMIT, can_use_mcp_servers: typing.Optional[bool] = OMIT, rag_retention_period_days: typing.Optional[int] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[GetConvAiSettingsResponseModel]: """ Update Convai settings for the workspace Parameters ---------- conversation_initiation_client_data_webhook : typing.Optional[ConversationInitiationClientDataWebhook] webhooks : typing.Optional[ConvAiWebhooks] can_use_mcp_servers : typing.Optional[bool] Whether the workspace can use MCP servers rag_retention_period_days : typing.Optional[int] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[GetConvAiSettingsResponseModel] Successful Response """ _response = await self._client_wrapper.httpx_client.request( "v1/convai/settings", base_url=self._client_wrapper.get_environment().base, method="PATCH", json={ "conversation_initiation_client_data_webhook": convert_and_respect_annotation_metadata( object_=conversation_initiation_client_data_webhook, annotation=ConversationInitiationClientDataWebhook, direction="write", ), "webhooks": convert_and_respect_annotation_metadata( object_=webhooks, annotation=ConvAiWebhooks, direction="write" ), "can_use_mcp_servers": can_use_mcp_servers, "rag_retention_period_days": rag_retention_period_days, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( GetConvAiSettingsResponseModel, construct_type( type_=GetConvAiSettingsResponseModel, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Update Convai settings for the workspace Parameters ---------- conversation_initiation_client_data_webhook : typing.Optional[ConversationInitiationClientDataWebhook] webhooks : typing.Optional[ConvAiWebhooks] can_use_mcp_servers : typing.Optional[bool] Whether the workspace can use MCP servers rag_retention_period_days : typing.Optional[int] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[GetConvAiSettingsResponseModel] Successful Response
update
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/settings/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/settings/raw_client.py
MIT
def outbound_call( self, *, agent_id: str, agent_phone_number_id: str, to_number: str, conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> SipTrunkOutboundCallResponse: """ Handle an outbound call via SIP trunk Parameters ---------- agent_id : str agent_phone_number_id : str to_number : str conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SipTrunkOutboundCallResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.conversational_ai.sip_trunk.outbound_call( agent_id="agent_id", agent_phone_number_id="agent_phone_number_id", to_number="to_number", ) """ _response = self._raw_client.outbound_call( agent_id=agent_id, agent_phone_number_id=agent_phone_number_id, to_number=to_number, conversation_initiation_client_data=conversation_initiation_client_data, request_options=request_options, ) return _response.data
Handle an outbound call via SIP trunk Parameters ---------- agent_id : str agent_phone_number_id : str to_number : str conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SipTrunkOutboundCallResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.conversational_ai.sip_trunk.outbound_call( agent_id="agent_id", agent_phone_number_id="agent_phone_number_id", to_number="to_number", )
outbound_call
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/sip_trunk/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/sip_trunk/client.py
MIT
async def outbound_call( self, *, agent_id: str, agent_phone_number_id: str, to_number: str, conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> SipTrunkOutboundCallResponse: """ Handle an outbound call via SIP trunk Parameters ---------- agent_id : str agent_phone_number_id : str to_number : str conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SipTrunkOutboundCallResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.conversational_ai.sip_trunk.outbound_call( agent_id="agent_id", agent_phone_number_id="agent_phone_number_id", to_number="to_number", ) asyncio.run(main()) """ _response = await self._raw_client.outbound_call( agent_id=agent_id, agent_phone_number_id=agent_phone_number_id, to_number=to_number, conversation_initiation_client_data=conversation_initiation_client_data, request_options=request_options, ) return _response.data
Handle an outbound call via SIP trunk Parameters ---------- agent_id : str agent_phone_number_id : str to_number : str conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SipTrunkOutboundCallResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.conversational_ai.sip_trunk.outbound_call( agent_id="agent_id", agent_phone_number_id="agent_phone_number_id", to_number="to_number", ) asyncio.run(main())
outbound_call
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/sip_trunk/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/sip_trunk/client.py
MIT
def outbound_call( self, *, agent_id: str, agent_phone_number_id: str, to_number: str, conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[SipTrunkOutboundCallResponse]: """ Handle an outbound call via SIP trunk Parameters ---------- agent_id : str agent_phone_number_id : str to_number : str conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[SipTrunkOutboundCallResponse] Successful Response """ _response = self._client_wrapper.httpx_client.request( "v1/convai/sip-trunk/outbound-call", base_url=self._client_wrapper.get_environment().base, method="POST", json={ "agent_id": agent_id, "agent_phone_number_id": agent_phone_number_id, "to_number": to_number, "conversation_initiation_client_data": convert_and_respect_annotation_metadata( object_=conversation_initiation_client_data, annotation=ConversationInitiationClientDataRequestInput, direction="write", ), }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( SipTrunkOutboundCallResponse, construct_type( type_=SipTrunkOutboundCallResponse, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Handle an outbound call via SIP trunk Parameters ---------- agent_id : str agent_phone_number_id : str to_number : str conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[SipTrunkOutboundCallResponse] Successful Response
outbound_call
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/sip_trunk/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/sip_trunk/raw_client.py
MIT
async def outbound_call( self, *, agent_id: str, agent_phone_number_id: str, to_number: str, conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[SipTrunkOutboundCallResponse]: """ Handle an outbound call via SIP trunk Parameters ---------- agent_id : str agent_phone_number_id : str to_number : str conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[SipTrunkOutboundCallResponse] Successful Response """ _response = await self._client_wrapper.httpx_client.request( "v1/convai/sip-trunk/outbound-call", base_url=self._client_wrapper.get_environment().base, method="POST", json={ "agent_id": agent_id, "agent_phone_number_id": agent_phone_number_id, "to_number": to_number, "conversation_initiation_client_data": convert_and_respect_annotation_metadata( object_=conversation_initiation_client_data, annotation=ConversationInitiationClientDataRequestInput, direction="write", ), }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( SipTrunkOutboundCallResponse, construct_type( type_=SipTrunkOutboundCallResponse, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Handle an outbound call via SIP trunk Parameters ---------- agent_id : str agent_phone_number_id : str to_number : str conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[SipTrunkOutboundCallResponse] Successful Response
outbound_call
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/sip_trunk/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/sip_trunk/raw_client.py
MIT
def outbound_call( self, *, agent_id: str, agent_phone_number_id: str, to_number: str, conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> TwilioOutboundCallResponse: """ Handle an outbound call via Twilio Parameters ---------- agent_id : str agent_phone_number_id : str to_number : str conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- TwilioOutboundCallResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.conversational_ai.twilio.outbound_call( agent_id="agent_id", agent_phone_number_id="agent_phone_number_id", to_number="to_number", ) """ _response = self._raw_client.outbound_call( agent_id=agent_id, agent_phone_number_id=agent_phone_number_id, to_number=to_number, conversation_initiation_client_data=conversation_initiation_client_data, request_options=request_options, ) return _response.data
Handle an outbound call via Twilio Parameters ---------- agent_id : str agent_phone_number_id : str to_number : str conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- TwilioOutboundCallResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.conversational_ai.twilio.outbound_call( agent_id="agent_id", agent_phone_number_id="agent_phone_number_id", to_number="to_number", )
outbound_call
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/twilio/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/twilio/client.py
MIT
async def outbound_call( self, *, agent_id: str, agent_phone_number_id: str, to_number: str, conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> TwilioOutboundCallResponse: """ Handle an outbound call via Twilio Parameters ---------- agent_id : str agent_phone_number_id : str to_number : str conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- TwilioOutboundCallResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.conversational_ai.twilio.outbound_call( agent_id="agent_id", agent_phone_number_id="agent_phone_number_id", to_number="to_number", ) asyncio.run(main()) """ _response = await self._raw_client.outbound_call( agent_id=agent_id, agent_phone_number_id=agent_phone_number_id, to_number=to_number, conversation_initiation_client_data=conversation_initiation_client_data, request_options=request_options, ) return _response.data
Handle an outbound call via Twilio Parameters ---------- agent_id : str agent_phone_number_id : str to_number : str conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- TwilioOutboundCallResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.conversational_ai.twilio.outbound_call( agent_id="agent_id", agent_phone_number_id="agent_phone_number_id", to_number="to_number", ) asyncio.run(main())
outbound_call
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/twilio/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/twilio/client.py
MIT
def outbound_call( self, *, agent_id: str, agent_phone_number_id: str, to_number: str, conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[TwilioOutboundCallResponse]: """ Handle an outbound call via Twilio Parameters ---------- agent_id : str agent_phone_number_id : str to_number : str conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[TwilioOutboundCallResponse] Successful Response """ _response = self._client_wrapper.httpx_client.request( "v1/convai/twilio/outbound-call", base_url=self._client_wrapper.get_environment().base, method="POST", json={ "agent_id": agent_id, "agent_phone_number_id": agent_phone_number_id, "to_number": to_number, "conversation_initiation_client_data": convert_and_respect_annotation_metadata( object_=conversation_initiation_client_data, annotation=ConversationInitiationClientDataRequestInput, direction="write", ), }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( TwilioOutboundCallResponse, construct_type( type_=TwilioOutboundCallResponse, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Handle an outbound call via Twilio Parameters ---------- agent_id : str agent_phone_number_id : str to_number : str conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[TwilioOutboundCallResponse] Successful Response
outbound_call
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/twilio/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/twilio/raw_client.py
MIT
async def outbound_call( self, *, agent_id: str, agent_phone_number_id: str, to_number: str, conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[TwilioOutboundCallResponse]: """ Handle an outbound call via Twilio Parameters ---------- agent_id : str agent_phone_number_id : str to_number : str conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[TwilioOutboundCallResponse] Successful Response """ _response = await self._client_wrapper.httpx_client.request( "v1/convai/twilio/outbound-call", base_url=self._client_wrapper.get_environment().base, method="POST", json={ "agent_id": agent_id, "agent_phone_number_id": agent_phone_number_id, "to_number": to_number, "conversation_initiation_client_data": convert_and_respect_annotation_metadata( object_=conversation_initiation_client_data, annotation=ConversationInitiationClientDataRequestInput, direction="write", ), }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( TwilioOutboundCallResponse, construct_type( type_=TwilioOutboundCallResponse, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Handle an outbound call via Twilio Parameters ---------- agent_id : str agent_phone_number_id : str to_number : str conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[TwilioOutboundCallResponse] Successful Response
outbound_call
python
elevenlabs/elevenlabs-python
src/elevenlabs/conversational_ai/twilio/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/conversational_ai/twilio/raw_client.py
MIT
def serialize_datetime(v: dt.datetime) -> str: """ Serialize a datetime including timezone info. Uses the timezone info provided if present, otherwise uses the current runtime's timezone info. UTC datetimes end in "Z" while all other timezones are represented as offset from UTC, e.g. +05:00. """ def _serialize_zoned_datetime(v: dt.datetime) -> str: if v.tzinfo is not None and v.tzinfo.tzname(None) == dt.timezone.utc.tzname(None): # UTC is a special case where we use "Z" at the end instead of "+00:00" return v.isoformat().replace("+00:00", "Z") else: # Delegate to the typical +/- offset format return v.isoformat() if v.tzinfo is not None: return _serialize_zoned_datetime(v) else: local_tz = dt.datetime.now().astimezone().tzinfo localized_dt = v.replace(tzinfo=local_tz) return _serialize_zoned_datetime(localized_dt)
Serialize a datetime including timezone info. Uses the timezone info provided if present, otherwise uses the current runtime's timezone info. UTC datetimes end in "Z" while all other timezones are represented as offset from UTC, e.g. +05:00.
serialize_datetime
python
elevenlabs/elevenlabs-python
src/elevenlabs/core/datetime_utils.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/core/datetime_utils.py
MIT
def convert_file_dict_to_httpx_tuples( d: Dict[str, Union[File, List[File]]], ) -> List[Tuple[str, File]]: """ The format we use is a list of tuples, where the first element is the name of the file and the second is the file object. Typically HTTPX wants a dict, but to be able to send lists of files, you have to use the list approach (which also works for non-lists) https://github.com/encode/httpx/pull/1032 """ httpx_tuples = [] for key, file_like in d.items(): if isinstance(file_like, list): for file_like_item in file_like: httpx_tuples.append((key, file_like_item)) else: httpx_tuples.append((key, file_like)) return httpx_tuples
The format we use is a list of tuples, where the first element is the name of the file and the second is the file object. Typically HTTPX wants a dict, but to be able to send lists of files, you have to use the list approach (which also works for non-lists) https://github.com/encode/httpx/pull/1032
convert_file_dict_to_httpx_tuples
python
elevenlabs/elevenlabs-python
src/elevenlabs/core/file.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/core/file.py
MIT
def with_content_type(*, file: File, default_content_type: str) -> File: """ This function resolves to the file's content type, if provided, and defaults to the default_content_type value if not. """ if isinstance(file, tuple): if len(file) == 2: filename, content = cast(Tuple[Optional[str], FileContent], file) # type: ignore return (filename, content, default_content_type) elif len(file) == 3: filename, content, file_content_type = cast(Tuple[Optional[str], FileContent, Optional[str]], file) # type: ignore out_content_type = file_content_type or default_content_type return (filename, content, out_content_type) elif len(file) == 4: filename, content, file_content_type, headers = cast( # type: ignore Tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]], file ) out_content_type = file_content_type or default_content_type return (filename, content, out_content_type, headers) else: raise ValueError(f"Unexpected tuple length: {len(file)}") return (None, file, default_content_type)
This function resolves to the file's content type, if provided, and defaults to the default_content_type value if not.
with_content_type
python
elevenlabs/elevenlabs-python
src/elevenlabs/core/file.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/core/file.py
MIT
def _parse_retry_after(response_headers: httpx.Headers) -> typing.Optional[float]: """ This function parses the `Retry-After` header in a HTTP response and returns the number of seconds to wait. Inspired by the urllib3 retry implementation. """ retry_after_ms = response_headers.get("retry-after-ms") if retry_after_ms is not None: try: return int(retry_after_ms) / 1000 if retry_after_ms > 0 else 0 except Exception: pass retry_after = response_headers.get("retry-after") if retry_after is None: return None # Attempt to parse the header as an int. if re.match(r"^\s*[0-9]+\s*$", retry_after): seconds = float(retry_after) # Fallback to parsing it as a date. else: retry_date_tuple = email.utils.parsedate_tz(retry_after) if retry_date_tuple is None: return None if retry_date_tuple[9] is None: # Python 2 # Assume UTC if no timezone was specified # On Python2.7, parsedate_tz returns None for a timezone offset # instead of 0 if no timezone is given, where mktime_tz treats # a None timezone offset as local time. retry_date_tuple = retry_date_tuple[:9] + (0,) + retry_date_tuple[10:] retry_date = email.utils.mktime_tz(retry_date_tuple) seconds = retry_date - time.time() if seconds < 0: seconds = 0 return seconds
This function parses the `Retry-After` header in a HTTP response and returns the number of seconds to wait. Inspired by the urllib3 retry implementation.
_parse_retry_after
python
elevenlabs/elevenlabs-python
src/elevenlabs/core/http_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/core/http_client.py
MIT
def _retry_timeout(response: httpx.Response, retries: int) -> float: """ Determine the amount of time to wait before retrying a request. This function begins by trying to parse a retry-after header from the response, and then proceeds to use exponential backoff with a jitter to determine the number of seconds to wait. """ # If the API asks us to wait a certain amount of time (and it's a reasonable amount), just do what it says. retry_after = _parse_retry_after(response.headers) if retry_after is not None and retry_after <= MAX_RETRY_DELAY_SECONDS_FROM_HEADER: return retry_after # Apply exponential backoff, capped at MAX_RETRY_DELAY_SECONDS. retry_delay = min(INITIAL_RETRY_DELAY_SECONDS * pow(2.0, retries), MAX_RETRY_DELAY_SECONDS) # Add a randomness / jitter to the retry delay to avoid overwhelming the server with retries. timeout = retry_delay * (1 - 0.25 * random()) return timeout if timeout >= 0 else 0
Determine the amount of time to wait before retrying a request. This function begins by trying to parse a retry-after header from the response, and then proceeds to use exponential backoff with a jitter to determine the number of seconds to wait.
_retry_timeout
python
elevenlabs/elevenlabs-python
src/elevenlabs/core/http_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/core/http_client.py
MIT
def dict(self, **kwargs: Any) -> Dict[str, Any]: """ Override the default dict method to `exclude_unset` by default. This function patches `exclude_unset` to work include fields within non-None default values. """ # Note: the logic here is multiplexed given the levers exposed in Pydantic V1 vs V2 # Pydantic V1's .dict can be extremely slow, so we do not want to call it twice. # # We'd ideally do the same for Pydantic V2, but it shells out to a library to serialize models # that we have less control over, and this is less intrusive than custom serializers for now. if IS_PYDANTIC_V2: kwargs_with_defaults_exclude_unset = { **kwargs, "by_alias": True, "exclude_unset": True, "exclude_none": False, } kwargs_with_defaults_exclude_none = { **kwargs, "by_alias": True, "exclude_none": True, "exclude_unset": False, } dict_dump = deep_union_pydantic_dicts( super().model_dump(**kwargs_with_defaults_exclude_unset), # type: ignore[misc] super().model_dump(**kwargs_with_defaults_exclude_none), # type: ignore[misc] ) else: _fields_set = self.__fields_set__.copy() fields = _get_model_fields(self.__class__) for name, field in fields.items(): if name not in _fields_set: default = _get_field_default(field) # If the default values are non-null act like they've been set # This effectively allows exclude_unset to work like exclude_none where # the latter passes through intentionally set none values. if default is not None or ("exclude_unset" in kwargs and not kwargs["exclude_unset"]): _fields_set.add(name) if default is not None: self.__fields_set__.add(name) kwargs_with_defaults_exclude_unset_include_fields = { "by_alias": True, "exclude_unset": True, "include": _fields_set, **kwargs, } dict_dump = super().dict(**kwargs_with_defaults_exclude_unset_include_fields) return convert_and_respect_annotation_metadata(object_=dict_dump, annotation=self.__class__, direction="write")
Override the default dict method to `exclude_unset` by default. This function patches `exclude_unset` to work include fields within non-None default values.
dict
python
elevenlabs/elevenlabs-python
src/elevenlabs/core/pydantic_utilities.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/core/pydantic_utilities.py
MIT
def convert_and_respect_annotation_metadata( *, object_: typing.Any, annotation: typing.Any, inner_type: typing.Optional[typing.Any] = None, direction: typing.Literal["read", "write"], ) -> typing.Any: """ Respect the metadata annotations on a field, such as aliasing. This function effectively manipulates the dict-form of an object to respect the metadata annotations. This is primarily used for TypedDicts, which cannot support aliasing out of the box, and can be extended for additional utilities, such as defaults. Parameters ---------- object_ : typing.Any annotation : type The type we're looking to apply typing annotations from inner_type : typing.Optional[type] Returns ------- typing.Any """ if object_ is None: return None if inner_type is None: inner_type = annotation clean_type = _remove_annotations(inner_type) # Pydantic models if ( inspect.isclass(clean_type) and issubclass(clean_type, pydantic.BaseModel) and isinstance(object_, typing.Mapping) ): return _convert_mapping(object_, clean_type, direction) # TypedDicts if typing_extensions.is_typeddict(clean_type) and isinstance(object_, typing.Mapping): return _convert_mapping(object_, clean_type, direction) if ( typing_extensions.get_origin(clean_type) == typing.Dict or typing_extensions.get_origin(clean_type) == dict or clean_type == typing.Dict ) and isinstance(object_, typing.Dict): key_type = typing_extensions.get_args(clean_type)[0] value_type = typing_extensions.get_args(clean_type)[1] return { key: convert_and_respect_annotation_metadata( object_=value, annotation=annotation, inner_type=value_type, direction=direction, ) for key, value in object_.items() } # If you're iterating on a string, do not bother to coerce it to a sequence. if not isinstance(object_, str): if ( typing_extensions.get_origin(clean_type) == typing.Set or typing_extensions.get_origin(clean_type) == set or clean_type == typing.Set ) and isinstance(object_, typing.Set): inner_type = typing_extensions.get_args(clean_type)[0] return { convert_and_respect_annotation_metadata( object_=item, annotation=annotation, inner_type=inner_type, direction=direction, ) for item in object_ } elif ( ( typing_extensions.get_origin(clean_type) == typing.List or typing_extensions.get_origin(clean_type) == list or clean_type == typing.List ) and isinstance(object_, typing.List) ) or ( ( typing_extensions.get_origin(clean_type) == typing.Sequence or typing_extensions.get_origin(clean_type) == collections.abc.Sequence or clean_type == typing.Sequence ) and isinstance(object_, typing.Sequence) ): inner_type = typing_extensions.get_args(clean_type)[0] return [ convert_and_respect_annotation_metadata( object_=item, annotation=annotation, inner_type=inner_type, direction=direction, ) for item in object_ ] if typing_extensions.get_origin(clean_type) == typing.Union: # We should be able to ~relatively~ safely try to convert keys against all # member types in the union, the edge case here is if one member aliases a field # of the same name to a different name from another member # Or if another member aliases a field of the same name that another member does not. for member in typing_extensions.get_args(clean_type): object_ = convert_and_respect_annotation_metadata( object_=object_, annotation=annotation, inner_type=member, direction=direction, ) return object_ annotated_type = _get_annotation(annotation) if annotated_type is None: return object_ # If the object is not a TypedDict, a Union, or other container (list, set, sequence, etc.) # Then we can safely call it on the recursive conversion. return object_
Respect the metadata annotations on a field, such as aliasing. This function effectively manipulates the dict-form of an object to respect the metadata annotations. This is primarily used for TypedDicts, which cannot support aliasing out of the box, and can be extended for additional utilities, such as defaults. Parameters ---------- object_ : typing.Any annotation : type The type we're looking to apply typing annotations from inner_type : typing.Optional[type] Returns ------- typing.Any
convert_and_respect_annotation_metadata
python
elevenlabs/elevenlabs-python
src/elevenlabs/core/serialization.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/core/serialization.py
MIT
def construct_type(*, type_: typing.Type[typing.Any], object_: typing.Any) -> typing.Any: """ Here we are essentially creating the same `construct` method in spirit as the above, but for all types, not just Pydantic models. The idea is to essentially attempt to coerce object_ to type_ (recursively) """ # Short circuit when dealing with optionals, don't try to coerces None to a type if object_ is None: return None base_type = get_origin(type_) or type_ is_annotated = base_type == typing_extensions.Annotated maybe_annotation_members = get_args(type_) is_annotated_union = is_annotated and is_union(get_origin(maybe_annotation_members[0])) if base_type == typing.Any: return object_ if base_type == dict: if not isinstance(object_, typing.Mapping): return object_ key_type, items_type = get_args(type_) d = { construct_type(object_=key, type_=key_type): construct_type(object_=item, type_=items_type) for key, item in object_.items() } return d if base_type == list: if not isinstance(object_, list): return object_ inner_type = get_args(type_)[0] return [construct_type(object_=entry, type_=inner_type) for entry in object_] if base_type == set: if not isinstance(object_, set) and not isinstance(object_, list): return object_ inner_type = get_args(type_)[0] return {construct_type(object_=entry, type_=inner_type) for entry in object_} if is_union(base_type) or is_annotated_union: return _convert_union_type(type_, object_) # Cannot do an `issubclass` with a literal type, let's also just confirm we have a class before this call if ( object_ is not None and not is_literal_type(type_) and ( (inspect.isclass(base_type) and issubclass(base_type, pydantic.BaseModel)) or ( is_annotated and inspect.isclass(maybe_annotation_members[0]) and issubclass(maybe_annotation_members[0], pydantic.BaseModel) ) ) ): if IS_PYDANTIC_V2: return type_.model_construct(**object_) else: return type_.construct(**object_) if base_type == dt.datetime: try: return parse_datetime(object_) except Exception: return object_ if base_type == dt.date: try: return parse_date(object_) except Exception: return object_ if base_type == uuid.UUID: try: return uuid.UUID(object_) except Exception: return object_ if base_type == int: try: return int(object_) except Exception: return object_ if base_type == bool: try: if isinstance(object_, str): stringified_object = object_.lower() return stringified_object == "true" or stringified_object == "1" return bool(object_) except Exception: return object_ return object_
Here we are essentially creating the same `construct` method in spirit as the above, but for all types, not just Pydantic models. The idea is to essentially attempt to coerce object_ to type_ (recursively)
construct_type
python
elevenlabs/elevenlabs-python
src/elevenlabs/core/unchecked_base_model.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/core/unchecked_base_model.py
MIT
def create( self, *, file: typing.Optional[core.File] = OMIT, csv_file: typing.Optional[core.File] = OMIT, foreground_audio_file: typing.Optional[core.File] = OMIT, background_audio_file: typing.Optional[core.File] = OMIT, name: typing.Optional[str] = OMIT, source_url: typing.Optional[str] = OMIT, source_lang: typing.Optional[str] = OMIT, target_lang: typing.Optional[str] = OMIT, num_speakers: typing.Optional[int] = OMIT, watermark: typing.Optional[bool] = OMIT, start_time: typing.Optional[int] = OMIT, end_time: typing.Optional[int] = OMIT, highest_resolution: typing.Optional[bool] = OMIT, drop_background_audio: typing.Optional[bool] = OMIT, use_profanity_filter: typing.Optional[bool] = OMIT, dubbing_studio: typing.Optional[bool] = OMIT, disable_voice_cloning: typing.Optional[bool] = OMIT, mode: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DoDubbingResponse: """ Dubs a provided audio or video file into given language. Parameters ---------- file : typing.Optional[core.File] See core.File for more documentation csv_file : typing.Optional[core.File] See core.File for more documentation foreground_audio_file : typing.Optional[core.File] See core.File for more documentation background_audio_file : typing.Optional[core.File] See core.File for more documentation name : typing.Optional[str] Name of the dubbing project. source_url : typing.Optional[str] URL of the source video/audio file. source_lang : typing.Optional[str] Source language. target_lang : typing.Optional[str] The Target language to dub the content into. num_speakers : typing.Optional[int] Number of speakers to use for the dubbing. Set to 0 to automatically detect the number of speakers watermark : typing.Optional[bool] Whether to apply watermark to the output video. start_time : typing.Optional[int] Start time of the source video/audio file. end_time : typing.Optional[int] End time of the source video/audio file. highest_resolution : typing.Optional[bool] Whether to use the highest resolution available. drop_background_audio : typing.Optional[bool] An advanced setting. Whether to drop background audio from the final dub. This can improve dub quality where it's known that audio shouldn't have a background track such as for speeches or monologues. use_profanity_filter : typing.Optional[bool] [BETA] Whether transcripts should have profanities censored with the words '[censored]' dubbing_studio : typing.Optional[bool] Whether to prepare dub for edits in dubbing studio or edits as a dubbing resource. disable_voice_cloning : typing.Optional[bool] [BETA] Instead of using a voice clone in dubbing, use a similar voice from the ElevenLabs Voice Library. mode : typing.Optional[str] automatic or manual. Manual mode is only supported when creating a dubbing studio project request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DoDubbingResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.create() """ _response = self._raw_client.create( file=file, csv_file=csv_file, foreground_audio_file=foreground_audio_file, background_audio_file=background_audio_file, name=name, source_url=source_url, source_lang=source_lang, target_lang=target_lang, num_speakers=num_speakers, watermark=watermark, start_time=start_time, end_time=end_time, highest_resolution=highest_resolution, drop_background_audio=drop_background_audio, use_profanity_filter=use_profanity_filter, dubbing_studio=dubbing_studio, disable_voice_cloning=disable_voice_cloning, mode=mode, request_options=request_options, ) return _response.data
Dubs a provided audio or video file into given language. Parameters ---------- file : typing.Optional[core.File] See core.File for more documentation csv_file : typing.Optional[core.File] See core.File for more documentation foreground_audio_file : typing.Optional[core.File] See core.File for more documentation background_audio_file : typing.Optional[core.File] See core.File for more documentation name : typing.Optional[str] Name of the dubbing project. source_url : typing.Optional[str] URL of the source video/audio file. source_lang : typing.Optional[str] Source language. target_lang : typing.Optional[str] The Target language to dub the content into. num_speakers : typing.Optional[int] Number of speakers to use for the dubbing. Set to 0 to automatically detect the number of speakers watermark : typing.Optional[bool] Whether to apply watermark to the output video. start_time : typing.Optional[int] Start time of the source video/audio file. end_time : typing.Optional[int] End time of the source video/audio file. highest_resolution : typing.Optional[bool] Whether to use the highest resolution available. drop_background_audio : typing.Optional[bool] An advanced setting. Whether to drop background audio from the final dub. This can improve dub quality where it's known that audio shouldn't have a background track such as for speeches or monologues. use_profanity_filter : typing.Optional[bool] [BETA] Whether transcripts should have profanities censored with the words '[censored]' dubbing_studio : typing.Optional[bool] Whether to prepare dub for edits in dubbing studio or edits as a dubbing resource. disable_voice_cloning : typing.Optional[bool] [BETA] Instead of using a voice clone in dubbing, use a similar voice from the ElevenLabs Voice Library. mode : typing.Optional[str] automatic or manual. Manual mode is only supported when creating a dubbing studio project request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DoDubbingResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.create()
create
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/client.py
MIT
def get( self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> DubbingMetadataResponse: """ Returns metadata about a dubbing project, including whether it's still in progress or not Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DubbingMetadataResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.get( dubbing_id="dubbing_id", ) """ _response = self._raw_client.get(dubbing_id, request_options=request_options) return _response.data
Returns metadata about a dubbing project, including whether it's still in progress or not Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DubbingMetadataResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.get( dubbing_id="dubbing_id", )
get
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/client.py
MIT
def delete( self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> DeleteDubbingResponseModel: """ Deletes a dubbing project. Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeleteDubbingResponseModel Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.delete( dubbing_id="dubbing_id", ) """ _response = self._raw_client.delete(dubbing_id, request_options=request_options) return _response.data
Deletes a dubbing project. Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeleteDubbingResponseModel Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.delete( dubbing_id="dubbing_id", )
delete
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/client.py
MIT
async def create( self, *, file: typing.Optional[core.File] = OMIT, csv_file: typing.Optional[core.File] = OMIT, foreground_audio_file: typing.Optional[core.File] = OMIT, background_audio_file: typing.Optional[core.File] = OMIT, name: typing.Optional[str] = OMIT, source_url: typing.Optional[str] = OMIT, source_lang: typing.Optional[str] = OMIT, target_lang: typing.Optional[str] = OMIT, num_speakers: typing.Optional[int] = OMIT, watermark: typing.Optional[bool] = OMIT, start_time: typing.Optional[int] = OMIT, end_time: typing.Optional[int] = OMIT, highest_resolution: typing.Optional[bool] = OMIT, drop_background_audio: typing.Optional[bool] = OMIT, use_profanity_filter: typing.Optional[bool] = OMIT, dubbing_studio: typing.Optional[bool] = OMIT, disable_voice_cloning: typing.Optional[bool] = OMIT, mode: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> DoDubbingResponse: """ Dubs a provided audio or video file into given language. Parameters ---------- file : typing.Optional[core.File] See core.File for more documentation csv_file : typing.Optional[core.File] See core.File for more documentation foreground_audio_file : typing.Optional[core.File] See core.File for more documentation background_audio_file : typing.Optional[core.File] See core.File for more documentation name : typing.Optional[str] Name of the dubbing project. source_url : typing.Optional[str] URL of the source video/audio file. source_lang : typing.Optional[str] Source language. target_lang : typing.Optional[str] The Target language to dub the content into. num_speakers : typing.Optional[int] Number of speakers to use for the dubbing. Set to 0 to automatically detect the number of speakers watermark : typing.Optional[bool] Whether to apply watermark to the output video. start_time : typing.Optional[int] Start time of the source video/audio file. end_time : typing.Optional[int] End time of the source video/audio file. highest_resolution : typing.Optional[bool] Whether to use the highest resolution available. drop_background_audio : typing.Optional[bool] An advanced setting. Whether to drop background audio from the final dub. This can improve dub quality where it's known that audio shouldn't have a background track such as for speeches or monologues. use_profanity_filter : typing.Optional[bool] [BETA] Whether transcripts should have profanities censored with the words '[censored]' dubbing_studio : typing.Optional[bool] Whether to prepare dub for edits in dubbing studio or edits as a dubbing resource. disable_voice_cloning : typing.Optional[bool] [BETA] Instead of using a voice clone in dubbing, use a similar voice from the ElevenLabs Voice Library. mode : typing.Optional[str] automatic or manual. Manual mode is only supported when creating a dubbing studio project request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DoDubbingResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.create() asyncio.run(main()) """ _response = await self._raw_client.create( file=file, csv_file=csv_file, foreground_audio_file=foreground_audio_file, background_audio_file=background_audio_file, name=name, source_url=source_url, source_lang=source_lang, target_lang=target_lang, num_speakers=num_speakers, watermark=watermark, start_time=start_time, end_time=end_time, highest_resolution=highest_resolution, drop_background_audio=drop_background_audio, use_profanity_filter=use_profanity_filter, dubbing_studio=dubbing_studio, disable_voice_cloning=disable_voice_cloning, mode=mode, request_options=request_options, ) return _response.data
Dubs a provided audio or video file into given language. Parameters ---------- file : typing.Optional[core.File] See core.File for more documentation csv_file : typing.Optional[core.File] See core.File for more documentation foreground_audio_file : typing.Optional[core.File] See core.File for more documentation background_audio_file : typing.Optional[core.File] See core.File for more documentation name : typing.Optional[str] Name of the dubbing project. source_url : typing.Optional[str] URL of the source video/audio file. source_lang : typing.Optional[str] Source language. target_lang : typing.Optional[str] The Target language to dub the content into. num_speakers : typing.Optional[int] Number of speakers to use for the dubbing. Set to 0 to automatically detect the number of speakers watermark : typing.Optional[bool] Whether to apply watermark to the output video. start_time : typing.Optional[int] Start time of the source video/audio file. end_time : typing.Optional[int] End time of the source video/audio file. highest_resolution : typing.Optional[bool] Whether to use the highest resolution available. drop_background_audio : typing.Optional[bool] An advanced setting. Whether to drop background audio from the final dub. This can improve dub quality where it's known that audio shouldn't have a background track such as for speeches or monologues. use_profanity_filter : typing.Optional[bool] [BETA] Whether transcripts should have profanities censored with the words '[censored]' dubbing_studio : typing.Optional[bool] Whether to prepare dub for edits in dubbing studio or edits as a dubbing resource. disable_voice_cloning : typing.Optional[bool] [BETA] Instead of using a voice clone in dubbing, use a similar voice from the ElevenLabs Voice Library. mode : typing.Optional[str] automatic or manual. Manual mode is only supported when creating a dubbing studio project request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DoDubbingResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.create() asyncio.run(main())
create
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/client.py
MIT
async def get( self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> DubbingMetadataResponse: """ Returns metadata about a dubbing project, including whether it's still in progress or not Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DubbingMetadataResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.get( dubbing_id="dubbing_id", ) asyncio.run(main()) """ _response = await self._raw_client.get(dubbing_id, request_options=request_options) return _response.data
Returns metadata about a dubbing project, including whether it's still in progress or not Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DubbingMetadataResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.get( dubbing_id="dubbing_id", ) asyncio.run(main())
get
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/client.py
MIT
async def delete( self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> DeleteDubbingResponseModel: """ Deletes a dubbing project. Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeleteDubbingResponseModel Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.delete( dubbing_id="dubbing_id", ) asyncio.run(main()) """ _response = await self._raw_client.delete(dubbing_id, request_options=request_options) return _response.data
Deletes a dubbing project. Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeleteDubbingResponseModel Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.delete( dubbing_id="dubbing_id", ) asyncio.run(main())
delete
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/client.py
MIT
def create( self, *, file: typing.Optional[core.File] = OMIT, csv_file: typing.Optional[core.File] = OMIT, foreground_audio_file: typing.Optional[core.File] = OMIT, background_audio_file: typing.Optional[core.File] = OMIT, name: typing.Optional[str] = OMIT, source_url: typing.Optional[str] = OMIT, source_lang: typing.Optional[str] = OMIT, target_lang: typing.Optional[str] = OMIT, num_speakers: typing.Optional[int] = OMIT, watermark: typing.Optional[bool] = OMIT, start_time: typing.Optional[int] = OMIT, end_time: typing.Optional[int] = OMIT, highest_resolution: typing.Optional[bool] = OMIT, drop_background_audio: typing.Optional[bool] = OMIT, use_profanity_filter: typing.Optional[bool] = OMIT, dubbing_studio: typing.Optional[bool] = OMIT, disable_voice_cloning: typing.Optional[bool] = OMIT, mode: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DoDubbingResponse]: """ Dubs a provided audio or video file into given language. Parameters ---------- file : typing.Optional[core.File] See core.File for more documentation csv_file : typing.Optional[core.File] See core.File for more documentation foreground_audio_file : typing.Optional[core.File] See core.File for more documentation background_audio_file : typing.Optional[core.File] See core.File for more documentation name : typing.Optional[str] Name of the dubbing project. source_url : typing.Optional[str] URL of the source video/audio file. source_lang : typing.Optional[str] Source language. target_lang : typing.Optional[str] The Target language to dub the content into. num_speakers : typing.Optional[int] Number of speakers to use for the dubbing. Set to 0 to automatically detect the number of speakers watermark : typing.Optional[bool] Whether to apply watermark to the output video. start_time : typing.Optional[int] Start time of the source video/audio file. end_time : typing.Optional[int] End time of the source video/audio file. highest_resolution : typing.Optional[bool] Whether to use the highest resolution available. drop_background_audio : typing.Optional[bool] An advanced setting. Whether to drop background audio from the final dub. This can improve dub quality where it's known that audio shouldn't have a background track such as for speeches or monologues. use_profanity_filter : typing.Optional[bool] [BETA] Whether transcripts should have profanities censored with the words '[censored]' dubbing_studio : typing.Optional[bool] Whether to prepare dub for edits in dubbing studio or edits as a dubbing resource. disable_voice_cloning : typing.Optional[bool] [BETA] Instead of using a voice clone in dubbing, use a similar voice from the ElevenLabs Voice Library. mode : typing.Optional[str] automatic or manual. Manual mode is only supported when creating a dubbing studio project request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[DoDubbingResponse] Successful Response """ _response = self._client_wrapper.httpx_client.request( "v1/dubbing", base_url=self._client_wrapper.get_environment().base, method="POST", data={ "name": name, "source_url": source_url, "source_lang": source_lang, "target_lang": target_lang, "num_speakers": num_speakers, "watermark": watermark, "start_time": start_time, "end_time": end_time, "highest_resolution": highest_resolution, "drop_background_audio": drop_background_audio, "use_profanity_filter": use_profanity_filter, "dubbing_studio": dubbing_studio, "disable_voice_cloning": disable_voice_cloning, "mode": mode, }, files={ **({"file": file} if file is not None else {}), **({"csv_file": csv_file} if csv_file is not None else {}), **({"foreground_audio_file": foreground_audio_file} if foreground_audio_file is not None else {}), **({"background_audio_file": background_audio_file} if background_audio_file is not None else {}), }, request_options=request_options, omit=OMIT, force_multipart=True, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( DoDubbingResponse, construct_type( type_=DoDubbingResponse, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Dubs a provided audio or video file into given language. Parameters ---------- file : typing.Optional[core.File] See core.File for more documentation csv_file : typing.Optional[core.File] See core.File for more documentation foreground_audio_file : typing.Optional[core.File] See core.File for more documentation background_audio_file : typing.Optional[core.File] See core.File for more documentation name : typing.Optional[str] Name of the dubbing project. source_url : typing.Optional[str] URL of the source video/audio file. source_lang : typing.Optional[str] Source language. target_lang : typing.Optional[str] The Target language to dub the content into. num_speakers : typing.Optional[int] Number of speakers to use for the dubbing. Set to 0 to automatically detect the number of speakers watermark : typing.Optional[bool] Whether to apply watermark to the output video. start_time : typing.Optional[int] Start time of the source video/audio file. end_time : typing.Optional[int] End time of the source video/audio file. highest_resolution : typing.Optional[bool] Whether to use the highest resolution available. drop_background_audio : typing.Optional[bool] An advanced setting. Whether to drop background audio from the final dub. This can improve dub quality where it's known that audio shouldn't have a background track such as for speeches or monologues. use_profanity_filter : typing.Optional[bool] [BETA] Whether transcripts should have profanities censored with the words '[censored]' dubbing_studio : typing.Optional[bool] Whether to prepare dub for edits in dubbing studio or edits as a dubbing resource. disable_voice_cloning : typing.Optional[bool] [BETA] Instead of using a voice clone in dubbing, use a similar voice from the ElevenLabs Voice Library. mode : typing.Optional[str] automatic or manual. Manual mode is only supported when creating a dubbing studio project request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[DoDubbingResponse] Successful Response
create
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/raw_client.py
MIT
def get( self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> HttpResponse[DubbingMetadataResponse]: """ Returns metadata about a dubbing project, including whether it's still in progress or not Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[DubbingMetadataResponse] Successful Response """ _response = self._client_wrapper.httpx_client.request( f"v1/dubbing/{jsonable_encoder(dubbing_id)}", base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( DubbingMetadataResponse, construct_type( type_=DubbingMetadataResponse, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Returns metadata about a dubbing project, including whether it's still in progress or not Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[DubbingMetadataResponse] Successful Response
get
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/raw_client.py
MIT
def delete( self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> HttpResponse[DeleteDubbingResponseModel]: """ Deletes a dubbing project. Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[DeleteDubbingResponseModel] Successful Response """ _response = self._client_wrapper.httpx_client.request( f"v1/dubbing/{jsonable_encoder(dubbing_id)}", base_url=self._client_wrapper.get_environment().base, method="DELETE", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( DeleteDubbingResponseModel, construct_type( type_=DeleteDubbingResponseModel, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Deletes a dubbing project. Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[DeleteDubbingResponseModel] Successful Response
delete
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/raw_client.py
MIT
async def create( self, *, file: typing.Optional[core.File] = OMIT, csv_file: typing.Optional[core.File] = OMIT, foreground_audio_file: typing.Optional[core.File] = OMIT, background_audio_file: typing.Optional[core.File] = OMIT, name: typing.Optional[str] = OMIT, source_url: typing.Optional[str] = OMIT, source_lang: typing.Optional[str] = OMIT, target_lang: typing.Optional[str] = OMIT, num_speakers: typing.Optional[int] = OMIT, watermark: typing.Optional[bool] = OMIT, start_time: typing.Optional[int] = OMIT, end_time: typing.Optional[int] = OMIT, highest_resolution: typing.Optional[bool] = OMIT, drop_background_audio: typing.Optional[bool] = OMIT, use_profanity_filter: typing.Optional[bool] = OMIT, dubbing_studio: typing.Optional[bool] = OMIT, disable_voice_cloning: typing.Optional[bool] = OMIT, mode: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DoDubbingResponse]: """ Dubs a provided audio or video file into given language. Parameters ---------- file : typing.Optional[core.File] See core.File for more documentation csv_file : typing.Optional[core.File] See core.File for more documentation foreground_audio_file : typing.Optional[core.File] See core.File for more documentation background_audio_file : typing.Optional[core.File] See core.File for more documentation name : typing.Optional[str] Name of the dubbing project. source_url : typing.Optional[str] URL of the source video/audio file. source_lang : typing.Optional[str] Source language. target_lang : typing.Optional[str] The Target language to dub the content into. num_speakers : typing.Optional[int] Number of speakers to use for the dubbing. Set to 0 to automatically detect the number of speakers watermark : typing.Optional[bool] Whether to apply watermark to the output video. start_time : typing.Optional[int] Start time of the source video/audio file. end_time : typing.Optional[int] End time of the source video/audio file. highest_resolution : typing.Optional[bool] Whether to use the highest resolution available. drop_background_audio : typing.Optional[bool] An advanced setting. Whether to drop background audio from the final dub. This can improve dub quality where it's known that audio shouldn't have a background track such as for speeches or monologues. use_profanity_filter : typing.Optional[bool] [BETA] Whether transcripts should have profanities censored with the words '[censored]' dubbing_studio : typing.Optional[bool] Whether to prepare dub for edits in dubbing studio or edits as a dubbing resource. disable_voice_cloning : typing.Optional[bool] [BETA] Instead of using a voice clone in dubbing, use a similar voice from the ElevenLabs Voice Library. mode : typing.Optional[str] automatic or manual. Manual mode is only supported when creating a dubbing studio project request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[DoDubbingResponse] Successful Response """ _response = await self._client_wrapper.httpx_client.request( "v1/dubbing", base_url=self._client_wrapper.get_environment().base, method="POST", data={ "name": name, "source_url": source_url, "source_lang": source_lang, "target_lang": target_lang, "num_speakers": num_speakers, "watermark": watermark, "start_time": start_time, "end_time": end_time, "highest_resolution": highest_resolution, "drop_background_audio": drop_background_audio, "use_profanity_filter": use_profanity_filter, "dubbing_studio": dubbing_studio, "disable_voice_cloning": disable_voice_cloning, "mode": mode, }, files={ **({"file": file} if file is not None else {}), **({"csv_file": csv_file} if csv_file is not None else {}), **({"foreground_audio_file": foreground_audio_file} if foreground_audio_file is not None else {}), **({"background_audio_file": background_audio_file} if background_audio_file is not None else {}), }, request_options=request_options, omit=OMIT, force_multipart=True, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( DoDubbingResponse, construct_type( type_=DoDubbingResponse, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Dubs a provided audio or video file into given language. Parameters ---------- file : typing.Optional[core.File] See core.File for more documentation csv_file : typing.Optional[core.File] See core.File for more documentation foreground_audio_file : typing.Optional[core.File] See core.File for more documentation background_audio_file : typing.Optional[core.File] See core.File for more documentation name : typing.Optional[str] Name of the dubbing project. source_url : typing.Optional[str] URL of the source video/audio file. source_lang : typing.Optional[str] Source language. target_lang : typing.Optional[str] The Target language to dub the content into. num_speakers : typing.Optional[int] Number of speakers to use for the dubbing. Set to 0 to automatically detect the number of speakers watermark : typing.Optional[bool] Whether to apply watermark to the output video. start_time : typing.Optional[int] Start time of the source video/audio file. end_time : typing.Optional[int] End time of the source video/audio file. highest_resolution : typing.Optional[bool] Whether to use the highest resolution available. drop_background_audio : typing.Optional[bool] An advanced setting. Whether to drop background audio from the final dub. This can improve dub quality where it's known that audio shouldn't have a background track such as for speeches or monologues. use_profanity_filter : typing.Optional[bool] [BETA] Whether transcripts should have profanities censored with the words '[censored]' dubbing_studio : typing.Optional[bool] Whether to prepare dub for edits in dubbing studio or edits as a dubbing resource. disable_voice_cloning : typing.Optional[bool] [BETA] Instead of using a voice clone in dubbing, use a similar voice from the ElevenLabs Voice Library. mode : typing.Optional[str] automatic or manual. Manual mode is only supported when creating a dubbing studio project request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[DoDubbingResponse] Successful Response
create
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/raw_client.py
MIT
async def get( self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> AsyncHttpResponse[DubbingMetadataResponse]: """ Returns metadata about a dubbing project, including whether it's still in progress or not Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[DubbingMetadataResponse] Successful Response """ _response = await self._client_wrapper.httpx_client.request( f"v1/dubbing/{jsonable_encoder(dubbing_id)}", base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( DubbingMetadataResponse, construct_type( type_=DubbingMetadataResponse, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Returns metadata about a dubbing project, including whether it's still in progress or not Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[DubbingMetadataResponse] Successful Response
get
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/raw_client.py
MIT
async def delete( self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> AsyncHttpResponse[DeleteDubbingResponseModel]: """ Deletes a dubbing project. Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[DeleteDubbingResponseModel] Successful Response """ _response = await self._client_wrapper.httpx_client.request( f"v1/dubbing/{jsonable_encoder(dubbing_id)}", base_url=self._client_wrapper.get_environment().base, method="DELETE", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( DeleteDubbingResponseModel, construct_type( type_=DeleteDubbingResponseModel, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Deletes a dubbing project. Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[DeleteDubbingResponseModel] Successful Response
delete
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/raw_client.py
MIT
def get( self, dubbing_id: str, language_code: str, *, request_options: typing.Optional[RequestOptions] = None ) -> typing.Iterator[bytes]: """ Returns dub as a streamed MP3 or MP4 file. If this dub has been edited using Dubbing Studio you need to use the resource render endpoint as this endpoint only returns the original automatic dub result. Parameters ---------- dubbing_id : str ID of the dubbing project. language_code : str ID of the language. request_options : typing.Optional[RequestOptions] Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. Returns ------- typing.Iterator[bytes] The dubbed audio or video file """ with self._raw_client.get(dubbing_id, language_code, request_options=request_options) as r: yield from r.data
Returns dub as a streamed MP3 or MP4 file. If this dub has been edited using Dubbing Studio you need to use the resource render endpoint as this endpoint only returns the original automatic dub result. Parameters ---------- dubbing_id : str ID of the dubbing project. language_code : str ID of the language. request_options : typing.Optional[RequestOptions] Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. Returns ------- typing.Iterator[bytes] The dubbed audio or video file
get
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/audio/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/audio/client.py
MIT
async def get( self, dubbing_id: str, language_code: str, *, request_options: typing.Optional[RequestOptions] = None ) -> typing.AsyncIterator[bytes]: """ Returns dub as a streamed MP3 or MP4 file. If this dub has been edited using Dubbing Studio you need to use the resource render endpoint as this endpoint only returns the original automatic dub result. Parameters ---------- dubbing_id : str ID of the dubbing project. language_code : str ID of the language. request_options : typing.Optional[RequestOptions] Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. Returns ------- typing.AsyncIterator[bytes] The dubbed audio or video file """ async with self._raw_client.get(dubbing_id, language_code, request_options=request_options) as r: async for _chunk in r.data: yield _chunk
Returns dub as a streamed MP3 or MP4 file. If this dub has been edited using Dubbing Studio you need to use the resource render endpoint as this endpoint only returns the original automatic dub result. Parameters ---------- dubbing_id : str ID of the dubbing project. language_code : str ID of the language. request_options : typing.Optional[RequestOptions] Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. Returns ------- typing.AsyncIterator[bytes] The dubbed audio or video file
get
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/audio/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/audio/client.py
MIT
def get( self, dubbing_id: str, language_code: str, *, request_options: typing.Optional[RequestOptions] = None ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: """ Returns dub as a streamed MP3 or MP4 file. If this dub has been edited using Dubbing Studio you need to use the resource render endpoint as this endpoint only returns the original automatic dub result. Parameters ---------- dubbing_id : str ID of the dubbing project. language_code : str ID of the language. request_options : typing.Optional[RequestOptions] Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. Returns ------- typing.Iterator[HttpResponse[typing.Iterator[bytes]]] The dubbed audio or video file """ with self._client_wrapper.httpx_client.stream( f"v1/dubbing/{jsonable_encoder(dubbing_id)}/audio/{jsonable_encoder(language_code)}", base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) as _response: def _stream() -> HttpResponse[typing.Iterator[bytes]]: try: if 200 <= _response.status_code < 300: _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 return HttpResponse( response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) ) _response.read() if _response.status_code == 403: raise ForbiddenError( headers=dict(_response.headers), body=typing.cast( typing.Optional[typing.Any], construct_type( type_=typing.Optional[typing.Any], # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 404: raise NotFoundError( headers=dict(_response.headers), body=typing.cast( typing.Optional[typing.Any], construct_type( type_=typing.Optional[typing.Any], # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 425: raise TooEarlyError( headers=dict(_response.headers), body=typing.cast( typing.Optional[typing.Any], construct_type( type_=typing.Optional[typing.Any], # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError( status_code=_response.status_code, headers=dict(_response.headers), body=_response.text ) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) yield _stream()
Returns dub as a streamed MP3 or MP4 file. If this dub has been edited using Dubbing Studio you need to use the resource render endpoint as this endpoint only returns the original automatic dub result. Parameters ---------- dubbing_id : str ID of the dubbing project. language_code : str ID of the language. request_options : typing.Optional[RequestOptions] Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. Returns ------- typing.Iterator[HttpResponse[typing.Iterator[bytes]]] The dubbed audio or video file
get
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/audio/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/audio/raw_client.py
MIT
async def get( self, dubbing_id: str, language_code: str, *, request_options: typing.Optional[RequestOptions] = None ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: """ Returns dub as a streamed MP3 or MP4 file. If this dub has been edited using Dubbing Studio you need to use the resource render endpoint as this endpoint only returns the original automatic dub result. Parameters ---------- dubbing_id : str ID of the dubbing project. language_code : str ID of the language. request_options : typing.Optional[RequestOptions] Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. Returns ------- typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] The dubbed audio or video file """ async with self._client_wrapper.httpx_client.stream( f"v1/dubbing/{jsonable_encoder(dubbing_id)}/audio/{jsonable_encoder(language_code)}", base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) as _response: async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: try: if 200 <= _response.status_code < 300: _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 return AsyncHttpResponse( response=_response, data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), ) await _response.aread() if _response.status_code == 403: raise ForbiddenError( headers=dict(_response.headers), body=typing.cast( typing.Optional[typing.Any], construct_type( type_=typing.Optional[typing.Any], # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 404: raise NotFoundError( headers=dict(_response.headers), body=typing.cast( typing.Optional[typing.Any], construct_type( type_=typing.Optional[typing.Any], # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 425: raise TooEarlyError( headers=dict(_response.headers), body=typing.cast( typing.Optional[typing.Any], construct_type( type_=typing.Optional[typing.Any], # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError( status_code=_response.status_code, headers=dict(_response.headers), body=_response.text ) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) yield await _stream()
Returns dub as a streamed MP3 or MP4 file. If this dub has been edited using Dubbing Studio you need to use the resource render endpoint as this endpoint only returns the original automatic dub result. Parameters ---------- dubbing_id : str ID of the dubbing project. language_code : str ID of the language. request_options : typing.Optional[RequestOptions] Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. Returns ------- typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] The dubbed audio or video file
get
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/audio/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/audio/raw_client.py
MIT
def transcribe( self, dubbing_id: str, *, segments: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None, ) -> SegmentTranscriptionResponse: """ Regenerate the transcriptions for the specified segments. Does not automatically regenerate translations or dubs. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Transcribe this specific list of segments. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentTranscriptionResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.resource.transcribe( dubbing_id="dubbing_id", segments=["segments"], ) """ _response = self._raw_client.transcribe(dubbing_id, segments=segments, request_options=request_options) return _response.data
Regenerate the transcriptions for the specified segments. Does not automatically regenerate translations or dubs. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Transcribe this specific list of segments. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentTranscriptionResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.resource.transcribe( dubbing_id="dubbing_id", segments=["segments"], )
transcribe
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/client.py
MIT
def translate( self, dubbing_id: str, *, segments: typing.Sequence[str], languages: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> SegmentTranslationResponse: """ Regenerate the translations for either the entire resource or the specified segments/languages. Will automatically transcribe missing transcriptions. Will not automatically regenerate the dubs. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Translate only this list of segments. languages : typing.Optional[typing.Sequence[str]] Translate only these languages for each segment. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentTranslationResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.resource.translate( dubbing_id="dubbing_id", segments=["segments"], ) """ _response = self._raw_client.translate( dubbing_id, segments=segments, languages=languages, request_options=request_options ) return _response.data
Regenerate the translations for either the entire resource or the specified segments/languages. Will automatically transcribe missing transcriptions. Will not automatically regenerate the dubs. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Translate only this list of segments. languages : typing.Optional[typing.Sequence[str]] Translate only these languages for each segment. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentTranslationResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.resource.translate( dubbing_id="dubbing_id", segments=["segments"], )
translate
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/client.py
MIT
def dub( self, dubbing_id: str, *, segments: typing.Sequence[str], languages: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> SegmentDubResponse: """ Regenerate the dubs for either the entire resource or the specified segments/languages. Will automatically transcribe and translate any missing transcriptions and translations. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Dub only this list of segments. languages : typing.Optional[typing.Sequence[str]] Dub only these languages for each segment. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentDubResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.resource.dub( dubbing_id="dubbing_id", segments=["segments"], ) """ _response = self._raw_client.dub( dubbing_id, segments=segments, languages=languages, request_options=request_options ) return _response.data
Regenerate the dubs for either the entire resource or the specified segments/languages. Will automatically transcribe and translate any missing transcriptions and translations. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Dub only this list of segments. languages : typing.Optional[typing.Sequence[str]] Dub only these languages for each segment. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentDubResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.resource.dub( dubbing_id="dubbing_id", segments=["segments"], )
dub
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/client.py
MIT
async def get(self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DubbingResource: """ Given a dubbing ID generated from the '/v1/dubbing' endpoint with studio enabled, returns the dubbing resource. Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DubbingResource Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.get( dubbing_id="dubbing_id", ) asyncio.run(main()) """ _response = await self._raw_client.get(dubbing_id, request_options=request_options) return _response.data
Given a dubbing ID generated from the '/v1/dubbing' endpoint with studio enabled, returns the dubbing resource. Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DubbingResource Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.get( dubbing_id="dubbing_id", ) asyncio.run(main())
get
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/client.py
MIT
async def transcribe( self, dubbing_id: str, *, segments: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None, ) -> SegmentTranscriptionResponse: """ Regenerate the transcriptions for the specified segments. Does not automatically regenerate translations or dubs. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Transcribe this specific list of segments. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentTranscriptionResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.transcribe( dubbing_id="dubbing_id", segments=["segments"], ) asyncio.run(main()) """ _response = await self._raw_client.transcribe(dubbing_id, segments=segments, request_options=request_options) return _response.data
Regenerate the transcriptions for the specified segments. Does not automatically regenerate translations or dubs. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Transcribe this specific list of segments. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentTranscriptionResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.transcribe( dubbing_id="dubbing_id", segments=["segments"], ) asyncio.run(main())
transcribe
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/client.py
MIT
async def translate( self, dubbing_id: str, *, segments: typing.Sequence[str], languages: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> SegmentTranslationResponse: """ Regenerate the translations for either the entire resource or the specified segments/languages. Will automatically transcribe missing transcriptions. Will not automatically regenerate the dubs. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Translate only this list of segments. languages : typing.Optional[typing.Sequence[str]] Translate only these languages for each segment. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentTranslationResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.translate( dubbing_id="dubbing_id", segments=["segments"], ) asyncio.run(main()) """ _response = await self._raw_client.translate( dubbing_id, segments=segments, languages=languages, request_options=request_options ) return _response.data
Regenerate the translations for either the entire resource or the specified segments/languages. Will automatically transcribe missing transcriptions. Will not automatically regenerate the dubs. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Translate only this list of segments. languages : typing.Optional[typing.Sequence[str]] Translate only these languages for each segment. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentTranslationResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.translate( dubbing_id="dubbing_id", segments=["segments"], ) asyncio.run(main())
translate
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/client.py
MIT
async def dub( self, dubbing_id: str, *, segments: typing.Sequence[str], languages: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> SegmentDubResponse: """ Regenerate the dubs for either the entire resource or the specified segments/languages. Will automatically transcribe and translate any missing transcriptions and translations. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Dub only this list of segments. languages : typing.Optional[typing.Sequence[str]] Dub only these languages for each segment. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentDubResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.dub( dubbing_id="dubbing_id", segments=["segments"], ) asyncio.run(main()) """ _response = await self._raw_client.dub( dubbing_id, segments=segments, languages=languages, request_options=request_options ) return _response.data
Regenerate the dubs for either the entire resource or the specified segments/languages. Will automatically transcribe and translate any missing transcriptions and translations. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Dub only this list of segments. languages : typing.Optional[typing.Sequence[str]] Dub only these languages for each segment. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentDubResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.dub( dubbing_id="dubbing_id", segments=["segments"], ) asyncio.run(main())
dub
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/client.py
MIT
def get( self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> HttpResponse[DubbingResource]: """ Given a dubbing ID generated from the '/v1/dubbing' endpoint with studio enabled, returns the dubbing resource. Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[DubbingResource] Successful Response """ _response = self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}", base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( DubbingResource, construct_type( type_=DubbingResource, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Given a dubbing ID generated from the '/v1/dubbing' endpoint with studio enabled, returns the dubbing resource. Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[DubbingResource] Successful Response
get
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/raw_client.py
MIT
def transcribe( self, dubbing_id: str, *, segments: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[SegmentTranscriptionResponse]: """ Regenerate the transcriptions for the specified segments. Does not automatically regenerate translations or dubs. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Transcribe this specific list of segments. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[SegmentTranscriptionResponse] Successful Response """ _response = self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/transcribe", base_url=self._client_wrapper.get_environment().base, method="POST", json={ "segments": segments, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( SegmentTranscriptionResponse, construct_type( type_=SegmentTranscriptionResponse, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Regenerate the transcriptions for the specified segments. Does not automatically regenerate translations or dubs. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Transcribe this specific list of segments. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[SegmentTranscriptionResponse] Successful Response
transcribe
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/raw_client.py
MIT
def translate( self, dubbing_id: str, *, segments: typing.Sequence[str], languages: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[SegmentTranslationResponse]: """ Regenerate the translations for either the entire resource or the specified segments/languages. Will automatically transcribe missing transcriptions. Will not automatically regenerate the dubs. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Translate only this list of segments. languages : typing.Optional[typing.Sequence[str]] Translate only these languages for each segment. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[SegmentTranslationResponse] Successful Response """ _response = self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/translate", base_url=self._client_wrapper.get_environment().base, method="POST", json={ "segments": segments, "languages": languages, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( SegmentTranslationResponse, construct_type( type_=SegmentTranslationResponse, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Regenerate the translations for either the entire resource or the specified segments/languages. Will automatically transcribe missing transcriptions. Will not automatically regenerate the dubs. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Translate only this list of segments. languages : typing.Optional[typing.Sequence[str]] Translate only these languages for each segment. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[SegmentTranslationResponse] Successful Response
translate
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/raw_client.py
MIT
def dub( self, dubbing_id: str, *, segments: typing.Sequence[str], languages: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[SegmentDubResponse]: """ Regenerate the dubs for either the entire resource or the specified segments/languages. Will automatically transcribe and translate any missing transcriptions and translations. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Dub only this list of segments. languages : typing.Optional[typing.Sequence[str]] Dub only these languages for each segment. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[SegmentDubResponse] Successful Response """ _response = self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/dub", base_url=self._client_wrapper.get_environment().base, method="POST", json={ "segments": segments, "languages": languages, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( SegmentDubResponse, construct_type( type_=SegmentDubResponse, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Regenerate the dubs for either the entire resource or the specified segments/languages. Will automatically transcribe and translate any missing transcriptions and translations. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Dub only this list of segments. languages : typing.Optional[typing.Sequence[str]] Dub only these languages for each segment. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[SegmentDubResponse] Successful Response
dub
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/raw_client.py
MIT
async def get( self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> AsyncHttpResponse[DubbingResource]: """ Given a dubbing ID generated from the '/v1/dubbing' endpoint with studio enabled, returns the dubbing resource. Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[DubbingResource] Successful Response """ _response = await self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}", base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( DubbingResource, construct_type( type_=DubbingResource, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Given a dubbing ID generated from the '/v1/dubbing' endpoint with studio enabled, returns the dubbing resource. Parameters ---------- dubbing_id : str ID of the dubbing project. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[DubbingResource] Successful Response
get
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/raw_client.py
MIT
async def transcribe( self, dubbing_id: str, *, segments: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[SegmentTranscriptionResponse]: """ Regenerate the transcriptions for the specified segments. Does not automatically regenerate translations or dubs. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Transcribe this specific list of segments. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[SegmentTranscriptionResponse] Successful Response """ _response = await self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/transcribe", base_url=self._client_wrapper.get_environment().base, method="POST", json={ "segments": segments, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( SegmentTranscriptionResponse, construct_type( type_=SegmentTranscriptionResponse, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Regenerate the transcriptions for the specified segments. Does not automatically regenerate translations or dubs. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Transcribe this specific list of segments. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[SegmentTranscriptionResponse] Successful Response
transcribe
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/raw_client.py
MIT
async def translate( self, dubbing_id: str, *, segments: typing.Sequence[str], languages: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[SegmentTranslationResponse]: """ Regenerate the translations for either the entire resource or the specified segments/languages. Will automatically transcribe missing transcriptions. Will not automatically regenerate the dubs. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Translate only this list of segments. languages : typing.Optional[typing.Sequence[str]] Translate only these languages for each segment. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[SegmentTranslationResponse] Successful Response """ _response = await self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/translate", base_url=self._client_wrapper.get_environment().base, method="POST", json={ "segments": segments, "languages": languages, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( SegmentTranslationResponse, construct_type( type_=SegmentTranslationResponse, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Regenerate the translations for either the entire resource or the specified segments/languages. Will automatically transcribe missing transcriptions. Will not automatically regenerate the dubs. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Translate only this list of segments. languages : typing.Optional[typing.Sequence[str]] Translate only these languages for each segment. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[SegmentTranslationResponse] Successful Response
translate
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/raw_client.py
MIT
async def dub( self, dubbing_id: str, *, segments: typing.Sequence[str], languages: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[SegmentDubResponse]: """ Regenerate the dubs for either the entire resource or the specified segments/languages. Will automatically transcribe and translate any missing transcriptions and translations. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Dub only this list of segments. languages : typing.Optional[typing.Sequence[str]] Dub only these languages for each segment. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[SegmentDubResponse] Successful Response """ _response = await self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/dub", base_url=self._client_wrapper.get_environment().base, method="POST", json={ "segments": segments, "languages": languages, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( SegmentDubResponse, construct_type( type_=SegmentDubResponse, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Regenerate the dubs for either the entire resource or the specified segments/languages. Will automatically transcribe and translate any missing transcriptions and translations. Parameters ---------- dubbing_id : str ID of the dubbing project. segments : typing.Sequence[str] Dub only this list of segments. languages : typing.Optional[typing.Sequence[str]] Dub only these languages for each segment. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[SegmentDubResponse] Successful Response
dub
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/raw_client.py
MIT
def add( self, dubbing_id: str, *, language: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> LanguageAddedResponse: """ Adds the given ElevenLab Turbo V2/V2.5 language code to the resource. Does not automatically generate transcripts/translations/audio. Parameters ---------- dubbing_id : str ID of the dubbing project. language : typing.Optional[str] The Target language. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- LanguageAddedResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.resource.language.add( dubbing_id="dubbing_id", ) """ _response = self._raw_client.add(dubbing_id, language=language, request_options=request_options) return _response.data
Adds the given ElevenLab Turbo V2/V2.5 language code to the resource. Does not automatically generate transcripts/translations/audio. Parameters ---------- dubbing_id : str ID of the dubbing project. language : typing.Optional[str] The Target language. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- LanguageAddedResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.resource.language.add( dubbing_id="dubbing_id", )
add
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/language/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/language/client.py
MIT
async def add( self, dubbing_id: str, *, language: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> LanguageAddedResponse: """ Adds the given ElevenLab Turbo V2/V2.5 language code to the resource. Does not automatically generate transcripts/translations/audio. Parameters ---------- dubbing_id : str ID of the dubbing project. language : typing.Optional[str] The Target language. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- LanguageAddedResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.language.add( dubbing_id="dubbing_id", ) asyncio.run(main()) """ _response = await self._raw_client.add(dubbing_id, language=language, request_options=request_options) return _response.data
Adds the given ElevenLab Turbo V2/V2.5 language code to the resource. Does not automatically generate transcripts/translations/audio. Parameters ---------- dubbing_id : str ID of the dubbing project. language : typing.Optional[str] The Target language. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- LanguageAddedResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.language.add( dubbing_id="dubbing_id", ) asyncio.run(main())
add
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/language/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/language/client.py
MIT
def add( self, dubbing_id: str, *, language: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[LanguageAddedResponse]: """ Adds the given ElevenLab Turbo V2/V2.5 language code to the resource. Does not automatically generate transcripts/translations/audio. Parameters ---------- dubbing_id : str ID of the dubbing project. language : typing.Optional[str] The Target language. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[LanguageAddedResponse] Successful Response """ _response = self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/language", base_url=self._client_wrapper.get_environment().base, method="POST", json={ "language": language, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( LanguageAddedResponse, construct_type( type_=LanguageAddedResponse, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Adds the given ElevenLab Turbo V2/V2.5 language code to the resource. Does not automatically generate transcripts/translations/audio. Parameters ---------- dubbing_id : str ID of the dubbing project. language : typing.Optional[str] The Target language. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[LanguageAddedResponse] Successful Response
add
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/language/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/language/raw_client.py
MIT
async def add( self, dubbing_id: str, *, language: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[LanguageAddedResponse]: """ Adds the given ElevenLab Turbo V2/V2.5 language code to the resource. Does not automatically generate transcripts/translations/audio. Parameters ---------- dubbing_id : str ID of the dubbing project. language : typing.Optional[str] The Target language. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[LanguageAddedResponse] Successful Response """ _response = await self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/language", base_url=self._client_wrapper.get_environment().base, method="POST", json={ "language": language, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( LanguageAddedResponse, construct_type( type_=LanguageAddedResponse, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Adds the given ElevenLab Turbo V2/V2.5 language code to the resource. Does not automatically generate transcripts/translations/audio. Parameters ---------- dubbing_id : str ID of the dubbing project. language : typing.Optional[str] The Target language. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[LanguageAddedResponse] Successful Response
add
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/language/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/language/raw_client.py
MIT
def update( self, dubbing_id: str, segment_id: str, language: str, *, start_time: typing.Optional[float] = OMIT, end_time: typing.Optional[float] = OMIT, text: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> SegmentUpdateResponse: """ Modifies a single segment with new text and/or start/end times. Will update the values for only a specific language of a segment. Does not automatically regenerate the dub. Parameters ---------- dubbing_id : str ID of the dubbing project. segment_id : str ID of the segment language : str ID of the language. start_time : typing.Optional[float] end_time : typing.Optional[float] text : typing.Optional[str] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentUpdateResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.resource.segment.update( dubbing_id="dubbing_id", segment_id="segment_id", language="language", ) """ _response = self._raw_client.update( dubbing_id, segment_id, language, start_time=start_time, end_time=end_time, text=text, request_options=request_options, ) return _response.data
Modifies a single segment with new text and/or start/end times. Will update the values for only a specific language of a segment. Does not automatically regenerate the dub. Parameters ---------- dubbing_id : str ID of the dubbing project. segment_id : str ID of the segment language : str ID of the language. start_time : typing.Optional[float] end_time : typing.Optional[float] text : typing.Optional[str] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentUpdateResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.resource.segment.update( dubbing_id="dubbing_id", segment_id="segment_id", language="language", )
update
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/segment/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/segment/client.py
MIT
def delete( self, dubbing_id: str, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> SegmentDeleteResponse: """ Deletes a single segment from the dubbing. Parameters ---------- dubbing_id : str ID of the dubbing project. segment_id : str ID of the segment request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentDeleteResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.resource.segment.delete( dubbing_id="dubbing_id", segment_id="segment_id", ) """ _response = self._raw_client.delete(dubbing_id, segment_id, request_options=request_options) return _response.data
Deletes a single segment from the dubbing. Parameters ---------- dubbing_id : str ID of the dubbing project. segment_id : str ID of the segment request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentDeleteResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.resource.segment.delete( dubbing_id="dubbing_id", segment_id="segment_id", )
delete
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/segment/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/segment/client.py
MIT
async def update( self, dubbing_id: str, segment_id: str, language: str, *, start_time: typing.Optional[float] = OMIT, end_time: typing.Optional[float] = OMIT, text: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> SegmentUpdateResponse: """ Modifies a single segment with new text and/or start/end times. Will update the values for only a specific language of a segment. Does not automatically regenerate the dub. Parameters ---------- dubbing_id : str ID of the dubbing project. segment_id : str ID of the segment language : str ID of the language. start_time : typing.Optional[float] end_time : typing.Optional[float] text : typing.Optional[str] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentUpdateResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.segment.update( dubbing_id="dubbing_id", segment_id="segment_id", language="language", ) asyncio.run(main()) """ _response = await self._raw_client.update( dubbing_id, segment_id, language, start_time=start_time, end_time=end_time, text=text, request_options=request_options, ) return _response.data
Modifies a single segment with new text and/or start/end times. Will update the values for only a specific language of a segment. Does not automatically regenerate the dub. Parameters ---------- dubbing_id : str ID of the dubbing project. segment_id : str ID of the segment language : str ID of the language. start_time : typing.Optional[float] end_time : typing.Optional[float] text : typing.Optional[str] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentUpdateResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.segment.update( dubbing_id="dubbing_id", segment_id="segment_id", language="language", ) asyncio.run(main())
update
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/segment/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/segment/client.py
MIT
async def delete( self, dubbing_id: str, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> SegmentDeleteResponse: """ Deletes a single segment from the dubbing. Parameters ---------- dubbing_id : str ID of the dubbing project. segment_id : str ID of the segment request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentDeleteResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.segment.delete( dubbing_id="dubbing_id", segment_id="segment_id", ) asyncio.run(main()) """ _response = await self._raw_client.delete(dubbing_id, segment_id, request_options=request_options) return _response.data
Deletes a single segment from the dubbing. Parameters ---------- dubbing_id : str ID of the dubbing project. segment_id : str ID of the segment request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentDeleteResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.segment.delete( dubbing_id="dubbing_id", segment_id="segment_id", ) asyncio.run(main())
delete
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/segment/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/segment/client.py
MIT
def update( self, dubbing_id: str, segment_id: str, language: str, *, start_time: typing.Optional[float] = OMIT, end_time: typing.Optional[float] = OMIT, text: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[SegmentUpdateResponse]: """ Modifies a single segment with new text and/or start/end times. Will update the values for only a specific language of a segment. Does not automatically regenerate the dub. Parameters ---------- dubbing_id : str ID of the dubbing project. segment_id : str ID of the segment language : str ID of the language. start_time : typing.Optional[float] end_time : typing.Optional[float] text : typing.Optional[str] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[SegmentUpdateResponse] Successful Response """ _response = self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/segment/{jsonable_encoder(segment_id)}/{jsonable_encoder(language)}", base_url=self._client_wrapper.get_environment().base, method="PATCH", json={ "start_time": start_time, "end_time": end_time, "text": text, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( SegmentUpdateResponse, construct_type( type_=SegmentUpdateResponse, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Modifies a single segment with new text and/or start/end times. Will update the values for only a specific language of a segment. Does not automatically regenerate the dub. Parameters ---------- dubbing_id : str ID of the dubbing project. segment_id : str ID of the segment language : str ID of the language. start_time : typing.Optional[float] end_time : typing.Optional[float] text : typing.Optional[str] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[SegmentUpdateResponse] Successful Response
update
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/segment/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/segment/raw_client.py
MIT
def delete( self, dubbing_id: str, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> HttpResponse[SegmentDeleteResponse]: """ Deletes a single segment from the dubbing. Parameters ---------- dubbing_id : str ID of the dubbing project. segment_id : str ID of the segment request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[SegmentDeleteResponse] Successful Response """ _response = self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/segment/{jsonable_encoder(segment_id)}", base_url=self._client_wrapper.get_environment().base, method="DELETE", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( SegmentDeleteResponse, construct_type( type_=SegmentDeleteResponse, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Deletes a single segment from the dubbing. Parameters ---------- dubbing_id : str ID of the dubbing project. segment_id : str ID of the segment request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[SegmentDeleteResponse] Successful Response
delete
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/segment/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/segment/raw_client.py
MIT
async def update( self, dubbing_id: str, segment_id: str, language: str, *, start_time: typing.Optional[float] = OMIT, end_time: typing.Optional[float] = OMIT, text: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[SegmentUpdateResponse]: """ Modifies a single segment with new text and/or start/end times. Will update the values for only a specific language of a segment. Does not automatically regenerate the dub. Parameters ---------- dubbing_id : str ID of the dubbing project. segment_id : str ID of the segment language : str ID of the language. start_time : typing.Optional[float] end_time : typing.Optional[float] text : typing.Optional[str] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[SegmentUpdateResponse] Successful Response """ _response = await self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/segment/{jsonable_encoder(segment_id)}/{jsonable_encoder(language)}", base_url=self._client_wrapper.get_environment().base, method="PATCH", json={ "start_time": start_time, "end_time": end_time, "text": text, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( SegmentUpdateResponse, construct_type( type_=SegmentUpdateResponse, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Modifies a single segment with new text and/or start/end times. Will update the values for only a specific language of a segment. Does not automatically regenerate the dub. Parameters ---------- dubbing_id : str ID of the dubbing project. segment_id : str ID of the segment language : str ID of the language. start_time : typing.Optional[float] end_time : typing.Optional[float] text : typing.Optional[str] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[SegmentUpdateResponse] Successful Response
update
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/segment/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/segment/raw_client.py
MIT
async def delete( self, dubbing_id: str, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> AsyncHttpResponse[SegmentDeleteResponse]: """ Deletes a single segment from the dubbing. Parameters ---------- dubbing_id : str ID of the dubbing project. segment_id : str ID of the segment request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[SegmentDeleteResponse] Successful Response """ _response = await self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/segment/{jsonable_encoder(segment_id)}", base_url=self._client_wrapper.get_environment().base, method="DELETE", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( SegmentDeleteResponse, construct_type( type_=SegmentDeleteResponse, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Deletes a single segment from the dubbing. Parameters ---------- dubbing_id : str ID of the dubbing project. segment_id : str ID of the segment request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[SegmentDeleteResponse] Successful Response
delete
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/segment/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/segment/raw_client.py
MIT
def update( self, dubbing_id: str, speaker_id: str, *, voice_id: typing.Optional[str] = OMIT, languages: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> SpeakerUpdatedResponse: """ Amend the metadata associated with a speaker, such as their voice. Both voice cloning and using voices from the ElevenLabs library are supported. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. voice_id : typing.Optional[str] Either the identifier of a voice from the ElevenLabs voice library, or one of ['track-clone', 'clip-clone']. languages : typing.Optional[typing.Sequence[str]] Languages to apply these changes to. If empty, will apply to all languages. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SpeakerUpdatedResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.resource.speaker.update( dubbing_id="dubbing_id", speaker_id="speaker_id", ) """ _response = self._raw_client.update( dubbing_id, speaker_id, voice_id=voice_id, languages=languages, request_options=request_options ) return _response.data
Amend the metadata associated with a speaker, such as their voice. Both voice cloning and using voices from the ElevenLabs library are supported. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. voice_id : typing.Optional[str] Either the identifier of a voice from the ElevenLabs voice library, or one of ['track-clone', 'clip-clone']. languages : typing.Optional[typing.Sequence[str]] Languages to apply these changes to. If empty, will apply to all languages. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SpeakerUpdatedResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.resource.speaker.update( dubbing_id="dubbing_id", speaker_id="speaker_id", )
update
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/speaker/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/speaker/client.py
MIT
def find_similar_voices( self, dubbing_id: str, speaker_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> SimilarVoicesForSpeakerResponse: """ Fetch the top 10 similar voices to a speaker, including the voice IDs, names, descriptions, and, where possible, a sample audio recording. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SimilarVoicesForSpeakerResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.resource.speaker.find_similar_voices( dubbing_id="dubbing_id", speaker_id="speaker_id", ) """ _response = self._raw_client.find_similar_voices(dubbing_id, speaker_id, request_options=request_options) return _response.data
Fetch the top 10 similar voices to a speaker, including the voice IDs, names, descriptions, and, where possible, a sample audio recording. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SimilarVoicesForSpeakerResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.resource.speaker.find_similar_voices( dubbing_id="dubbing_id", speaker_id="speaker_id", )
find_similar_voices
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/speaker/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/speaker/client.py
MIT
async def update( self, dubbing_id: str, speaker_id: str, *, voice_id: typing.Optional[str] = OMIT, languages: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> SpeakerUpdatedResponse: """ Amend the metadata associated with a speaker, such as their voice. Both voice cloning and using voices from the ElevenLabs library are supported. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. voice_id : typing.Optional[str] Either the identifier of a voice from the ElevenLabs voice library, or one of ['track-clone', 'clip-clone']. languages : typing.Optional[typing.Sequence[str]] Languages to apply these changes to. If empty, will apply to all languages. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SpeakerUpdatedResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.speaker.update( dubbing_id="dubbing_id", speaker_id="speaker_id", ) asyncio.run(main()) """ _response = await self._raw_client.update( dubbing_id, speaker_id, voice_id=voice_id, languages=languages, request_options=request_options ) return _response.data
Amend the metadata associated with a speaker, such as their voice. Both voice cloning and using voices from the ElevenLabs library are supported. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. voice_id : typing.Optional[str] Either the identifier of a voice from the ElevenLabs voice library, or one of ['track-clone', 'clip-clone']. languages : typing.Optional[typing.Sequence[str]] Languages to apply these changes to. If empty, will apply to all languages. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SpeakerUpdatedResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.speaker.update( dubbing_id="dubbing_id", speaker_id="speaker_id", ) asyncio.run(main())
update
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/speaker/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/speaker/client.py
MIT
async def find_similar_voices( self, dubbing_id: str, speaker_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> SimilarVoicesForSpeakerResponse: """ Fetch the top 10 similar voices to a speaker, including the voice IDs, names, descriptions, and, where possible, a sample audio recording. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SimilarVoicesForSpeakerResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.speaker.find_similar_voices( dubbing_id="dubbing_id", speaker_id="speaker_id", ) asyncio.run(main()) """ _response = await self._raw_client.find_similar_voices(dubbing_id, speaker_id, request_options=request_options) return _response.data
Fetch the top 10 similar voices to a speaker, including the voice IDs, names, descriptions, and, where possible, a sample audio recording. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SimilarVoicesForSpeakerResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.speaker.find_similar_voices( dubbing_id="dubbing_id", speaker_id="speaker_id", ) asyncio.run(main())
find_similar_voices
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/speaker/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/speaker/client.py
MIT
def update( self, dubbing_id: str, speaker_id: str, *, voice_id: typing.Optional[str] = OMIT, languages: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[SpeakerUpdatedResponse]: """ Amend the metadata associated with a speaker, such as their voice. Both voice cloning and using voices from the ElevenLabs library are supported. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. voice_id : typing.Optional[str] Either the identifier of a voice from the ElevenLabs voice library, or one of ['track-clone', 'clip-clone']. languages : typing.Optional[typing.Sequence[str]] Languages to apply these changes to. If empty, will apply to all languages. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[SpeakerUpdatedResponse] Successful Response """ _response = self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/speaker/{jsonable_encoder(speaker_id)}", base_url=self._client_wrapper.get_environment().base, method="PATCH", json={ "voice_id": voice_id, "languages": languages, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( SpeakerUpdatedResponse, construct_type( type_=SpeakerUpdatedResponse, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Amend the metadata associated with a speaker, such as their voice. Both voice cloning and using voices from the ElevenLabs library are supported. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. voice_id : typing.Optional[str] Either the identifier of a voice from the ElevenLabs voice library, or one of ['track-clone', 'clip-clone']. languages : typing.Optional[typing.Sequence[str]] Languages to apply these changes to. If empty, will apply to all languages. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[SpeakerUpdatedResponse] Successful Response
update
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/speaker/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/speaker/raw_client.py
MIT
def find_similar_voices( self, dubbing_id: str, speaker_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> HttpResponse[SimilarVoicesForSpeakerResponse]: """ Fetch the top 10 similar voices to a speaker, including the voice IDs, names, descriptions, and, where possible, a sample audio recording. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[SimilarVoicesForSpeakerResponse] Successful Response """ _response = self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/speaker/{jsonable_encoder(speaker_id)}/similar-voices", base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( SimilarVoicesForSpeakerResponse, construct_type( type_=SimilarVoicesForSpeakerResponse, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Fetch the top 10 similar voices to a speaker, including the voice IDs, names, descriptions, and, where possible, a sample audio recording. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[SimilarVoicesForSpeakerResponse] Successful Response
find_similar_voices
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/speaker/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/speaker/raw_client.py
MIT
async def update( self, dubbing_id: str, speaker_id: str, *, voice_id: typing.Optional[str] = OMIT, languages: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[SpeakerUpdatedResponse]: """ Amend the metadata associated with a speaker, such as their voice. Both voice cloning and using voices from the ElevenLabs library are supported. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. voice_id : typing.Optional[str] Either the identifier of a voice from the ElevenLabs voice library, or one of ['track-clone', 'clip-clone']. languages : typing.Optional[typing.Sequence[str]] Languages to apply these changes to. If empty, will apply to all languages. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[SpeakerUpdatedResponse] Successful Response """ _response = await self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/speaker/{jsonable_encoder(speaker_id)}", base_url=self._client_wrapper.get_environment().base, method="PATCH", json={ "voice_id": voice_id, "languages": languages, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( SpeakerUpdatedResponse, construct_type( type_=SpeakerUpdatedResponse, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Amend the metadata associated with a speaker, such as their voice. Both voice cloning and using voices from the ElevenLabs library are supported. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. voice_id : typing.Optional[str] Either the identifier of a voice from the ElevenLabs voice library, or one of ['track-clone', 'clip-clone']. languages : typing.Optional[typing.Sequence[str]] Languages to apply these changes to. If empty, will apply to all languages. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[SpeakerUpdatedResponse] Successful Response
update
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/speaker/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/speaker/raw_client.py
MIT
async def find_similar_voices( self, dubbing_id: str, speaker_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> AsyncHttpResponse[SimilarVoicesForSpeakerResponse]: """ Fetch the top 10 similar voices to a speaker, including the voice IDs, names, descriptions, and, where possible, a sample audio recording. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[SimilarVoicesForSpeakerResponse] Successful Response """ _response = await self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/speaker/{jsonable_encoder(speaker_id)}/similar-voices", base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( SimilarVoicesForSpeakerResponse, construct_type( type_=SimilarVoicesForSpeakerResponse, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Fetch the top 10 similar voices to a speaker, including the voice IDs, names, descriptions, and, where possible, a sample audio recording. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[SimilarVoicesForSpeakerResponse] Successful Response
find_similar_voices
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/speaker/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/speaker/raw_client.py
MIT
def create( self, dubbing_id: str, speaker_id: str, *, start_time: float, end_time: float, text: typing.Optional[str] = OMIT, translations: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> SegmentCreateResponse: """ Creates a new segment in dubbing resource with a start and end time for the speaker in every available language. Does not automatically generate transcripts/translations/audio. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. start_time : float end_time : float text : typing.Optional[str] translations : typing.Optional[typing.Dict[str, typing.Optional[str]]] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentCreateResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.resource.speaker.segment.create( dubbing_id="dubbing_id", speaker_id="speaker_id", start_time=1.1, end_time=1.1, ) """ _response = self._raw_client.create( dubbing_id, speaker_id, start_time=start_time, end_time=end_time, text=text, translations=translations, request_options=request_options, ) return _response.data
Creates a new segment in dubbing resource with a start and end time for the speaker in every available language. Does not automatically generate transcripts/translations/audio. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. start_time : float end_time : float text : typing.Optional[str] translations : typing.Optional[typing.Dict[str, typing.Optional[str]]] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentCreateResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.resource.speaker.segment.create( dubbing_id="dubbing_id", speaker_id="speaker_id", start_time=1.1, end_time=1.1, )
create
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/speaker/segment/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/speaker/segment/client.py
MIT
async def create( self, dubbing_id: str, speaker_id: str, *, start_time: float, end_time: float, text: typing.Optional[str] = OMIT, translations: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> SegmentCreateResponse: """ Creates a new segment in dubbing resource with a start and end time for the speaker in every available language. Does not automatically generate transcripts/translations/audio. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. start_time : float end_time : float text : typing.Optional[str] translations : typing.Optional[typing.Dict[str, typing.Optional[str]]] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentCreateResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.speaker.segment.create( dubbing_id="dubbing_id", speaker_id="speaker_id", start_time=1.1, end_time=1.1, ) asyncio.run(main()) """ _response = await self._raw_client.create( dubbing_id, speaker_id, start_time=start_time, end_time=end_time, text=text, translations=translations, request_options=request_options, ) return _response.data
Creates a new segment in dubbing resource with a start and end time for the speaker in every available language. Does not automatically generate transcripts/translations/audio. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. start_time : float end_time : float text : typing.Optional[str] translations : typing.Optional[typing.Dict[str, typing.Optional[str]]] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SegmentCreateResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.resource.speaker.segment.create( dubbing_id="dubbing_id", speaker_id="speaker_id", start_time=1.1, end_time=1.1, ) asyncio.run(main())
create
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/speaker/segment/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/speaker/segment/client.py
MIT
def create( self, dubbing_id: str, speaker_id: str, *, start_time: float, end_time: float, text: typing.Optional[str] = OMIT, translations: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[SegmentCreateResponse]: """ Creates a new segment in dubbing resource with a start and end time for the speaker in every available language. Does not automatically generate transcripts/translations/audio. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. start_time : float end_time : float text : typing.Optional[str] translations : typing.Optional[typing.Dict[str, typing.Optional[str]]] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[SegmentCreateResponse] Successful Response """ _response = self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/speaker/{jsonable_encoder(speaker_id)}/segment", base_url=self._client_wrapper.get_environment().base, method="POST", json={ "start_time": start_time, "end_time": end_time, "text": text, "translations": translations, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( SegmentCreateResponse, construct_type( type_=SegmentCreateResponse, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Creates a new segment in dubbing resource with a start and end time for the speaker in every available language. Does not automatically generate transcripts/translations/audio. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. start_time : float end_time : float text : typing.Optional[str] translations : typing.Optional[typing.Dict[str, typing.Optional[str]]] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[SegmentCreateResponse] Successful Response
create
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/speaker/segment/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/speaker/segment/raw_client.py
MIT
async def create( self, dubbing_id: str, speaker_id: str, *, start_time: float, end_time: float, text: typing.Optional[str] = OMIT, translations: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[SegmentCreateResponse]: """ Creates a new segment in dubbing resource with a start and end time for the speaker in every available language. Does not automatically generate transcripts/translations/audio. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. start_time : float end_time : float text : typing.Optional[str] translations : typing.Optional[typing.Dict[str, typing.Optional[str]]] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[SegmentCreateResponse] Successful Response """ _response = await self._client_wrapper.httpx_client.request( f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/speaker/{jsonable_encoder(speaker_id)}/segment", base_url=self._client_wrapper.get_environment().base, method="POST", json={ "start_time": start_time, "end_time": end_time, "text": text, "translations": translations, }, headers={ "content-type": "application/json", }, request_options=request_options, omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( SegmentCreateResponse, construct_type( type_=SegmentCreateResponse, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Creates a new segment in dubbing resource with a start and end time for the speaker in every available language. Does not automatically generate transcripts/translations/audio. Parameters ---------- dubbing_id : str ID of the dubbing project. speaker_id : str ID of the speaker. start_time : float end_time : float text : typing.Optional[str] translations : typing.Optional[typing.Dict[str, typing.Optional[str]]] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[SegmentCreateResponse] Successful Response
create
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/resource/speaker/segment/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/resource/speaker/segment/raw_client.py
MIT
def get_transcript_for_dub( self, dubbing_id: str, language_code: str, *, format_type: typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] = None, request_options: typing.Optional[RequestOptions] = None, ) -> str: """ Returns transcript for the dub as an SRT or WEBVTT file. Parameters ---------- dubbing_id : str ID of the dubbing project. language_code : str ID of the language. format_type : typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] Format to use for the subtitle file, either 'srt' or 'webvtt' request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- str Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.transcript.get_transcript_for_dub( dubbing_id="dubbing_id", language_code="language_code", ) """ _response = self._raw_client.get_transcript_for_dub( dubbing_id, language_code, format_type=format_type, request_options=request_options ) return _response.data
Returns transcript for the dub as an SRT or WEBVTT file. Parameters ---------- dubbing_id : str ID of the dubbing project. language_code : str ID of the language. format_type : typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] Format to use for the subtitle file, either 'srt' or 'webvtt' request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- str Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.dubbing.transcript.get_transcript_for_dub( dubbing_id="dubbing_id", language_code="language_code", )
get_transcript_for_dub
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/transcript/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/transcript/client.py
MIT
async def get_transcript_for_dub( self, dubbing_id: str, language_code: str, *, format_type: typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] = None, request_options: typing.Optional[RequestOptions] = None, ) -> str: """ Returns transcript for the dub as an SRT or WEBVTT file. Parameters ---------- dubbing_id : str ID of the dubbing project. language_code : str ID of the language. format_type : typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] Format to use for the subtitle file, either 'srt' or 'webvtt' request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- str Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.transcript.get_transcript_for_dub( dubbing_id="dubbing_id", language_code="language_code", ) asyncio.run(main()) """ _response = await self._raw_client.get_transcript_for_dub( dubbing_id, language_code, format_type=format_type, request_options=request_options ) return _response.data
Returns transcript for the dub as an SRT or WEBVTT file. Parameters ---------- dubbing_id : str ID of the dubbing project. language_code : str ID of the language. format_type : typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] Format to use for the subtitle file, either 'srt' or 'webvtt' request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- str Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.dubbing.transcript.get_transcript_for_dub( dubbing_id="dubbing_id", language_code="language_code", ) asyncio.run(main())
get_transcript_for_dub
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/transcript/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/transcript/client.py
MIT
def get_transcript_for_dub( self, dubbing_id: str, language_code: str, *, format_type: typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] = None, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[str]: """ Returns transcript for the dub as an SRT or WEBVTT file. Parameters ---------- dubbing_id : str ID of the dubbing project. language_code : str ID of the language. format_type : typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] Format to use for the subtitle file, either 'srt' or 'webvtt' request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[str] Successful Response """ _response = self._client_wrapper.httpx_client.request( f"v1/dubbing/{jsonable_encoder(dubbing_id)}/transcript/{jsonable_encoder(language_code)}", base_url=self._client_wrapper.get_environment().base, method="GET", params={ "format_type": format_type, }, request_options=request_options, ) try: if 200 <= _response.status_code < 300: return HttpResponse(response=_response, data=_response.text) # type: ignore if _response.status_code == 403: raise ForbiddenError( headers=dict(_response.headers), body=typing.cast( typing.Optional[typing.Any], construct_type( type_=typing.Optional[typing.Any], # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 404: raise NotFoundError( headers=dict(_response.headers), body=typing.cast( typing.Optional[typing.Any], construct_type( type_=typing.Optional[typing.Any], # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 425: raise TooEarlyError( headers=dict(_response.headers), body=typing.cast( typing.Optional[typing.Any], construct_type( type_=typing.Optional[typing.Any], # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Returns transcript for the dub as an SRT or WEBVTT file. Parameters ---------- dubbing_id : str ID of the dubbing project. language_code : str ID of the language. format_type : typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] Format to use for the subtitle file, either 'srt' or 'webvtt' request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[str] Successful Response
get_transcript_for_dub
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/transcript/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/transcript/raw_client.py
MIT
async def get_transcript_for_dub( self, dubbing_id: str, language_code: str, *, format_type: typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] = None, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[str]: """ Returns transcript for the dub as an SRT or WEBVTT file. Parameters ---------- dubbing_id : str ID of the dubbing project. language_code : str ID of the language. format_type : typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] Format to use for the subtitle file, either 'srt' or 'webvtt' request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[str] Successful Response """ _response = await self._client_wrapper.httpx_client.request( f"v1/dubbing/{jsonable_encoder(dubbing_id)}/transcript/{jsonable_encoder(language_code)}", base_url=self._client_wrapper.get_environment().base, method="GET", params={ "format_type": format_type, }, request_options=request_options, ) try: if 200 <= _response.status_code < 300: return AsyncHttpResponse(response=_response, data=_response.text) # type: ignore if _response.status_code == 403: raise ForbiddenError( headers=dict(_response.headers), body=typing.cast( typing.Optional[typing.Any], construct_type( type_=typing.Optional[typing.Any], # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 404: raise NotFoundError( headers=dict(_response.headers), body=typing.cast( typing.Optional[typing.Any], construct_type( type_=typing.Optional[typing.Any], # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) if _response.status_code == 425: raise TooEarlyError( headers=dict(_response.headers), body=typing.cast( typing.Optional[typing.Any], construct_type( type_=typing.Optional[typing.Any], # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Returns transcript for the dub as an SRT or WEBVTT file. Parameters ---------- dubbing_id : str ID of the dubbing project. language_code : str ID of the language. format_type : typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] Format to use for the subtitle file, either 'srt' or 'webvtt' request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[str] Successful Response
get_transcript_for_dub
python
elevenlabs/elevenlabs-python
src/elevenlabs/dubbing/transcript/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/dubbing/transcript/raw_client.py
MIT
def create( self, *, file: core.File, text: str, enabled_spooled_file: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> ForcedAlignmentResponseModel: """ Force align an audio file to text. Use this endpoint to get the timing information for each character and word in an audio file based on a provided text transcript. Parameters ---------- file : core.File See core.File for more documentation text : str The text to align with the audio. The input text can be in any format, however diarization is not supported at this time. enabled_spooled_file : typing.Optional[bool] If true, the file will be streamed to the server and processed in chunks. This is useful for large files that cannot be loaded into memory. The default is false. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- ForcedAlignmentResponseModel Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.forced_alignment.create( text="text", ) """ _response = self._raw_client.create( file=file, text=text, enabled_spooled_file=enabled_spooled_file, request_options=request_options ) return _response.data
Force align an audio file to text. Use this endpoint to get the timing information for each character and word in an audio file based on a provided text transcript. Parameters ---------- file : core.File See core.File for more documentation text : str The text to align with the audio. The input text can be in any format, however diarization is not supported at this time. enabled_spooled_file : typing.Optional[bool] If true, the file will be streamed to the server and processed in chunks. This is useful for large files that cannot be loaded into memory. The default is false. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- ForcedAlignmentResponseModel Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.forced_alignment.create( text="text", )
create
python
elevenlabs/elevenlabs-python
src/elevenlabs/forced_alignment/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/forced_alignment/client.py
MIT
async def create( self, *, file: core.File, text: str, enabled_spooled_file: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> ForcedAlignmentResponseModel: """ Force align an audio file to text. Use this endpoint to get the timing information for each character and word in an audio file based on a provided text transcript. Parameters ---------- file : core.File See core.File for more documentation text : str The text to align with the audio. The input text can be in any format, however diarization is not supported at this time. enabled_spooled_file : typing.Optional[bool] If true, the file will be streamed to the server and processed in chunks. This is useful for large files that cannot be loaded into memory. The default is false. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- ForcedAlignmentResponseModel Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.forced_alignment.create( text="text", ) asyncio.run(main()) """ _response = await self._raw_client.create( file=file, text=text, enabled_spooled_file=enabled_spooled_file, request_options=request_options ) return _response.data
Force align an audio file to text. Use this endpoint to get the timing information for each character and word in an audio file based on a provided text transcript. Parameters ---------- file : core.File See core.File for more documentation text : str The text to align with the audio. The input text can be in any format, however diarization is not supported at this time. enabled_spooled_file : typing.Optional[bool] If true, the file will be streamed to the server and processed in chunks. This is useful for large files that cannot be loaded into memory. The default is false. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- ForcedAlignmentResponseModel Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.forced_alignment.create( text="text", ) asyncio.run(main())
create
python
elevenlabs/elevenlabs-python
src/elevenlabs/forced_alignment/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/forced_alignment/client.py
MIT
def create( self, *, file: core.File, text: str, enabled_spooled_file: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[ForcedAlignmentResponseModel]: """ Force align an audio file to text. Use this endpoint to get the timing information for each character and word in an audio file based on a provided text transcript. Parameters ---------- file : core.File See core.File for more documentation text : str The text to align with the audio. The input text can be in any format, however diarization is not supported at this time. enabled_spooled_file : typing.Optional[bool] If true, the file will be streamed to the server and processed in chunks. This is useful for large files that cannot be loaded into memory. The default is false. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[ForcedAlignmentResponseModel] Successful Response """ _response = self._client_wrapper.httpx_client.request( "v1/forced-alignment", base_url=self._client_wrapper.get_environment().base, method="POST", data={ "text": text, "enabled_spooled_file": enabled_spooled_file, }, files={ "file": file, }, request_options=request_options, omit=OMIT, force_multipart=True, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( ForcedAlignmentResponseModel, construct_type( type_=ForcedAlignmentResponseModel, # type: ignore object_=_response.json(), ), ) return HttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Force align an audio file to text. Use this endpoint to get the timing information for each character and word in an audio file based on a provided text transcript. Parameters ---------- file : core.File See core.File for more documentation text : str The text to align with the audio. The input text can be in any format, however diarization is not supported at this time. enabled_spooled_file : typing.Optional[bool] If true, the file will be streamed to the server and processed in chunks. This is useful for large files that cannot be loaded into memory. The default is false. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- HttpResponse[ForcedAlignmentResponseModel] Successful Response
create
python
elevenlabs/elevenlabs-python
src/elevenlabs/forced_alignment/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/forced_alignment/raw_client.py
MIT
async def create( self, *, file: core.File, text: str, enabled_spooled_file: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[ForcedAlignmentResponseModel]: """ Force align an audio file to text. Use this endpoint to get the timing information for each character and word in an audio file based on a provided text transcript. Parameters ---------- file : core.File See core.File for more documentation text : str The text to align with the audio. The input text can be in any format, however diarization is not supported at this time. enabled_spooled_file : typing.Optional[bool] If true, the file will be streamed to the server and processed in chunks. This is useful for large files that cannot be loaded into memory. The default is false. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[ForcedAlignmentResponseModel] Successful Response """ _response = await self._client_wrapper.httpx_client.request( "v1/forced-alignment", base_url=self._client_wrapper.get_environment().base, method="POST", data={ "text": text, "enabled_spooled_file": enabled_spooled_file, }, files={ "file": file, }, request_options=request_options, omit=OMIT, force_multipart=True, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( ForcedAlignmentResponseModel, construct_type( type_=ForcedAlignmentResponseModel, # type: ignore object_=_response.json(), ), ) return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( HttpValidationError, construct_type( type_=HttpValidationError, # type: ignore object_=_response.json(), ), ), ) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
Force align an audio file to text. Use this endpoint to get the timing information for each character and word in an audio file based on a provided text transcript. Parameters ---------- file : core.File See core.File for more documentation text : str The text to align with the audio. The input text can be in any format, however diarization is not supported at this time. enabled_spooled_file : typing.Optional[bool] If true, the file will be streamed to the server and processed in chunks. This is useful for large files that cannot be loaded into memory. The default is false. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- AsyncHttpResponse[ForcedAlignmentResponseModel] Successful Response
create
python
elevenlabs/elevenlabs-python
src/elevenlabs/forced_alignment/raw_client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/forced_alignment/raw_client.py
MIT
def list( self, *, page_size: typing.Optional[int] = None, start_after_history_item_id: typing.Optional[str] = None, voice_id: typing.Optional[str] = None, search: typing.Optional[str] = None, source: typing.Optional[HistoryListRequestSource] = None, request_options: typing.Optional[RequestOptions] = None, ) -> GetSpeechHistoryResponse: """ Returns a list of your generated audio. Parameters ---------- page_size : typing.Optional[int] How many history items to return at maximum. Can not exceed 1000, defaults to 100. start_after_history_item_id : typing.Optional[str] After which ID to start fetching, use this parameter to paginate across a large collection of history items. In case this parameter is not provided history items will be fetched starting from the most recently created one ordered descending by their creation date. voice_id : typing.Optional[str] ID of the voice to be filtered for. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. search : typing.Optional[str] Search term used for filtering history items. If provided, source becomes required. source : typing.Optional[HistoryListRequestSource] Source of the generated history item request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- GetSpeechHistoryResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.history.list() """ _response = self._raw_client.list( page_size=page_size, start_after_history_item_id=start_after_history_item_id, voice_id=voice_id, search=search, source=source, request_options=request_options, ) return _response.data
Returns a list of your generated audio. Parameters ---------- page_size : typing.Optional[int] How many history items to return at maximum. Can not exceed 1000, defaults to 100. start_after_history_item_id : typing.Optional[str] After which ID to start fetching, use this parameter to paginate across a large collection of history items. In case this parameter is not provided history items will be fetched starting from the most recently created one ordered descending by their creation date. voice_id : typing.Optional[str] ID of the voice to be filtered for. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. search : typing.Optional[str] Search term used for filtering history items. If provided, source becomes required. source : typing.Optional[HistoryListRequestSource] Source of the generated history item request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- GetSpeechHistoryResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.history.list()
list
python
elevenlabs/elevenlabs-python
src/elevenlabs/history/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/history/client.py
MIT
def get( self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> SpeechHistoryItemResponse: """ Retrieves a history item. Parameters ---------- history_item_id : str ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/get-all) endpoint to retrieve a list of history items. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SpeechHistoryItemResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.history.get( history_item_id="VW7YKqPnjY4h39yTbx2L", ) """ _response = self._raw_client.get(history_item_id, request_options=request_options) return _response.data
Retrieves a history item. Parameters ---------- history_item_id : str ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/get-all) endpoint to retrieve a list of history items. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SpeechHistoryItemResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.history.get( history_item_id="VW7YKqPnjY4h39yTbx2L", )
get
python
elevenlabs/elevenlabs-python
src/elevenlabs/history/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/history/client.py
MIT
def delete( self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> DeleteHistoryItemResponse: """ Delete a history item by its ID Parameters ---------- history_item_id : str ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/get-all) endpoint to retrieve a list of history items. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeleteHistoryItemResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.history.delete( history_item_id="VW7YKqPnjY4h39yTbx2L", ) """ _response = self._raw_client.delete(history_item_id, request_options=request_options) return _response.data
Delete a history item by its ID Parameters ---------- history_item_id : str ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/get-all) endpoint to retrieve a list of history items. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeleteHistoryItemResponse Successful Response Examples -------- from elevenlabs import ElevenLabs client = ElevenLabs( api_key="YOUR_API_KEY", ) client.history.delete( history_item_id="VW7YKqPnjY4h39yTbx2L", )
delete
python
elevenlabs/elevenlabs-python
src/elevenlabs/history/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/history/client.py
MIT
def get_audio( self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> typing.Iterator[bytes]: """ Returns the audio of an history item. Parameters ---------- history_item_id : str ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/get-all) endpoint to retrieve a list of history items. request_options : typing.Optional[RequestOptions] Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. Returns ------- typing.Iterator[bytes] The audio file of the history item. """ with self._raw_client.get_audio(history_item_id, request_options=request_options) as r: yield from r.data
Returns the audio of an history item. Parameters ---------- history_item_id : str ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/get-all) endpoint to retrieve a list of history items. request_options : typing.Optional[RequestOptions] Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. Returns ------- typing.Iterator[bytes] The audio file of the history item.
get_audio
python
elevenlabs/elevenlabs-python
src/elevenlabs/history/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/history/client.py
MIT
def download( self, *, history_item_ids: typing.Sequence[str], output_format: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.Iterator[bytes]: """ Download one or more history items. If one history item ID is provided, we will return a single audio file. If more than one history item IDs are provided, we will provide the history items packed into a .zip file. Parameters ---------- history_item_ids : typing.Sequence[str] A list of history items to download, you can get IDs of history items and other metadata using the GET https://api.elevenlabs.io/v1/history endpoint. output_format : typing.Optional[str] Output format to transcode the audio file, can be wav or default. request_options : typing.Optional[RequestOptions] Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. Returns ------- typing.Iterator[bytes] The requested audio file, or a zip file containing multiple audio files when multiple history items are requested. """ with self._raw_client.download( history_item_ids=history_item_ids, output_format=output_format, request_options=request_options ) as r: yield from r.data
Download one or more history items. If one history item ID is provided, we will return a single audio file. If more than one history item IDs are provided, we will provide the history items packed into a .zip file. Parameters ---------- history_item_ids : typing.Sequence[str] A list of history items to download, you can get IDs of history items and other metadata using the GET https://api.elevenlabs.io/v1/history endpoint. output_format : typing.Optional[str] Output format to transcode the audio file, can be wav or default. request_options : typing.Optional[RequestOptions] Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. Returns ------- typing.Iterator[bytes] The requested audio file, or a zip file containing multiple audio files when multiple history items are requested.
download
python
elevenlabs/elevenlabs-python
src/elevenlabs/history/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/history/client.py
MIT
async def list( self, *, page_size: typing.Optional[int] = None, start_after_history_item_id: typing.Optional[str] = None, voice_id: typing.Optional[str] = None, search: typing.Optional[str] = None, source: typing.Optional[HistoryListRequestSource] = None, request_options: typing.Optional[RequestOptions] = None, ) -> GetSpeechHistoryResponse: """ Returns a list of your generated audio. Parameters ---------- page_size : typing.Optional[int] How many history items to return at maximum. Can not exceed 1000, defaults to 100. start_after_history_item_id : typing.Optional[str] After which ID to start fetching, use this parameter to paginate across a large collection of history items. In case this parameter is not provided history items will be fetched starting from the most recently created one ordered descending by their creation date. voice_id : typing.Optional[str] ID of the voice to be filtered for. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. search : typing.Optional[str] Search term used for filtering history items. If provided, source becomes required. source : typing.Optional[HistoryListRequestSource] Source of the generated history item request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- GetSpeechHistoryResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.history.list() asyncio.run(main()) """ _response = await self._raw_client.list( page_size=page_size, start_after_history_item_id=start_after_history_item_id, voice_id=voice_id, search=search, source=source, request_options=request_options, ) return _response.data
Returns a list of your generated audio. Parameters ---------- page_size : typing.Optional[int] How many history items to return at maximum. Can not exceed 1000, defaults to 100. start_after_history_item_id : typing.Optional[str] After which ID to start fetching, use this parameter to paginate across a large collection of history items. In case this parameter is not provided history items will be fetched starting from the most recently created one ordered descending by their creation date. voice_id : typing.Optional[str] ID of the voice to be filtered for. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. search : typing.Optional[str] Search term used for filtering history items. If provided, source becomes required. source : typing.Optional[HistoryListRequestSource] Source of the generated history item request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- GetSpeechHistoryResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.history.list() asyncio.run(main())
list
python
elevenlabs/elevenlabs-python
src/elevenlabs/history/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/history/client.py
MIT
async def get( self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> SpeechHistoryItemResponse: """ Retrieves a history item. Parameters ---------- history_item_id : str ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/get-all) endpoint to retrieve a list of history items. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SpeechHistoryItemResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.history.get( history_item_id="VW7YKqPnjY4h39yTbx2L", ) asyncio.run(main()) """ _response = await self._raw_client.get(history_item_id, request_options=request_options) return _response.data
Retrieves a history item. Parameters ---------- history_item_id : str ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/get-all) endpoint to retrieve a list of history items. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- SpeechHistoryItemResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.history.get( history_item_id="VW7YKqPnjY4h39yTbx2L", ) asyncio.run(main())
get
python
elevenlabs/elevenlabs-python
src/elevenlabs/history/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/history/client.py
MIT
async def delete( self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> DeleteHistoryItemResponse: """ Delete a history item by its ID Parameters ---------- history_item_id : str ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/get-all) endpoint to retrieve a list of history items. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeleteHistoryItemResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.history.delete( history_item_id="VW7YKqPnjY4h39yTbx2L", ) asyncio.run(main()) """ _response = await self._raw_client.delete(history_item_id, request_options=request_options) return _response.data
Delete a history item by its ID Parameters ---------- history_item_id : str ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/get-all) endpoint to retrieve a list of history items. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- DeleteHistoryItemResponse Successful Response Examples -------- import asyncio from elevenlabs import AsyncElevenLabs client = AsyncElevenLabs( api_key="YOUR_API_KEY", ) async def main() -> None: await client.history.delete( history_item_id="VW7YKqPnjY4h39yTbx2L", ) asyncio.run(main())
delete
python
elevenlabs/elevenlabs-python
src/elevenlabs/history/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/history/client.py
MIT
async def get_audio( self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> typing.AsyncIterator[bytes]: """ Returns the audio of an history item. Parameters ---------- history_item_id : str ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/get-all) endpoint to retrieve a list of history items. request_options : typing.Optional[RequestOptions] Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. Returns ------- typing.AsyncIterator[bytes] The audio file of the history item. """ async with self._raw_client.get_audio(history_item_id, request_options=request_options) as r: async for _chunk in r.data: yield _chunk
Returns the audio of an history item. Parameters ---------- history_item_id : str ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/get-all) endpoint to retrieve a list of history items. request_options : typing.Optional[RequestOptions] Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. Returns ------- typing.AsyncIterator[bytes] The audio file of the history item.
get_audio
python
elevenlabs/elevenlabs-python
src/elevenlabs/history/client.py
https://github.com/elevenlabs/elevenlabs-python/blob/master/src/elevenlabs/history/client.py
MIT