cartesia-ai / cartesia-python

The official Cartesia client for Python.
MIT License
23 stars 2 forks source link

Please add Language to class create voice #9

Open ilyamk opened 1 week ago

ilyamk commented 1 week ago

Add language code to this method of class Voices:

def create(
        self,
        name: str,
        description: str,
        embedding: List[float],
        base_voice_id: Optional[str] = None,
    ) -> VoiceMetadata:
        """Create a new voice.

        Args:
            name: The name of the voice.
            description: The description of the voice.
            embedding: The embedding of the voice. This should be generated with :meth:`clone`.
            base_voice_id: The ID of the base voice. This should be a valid voice ID if specified.

        Returns:
            A dictionary containing the voice metadata.
        """
        response = httpx.post(
            f"{self._http_url()}/voices",
            headers=self.headers,
            json={
                "name": name,
                "description": description,
                "embedding": embedding,
# Add "language" 
                "base_voice_id": base_voice_id,
            },
            timeout=self.timeout,
        )

        if not response.is_success:
            raise ValueError(f"Failed to create voice. Error: {response.text}")

        return response.json()