-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #174 from dsinghvi/v3
🌿 Introduce V3 SDK (generated by Fern)
- Loading branch information
Showing
43 changed files
with
1,100 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## Contributing | ||
|
||
While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us! | ||
|
||
On the other hand, contributions to the README are always very welcome! | ||
|
||
### Tests | ||
|
||
Run the following commands from the root of the repo | ||
|
||
```sh | ||
ELEVEN_API_KEY=<YOUR_API_KEY> poetry run pytest -sv | ||
``` | ||
|
||
### Run a specific test | ||
_e.g. `test_voice_design` in the `elevenlabs/tests/api/test_voice.py` file_ | ||
```sh | ||
ELEVEN_API_KEY=<YOUR_API_KEY> poerty run pytest elevenlabs/tests/api/test_voice.py::test_voice_design -sv | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import json | ||
from typing import Dict, List, Optional | ||
|
||
from .client import ElevenLabs | ||
from .voice import Voice | ||
|
||
|
||
def clone( | ||
name: str, | ||
api_key: Optional[str] = None, | ||
description: str = "", | ||
files: List[str] = [], | ||
labels: Optional[Dict[str, str]] = dict(), | ||
) -> Voice: | ||
client = ElevenLabs(api_key=api_key) | ||
add_voice_response = client.voices.add( | ||
name=name, | ||
description=description, | ||
files=[open(file, 'rb') for file in files], | ||
labels=str(json.dumps(labels or {})) | ||
) | ||
voice = client.voices.get(voice_id=add_voice_response.voice_id) | ||
return Voice( | ||
**voice.dict() | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from typing import ( | ||
IO, | ||
Mapping, | ||
Optional, | ||
Tuple, | ||
Union, | ||
) | ||
|
||
FileContent = Union[IO[bytes], bytes, str] | ||
FileType = Union[ | ||
# file (or bytes) | ||
FileContent, | ||
# (filename, file (or bytes)) | ||
Tuple[Optional[str], FileContent], | ||
# (filename, file (or bytes), content_type) | ||
Tuple[Optional[str], FileContent, Optional[str]], | ||
# (filename, file (or bytes), content_type, headers) | ||
Tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]], | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.