Class WMLLMDTO
the DTO for the WMLLM class. Contains all of the data and metadata needed to start a LLM conversation with a provider.
Inherited Members
Namespace: Quantellia.WMServer.Asset.LLM
Assembly: WMServer.dll
Syntax
public class WMLLMDTO : WMAssetBaseDTO<WMLLM>, IWMAssetBaseDTO, IDbEntity, IWMEntity, IHasEncryptedValues
Constructors
WMLLMDTO()
Constructor for WMLLMDTO
Declaration
public WMLLMDTO()
WMLLMDTO(string)
Constructor for WMLLMDTO, with specified ID
Declaration
public WMLLMDTO(string ID)
Parameters
Type | Name | Description |
---|---|---|
string | ID |
Properties
APIKey
The API Key granting the user access to this LLM.
Declaration
public string APIKey { get; set; }
Property Value
Type | Description |
---|---|
string |
EncryptionPlaceholder
Standard string to replace encrypted values with when not returning plain-text values.
Declaration
[NotMapped]
public string EncryptionPlaceholder { get; set; }
Property Value
Type | Description |
---|---|
string |
LLMType
The type of LLM in use (i.e. ChatGPT, Gemini, etc...)
Declaration
public string LLMType { get; set; }
Property Value
Type | Description |
---|---|
string |
MaxRecords
The maximum number of records to return in VectorDB queries.
Declaration
public int MaxRecords { get; set; }
Property Value
Type | Description |
---|---|
int |
MaxTokens
The MaxTokens parameter of the model.
Declaration
public int? MaxTokens { get; set; }
Property Value
Type | Description |
---|---|
int? |
ModelName
The name of the model in use.
Declaration
public string? ModelName { get; set; }
Property Value
Type | Description |
---|---|
string |
Overlap
The maximum number of messages to include when calculating the context vector for RAG
Declaration
public int Overlap { get; set; }
Property Value
Type | Description |
---|---|
int |
Prompt
The system prompt determining the behavior of this LLM.
Declaration
public string Prompt { get; set; }
Property Value
Type | Description |
---|---|
string |
Temperature
The temperature parameter of the model.
Declaration
public float? Temperature { get; set; }
Property Value
Type | Description |
---|---|
float? |
Threshold
The minimum similarity required for RAG to be used.
Declaration
public float Threshold { get; set; }
Property Value
Type | Description |
---|---|
float |
Tools
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
Type | Description |
---|---|
string |
VectorIndexType
The type of VectorIndex in use. (i.e. WMNativeVectorIndex, PineconeVectorIndex, etc...)
Declaration
public string VectorIndexType { get; set; }
Property Value
Type | Description |
---|---|
string |
WindowSize
The maximum characters to include in each window when calculating embeddings.
Declaration
public int WindowSize { get; set; }
Property Value
Type | Description |
---|---|
int |
Methods
Create(WMPrincipal, WMLLMDTO, WMAppDbContext, string, string)
Create a new WMLLMDTO from the provided data.
Declaration
public static Task<WMLLM> Create(WMPrincipal principal, WMLLMDTO a_dto, WMAppDbContext context, string assetOwnerType, string assetOwnerID)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | The owner of the data reader |
WMLLMDTO | a_dto | The WMLLMDTO to be created. |
WMAppDbContext | context | The DbContext |
string | assetOwnerType | TYpe of the WMPrincipal that owns the Asset. |
string | assetOwnerID | ID of the WMPrincipal that owns the Asset. |
Returns
Type | Description |
---|---|
Task<WMLLM> |
Exceptions
Type | Condition |
---|---|
Exception |
Delete(WMPrincipal, string, WMAppDbContext)
Delete the WMLLMDTO with the corresponding ID or FullPathName
Declaration
public static Task Delete(WMPrincipal principal, string dir, WMAppDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | The owner of the directory |
string | dir | The Id or FullPathName of the corresponding WMLLMDTO to be deleted. |
WMAppDbContext | context | The DbContext |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
Exception |
FromModel()
Create this instance by reading properties from a WMLLM
Declaration
public override void FromModel()
Overrides
Get(WMPrincipal, string, WMAppDbContext?)
Gets the WMLLMDTO instance with the specified id. Ensures ownership.
Declaration
public static Task<WMLLMDTO> Get(WMPrincipal principal, string dir, WMAppDbContext? context = null)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | |
string | dir | |
WMAppDbContext | context |
Returns
Type | Description |
---|---|
Task<WMLLMDTO> |
Get(WMPrincipal, string?, int, WMAppDbContext?)
Gets a listing of the specified WMLLMDTO to the recursion depth specified.
Declaration
public static Task<IEnumerable<WMLLMDTO>> Get(WMPrincipal principal, string? dir = null, int recursionDepth = 0, WMAppDbContext? context = null)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | The owner of the Asset Directory being requested. |
string | dir | Specification of the directory under which to retrieve WMLLMDTO |
int | recursionDepth | Depth to which the directory subtrees under the specified directory should be traversed. |
WMAppDbContext | context | Optional reference to a WMAppDbContext instance. |
Returns
Type | Description |
---|---|
Task<IEnumerable<WMLLMDTO>> |
GetAPIKey(WMPrincipal, string, WMAppDbContext)
Returns the API Key belonging to the LLM with this ID/dir, otherwise an exception.
Declaration
public static Task<string> GetAPIKey(WMPrincipal principal, string dir = null, WMAppDbContext context = null)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | |
string | dir | The ID or fullPathName of the LLM to get. |
WMAppDbContext | context |
Returns
Type | Description |
---|---|
Task<string> |
GetAssociatedVectorDBs(WMPrincipal, string, WMAppDbContext)
Get this LLM's associated VectorDBs
Declaration
public static Task<IEnumerable<WMDocumentIndexDTO>> GetAssociatedVectorDBs(WMPrincipal principal, string dir, WMAppDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | |
string | dir | |
WMAppDbContext | context |
Returns
Type | Description |
---|---|
Task<IEnumerable<WMDocumentIndexDTO>> |
GetFromDirectory(WMPrincipal, string, int, WMAppDbContext)
Gets a listing of the specified WMLLMDTO to the recursion depth specified with the ID/Dir of a WMAssetDirectory as input.
Declaration
public static Task<IEnumerable<WMLLMDTO>> GetFromDirectory(WMPrincipal principal, string dir = null, int recursionDepth = 0, WMAppDbContext context = null)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | The owner of the data readers being requested. |
string | dir | Specification of the directory under which to retrieve WMLLMDTO |
int | recursionDepth | Depth to which the directory subtrees under the specified directory should be traversed. |
WMAppDbContext | context | Optional reference to a WMAppDbContext instance. |
Returns
Type | Description |
---|---|
Task<IEnumerable<WMLLMDTO>> |
Update(WMPrincipal, string, WMLLMDTO, WMAppDbContext)
Updates the specified WMLLMDTO from the provided data.
Declaration
public static Task Update(WMPrincipal principal, string id, WMLLMDTO a_dto, WMAppDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | The owner of the directory |
string | id | The id or fullpath of the directory |
WMLLMDTO | a_dto | The WMLLMDTO to be updated. |
WMAppDbContext | context | The DbContext |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
Exception |
UpdateModel(WMPrincipal, DbContext, object[]?)
Updates and returns the contained WMLLM.
Declaration
public override Task<WMLLM> UpdateModel(WMPrincipal principal, DbContext context, object[]? data = null)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | |
DbContext | context | |
object[] | data |
Returns
Type | Description |
---|---|
Task<WMLLM> |