From 5e471581afb651782d5e6e796b5f9ed11b603e8e Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Sat, 11 Jan 2025 12:07:44 -0500 Subject: [PATCH] ElevenLabs-DotNet 3.4.2 - Added flash models - Fixed http/https protocol in client settings --- .../Authentication/ElevenLabsClientSettings.cs | 16 +++++++++++++++- ElevenLabs-DotNet/ElevenLabs-DotNet.csproj | 5 ++++- ElevenLabs-DotNet/Models/Model.cs | 12 ++++++++++++ .../TextToSpeech/TextToSpeechRequest.cs | 4 ++-- README.md | 2 +- 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/ElevenLabs-DotNet/Authentication/ElevenLabsClientSettings.cs b/ElevenLabs-DotNet/Authentication/ElevenLabsClientSettings.cs index c876e39..b0b2b72 100644 --- a/ElevenLabs-DotNet/Authentication/ElevenLabsClientSettings.cs +++ b/ElevenLabs-DotNet/Authentication/ElevenLabsClientSettings.cs @@ -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"; @@ -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}}"; diff --git a/ElevenLabs-DotNet/ElevenLabs-DotNet.csproj b/ElevenLabs-DotNet/ElevenLabs-DotNet.csproj index f2eada9..0bffdfb 100644 --- a/ElevenLabs-DotNet/ElevenLabs-DotNet.csproj +++ b/ElevenLabs-DotNet/ElevenLabs-DotNet.csproj @@ -25,8 +25,11 @@ All copyrights, trademarks, logos, and assets are the property of their respecti false true true - 3.4.1 + 3.4.2 +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 diff --git a/ElevenLabs-DotNet/Models/Model.cs b/ElevenLabs-DotNet/Models/Model.cs index a1bf3c7..2d864c3 100644 --- a/ElevenLabs-DotNet/Models/Model.cs +++ b/ElevenLabs-DotNet/Models/Model.cs @@ -51,6 +51,18 @@ public Model(string id) #region Predefined Models + /// + /// Our latest, ultra-low-latency model, generating speech in under 75ms. Best for developer use cases requiring speed and multiple languages. + /// + [JsonIgnore] + public static Model FlashV2 { get; } = new("eleven_flash_v2"); + + /// + /// Our latest, ultra-low-latency English only model, generating speech in under 75ms. Best for developer use cases requiring speed. + /// + [JsonIgnore] + public static Model FlashV2_5 { get; } = new("eleven_flash_v2_5"); + [JsonIgnore] [Obsolete("Use EnglishV1")] public static Model MonoLingualV1 => EnglishV1; diff --git a/ElevenLabs-DotNet/TextToSpeech/TextToSpeechRequest.cs b/ElevenLabs-DotNet/TextToSpeech/TextToSpeechRequest.cs index f5f2f4a..78a8126 100644 --- a/ElevenLabs-DotNet/TextToSpeech/TextToSpeechRequest.cs +++ b/ElevenLabs-DotNet/TextToSpeech/TextToSpeechRequest.cs @@ -52,7 +52,7 @@ public TextToSpeechRequest(string text, Model model, VoiceSettings voiceSettings /// /// /// - /// Optional, Language code (ISO 639-1) used to enforce a language for the model. Currently only supports language enforcement. + /// Optional, Language code (ISO 639-1) used to enforce a language for the model. Currently only supports language enforcement. /// For other models, an error will be returned if language code is provided. /// /// @@ -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; diff --git a/README.md b/README.md index d1741b3..3270132 100644 --- a/README.md +++ b/README.md @@ -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}");