diff --git a/dotnet/src/AutoGen/LMStudioConfig.cs b/dotnet/src/AutoGen/LMStudioConfig.cs index 4605b051142f..29c60ff13f39 100644 --- a/dotnet/src/AutoGen/LMStudioConfig.cs +++ b/dotnet/src/AutoGen/LMStudioConfig.cs @@ -13,18 +13,28 @@ namespace AutoGen; /// public class LMStudioConfig : ILLMConfig { - public LMStudioConfig(string host, int port) + public LMStudioConfig(string host, int port, string modelName) { this.Host = host; this.Port = port; - this.Uri = new Uri($"http://{host}:{port}"); + this.Uri = new Uri($"http://{host}:{port}/v1"); + if (modelName == null) + { + throw new ArgumentNullException("modelName is a required property for LMStudioConfig and cannot be null"); + } + this.ModelName = modelName; } - public LMStudioConfig(Uri uri) + public LMStudioConfig(Uri uri, string modelName) { this.Uri = uri; this.Host = uri.Host; this.Port = uri.Port; + if (modelName == null) + { + throw new ArgumentNullException("modelName is a required property for LMStudioConfig and cannot be null"); + } + this.ModelName = modelName; } public string Host { get; } @@ -33,6 +43,8 @@ public LMStudioConfig(Uri uri) public Uri Uri { get; } + public string ModelName { get; } + internal ChatClient CreateChatClient() { var client = new OpenAIClient(new ApiKeyCredential("api-key"), new OpenAIClientOptions @@ -40,8 +52,6 @@ internal ChatClient CreateChatClient() Endpoint = this.Uri, }); - // model name doesn't matter for LM Studio - - return client.GetChatClient("model-name"); + return client.GetChatClient(this.ModelName); } }