Class ChatGPTConversation
OpenAI implementation of the ILLMConversation interface
Implements
Inherited Members
Namespace: Quantellia.WMServer.Asset.LLM
Assembly: WMServer.dll
Syntax
public class ChatGPTConversation : ILLMConversation
Properties
ConversationID
The ID of the conversation represented by this entity
Declaration
public string ConversationID { get; set; }
Property Value
Type | Description |
---|---|
string |
LLMID
The ID of the LLM in use
Declaration
public string LLMID { 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 |
_ChatClient
The OpenAI chat client
Declaration
public ChatClient _ChatClient { get; set; }
Property Value
Type | Description |
---|---|
ChatClient |
_ChatMessages
A list of all chat messages sent to and from OpenAI's stateless REST API
Declaration
public List<ChatMessage> _ChatMessages { get; set; }
Property Value
Type | Description |
---|---|
List<ChatMessage> |
_Client
The OpenAI client
Declaration
public OpenAIClient _Client { get; set; }
Property Value
Type | Description |
---|---|
OpenAIClient |
_CompletionOptions
Options on the chat client.
Declaration
public ChatCompletionOptions _CompletionOptions { get; set; }
Property Value
Type | Description |
---|---|
ChatCompletionOptions |
Methods
GetRetrievalAugmentedMessage(WMPrincipal, string, WMAppDbContext)
Modifies a message with contextual information
Declaration
public Task<string> GetRetrievalAugmentedMessage(WMPrincipal principal, string message, WMAppDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | |
string | message | The message to search for additional context in the VectorDB with. |
WMAppDbContext | context |
Returns
Type | Description |
---|---|
Task<string> | A string with extra context to be submitted as a system message, or an empty string to indicate no context. |
StreamConversation(WMPrincipal, HttpResponse, ConversationArgs, bool, WMAppDbContext)
Stream OpenAI's response to the HTTPResponse stream in real time.
Declaration
public IAsyncEnumerable<ILLMConversation.Response> StreamConversation(WMPrincipal principal, HttpResponse response, ConversationArgs args, bool streamResultsAsTheyCome, WMAppDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | |
HttpResponse | response | the HTTPResponse |
ConversationArgs | args | The message args to send |
bool | streamResultsAsTheyCome | Whether the response body stream should be flushed whenever a response is written |
WMAppDbContext | context |
Returns
Type | Description |
---|---|
IAsyncEnumerable<ILLMConversation.Response> |
ToDatabaseRecord(WMPrincipal)
Converts the current ILLMConversation to a database record for journaling.
Declaration
public Task<WMLLMConversationRecord> ToDatabaseRecord(WMPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal |
Returns
Type | Description |
---|---|
Task<WMLLMConversationRecord> |