From 0363756571a00d951f185502d86aac4bbdc6e570 Mon Sep 17 00:00:00 2001
From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com>
Date: Wed, 10 Jul 2024 08:57:23 -0500
Subject: [PATCH] fix: add stop sequences parameter
---
src/AnthropicClient/Models/BaseMessageRequest.cs | 5 ++++-
src/AnthropicClient/Models/MessageRequest.cs | 7 +++++--
src/AnthropicClient/Models/StreamMessageRequest.cs | 7 +++++--
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/AnthropicClient/Models/BaseMessageRequest.cs b/src/AnthropicClient/Models/BaseMessageRequest.cs
index e354a7e..a46dce6 100644
--- a/src/AnthropicClient/Models/BaseMessageRequest.cs
+++ b/src/AnthropicClient/Models/BaseMessageRequest.cs
@@ -89,6 +89,7 @@ public abstract class BaseMessageRequest
/// The tool choice mode to use for the request.
/// The tools to use for the request.
/// A value indicating whether the message should be streamed.
+ /// The prompt stop sequences.
/// Thrown when the model ID is invalid.
/// Thrown when the model or messages is null.
/// Thrown when the messages contain no messages.
@@ -106,7 +107,8 @@ public abstract class BaseMessageRequest
decimal? topP = null,
ToolChoice? toolChoice = null,
List? tools = null,
- bool stream = false
+ bool stream = false,
+ List? stopSequences = null
)
{
ArgumentValidator.ThrowIfNull(model, nameof(model));
@@ -143,5 +145,6 @@ public abstract class BaseMessageRequest
ToolChoice = toolChoice;
Tools = tools;
Stream = stream;
+ StopSequences = stopSequences ?? [];
}
}
\ No newline at end of file
diff --git a/src/AnthropicClient/Models/MessageRequest.cs b/src/AnthropicClient/Models/MessageRequest.cs
index ed02cf2..fab7af1 100644
--- a/src/AnthropicClient/Models/MessageRequest.cs
+++ b/src/AnthropicClient/Models/MessageRequest.cs
@@ -23,6 +23,7 @@ public class MessageRequest : BaseMessageRequest
/// The top-P value to use for the request.
/// The tool choice mode to use for the request.
/// The tools to use for the request.
+ /// The prompt stop sequences.
/// Thrown when the model ID is invalid.
/// Thrown when the model or messages is null.
/// Thrown when the messages contain no messages.
@@ -39,7 +40,8 @@ public class MessageRequest : BaseMessageRequest
int? topK = null,
decimal? topP = null,
ToolChoice? toolChoice = null,
- List? tools = null
+ List? tools = null,
+ List? stopSequences = null
) : base(
model,
messages,
@@ -51,7 +53,8 @@ public class MessageRequest : BaseMessageRequest
topP,
toolChoice,
tools,
- false
+ false,
+ stopSequences
)
{
}
diff --git a/src/AnthropicClient/Models/StreamMessageRequest.cs b/src/AnthropicClient/Models/StreamMessageRequest.cs
index 64f7437..9ef0e0b 100644
--- a/src/AnthropicClient/Models/StreamMessageRequest.cs
+++ b/src/AnthropicClient/Models/StreamMessageRequest.cs
@@ -23,6 +23,7 @@ public class StreamMessageRequest : BaseMessageRequest
/// The top-P value to use for the request.
/// The tool choice mode to use for the request.
/// The tools to use for the request.
+ /// The prompt stop sequences.
/// Thrown when the model ID is invalid.
/// Thrown when the model or messages is null.
/// Thrown when the messages contain no messages.
@@ -39,7 +40,8 @@ public class StreamMessageRequest : BaseMessageRequest
int? topK = null,
decimal? topP = null,
ToolChoice? toolChoice = null,
- List? tools = null
+ List? tools = null,
+ List? stopSequences = null
) : base(
model,
messages,
@@ -51,7 +53,8 @@ public class StreamMessageRequest : BaseMessageRequest
topP,
toolChoice,
tools,
- true
+ true,
+ stopSequences
)
{
}