Skip to content

Commit

Permalink
Improved handling of sampling parameters. (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcarrere authored Nov 23, 2024
1 parent 82e2d01 commit 532d3f1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion LM-Kit-Maestro/Services/LMKitService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ private void BeforeSubmittingPrompt(Conversation conversation)
{
ChatHistory? chatHistory = shouldUseCurrentChatHistory ? conversation.ChatHistory : ChatHistory.Deserialize(conversation.LatestChatHistoryData, _model);

_multiTurnConversation = new MultiTurnConversation(_model, chatHistory)
_multiTurnConversation = new MultiTurnConversation(_model, chatHistory, LMKitConfig.ContextSize)
{
SamplingMode = GetTokenSampling(LMKitConfig),
MaximumCompletionTokens = LMKitConfig.MaximumCompletionTokens,
Expand All @@ -443,6 +443,17 @@ private void BeforeSubmittingPrompt(Conversation conversation)
conversation.LastUsedModelUri = LMKitConfig.LoadedModelUri;
_lastConversationUsed = conversation;
}
else //updating sampling options, if any.
{
//todo: Implement a mechanism to determine whether SamplingMode and MaximumCompletionTokens need to be updated.
_multiTurnConversation.SamplingMode = GetTokenSampling(LMKitConfig);
_multiTurnConversation.MaximumCompletionTokens = LMKitConfig.MaximumCompletionTokens;

if (LMKitConfig.ContextSize != _multiTurnConversation.ContextSize)
{
//todo: implement context size update.
}
}

if (_singleTurnConversation == null)
{
Expand Down

0 comments on commit 532d3f1

Please sign in to comment.