- Notifications
You must be signed in to change notification settings - Fork0
HumeAI/hume-dotnet-sdk
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
The Hume C# library provides convenient access to the Hume APIs from C#.
This SDK requires:
dotnet add package Hume
A full reference for this library is availablehere.
Instantiate and use the client with the following:
usingHume.Tts;usingHume;varclient=newHumeClient("API_KEY");awaitclient.Tts.Voices.CreateAsync(newPostedVoice{GenerationId="795c949a-1510-4a80-9646-7d0863b023ab",Name="David Hume"});
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following errorwill be thrown.
usingHume;try{varresponse=awaitclient.Tts.Voices.CreateAsync(...);}catch(HumeClientApiExceptione){System.Console.WriteLine(e.Body);System.Console.WriteLine(e.StatusCode);}
List endpoints are paginated. The SDK provides an async enumerable so that you can simply loop over the items:
usingHume.Tts;usingHume;varclient=newHumeClient("API_KEY");varitems=awaitclient.Tts.Voices.ListAsync(newVoicesListRequest{Provider=Hume.Tts.VoiceProvider.CustomVoice});awaitforeach(variteminitems){// do something with item}
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as longas the request is deemed retryable and the number of retry attempts has not grown larger than the configuredretry limit (default: 2).
A request is deemed retryable when any of the following HTTP status codes is returned:
Use theMaxRetries request option to configure this behavior.
varresponse=awaitclient.Tts.Voices.CreateAsync( ...,newRequestOptions{MaxRetries:0// Override MaxRetries at the request level});
The SDK defaults to a 30 second timeout. Use theTimeout option to configure this behavior.
varresponse=awaitclient.Tts.Voices.CreateAsync( ...,newRequestOptions{Timeout: TimeSpan.FromSeconds(3)// Override timeout to 3s});
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 asa proof of concept, but know that we will not be able to merge it as-is. We suggest openingan issue first to discuss with us!
On the other hand, contributions to the README are always very welcome!
About
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.