Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add section about timeouts #123

Merged
merged 3 commits into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 37 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ When you create a transcript, you can either pass in a URL to an audio file
or upload a file directly.

```java
import com.assemblyai.api.types.Transcript;
import com.assemblyai.api.resources.transcripts.types.Transcript;

// Transcribe file at remote URL
Transcript transcript = aai.transcripts().transcribe(
Expand All @@ -94,7 +94,7 @@ transcript = aai.transcripts().transcribe(
If you don't want to wait until the transcript is ready, you can use submit:

```java
import com.assemblyai.api.types.Transcript;
import com.assemblyai.api.resources.transcripts.types.Transcript;

// Transcribe file at remote URL
Transcript transcript = aai.transcripts().submit(
Expand All @@ -111,7 +111,7 @@ audio streams and sends data over websockets. The Realtime Transcriber
will take event handlers

```java
import com.assemblyai.api.Transcriber;
import com.assemblyai.api.RealtimeTranscriber;

RealtimeTranscriber realtime = RealtimeTranscriber.builder()
.apiKey("YOUR_API_KEY")
Expand All @@ -135,13 +135,44 @@ method on `CreateTranscriptParameters` until you have specified the mandatory
audioUrl variable.

```java
import com.assemblyai.api.TranscriptParams;
import com.assemblyai.api.resources.transcripts.requests.TranscriptParams;

TranscriptParams params = TranscriptParams.builder()
.audioUrl("https://...")
.build();
.audioUrl("https://...")
.build();
```

## Timeouts

The SDK uses the default timeouts of OkHttpClient:
* 10 seconds for connection timeout
* 10 seconds for read timeout
* 10 seconds for write timeout
* No timeout for call timeout

However, there are **no timeouts for any LeMUR** HTTP request.

To specify your own timeout, you can pass `RequestOptions` to each request method:

```java
import com.assemblyai.api.core.RequestOptions;

// initialize client

client.transcripts()
.get(
"50c54d73-7a3f-44dc-af6b-f4579841b1ce",
RequestOptions.builder()
.timeout(30, TimeUnit.SECONDS)
.build()
);
```

For this operation, the call timeout will be 30 seconds, and the other timeouts will be turned off.

The default timeout should be sufficient for most use cases.
However, depending on your network speed and distance, you may occasionally experience timeouts, in which case you can increase the timeout.

## Contributing
While we value open-source contributions to this SDK, this library
is generated programmatically. Additions made directly to this library
Expand Down
Loading