18 Commits
Author SHA1 Message Date
Stevan Freeborn 5ab8297a83 chore(release): 0.0.4 [skip ci] 2024-07-20 03:40:07 +00:00
Stevan Freeborn d27538b656 Merge pull request #11 from StevanFreeborn/stevanfreeborn/fix/missing-type-property-and-response-handling
fix: address issues
2024-07-19 22:39:51 -05:00
Stevan Freeborn a16b64d5a0 chore: use base64 text file 2024-07-19 22:38:47 -05:00
Stevan Freeborn 48b2716a61 chore: debug CI failure 2024-07-19 22:31:36 -05:00
Stevan Freeborn 641eaf30a4 chore: debug ci failure 2024-07-19 21:52:29 -05:00
Stevan Freeborn 30c0116113 chore: debug ci failure 2024-07-19 21:50:07 -05:00
Stevan Freeborn 9b714df12f chore: debug CI failure 2024-07-19 21:45:56 -05:00
Stevan Freeborn f39e76cfa6 chore: debug test failure in CI 2024-07-19 21:41:26 -05:00
Stevan Freeborn f970b07ed7 tests: add missing type property 2024-07-19 21:39:04 -05:00
Stevan Freeborn 93761b8e7e chore: run format 2024-07-19 21:38:52 -05:00
Stevan Freeborn b3d4ac3faa fix: add end to end test for vision 2024-07-19 21:31:49 -05:00
Stevan Freeborn 3b47ed3fb4 fix: yield error when initial stream response is not successful 2024-07-19 21:15:59 -05:00
Stevan Freeborn 0a692d1b9a fix: add missing type property to image source model 2024-07-18 23:46:55 -05:00
Stevan Freeborn 999a255468 chore(release): 0.0.3 [skip ci] 2024-07-11 14:23:11 +00:00
Stevan Freeborn f245d6442f Merge pull request #8 from StevanFreeborn/stevanfreeborn/feat/address-nuget-health-checks
feat: address nuget health checks
2024-07-11 09:22:49 -05:00
Stevan Freeborn 5576b688c5 chore: upgrade System.Text.Json dep 2024-07-11 09:20:38 -05:00
Stevan Freeborn 989951db55 fix: address nuget health checks 2024-07-11 09:20:22 -05:00
Stevan Freeborn d486bc8691 docs: documentation for v0.0.2 [skip ci] 2024-07-10 14:00:35 +00:00
17 changed files with 262 additions and 52 deletions
@@ -162,9 +162,9 @@ Class BaseMessageRequest <a class="header-action link-secondary" title="View so
<a id="AnthropicClient_Models_BaseMessageRequest__ctor_" data-uid="AnthropicClient.Models.BaseMessageRequest.#ctor*"></a>
<h3 id="AnthropicClient_Models_BaseMessageRequest__ctor_System_String_System_Collections_Generic_List_AnthropicClient_Models_Message__System_Int32_System_String_System_Collections_Generic_Dictionary_System_String_System_Object__System_Decimal_System_Nullable_System_Int32__System_Nullable_System_Decimal__AnthropicClient_Models_ToolChoice_System_Collections_Generic_List_AnthropicClient_Models_Tool__System_Boolean_" data-uid="AnthropicClient.Models.BaseMessageRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},System.Int32,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Decimal,System.Nullable{System.Int32},System.Nullable{System.Decimal},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool},System.Boolean)">
BaseMessageRequest(string, List&lt;Message&gt;, int, string?, Dictionary&lt;string, object&gt;?, decimal, int?, decimal?, ToolChoice?, List&lt;Tool&gt;?, bool)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/BaseMessageRequest.cs/#L98"><i class="bi bi-code-slash"></i></a>
<h3 id="AnthropicClient_Models_BaseMessageRequest__ctor_System_String_System_Collections_Generic_List_AnthropicClient_Models_Message__System_Int32_System_String_System_Collections_Generic_Dictionary_System_String_System_Object__System_Decimal_System_Nullable_System_Int32__System_Nullable_System_Decimal__AnthropicClient_Models_ToolChoice_System_Collections_Generic_List_AnthropicClient_Models_Tool__System_Boolean_System_Collections_Generic_List_System_String__" data-uid="AnthropicClient.Models.BaseMessageRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},System.Int32,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Decimal,System.Nullable{System.Int32},System.Nullable{System.Decimal},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool},System.Boolean,System.Collections.Generic.List{System.String})">
BaseMessageRequest(string, List&lt;Message&gt;, int, string?, Dictionary&lt;string, object&gt;?, decimal, int?, decimal?, ToolChoice?, List&lt;Tool&gt;?, bool, List&lt;string&gt;?)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/BaseMessageRequest.cs/#L99"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.Models.BaseMessageRequest.html">BaseMessageRequest</a> class.</p>
@@ -172,7 +172,7 @@ Class BaseMessageRequest <a class="header-action link-secondary" title="View so
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected BaseMessageRequest(string model, List&lt;Message&gt; messages, int maxTokens = 1024, string? system = null, Dictionary&lt;string, object&gt;? metadata = null, decimal temperature = 0.0, int? topK = null, decimal? topP = null, ToolChoice? toolChoice = null, List&lt;Tool&gt;? tools = null, bool stream = false)</code></pre>
<pre><code class="lang-csharp hljs">protected BaseMessageRequest(string model, List&lt;Message&gt; messages, int maxTokens = 1024, string? system = null, Dictionary&lt;string, object&gt;? metadata = null, decimal temperature = 0.0, int? topK = null, decimal? topP = null, ToolChoice? toolChoice = null, List&lt;Tool&gt;? tools = null, bool stream = false, List&lt;string&gt;? stopSequences = null)</code></pre>
</div>
<h4 class="section">Parameters</h4>
@@ -209,6 +209,9 @@ Class BaseMessageRequest <a class="header-action link-secondary" title="View so
</dd>
<dt><code>stream</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></dt>
<dd><p>A value indicating whether the message should be streamed.</p>
</dd>
<dt><code>stopSequences</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a>&gt;</dt>
<dd><p>The prompt stop sequences.</p>
</dd>
</dl>
@@ -446,7 +449,7 @@ public List&lt;string&gt; StopSequences { get; init; }</code></pre>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/BaseMessageRequest.cs/#L20"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets the system ID to use for the request.</p>
<div class="markdown level1 summary"><p>Gets the system prompt to use for the request.</p>
</div>
<div class="markdown level1 conceptual"></div>
@@ -192,9 +192,9 @@ Class MessageRequest <a class="header-action link-secondary" title="View source
<a id="AnthropicClient_Models_MessageRequest__ctor_" data-uid="AnthropicClient.Models.MessageRequest.#ctor*"></a>
<h3 id="AnthropicClient_Models_MessageRequest__ctor_System_String_System_Collections_Generic_List_AnthropicClient_Models_Message__System_Int32_System_String_System_Collections_Generic_Dictionary_System_String_System_Object__System_Decimal_System_Nullable_System_Int32__System_Nullable_System_Decimal__AnthropicClient_Models_ToolChoice_System_Collections_Generic_List_AnthropicClient_Models_Tool__" data-uid="AnthropicClient.Models.MessageRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},System.Int32,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Decimal,System.Nullable{System.Int32},System.Nullable{System.Decimal},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool})">
MessageRequest(string, List&lt;Message&gt;, int, string?, Dictionary&lt;string, object&gt;?, decimal, int?, decimal?, ToolChoice?, List&lt;Tool&gt;?)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/MessageRequest.cs/#L32"><i class="bi bi-code-slash"></i></a>
<h3 id="AnthropicClient_Models_MessageRequest__ctor_System_String_System_Collections_Generic_List_AnthropicClient_Models_Message__System_Int32_System_String_System_Collections_Generic_Dictionary_System_String_System_Object__System_Decimal_System_Nullable_System_Int32__System_Nullable_System_Decimal__AnthropicClient_Models_ToolChoice_System_Collections_Generic_List_AnthropicClient_Models_Tool__System_Collections_Generic_List_System_String__" data-uid="AnthropicClient.Models.MessageRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},System.Int32,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Decimal,System.Nullable{System.Int32},System.Nullable{System.Decimal},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool},System.Collections.Generic.List{System.String})">
MessageRequest(string, List&lt;Message&gt;, int, string?, Dictionary&lt;string, object&gt;?, decimal, int?, decimal?, ToolChoice?, List&lt;Tool&gt;?, List&lt;string&gt;?)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/MessageRequest.cs/#L33"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.Models.MessageRequest.html">MessageRequest</a> class.</p>
@@ -202,7 +202,7 @@ Class MessageRequest <a class="header-action link-secondary" title="View source
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public MessageRequest(string model, List&lt;Message&gt; messages, int maxTokens = 1024, string? system = null, Dictionary&lt;string, object&gt;? metadata = null, decimal temperature = 0.0, int? topK = null, decimal? topP = null, ToolChoice? toolChoice = null, List&lt;Tool&gt;? tools = null)</code></pre>
<pre><code class="lang-csharp hljs">public MessageRequest(string model, List&lt;Message&gt; messages, int maxTokens = 1024, string? system = null, Dictionary&lt;string, object&gt;? metadata = null, decimal temperature = 0.0, int? topK = null, decimal? topP = null, ToolChoice? toolChoice = null, List&lt;Tool&gt;? tools = null, List&lt;string&gt;? stopSequences = null)</code></pre>
</div>
<h4 class="section">Parameters</h4>
@@ -236,6 +236,9 @@ Class MessageRequest <a class="header-action link-secondary" title="View source
</dd>
<dt><code>tools</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;<a class="xref" href="AnthropicClient.Models.Tool.html">Tool</a>&gt;</dt>
<dd><p>The tools to use for the request.</p>
</dd>
<dt><code>stopSequences</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a>&gt;</dt>
<dd><p>The prompt stop sequences.</p>
</dd>
</dl>
@@ -192,9 +192,9 @@ Class StreamMessageRequest <a class="header-action link-secondary" title="View
<a id="AnthropicClient_Models_StreamMessageRequest__ctor_" data-uid="AnthropicClient.Models.StreamMessageRequest.#ctor*"></a>
<h3 id="AnthropicClient_Models_StreamMessageRequest__ctor_System_String_System_Collections_Generic_List_AnthropicClient_Models_Message__System_Int32_System_String_System_Collections_Generic_Dictionary_System_String_System_Object__System_Decimal_System_Nullable_System_Int32__System_Nullable_System_Decimal__AnthropicClient_Models_ToolChoice_System_Collections_Generic_List_AnthropicClient_Models_Tool__" data-uid="AnthropicClient.Models.StreamMessageRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},System.Int32,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Decimal,System.Nullable{System.Int32},System.Nullable{System.Decimal},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool})">
StreamMessageRequest(string, List&lt;Message&gt;, int, string?, Dictionary&lt;string, object&gt;?, decimal, int?, decimal?, ToolChoice?, List&lt;Tool&gt;?)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/StreamMessageRequest.cs/#L32"><i class="bi bi-code-slash"></i></a>
<h3 id="AnthropicClient_Models_StreamMessageRequest__ctor_System_String_System_Collections_Generic_List_AnthropicClient_Models_Message__System_Int32_System_String_System_Collections_Generic_Dictionary_System_String_System_Object__System_Decimal_System_Nullable_System_Int32__System_Nullable_System_Decimal__AnthropicClient_Models_ToolChoice_System_Collections_Generic_List_AnthropicClient_Models_Tool__System_Collections_Generic_List_System_String__" data-uid="AnthropicClient.Models.StreamMessageRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},System.Int32,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Decimal,System.Nullable{System.Int32},System.Nullable{System.Decimal},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool},System.Collections.Generic.List{System.String})">
StreamMessageRequest(string, List&lt;Message&gt;, int, string?, Dictionary&lt;string, object&gt;?, decimal, int?, decimal?, ToolChoice?, List&lt;Tool&gt;?, List&lt;string&gt;?)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/StreamMessageRequest.cs/#L33"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.Models.StreamMessageRequest.html">StreamMessageRequest</a> class.</p>
@@ -202,7 +202,7 @@ Class StreamMessageRequest <a class="header-action link-secondary" title="View
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public StreamMessageRequest(string model, List&lt;Message&gt; messages, int maxTokens = 1024, string? system = null, Dictionary&lt;string, object&gt;? metadata = null, decimal temperature = 0.0, int? topK = null, decimal? topP = null, ToolChoice? toolChoice = null, List&lt;Tool&gt;? tools = null)</code></pre>
<pre><code class="lang-csharp hljs">public StreamMessageRequest(string model, List&lt;Message&gt; messages, int maxTokens = 1024, string? system = null, Dictionary&lt;string, object&gt;? metadata = null, decimal temperature = 0.0, int? topK = null, decimal? topP = null, ToolChoice? toolChoice = null, List&lt;Tool&gt;? tools = null, List&lt;string&gt;? stopSequences = null)</code></pre>
</div>
<h4 class="section">Parameters</h4>
@@ -236,6 +236,9 @@ Class StreamMessageRequest <a class="header-action link-secondary" title="View
</dd>
<dt><code>tools</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;<a class="xref" href="AnthropicClient.Models.Tool.html">Tool</a>&gt;</dt>
<dd><p>The tools to use for the request.</p>
</dd>
<dt><code>stopSequences</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a>&gt;</dt>
<dd><p>The prompt stop sequences.</p>
</dd>
</dl>
+3 -3
View File
@@ -57,7 +57,7 @@
"api/AnthropicClient.Models.BaseMessageRequest.html": {
"href": "api/AnthropicClient.Models.BaseMessageRequest.html",
"title": "Class BaseMessageRequest | AnthropicClient",
"keywords": "Class BaseMessageRequest Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents a message request. public abstract class BaseMessageRequest Inheritance object BaseMessageRequest Derived MessageRequest StreamMessageRequest Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Constructors BaseMessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, bool) Initializes a new instance of the BaseMessageRequest class. protected BaseMessageRequest(string model, List<Message> messages, int maxTokens = 1024, string? system = null, Dictionary<string, object>? metadata = null, decimal temperature = 0.0, int? topK = null, decimal? topP = null, ToolChoice? toolChoice = null, List<Tool>? tools = null, bool stream = false) Parameters model string The model ID to use for the request. messages List<Message> The messages to send to the model. maxTokens int The maximum number of tokens to generate. system string The system ID to use for the request. metadata Dictionary<string, object> The metadata to include with the request. temperature decimal The temperature to use for the request. topK int? The top-K value to use for the request. topP decimal? The top-P value to use for the request. toolChoice ToolChoice The tool choice mode to use for the request. tools List<Tool> The tools to use for the request. stream bool A value indicating whether the message should be streamed. Exceptions ArgumentException Thrown when the model ID is invalid. ArgumentNullException Thrown when the model or messages is null. ArgumentException Thrown when the messages contain no messages. ArgumentException Thrown when the max tokens is less than one. ArgumentException Thrown when the temperature is less than zero or greater than one. Properties MaxTokens Gets the maximum number of tokens to generate. [JsonPropertyName(\"max_tokens\")] public int MaxTokens { get; init; } Property Value int Messages Gets the messages to send to the model. public List<Message> Messages { get; init; } Property Value List<Message> Metadata Gets the metadata to include with the request. public Dictionary<string, object>? Metadata { get; init; } Property Value Dictionary<string, object> Model Gets the model ID to use for the request. public string Model { get; init; } Property Value string StopSequences Gets the prompt stop sequences. [JsonPropertyName(\"stop_sequences\")] public List<string> StopSequences { get; init; } Property Value List<string> Stream Gets a value indicating whether the message should be streamed. public bool Stream { get; init; } Property Value bool System Gets the system ID to use for the request. public string? System { get; init; } Property Value string Temperature Gets the temperature to use for the request. public decimal Temperature { get; init; } Property Value decimal ToolChoice Gets the tool choice mode to use for the request. [JsonPropertyName(\"tool_choice\")] public ToolChoice? ToolChoice { get; init; } Property Value ToolChoice Tools Gets the tools to use for the request. public List<Tool>? Tools { get; init; } Property Value List<Tool> TopK Gets the top-K value to use for the request. public int? TopK { get; init; } Property Value int? TopP Gets the top-P value to use for the request. public decimal? TopP { get; init; } Property Value decimal?"
"keywords": "Class BaseMessageRequest Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents a message request. public abstract class BaseMessageRequest Inheritance object BaseMessageRequest Derived MessageRequest StreamMessageRequest Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Constructors BaseMessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, bool, List<string>?) Initializes a new instance of the BaseMessageRequest class. protected BaseMessageRequest(string model, List<Message> messages, int maxTokens = 1024, string? system = null, Dictionary<string, object>? metadata = null, decimal temperature = 0.0, int? topK = null, decimal? topP = null, ToolChoice? toolChoice = null, List<Tool>? tools = null, bool stream = false, List<string>? stopSequences = null) Parameters model string The model ID to use for the request. messages List<Message> The messages to send to the model. maxTokens int The maximum number of tokens to generate. system string The system ID to use for the request. metadata Dictionary<string, object> The metadata to include with the request. temperature decimal The temperature to use for the request. topK int? The top-K value to use for the request. topP decimal? The top-P value to use for the request. toolChoice ToolChoice The tool choice mode to use for the request. tools List<Tool> The tools to use for the request. stream bool A value indicating whether the message should be streamed. stopSequences List<string> The prompt stop sequences. Exceptions ArgumentException Thrown when the model ID is invalid. ArgumentNullException Thrown when the model or messages is null. ArgumentException Thrown when the messages contain no messages. ArgumentException Thrown when the max tokens is less than one. ArgumentException Thrown when the temperature is less than zero or greater than one. Properties MaxTokens Gets the maximum number of tokens to generate. [JsonPropertyName(\"max_tokens\")] public int MaxTokens { get; init; } Property Value int Messages Gets the messages to send to the model. public List<Message> Messages { get; init; } Property Value List<Message> Metadata Gets the metadata to include with the request. public Dictionary<string, object>? Metadata { get; init; } Property Value Dictionary<string, object> Model Gets the model ID to use for the request. public string Model { get; init; } Property Value string StopSequences Gets the prompt stop sequences. [JsonPropertyName(\"stop_sequences\")] public List<string> StopSequences { get; init; } Property Value List<string> Stream Gets a value indicating whether the message should be streamed. public bool Stream { get; init; } Property Value bool System Gets the system prompt to use for the request. public string? System { get; init; } Property Value string Temperature Gets the temperature to use for the request. public decimal Temperature { get; init; } Property Value decimal ToolChoice Gets the tool choice mode to use for the request. [JsonPropertyName(\"tool_choice\")] public ToolChoice? ToolChoice { get; init; } Property Value ToolChoice Tools Gets the tools to use for the request. public List<Tool>? Tools { get; init; } Property Value List<Tool> TopK Gets the top-K value to use for the request. public int? TopK { get; init; } Property Value int? TopP Gets the top-P value to use for the request. public decimal? TopP { get; init; } Property Value decimal?"
},
"api/AnthropicClient.Models.Content.html": {
"href": "api/AnthropicClient.Models.Content.html",
@@ -192,7 +192,7 @@
"api/AnthropicClient.Models.MessageRequest.html": {
"href": "api/AnthropicClient.Models.MessageRequest.html",
"title": "Class MessageRequest | AnthropicClient",
"keywords": "Class MessageRequest Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents a message request. public class MessageRequest : BaseMessageRequest Inheritance object BaseMessageRequest MessageRequest Inherited Members BaseMessageRequest.Model BaseMessageRequest.System BaseMessageRequest.Messages BaseMessageRequest.MaxTokens BaseMessageRequest.Metadata BaseMessageRequest.StopSequences BaseMessageRequest.Temperature BaseMessageRequest.TopK BaseMessageRequest.TopP BaseMessageRequest.ToolChoice BaseMessageRequest.Tools BaseMessageRequest.Stream object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Constructors MessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?) Initializes a new instance of the MessageRequest class. public MessageRequest(string model, List<Message> messages, int maxTokens = 1024, string? system = null, Dictionary<string, object>? metadata = null, decimal temperature = 0.0, int? topK = null, decimal? topP = null, ToolChoice? toolChoice = null, List<Tool>? tools = null) Parameters model string The model ID to use for the request. messages List<Message> The messages to send to the model. maxTokens int The maximum number of tokens to generate. system string The system ID to use for the request. metadata Dictionary<string, object> The metadata to include with the request. temperature decimal The temperature to use for the request. topK int? The top-K value to use for the request. topP decimal? The top-P value to use for the request. toolChoice ToolChoice The tool choice mode to use for the request. tools List<Tool> The tools to use for the request. Exceptions ArgumentException Thrown when the model ID is invalid. ArgumentNullException Thrown when the model or messages is null. ArgumentException Thrown when the messages contain no messages. ArgumentException Thrown when the max tokens is less than one. ArgumentException Thrown when the temperature is less than zero or greater than one."
"keywords": "Class MessageRequest Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents a message request. public class MessageRequest : BaseMessageRequest Inheritance object BaseMessageRequest MessageRequest Inherited Members BaseMessageRequest.Model BaseMessageRequest.System BaseMessageRequest.Messages BaseMessageRequest.MaxTokens BaseMessageRequest.Metadata BaseMessageRequest.StopSequences BaseMessageRequest.Temperature BaseMessageRequest.TopK BaseMessageRequest.TopP BaseMessageRequest.ToolChoice BaseMessageRequest.Tools BaseMessageRequest.Stream object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Constructors MessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, List<string>?) Initializes a new instance of the MessageRequest class. public MessageRequest(string model, List<Message> messages, int maxTokens = 1024, string? system = null, Dictionary<string, object>? metadata = null, decimal temperature = 0.0, int? topK = null, decimal? topP = null, ToolChoice? toolChoice = null, List<Tool>? tools = null, List<string>? stopSequences = null) Parameters model string The model ID to use for the request. messages List<Message> The messages to send to the model. maxTokens int The maximum number of tokens to generate. system string The system ID to use for the request. metadata Dictionary<string, object> The metadata to include with the request. temperature decimal The temperature to use for the request. topK int? The top-K value to use for the request. topP decimal? The top-P value to use for the request. toolChoice ToolChoice The tool choice mode to use for the request. tools List<Tool> The tools to use for the request. stopSequences List<string> The prompt stop sequences. Exceptions ArgumentException Thrown when the model ID is invalid. ArgumentNullException Thrown when the model or messages is null. ArgumentException Thrown when the messages contain no messages. ArgumentException Thrown when the max tokens is less than one. ArgumentException Thrown when the temperature is less than zero or greater than one."
},
"api/AnthropicClient.Models.MessageResponse.html": {
"href": "api/AnthropicClient.Models.MessageResponse.html",
@@ -252,7 +252,7 @@
"api/AnthropicClient.Models.StreamMessageRequest.html": {
"href": "api/AnthropicClient.Models.StreamMessageRequest.html",
"title": "Class StreamMessageRequest | AnthropicClient",
"keywords": "Class StreamMessageRequest Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents a message request. public class StreamMessageRequest : BaseMessageRequest Inheritance object BaseMessageRequest StreamMessageRequest Inherited Members BaseMessageRequest.Model BaseMessageRequest.System BaseMessageRequest.Messages BaseMessageRequest.MaxTokens BaseMessageRequest.Metadata BaseMessageRequest.StopSequences BaseMessageRequest.Temperature BaseMessageRequest.TopK BaseMessageRequest.TopP BaseMessageRequest.ToolChoice BaseMessageRequest.Tools BaseMessageRequest.Stream object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Constructors StreamMessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?) Initializes a new instance of the StreamMessageRequest class. public StreamMessageRequest(string model, List<Message> messages, int maxTokens = 1024, string? system = null, Dictionary<string, object>? metadata = null, decimal temperature = 0.0, int? topK = null, decimal? topP = null, ToolChoice? toolChoice = null, List<Tool>? tools = null) Parameters model string The model ID to use for the request. messages List<Message> The messages to send to the model. maxTokens int The maximum number of tokens to generate. system string The system ID to use for the request. metadata Dictionary<string, object> The metadata to include with the request. temperature decimal The temperature to use for the request. topK int? The top-K value to use for the request. topP decimal? The top-P value to use for the request. toolChoice ToolChoice The tool choice mode to use for the request. tools List<Tool> The tools to use for the request. Exceptions ArgumentException Thrown when the model ID is invalid. ArgumentNullException Thrown when the model or messages is null. ArgumentException Thrown when the messages contain no messages. ArgumentException Thrown when the max tokens is less than one. ArgumentException Thrown when the temperature is less than zero or greater than one."
"keywords": "Class StreamMessageRequest Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents a message request. public class StreamMessageRequest : BaseMessageRequest Inheritance object BaseMessageRequest StreamMessageRequest Inherited Members BaseMessageRequest.Model BaseMessageRequest.System BaseMessageRequest.Messages BaseMessageRequest.MaxTokens BaseMessageRequest.Metadata BaseMessageRequest.StopSequences BaseMessageRequest.Temperature BaseMessageRequest.TopK BaseMessageRequest.TopP BaseMessageRequest.ToolChoice BaseMessageRequest.Tools BaseMessageRequest.Stream object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Constructors StreamMessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, List<string>?) Initializes a new instance of the StreamMessageRequest class. public StreamMessageRequest(string model, List<Message> messages, int maxTokens = 1024, string? system = null, Dictionary<string, object>? metadata = null, decimal temperature = 0.0, int? topK = null, decimal? topP = null, ToolChoice? toolChoice = null, List<Tool>? tools = null, List<string>? stopSequences = null) Parameters model string The model ID to use for the request. messages List<Message> The messages to send to the model. maxTokens int The maximum number of tokens to generate. system string The system ID to use for the request. metadata Dictionary<string, object> The metadata to include with the request. temperature decimal The temperature to use for the request. topK int? The top-K value to use for the request. topP decimal? The top-P value to use for the request. toolChoice ToolChoice The tool choice mode to use for the request. tools List<Tool> The tools to use for the request. stopSequences List<string> The prompt stop sequences. Exceptions ArgumentException Thrown when the model ID is invalid. ArgumentNullException Thrown when the model or messages is null. ArgumentException Thrown when the messages contain no messages. ArgumentException Thrown when the max tokens is less than one. ArgumentException Thrown when the temperature is less than zero or greater than one."
},
"api/AnthropicClient.Models.TextContent.html": {
"href": "api/AnthropicClient.Models.TextContent.html",
+6 -6
View File
@@ -644,11 +644,11 @@
"type": "Toc",
"source_relative_path": "api/toc.yml",
"output": {
".json": {
"relative_path": "api/toc.json"
},
".html": {
"relative_path": "api/toc.html"
},
".json": {
"relative_path": "api/toc.json"
}
},
"version": ""
@@ -667,11 +667,11 @@
"type": "Toc",
"source_relative_path": "toc.yml",
"output": {
".json": {
"relative_path": "toc.json"
},
".html": {
"relative_path": "toc.html"
},
".json": {
"relative_path": "toc.json"
}
},
"version": ""
+27 -27
View File
@@ -481,15 +481,15 @@ references:
commentId: T:AnthropicClient.Models.BaseMessageRequest
fullName: AnthropicClient.Models.BaseMessageRequest
nameWithType: BaseMessageRequest
- uid: AnthropicClient.Models.BaseMessageRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},System.Int32,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Decimal,System.Nullable{System.Int32},System.Nullable{System.Decimal},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool},System.Boolean)
name: BaseMessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, bool)
href: api/AnthropicClient.Models.BaseMessageRequest.html#AnthropicClient_Models_BaseMessageRequest__ctor_System_String_System_Collections_Generic_List_AnthropicClient_Models_Message__System_Int32_System_String_System_Collections_Generic_Dictionary_System_String_System_Object__System_Decimal_System_Nullable_System_Int32__System_Nullable_System_Decimal__AnthropicClient_Models_ToolChoice_System_Collections_Generic_List_AnthropicClient_Models_Tool__System_Boolean_
commentId: M:AnthropicClient.Models.BaseMessageRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},System.Int32,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Decimal,System.Nullable{System.Int32},System.Nullable{System.Decimal},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool},System.Boolean)
name.vb: New(String, List(Of Message), Integer, String, Dictionary(Of String, Object), Decimal, Integer?, Decimal?, ToolChoice, List(Of Tool), Boolean)
fullName: AnthropicClient.Models.BaseMessageRequest.BaseMessageRequest(string, System.Collections.Generic.List<AnthropicClient.Models.Message>, int, string?, System.Collections.Generic.Dictionary<string, object>?, decimal, int?, decimal?, AnthropicClient.Models.ToolChoice?, System.Collections.Generic.List<AnthropicClient.Models.Tool>?, bool)
fullName.vb: AnthropicClient.Models.BaseMessageRequest.New(String, System.Collections.Generic.List(Of AnthropicClient.Models.Message), Integer, String, System.Collections.Generic.Dictionary(Of String, Object), Decimal, Integer?, Decimal?, AnthropicClient.Models.ToolChoice, System.Collections.Generic.List(Of AnthropicClient.Models.Tool), Boolean)
nameWithType: BaseMessageRequest.BaseMessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, bool)
nameWithType.vb: BaseMessageRequest.New(String, List(Of Message), Integer, String, Dictionary(Of String, Object), Decimal, Integer?, Decimal?, ToolChoice, List(Of Tool), Boolean)
- uid: AnthropicClient.Models.BaseMessageRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},System.Int32,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Decimal,System.Nullable{System.Int32},System.Nullable{System.Decimal},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool},System.Boolean,System.Collections.Generic.List{System.String})
name: BaseMessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, bool, List<string>?)
href: api/AnthropicClient.Models.BaseMessageRequest.html#AnthropicClient_Models_BaseMessageRequest__ctor_System_String_System_Collections_Generic_List_AnthropicClient_Models_Message__System_Int32_System_String_System_Collections_Generic_Dictionary_System_String_System_Object__System_Decimal_System_Nullable_System_Int32__System_Nullable_System_Decimal__AnthropicClient_Models_ToolChoice_System_Collections_Generic_List_AnthropicClient_Models_Tool__System_Boolean_System_Collections_Generic_List_System_String__
commentId: M:AnthropicClient.Models.BaseMessageRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},System.Int32,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Decimal,System.Nullable{System.Int32},System.Nullable{System.Decimal},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool},System.Boolean,System.Collections.Generic.List{System.String})
name.vb: New(String, List(Of Message), Integer, String, Dictionary(Of String, Object), Decimal, Integer?, Decimal?, ToolChoice, List(Of Tool), Boolean, List(Of String))
fullName: AnthropicClient.Models.BaseMessageRequest.BaseMessageRequest(string, System.Collections.Generic.List<AnthropicClient.Models.Message>, int, string?, System.Collections.Generic.Dictionary<string, object>?, decimal, int?, decimal?, AnthropicClient.Models.ToolChoice?, System.Collections.Generic.List<AnthropicClient.Models.Tool>?, bool, System.Collections.Generic.List<string>?)
fullName.vb: AnthropicClient.Models.BaseMessageRequest.New(String, System.Collections.Generic.List(Of AnthropicClient.Models.Message), Integer, String, System.Collections.Generic.Dictionary(Of String, Object), Decimal, Integer?, Decimal?, AnthropicClient.Models.ToolChoice, System.Collections.Generic.List(Of AnthropicClient.Models.Tool), Boolean, System.Collections.Generic.List(Of String))
nameWithType: BaseMessageRequest.BaseMessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, bool, List<string>?)
nameWithType.vb: BaseMessageRequest.New(String, List(Of Message), Integer, String, Dictionary(Of String, Object), Decimal, Integer?, Decimal?, ToolChoice, List(Of Tool), Boolean, List(Of String))
- uid: AnthropicClient.Models.BaseMessageRequest.#ctor*
name: BaseMessageRequest
href: api/AnthropicClient.Models.BaseMessageRequest.html#AnthropicClient_Models_BaseMessageRequest__ctor_
@@ -1848,15 +1848,15 @@ references:
commentId: T:AnthropicClient.Models.MessageRequest
fullName: AnthropicClient.Models.MessageRequest
nameWithType: MessageRequest
- uid: AnthropicClient.Models.MessageRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},System.Int32,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Decimal,System.Nullable{System.Int32},System.Nullable{System.Decimal},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool})
name: MessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?)
href: api/AnthropicClient.Models.MessageRequest.html#AnthropicClient_Models_MessageRequest__ctor_System_String_System_Collections_Generic_List_AnthropicClient_Models_Message__System_Int32_System_String_System_Collections_Generic_Dictionary_System_String_System_Object__System_Decimal_System_Nullable_System_Int32__System_Nullable_System_Decimal__AnthropicClient_Models_ToolChoice_System_Collections_Generic_List_AnthropicClient_Models_Tool__
commentId: M:AnthropicClient.Models.MessageRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},System.Int32,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Decimal,System.Nullable{System.Int32},System.Nullable{System.Decimal},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool})
name.vb: New(String, List(Of Message), Integer, String, Dictionary(Of String, Object), Decimal, Integer?, Decimal?, ToolChoice, List(Of Tool))
fullName: AnthropicClient.Models.MessageRequest.MessageRequest(string, System.Collections.Generic.List<AnthropicClient.Models.Message>, int, string?, System.Collections.Generic.Dictionary<string, object>?, decimal, int?, decimal?, AnthropicClient.Models.ToolChoice?, System.Collections.Generic.List<AnthropicClient.Models.Tool>?)
fullName.vb: AnthropicClient.Models.MessageRequest.New(String, System.Collections.Generic.List(Of AnthropicClient.Models.Message), Integer, String, System.Collections.Generic.Dictionary(Of String, Object), Decimal, Integer?, Decimal?, AnthropicClient.Models.ToolChoice, System.Collections.Generic.List(Of AnthropicClient.Models.Tool))
nameWithType: MessageRequest.MessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?)
nameWithType.vb: MessageRequest.New(String, List(Of Message), Integer, String, Dictionary(Of String, Object), Decimal, Integer?, Decimal?, ToolChoice, List(Of Tool))
- uid: AnthropicClient.Models.MessageRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},System.Int32,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Decimal,System.Nullable{System.Int32},System.Nullable{System.Decimal},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool},System.Collections.Generic.List{System.String})
name: MessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, List<string>?)
href: api/AnthropicClient.Models.MessageRequest.html#AnthropicClient_Models_MessageRequest__ctor_System_String_System_Collections_Generic_List_AnthropicClient_Models_Message__System_Int32_System_String_System_Collections_Generic_Dictionary_System_String_System_Object__System_Decimal_System_Nullable_System_Int32__System_Nullable_System_Decimal__AnthropicClient_Models_ToolChoice_System_Collections_Generic_List_AnthropicClient_Models_Tool__System_Collections_Generic_List_System_String__
commentId: M:AnthropicClient.Models.MessageRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},System.Int32,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Decimal,System.Nullable{System.Int32},System.Nullable{System.Decimal},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool},System.Collections.Generic.List{System.String})
name.vb: New(String, List(Of Message), Integer, String, Dictionary(Of String, Object), Decimal, Integer?, Decimal?, ToolChoice, List(Of Tool), List(Of String))
fullName: AnthropicClient.Models.MessageRequest.MessageRequest(string, System.Collections.Generic.List<AnthropicClient.Models.Message>, int, string?, System.Collections.Generic.Dictionary<string, object>?, decimal, int?, decimal?, AnthropicClient.Models.ToolChoice?, System.Collections.Generic.List<AnthropicClient.Models.Tool>?, System.Collections.Generic.List<string>?)
fullName.vb: AnthropicClient.Models.MessageRequest.New(String, System.Collections.Generic.List(Of AnthropicClient.Models.Message), Integer, String, System.Collections.Generic.Dictionary(Of String, Object), Decimal, Integer?, Decimal?, AnthropicClient.Models.ToolChoice, System.Collections.Generic.List(Of AnthropicClient.Models.Tool), System.Collections.Generic.List(Of String))
nameWithType: MessageRequest.MessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, List<string>?)
nameWithType.vb: MessageRequest.New(String, List(Of Message), Integer, String, Dictionary(Of String, Object), Decimal, Integer?, Decimal?, ToolChoice, List(Of Tool), List(Of String))
- uid: AnthropicClient.Models.MessageRequest.#ctor*
name: MessageRequest
href: api/AnthropicClient.Models.MessageRequest.html#AnthropicClient_Models_MessageRequest__ctor_
@@ -2270,15 +2270,15 @@ references:
commentId: T:AnthropicClient.Models.StreamMessageRequest
fullName: AnthropicClient.Models.StreamMessageRequest
nameWithType: StreamMessageRequest
- uid: AnthropicClient.Models.StreamMessageRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},System.Int32,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Decimal,System.Nullable{System.Int32},System.Nullable{System.Decimal},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool})
name: StreamMessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?)
href: api/AnthropicClient.Models.StreamMessageRequest.html#AnthropicClient_Models_StreamMessageRequest__ctor_System_String_System_Collections_Generic_List_AnthropicClient_Models_Message__System_Int32_System_String_System_Collections_Generic_Dictionary_System_String_System_Object__System_Decimal_System_Nullable_System_Int32__System_Nullable_System_Decimal__AnthropicClient_Models_ToolChoice_System_Collections_Generic_List_AnthropicClient_Models_Tool__
commentId: M:AnthropicClient.Models.StreamMessageRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},System.Int32,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Decimal,System.Nullable{System.Int32},System.Nullable{System.Decimal},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool})
name.vb: New(String, List(Of Message), Integer, String, Dictionary(Of String, Object), Decimal, Integer?, Decimal?, ToolChoice, List(Of Tool))
fullName: AnthropicClient.Models.StreamMessageRequest.StreamMessageRequest(string, System.Collections.Generic.List<AnthropicClient.Models.Message>, int, string?, System.Collections.Generic.Dictionary<string, object>?, decimal, int?, decimal?, AnthropicClient.Models.ToolChoice?, System.Collections.Generic.List<AnthropicClient.Models.Tool>?)
fullName.vb: AnthropicClient.Models.StreamMessageRequest.New(String, System.Collections.Generic.List(Of AnthropicClient.Models.Message), Integer, String, System.Collections.Generic.Dictionary(Of String, Object), Decimal, Integer?, Decimal?, AnthropicClient.Models.ToolChoice, System.Collections.Generic.List(Of AnthropicClient.Models.Tool))
nameWithType: StreamMessageRequest.StreamMessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?)
nameWithType.vb: StreamMessageRequest.New(String, List(Of Message), Integer, String, Dictionary(Of String, Object), Decimal, Integer?, Decimal?, ToolChoice, List(Of Tool))
- uid: AnthropicClient.Models.StreamMessageRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},System.Int32,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Decimal,System.Nullable{System.Int32},System.Nullable{System.Decimal},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool},System.Collections.Generic.List{System.String})
name: StreamMessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, List<string>?)
href: api/AnthropicClient.Models.StreamMessageRequest.html#AnthropicClient_Models_StreamMessageRequest__ctor_System_String_System_Collections_Generic_List_AnthropicClient_Models_Message__System_Int32_System_String_System_Collections_Generic_Dictionary_System_String_System_Object__System_Decimal_System_Nullable_System_Int32__System_Nullable_System_Decimal__AnthropicClient_Models_ToolChoice_System_Collections_Generic_List_AnthropicClient_Models_Tool__System_Collections_Generic_List_System_String__
commentId: M:AnthropicClient.Models.StreamMessageRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},System.Int32,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Decimal,System.Nullable{System.Int32},System.Nullable{System.Decimal},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool},System.Collections.Generic.List{System.String})
name.vb: New(String, List(Of Message), Integer, String, Dictionary(Of String, Object), Decimal, Integer?, Decimal?, ToolChoice, List(Of Tool), List(Of String))
fullName: AnthropicClient.Models.StreamMessageRequest.StreamMessageRequest(string, System.Collections.Generic.List<AnthropicClient.Models.Message>, int, string?, System.Collections.Generic.Dictionary<string, object>?, decimal, int?, decimal?, AnthropicClient.Models.ToolChoice?, System.Collections.Generic.List<AnthropicClient.Models.Tool>?, System.Collections.Generic.List<string>?)
fullName.vb: AnthropicClient.Models.StreamMessageRequest.New(String, System.Collections.Generic.List(Of AnthropicClient.Models.Message), Integer, String, System.Collections.Generic.Dictionary(Of String, Object), Decimal, Integer?, Decimal?, AnthropicClient.Models.ToolChoice, System.Collections.Generic.List(Of AnthropicClient.Models.Tool), System.Collections.Generic.List(Of String))
nameWithType: StreamMessageRequest.StreamMessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, List<string>?)
nameWithType.vb: StreamMessageRequest.New(String, List(Of Message), Integer, String, Dictionary(Of String, Object), Decimal, Integer?, Decimal?, ToolChoice, List(Of Tool), List(Of String))
- uid: AnthropicClient.Models.StreamMessageRequest.#ctor*
name: StreamMessageRequest
href: api/AnthropicClient.Models.StreamMessageRequest.html#AnthropicClient_Models_StreamMessageRequest__ctor_
@@ -95,6 +95,14 @@ public class AnthropicApiClient : IAnthropicApiClient
public async IAsyncEnumerable<AnthropicEvent> CreateMessageAsync(StreamMessageRequest request)
{
var response = await SendRequestAsync(request);
if (response.IsSuccessStatusCode is false)
{
var error = Deserialize<AnthropicError>(await response.Content.ReadAsStringAsync()) ?? new AnthropicError();
yield return new AnthropicEvent(EventType.Error, new ErrorEventData(error.Error));
yield break;
}
var anthropicHeaders = new AnthropicHeaders(response.Headers);
using var responseContent = await response.Content.ReadAsStreamAsync();
+10 -2
View File
@@ -4,11 +4,14 @@
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<PackageId>AnthropicClient</PackageId>
<Version>0.0.2</Version>
<Version>0.0.4</Version>
<Authors>Stevan Freeborn</Authors>
<Description>Anthropic Client Library</Description>
<PackageProjectUrl>https://anthropicclient.stevanfreeborn.com/</PackageProjectUrl>
<RepositoryUrl>https://github.com/StevanFreeborn/anthropic-client</RepositoryUrl>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<DebugType>embedded</DebugType>
<RepositoryType>git</RepositoryType>
<PackageTags>anthropic;client</PackageTags>
<PackageReadmeFile>README.md</PackageReadmeFile>
@@ -22,13 +25,18 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<ItemGroup>
<InternalsVisibleTo Include="$(AssemblyName).Tests" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.3" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
+34
View File
@@ -2,6 +2,40 @@
All notable changes to this project will be documented in this file. See [versionize](https://github.com/versionize/versionize) for commit guidelines.
<a name="0.0.4"></a>
## [0.0.4](https://www.github.com/StevanFreeborn/anthropic-client/releases/tag/v0.0.4) (2024-07-20)
### Bug Fixes
* add end to end test for vision ([b3d4ac3](https://www.github.com/StevanFreeborn/anthropic-client/commit/b3d4ac3faa94086369a02b0a47a19db9441b274e))
* add missing type property to image source model ([0a692d1](https://www.github.com/StevanFreeborn/anthropic-client/commit/0a692d1b9a5f39869aef05892f0801fefe31f50e))
* yield error when initial stream response is not successful ([3b47ed3](https://www.github.com/StevanFreeborn/anthropic-client/commit/3b47ed3fb4e8b30a73a8297e6485985fee7c129a))
### Other
* Merge pull request #11 from StevanFreeborn/stevanfreeborn/fix/missing-type-property-and-response-handling ([d27538b](https://www.github.com/StevanFreeborn/anthropic-client/commit/d27538b65620333ade65e920110a21acd829123f))
* add missing type property ([f970b07](https://www.github.com/StevanFreeborn/anthropic-client/commit/f970b07ed79979b94961c93a192b57fc12a81097))
* debug ci failure ([641eaf3](https://www.github.com/StevanFreeborn/anthropic-client/commit/641eaf30a476cece3cc8bb37f147aa42625992d2))
* debug ci failure ([30c0116](https://www.github.com/StevanFreeborn/anthropic-client/commit/30c01161136949471d661284fa86838ac663ec87))
* debug CI failure ([48b2716](https://www.github.com/StevanFreeborn/anthropic-client/commit/48b2716a61894c471bd2b703254ceb7126354f5e))
* debug CI failure ([9b714df](https://www.github.com/StevanFreeborn/anthropic-client/commit/9b714df12f1d7a6e2e500726ac10a345e4c66054))
* debug test failure in CI ([f39e76c](https://www.github.com/StevanFreeborn/anthropic-client/commit/f39e76cfa64f649e9297bab319ef6ddd58995e0e))
* run format ([93761b8](https://www.github.com/StevanFreeborn/anthropic-client/commit/93761b8e7e0ac67f205abd93f6e9db9465924b02))
* use base64 text file ([a16b64d](https://www.github.com/StevanFreeborn/anthropic-client/commit/a16b64d5a079f65884a8f3a2cf15be4da06f73d3))
<a name="0.0.3"></a>
## [0.0.3](https://www.github.com/StevanFreeborn/anthropic-client/releases/tag/v0.0.3) (2024-07-11)
### Bug Fixes
* address nuget health checks ([989951d](https://www.github.com/StevanFreeborn/anthropic-client/commit/989951db552b2305e2fab9131e26d2fcc2e9283a))
### Other
* Merge pull request #8 from StevanFreeborn/stevanfreeborn/feat/address-nuget-health-checks ([f245d64](https://www.github.com/StevanFreeborn/anthropic-client/commit/f245d6442f040d8dcabd27f013b90373ab25370a))
* documentation for v0.0.2 [skip ci] ([d486bc8](https://www.github.com/StevanFreeborn/anthropic-client/commit/d486bc869101e9ca87dfc60f9aa6b6ad12f073de))
* upgrade System.Text.Json dep ([5576b68](https://www.github.com/StevanFreeborn/anthropic-client/commit/5576b688c50b21031f68fca7e2728d1398a366c5))
<a name="0.0.2"></a>
## [0.0.2](https://www.github.com/StevanFreeborn/anthropic-client/releases/tag/v0.0.2) (2024-07-10)
@@ -20,6 +20,11 @@ public class ImageSource
/// </summary>
public string Data { get; init; } = string.Empty;
/// <summary>
/// Gets the type of encoding of the image data.
/// </summary>
public string Type { get; init; } = "base64";
[JsonConstructor]
internal ImageSource()
{
@@ -6,6 +6,7 @@
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<NoWarn>$(NoWarn);IDE0039</NoWarn>
</PropertyGroup>
<ItemGroup>
@@ -53,5 +54,11 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Update="Files/**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
@@ -1,3 +1,6 @@
using Xunit.Abstractions;
using Xunit.Sdk;
namespace AnthropicClient.Tests.EndToEnd;
public class ClientTests(ConfigurationFixture configFixture) : EndToEndTest(configFixture)
@@ -56,4 +59,40 @@ public class ClientTests(ConfigurationFixture configFixture) : EndToEndTest(conf
}
}
}
[Fact]
public async Task CreateMessageAsync_WhenImageIsSent_ItShouldReturnResponse()
{
var imagePath = Path.Combine(Directory.GetCurrentDirectory(), "Files", "base64-elephant.txt");
var mediaType = "image/jpeg";
var base64Data = await File.ReadAllTextAsync(imagePath);
var request = new MessageRequest(
model: AnthropicModels.Claude3Haiku,
messages: [
new(MessageRole.User, [
new ImageContent(mediaType, base64Data),
new TextContent("What is in this image?")
]),
]
);
var result = await _client.CreateMessageAsync(request);
result.IsSuccess.Should().BeTrue();
result.Value.Should().BeOfType<MessageResponse>();
result.Value.Content.Should().NotBeNullOrEmpty();
var text = result.Value.Content.Aggregate("", (acc, content) =>
{
if (content is TextContent textContent)
{
acc += textContent.Text;
}
return acc;
});
text.Should().Contain("elephant");
}
}
File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

@@ -321,4 +321,42 @@ public class AnthropicApiClientTests : IntegrationTest
toolCallResult.IsSuccess.Should().BeTrue();
toolCallResult.Value.Should().Be(getWeather("San Francisco, CA", "fahrenheit"));
}
[Fact]
public async Task CreateMessageAsync_WhenCalledMessageIsStreamAndRequestFails_ItShouldReturnErrorEvent()
{
_mockHttpMessageHandler
.WhenCreateStreamMessageRequest()
.Respond(
HttpStatusCode.BadRequest,
"application/json",
@"{
""type"": ""error"",
""error"": {
""type"": ""invalid_request_error"",
""message"": ""messages: roles must alternate between user and assistant, but found multiple user roles in a row""
}
}"
);
var request = new StreamMessageRequest(
model: AnthropicModels.Claude35Sonnet,
messages: [
new(MessageRole.User, [new TextContent("Hello!")]),
new(MessageRole.User, [new TextContent("Hello!")])
]
);
var result = Client.CreateMessageAsync(request);
var events = await result.ToListAsync();
events.Should().HaveCount(1);
events[0].Type.Should().Be(EventType.Error);
events[0].Data.Should().BeOfType<ErrorEventData>();
events[0].Data.Should().BeEquivalentTo(new ErrorEventData(
new InvalidRequestError(
"messages: roles must alternate between user and assistant, but found multiple user roles in a row"
)
));
}
}
@@ -5,7 +5,8 @@ public class ImageContentTests : SerializationTest
private readonly string _testJson = @"{
""source"": {
""media_type"": ""image/png"",
""data"": ""data""
""data"": ""data"",
""type"": ""base64""
},
""type"": ""image""
}";
@@ -0,0 +1,60 @@
namespace AnthropicClient.Tests.Unit.Models;
public class ImageSourceTests
{
[Fact]
public void Constructor_WhenCalledWithValidArguments_ItShouldSetProperties()
{
var mediaType = "image/jpeg";
var data = "base64data";
var imageSource = new ImageSource(mediaType, data);
imageSource.MediaType.Should().Be(mediaType);
imageSource.Data.Should().Be(data);
}
[Fact]
public void Constructor_WhenCalledWithInvalidMediaType_ItShouldThrowArgumentException()
{
var mediaType = "invalid";
var data = "base64data";
var action = () => new ImageSource(mediaType, data);
action.Should().Throw<ArgumentException>();
}
[Fact]
public void Constructor_WhenCalledWithNullMediaType_ItShouldThrowArgumentNullException()
{
string? mediaType = null;
var data = "base64data";
var action = () => new ImageSource(mediaType!, data);
action.Should().Throw<ArgumentNullException>();
}
[Fact]
public void Constructor_WhenCalledWithNullData_ItShouldThrowArgumentNullException()
{
var mediaType = "image/jpeg";
string? data = null;
var action = () => new ImageSource(mediaType, data!);
action.Should().Throw<ArgumentNullException>();
}
[Fact]
public void Constructor_WhenCalled_ItShouldHaveTypePropertySetToBase64()
{
var mediaType = "image/jpeg";
var data = "base64data";
var imageSource = new ImageSource(mediaType, data);
imageSource.Type.Should().Be("base64");
}
}