Class LLM<TMessage>
- Namespace
- Prefrontal.Modules.Chat
- Assembly
- Prefrontal.Modules.dll
A base class for large language models (LLMs) that can be used to generate text and embeddings.
public abstract class LLM<TMessage>
Type Parameters
TMessage
The type of Messages the LLM uses. Typically this would be Message or Microsoft.SemanticKernel.ChatMessageContent .
- Inheritance
-
LLM<TMessage>
- Derived
- Inherited Members
- Extension Methods
Fields
EmptyCompletionMessageFactory
[JsonIgnore]
public Func<TMessage>? EmptyCompletionMessageFactory
Field Value
- Func<TMessage>
FrequencyPenalty
public double FrequencyPenalty
Field Value
MaxTokens
public int MaxTokens
Field Value
Messages
The messages in the conversation. This is the context that the LLM uses to generate completions. Do not edit this while the LLM is generating completions.
public List<TMessage> Messages
Field Value
- List<TMessage>
Model
public string Model
Field Value
PresencePenalty
public double PresencePenalty
Field Value
ReasoningEffort
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public LLM<TMessage>.Effort? ReasoningEffort
Field Value
RepeatPenalty
public double RepeatPenalty
Field Value
Seed
public int Seed
Field Value
Temperature
public double Temperature
Field Value
TopK
public double TopK
Field Value
TopP
public double TopP
Field Value
Methods
CompleteAsync(int, CancellationToken)
public abstract Task<LLM<TMessage>.CompletionChunk> CompleteAsync(int n, CancellationToken cancellationToken = default)
Parameters
n
intcancellationToken
CancellationToken
Returns
- Task<LLM<TMessage>.CompletionChunk>
CompleteAsync(CancellationToken)
public virtual Task<TMessage> CompleteAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationToken
Returns
- Task<TMessage>
ContinueAsync(int, CancellationToken)
public abstract IAsyncEnumerable<LLM<TMessage>.CompletionChunk> ContinueAsync(int n, CancellationToken cancellationToken = default)
Parameters
n
intcancellationToken
CancellationToken
Returns
- IAsyncEnumerable<LLM<TMessage>.CompletionChunk>
ContinueAsync(CancellationToken)
public virtual IAsyncEnumerable<TMessage> ContinueAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationToken
Returns
- IAsyncEnumerable<TMessage>
CreateEmptyCompletionChunk(int)
protected LLM<TMessage>.CompletionChunk CreateEmptyCompletionChunk(int n)
Parameters
n
int
Returns
- LLM<TMessage>.CompletionChunk
GetAvailableModelsAsync(CancellationToken)
public abstract Task<List<LLM<TMessage>.ModelInfo>> GetAvailableModelsAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationToken
Returns
GetEmbeddingsAsync(List<string>, int?, string?, CancellationToken)
public abstract Task<List<LLM<TMessage>.EmbeddingObject>> GetEmbeddingsAsync(List<string> input, int? dimensions = null, string? user = null, CancellationToken cancellationToken = default)
Parameters
input
List<string>dimensions
int?user
stringcancellationToken
CancellationToken
Returns
- Task<List<LLM<TMessage>.EmbeddingObject>>
GetEmbeddingsAsync(string, int?, string?, CancellationToken)
public virtual Task<LLM<TMessage>.EmbeddingObject> GetEmbeddingsAsync(string input, int? dimensions = null, string? user = null, CancellationToken cancellationToken = default)
Parameters
input
stringdimensions
int?user
stringcancellationToken
CancellationToken
Returns
- Task<LLM<TMessage>.EmbeddingObject>