mirror of
https://github.com/microsoft/autogen.git
synced 2026-02-16 00:04:54 -05:00
* add lmstudio agent to assistant agent * fix #2609 * update updatelog * Update Directory.Build.props
This commit is contained in:
@@ -13,6 +13,15 @@ public class LMStudioConfig : ILLMConfig
|
||||
this.Host = host;
|
||||
this.Port = port;
|
||||
this.Version = version;
|
||||
this.Uri = new Uri($"http://{host}:{port}/v{version}");
|
||||
}
|
||||
|
||||
public LMStudioConfig(Uri uri)
|
||||
{
|
||||
this.Uri = uri;
|
||||
this.Host = uri.Host;
|
||||
this.Port = uri.Port;
|
||||
this.Version = int.Parse(uri.Segments[1].TrimStart('v'));
|
||||
}
|
||||
|
||||
public string Host { get; }
|
||||
@@ -21,5 +30,5 @@ public class LMStudioConfig : ILLMConfig
|
||||
|
||||
public int Version { get; }
|
||||
|
||||
public Uri Uri => new Uri($"http://{Host}:{Port}/v{Version}");
|
||||
public Uri Uri { get; }
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AutoGen.LMStudio;
|
||||
using AutoGen.OpenAI;
|
||||
|
||||
namespace AutoGen;
|
||||
@@ -74,15 +75,25 @@ public class ConversableAgent : IAgent
|
||||
this.functions = llmConfig?.FunctionContracts;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For test purpose only.
|
||||
/// </summary>
|
||||
internal IAgent? InnerAgent => this.innerAgent;
|
||||
|
||||
private IAgent? CreateInnerAgentFromConfigList(ConversableAgentConfig config)
|
||||
{
|
||||
IAgent? agent = null;
|
||||
foreach (var llmConfig in config.ConfigList ?? Enumerable.Empty<ILLMConfig>())
|
||||
{
|
||||
var nextAgent = llmConfig switch
|
||||
IAgent nextAgent = llmConfig switch
|
||||
{
|
||||
AzureOpenAIConfig azureConfig => new GPTAgent(this.Name!, this.systemMessage, azureConfig, temperature: config.Temperature ?? 0),
|
||||
OpenAIConfig openAIConfig => new GPTAgent(this.Name!, this.systemMessage, openAIConfig, temperature: config.Temperature ?? 0),
|
||||
LMStudioConfig lmStudioConfig => new LMStudioAgent(
|
||||
name: this.Name,
|
||||
config: lmStudioConfig,
|
||||
systemMessage: this.systemMessage,
|
||||
temperature: config.Temperature ?? 0),
|
||||
_ => throw new ArgumentException($"Unsupported config type {llmConfig.GetType()}"),
|
||||
};
|
||||
|
||||
|
||||
@@ -26,5 +26,9 @@
|
||||
<ProjectReference Include="..\AutoGen.Core\AutoGen.Core.csproj" />
|
||||
<ProjectReference Include="..\AutoGen.OpenAI\AutoGen.OpenAI.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<InternalsVisibleTo Include="AutoGen.Tests" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user