Skip to content

Commit

Permalink
ElevenLabs-DotNet 3.4.2
Browse files Browse the repository at this point in the history
- Added flash models
- Fixed http/https protocol in client settings
  • Loading branch information
StephenHodgson committed Jan 11, 2025
1 parent 9884433 commit 5e47158
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
16 changes: 15 additions & 1 deletion ElevenLabs-DotNet/Authentication/ElevenLabsClientSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace ElevenLabs
{
public sealed class ElevenLabsClientSettings
{
internal const string Http = "http://";
internal const string Https = "https://";
internal const string DefaultApiVersion = "v1";
internal const string ElevenLabsDomain = "api.elevenlabs.io";
Expand Down Expand Up @@ -44,7 +45,20 @@ public ElevenLabsClientSettings(string domain, string apiVersion = DefaultApiVer
apiVersion = DefaultApiVersion;
}

Domain = domain.Contains("http") ? domain : $"{Https}{domain}";
var protocol = Https;

if (domain.StartsWith(Http))
{
protocol = Http;
domain = domain.Replace(Http, string.Empty);
}
else if (domain.StartsWith(Https))
{
protocol = Https;
domain = domain.Replace(Https, string.Empty);
}

Domain = $"{protocol}{domain}";
ApiVersion = apiVersion;
BaseRequest = $"/{ApiVersion}/";
BaseRequestUrlFormat = $"{Domain}{BaseRequest}{{0}}";
Expand Down
5 changes: 4 additions & 1 deletion ElevenLabs-DotNet/ElevenLabs-DotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ All copyrights, trademarks, logos, and assets are the property of their respecti
<SignAssembly>false</SignAssembly>
<IncludeSymbols>true</IncludeSymbols>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>3.4.1</Version>
<Version>3.4.2</Version>
<PackageReleaseNotes>
Version 3.4.2
- Added flash models
- Fixed http/https protocol in client settings
Version 3.4.1
- Removed text length check in TextToSpeechRequest
Version 3.4.0
Expand Down
12 changes: 12 additions & 0 deletions ElevenLabs-DotNet/Models/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ public Model(string id)

#region Predefined Models

/// <summary>
/// Our latest, ultra-low-latency model, generating speech in under 75ms. Best for developer use cases requiring speed and multiple languages.
/// </summary>
[JsonIgnore]
public static Model FlashV2 { get; } = new("eleven_flash_v2");

/// <summary>
/// Our latest, ultra-low-latency English only model, generating speech in under 75ms. Best for developer use cases requiring speed.
/// </summary>
[JsonIgnore]
public static Model FlashV2_5 { get; } = new("eleven_flash_v2_5");

[JsonIgnore]
[Obsolete("Use EnglishV1")]
public static Model MonoLingualV1 => EnglishV1;
Expand Down
4 changes: 2 additions & 2 deletions ElevenLabs-DotNet/TextToSpeech/TextToSpeechRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public TextToSpeechRequest(string text, Model model, VoiceSettings voiceSettings
/// <param name="previousRequestIds"></param>
/// <param name="nextRequestIds"></param>
/// <param name="languageCode">
/// Optional, Language code (ISO 639-1) used to enforce a language for the model. Currently only <see cref="Model.TurboV2_5"/> supports language enforcement.
/// Optional, Language code (ISO 639-1) used to enforce a language for the model. Currently only <see cref="Model.TurboV2_5"/> supports language enforcement.
/// For other models, an error will be returned if language code is provided.
/// </param>
/// <param name="withTimestamps"></param>
Expand Down Expand Up @@ -88,7 +88,7 @@ public TextToSpeechRequest(
}

Text = text;
Model = model ?? Models.Model.TurboV2_5;
Model = model ?? Models.Model.FlashV2;
Voice = voice;
VoiceSettings = voiceSettings ?? voice.Settings;
OutputFormat = outputFormat;
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ Gets a list of shared voices in the public voice library.

```csharp
var api = new ElevenLabsClient();
var results = await ElevenLabsClient.SharedVoicesEndpoint.GetSharedVoicesAsync();
var results = await api.SharedVoicesEndpoint.GetSharedVoicesAsync();
foreach (var voice in results.Voices)
{
Console.WriteLine($"{voice.OwnerId} | {voice.VoiceId} | {voice.Date} | {voice.Name}");
Expand Down

0 comments on commit 5e47158

Please sign in to comment.