Class WMLLM
LLM model class. Contains all properties needed to create and interface with an LLM
Assembly: WMServer.dll
Syntax
public class WMLLM : WMAssetBase, IWMAsset, IDbEntity, IWMEntity, IDocumentedEntity, INamedEntity, IWMAssetDirectoryMember, IWMPrincipalOwned, IWMVersionableAsset, IWMOwnableResource, IWMResource, IHasEncryptedValues
Constructors
WMLLM()
Declaration
WMLLM(string)
Constructor that initializes the ID
Declaration
Parameters
Type |
Name |
Description |
string |
id |
|
Properties
EncryptionPlaceholder
Standard string to replace encrypted values with when not returning plain-text values.
Declaration
[NotMapped]
public string EncryptionPlaceholder { get; set; }
Property Value
LLMConnection
Declaration
public WMLLMConnection LLMConnection { get; set; }
Property Value
Prompt
The system prompt determining the behavior of this LLM.
Declaration
public string Prompt { get; set; }
Property Value
Temperature
The temperature parameter of the model.
Declaration
public float? Temperature { get; set; }
Property Value
The Tools used by the model. Note, Tools refers to a method with a description made available to the model. If a Tool "GetTimeZone()" has description "Returns the timezone of the user"
and the LLM determines that it needs the user's timezone to answer a question, it will request the execution of "GetTimeZone()", and format its answer based on the return value.
Declaration
public string? Tools { get; set; }
Property Value
Methods
EndConversation(WMPrincipal, string, WMAppDbContext)
Ends the conversation with the given ID
Declaration
public static Task EndConversation(WMPrincipal principal, string ConversationID, WMAppDbContext context)
Parameters
Returns
GetAPIKey(WMPrincipal, WMAssetIdentifier, WMAppDbContext)
Returns the API Key belonging to the LLM with this ID/dir, otherwise an exception.
Declaration
public static Task<string> GetAPIKey(WMPrincipal principal, WMAssetIdentifier identifier, WMAppDbContext context = null)
Parameters
Returns
Insert(WMPrincipal, WMAssetIdentifier, WMAssetIdentifier, WMAppDbContext)
Inserts the text from a WMDocument to the vectorDB.
Declaration
public Task Insert(WMPrincipal principal, WMAssetIdentifier documentIndexIdentifier, WMAssetIdentifier documentIdentifier, WMAppDbContext context)
Parameters
Returns
Exceptions
Query(WMPrincipal, WMAssetIdentifier, string, WMAppDbContext)
Converts a message to an embedding, and searches the LLM's vectorDB for similar text.
Declaration
public static Task<IEnumerable<string>> Query(WMPrincipal principal, WMAssetIdentifier identifier, string message, WMAppDbContext context)
Parameters
Returns
Remove(WMPrincipal, WMAssetIdentifier, WMAssetIdentifier, WMAppDbContext)
Inserts the text from a WMDocument from the vectorDB.
Declaration
public Task Remove(WMPrincipal principal, WMAssetIdentifier documentIndexIdentifier, WMAssetIdentifier documentIdentifier, WMAppDbContext context)
Parameters
Returns
Exceptions
ResourceDefinition()
The resource operation definition for this asset.
Declaration
public static WMResourceOperationsDefinition ResourceDefinition()
Returns
StreamConversation(WMPrincipal, ConversationArgs, WMAppDbContext)
Creates or continues a conversation with the LLM provider. Streams the responses directly to the receiver as they arrive.
Declaration
public static IAsyncEnumerable<ILLMConversation.Response> StreamConversation(WMPrincipal principal, ConversationArgs args, WMAppDbContext context)
Parameters
Returns
StreamConversationAtOnce(WMPrincipal, ConversationArgs, WMAppDbContext)
Declaration
public static Task<ILLMConversation.Response> StreamConversationAtOnce(WMPrincipal principal, ConversationArgs args, WMAppDbContext context)
Parameters
Returns
Implements