Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
146 changes: 141 additions & 5 deletions .fern/replay.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 13 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ The Speechifyinc Python library provides convenient access to the Speechifyinc A
- [Usage](#usage)
- [Async Client](#async-client)
- [Exception Handling](#exception-handling)
- [Pagination](#pagination)
- [Advanced](#advanced)
- [Retries](#retries)
- [Timeouts](#timeouts)
Expand Down Expand Up @@ -44,11 +43,11 @@ from speechify import Speechify
client = Speechify(
token="YOUR_TOKEN",
)
client.agent.create(
name="name",
prompt="prompt",
first_message="first_message",
voice_id="voice_id",
client.tts.audio.speech(
audio_format="mp3",
input="Hello! This is the Speechify text-to-speech API.",
model="simba-english",
voice_id="george",
)
```

Expand All @@ -67,11 +66,11 @@ client = AsyncSpeechify(


async def main() -> None:
await client.agent.create(
name="name",
prompt="prompt",
first_message="first_message",
voice_id="voice_id",
await client.tts.audio.speech(
audio_format="mp3",
input="Hello! This is the Speechify text-to-speech API.",
model="simba-english",
voice_id="george",
)


Expand All @@ -87,30 +86,12 @@ will be thrown.
from speechify.core.api_error import ApiError

try:
client.agent.create(...)
client.tts.audio.speech(...)
except ApiError as e:
print(e.status_code)
print(e.body)
```

## Pagination

Paginated requests will return a `SyncPager` or `AsyncPager`, which can be used as generators for the underlying object.

```python
from speechify import Speechify

client = Speechify(
token="YOUR_TOKEN",
)
response = client.agent.tools.list()
for item in response:
yield item
# alternatively, you can paginate page-by-page
for page in response.iter_pages():
yield page
```

## Advanced

### Retries
Expand All @@ -128,7 +109,7 @@ A request is deemed retryable when any of the following HTTP status codes is ret
Use the `max_retries` request option to configure this behavior.

```python
client.agent.create(..., request_options={
client.tts.audio.speech(..., request_options={
"max_retries": 1
})
```
Expand All @@ -148,7 +129,7 @@ client = Speechify(


# Override timeout for a specific method
client.agent.create(..., request_options={
client.tts.audio.speech(..., request_options={
"timeout_in_seconds": 1
})
```
Expand Down
Loading