fix: add stop sequences parameter

This commit is contained in:
Stevan Freeborn
2024-07-10 08:57:23 -05:00
parent 48f813f49f
commit 0363756571
3 changed files with 14 additions and 5 deletions
@@ -89,6 +89,7 @@ public abstract class BaseMessageRequest
/// <param name="toolChoice">The tool choice mode to use for the request.</param>
/// <param name="tools">The tools to use for the request.</param>
/// <param name="stream">A value indicating whether the message should be streamed.</param>
/// <param name="stopSequences">The prompt stop sequences.</param>
/// <exception cref="ArgumentException">Thrown when the model ID is invalid.</exception>
/// <exception cref="ArgumentNullException">Thrown when the model or messages is null.</exception>
/// <exception cref="ArgumentException">Thrown when the messages contain no messages.</exception>
@@ -106,7 +107,8 @@ public abstract class BaseMessageRequest
decimal? topP = null,
ToolChoice? toolChoice = null,
List<Tool>? tools = null,
bool stream = false
bool stream = false,
List<string>? stopSequences = null
)
{
ArgumentValidator.ThrowIfNull(model, nameof(model));
@@ -143,5 +145,6 @@ public abstract class BaseMessageRequest
ToolChoice = toolChoice;
Tools = tools;
Stream = stream;
StopSequences = stopSequences ?? [];
}
}
+5 -2
View File
@@ -23,6 +23,7 @@ public class MessageRequest : BaseMessageRequest
/// <param name="topP">The top-P value to use for the request.</param>
/// <param name="toolChoice">The tool choice mode to use for the request.</param>
/// <param name="tools">The tools to use for the request.</param>
/// <param name="stopSequences">The prompt stop sequences.</param>
/// <exception cref="ArgumentException">Thrown when the model ID is invalid.</exception>
/// <exception cref="ArgumentNullException">Thrown when the model or messages is null.</exception>
/// <exception cref="ArgumentException">Thrown when the messages contain no messages.</exception>
@@ -39,7 +40,8 @@ public class MessageRequest : BaseMessageRequest
int? topK = null,
decimal? topP = null,
ToolChoice? toolChoice = null,
List<Tool>? tools = null
List<Tool>? tools = null,
List<string>? stopSequences = null
) : base(
model,
messages,
@@ -51,7 +53,8 @@ public class MessageRequest : BaseMessageRequest
topP,
toolChoice,
tools,
false
false,
stopSequences
)
{
}
@@ -23,6 +23,7 @@ public class StreamMessageRequest : BaseMessageRequest
/// <param name="topP">The top-P value to use for the request.</param>
/// <param name="toolChoice">The tool choice mode to use for the request.</param>
/// <param name="tools">The tools to use for the request.</param>
/// <param name="stopSequences">The prompt stop sequences.</param>
/// <exception cref="ArgumentException">Thrown when the model ID is invalid.</exception>
/// <exception cref="ArgumentNullException">Thrown when the model or messages is null.</exception>
/// <exception cref="ArgumentException">Thrown when the messages contain no messages.</exception>
@@ -39,7 +40,8 @@ public class StreamMessageRequest : BaseMessageRequest
int? topK = null,
decimal? topP = null,
ToolChoice? toolChoice = null,
List<Tool>? tools = null
List<Tool>? tools = null,
List<string>? stopSequences = null
) : base(
model,
messages,
@@ -51,7 +53,8 @@ public class StreamMessageRequest : BaseMessageRequest
topP,
toolChoice,
tools,
true
true,
stopSequences
)
{
}