-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #520 from solliancenet/cj-polymorphic-models
Management API updates
- Loading branch information
Showing
42 changed files
with
1,098 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<RootNamespace>FoundationaLLM.Agent</RootNamespace> | ||
<AssemblyName>FoundationaLLM.Agent</AssemblyName> | ||
<GenerateDocumentationFile>True</GenerateDocumentationFile> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Azure.Storage.Blobs" Version="12.19.1" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Common\Common.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Text.Json.Serialization; | ||
using System.Threading.Tasks; | ||
using FoundationaLLM.Common.Models.Metadata; | ||
using FoundationaLLM.Common.Models.ResourceProvider; | ||
using Newtonsoft.Json; | ||
|
||
namespace FoundationaLLM.Agent.Models.Metadata | ||
{ | ||
/// <summary> | ||
/// Base agent metadata model. | ||
/// </summary> | ||
public class AgentBase : ResourceBase | ||
{ | ||
/// <summary> | ||
/// The agent's language model configuration. | ||
/// </summary> | ||
[JsonProperty("language_model")] | ||
public LanguageModel? LanguageModel { get; set; } | ||
/// <summary> | ||
/// Indicates whether sessions are enabled for the agent. | ||
/// </summary> | ||
[JsonProperty("sessions_enabled")] | ||
public bool SessionsEnabled { get; set; } | ||
/// <summary> | ||
/// The agent's conversation history configuration. | ||
/// </summary> | ||
[JsonProperty("conversation_history")] | ||
public ConversationHistory? ConversationHistory { get; set; } | ||
/// <summary> | ||
/// The agent's Gatekeeper configuration. | ||
/// </summary> | ||
[JsonProperty("gatekeeper")] | ||
public Gatekeeper? Gatekeeper { get; set; } | ||
/// <summary> | ||
/// The agent's LLM orchestrator type. | ||
/// </summary> | ||
[JsonProperty("orchestrator")] | ||
public string? Orchestrator { get; set; } | ||
/// <summary> | ||
/// The agent's prompt. | ||
/// </summary> | ||
[JsonProperty("prompt")] | ||
public string? Prompt { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Agent conversation history settings. | ||
/// </summary> | ||
public class ConversationHistory | ||
{ | ||
/// <summary> | ||
/// Indicates whether the conversation history is enabled. | ||
/// </summary> | ||
[JsonProperty("enabled")] | ||
public bool Enabled { get; set; } | ||
/// <summary> | ||
/// The maximum number of turns to store in the conversation history. | ||
/// </summary> | ||
[JsonProperty("max_history")] | ||
public int MaxHistory { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Agent Gatekeeper settings. | ||
/// </summary> | ||
public class Gatekeeper | ||
{ | ||
/// <summary> | ||
/// Indicates whether to abide by or override the system settings for the Gatekeeper. | ||
/// </summary> | ||
[JsonProperty("use_system_setting")] | ||
public bool UseSystemSetting { get; set; } | ||
/// <summary> | ||
/// If <see cref="UseSystemSetting"/> is false, provides Gatekeeper feature selection. | ||
/// </summary> | ||
[JsonProperty("options")] | ||
public string[]? Options { get; set; } | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
src/dotnet/Agent/Models/Metadata/KnowledgeManagementAgent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace FoundationaLLM.Agent.Models.Metadata | ||
{ | ||
/// <summary> | ||
/// The Knowledge Management agent metadata model. | ||
/// </summary> | ||
public class KnowledgeManagementAgent : AgentBase | ||
{ | ||
/// <summary> | ||
/// The vectorization indexing profile resource path. | ||
/// </summary> | ||
[JsonProperty("indexing_profile")] | ||
public string? IndexingProfile { get; set; } | ||
/// <summary> | ||
/// The vectorization embedding profile resource path. | ||
/// </summary> | ||
[JsonProperty("embedding_profile")] | ||
public string? EmbeddingProfile { get; set; } | ||
|
||
/// <summary> | ||
/// Set default property values. | ||
/// </summary> | ||
public KnowledgeManagementAgent() => | ||
Type = Common.Constants.AgentTypes.KnowledgeManagement; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using FoundationaLLM.Agent.Models.Metadata; | ||
using FoundationaLLM.Common.Constants; | ||
using FoundationaLLM.Common.Exceptions; | ||
using Newtonsoft.Json; | ||
|
||
namespace FoundationaLLM.Agent.Models.Resources | ||
{ | ||
/// <summary> | ||
/// Provides details about an agent. | ||
/// </summary> | ||
public class AgentReference | ||
{ | ||
/// <summary> | ||
/// The name of the agent. | ||
/// </summary> | ||
public required string Name { get; set; } | ||
/// <summary> | ||
/// The filename of the agent. | ||
/// </summary> | ||
public required string Filename { get; set; } | ||
/// <summary> | ||
/// The type of the agent. | ||
/// </summary> | ||
public required string Type { get; set; } | ||
|
||
/// <summary> | ||
/// The object type of the agent. | ||
/// </summary> | ||
[JsonIgnore] | ||
public Type AgentType => | ||
Type switch | ||
{ | ||
AgentTypes.KnowledgeManagement => typeof(KnowledgeManagementAgent), | ||
_ => throw new ResourceProviderException($"The agent type {Type} is not supported.") | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace FoundationaLLM.Agent.Models.Resources | ||
{ | ||
/// <summary> | ||
/// Models the content of the agent reference store managed by the FoundationaLLM.Agent resource provider. | ||
/// </summary> | ||
public class AgentReferenceStore | ||
{ | ||
/// <summary> | ||
/// The list of all agents registered in the system. | ||
/// </summary> | ||
public required List<AgentReference> AgentReferences { get; set; } | ||
|
||
/// <summary> | ||
/// Creates a string-based dictionary of <see cref="AgentReference"/> values from the current object. | ||
/// </summary> | ||
/// <returns>The string-based dictionary of <see cref="AgentReference"/> values from the current object.</returns> | ||
public Dictionary<string, AgentReference> ToDictionary() => | ||
AgentReferences.ToDictionary<AgentReference, string>(ar => ar.Name); | ||
|
||
/// <summary> | ||
/// Creates a new instance of the <see cref="AgentReferenceStore"/> from a dictionary. | ||
/// </summary> | ||
/// <param name="dictionary">A string-based dictionary of <see cref="AgentReference"/> values.</param> | ||
/// <returns>The <see cref="AgentReferenceStore"/> object created from the dictionary.</returns> | ||
public static AgentReferenceStore FromDictionary(Dictionary<string, AgentReference> dictionary) => | ||
new AgentReferenceStore | ||
{ | ||
AgentReferences = dictionary.Values.ToList() | ||
}; | ||
} | ||
} |
Oops, something went wrong.