Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8a3d6c6cd | ||
|
|
26e5d297bb | ||
|
|
fc2932f3c5 | ||
|
|
ee9dbcf647 | ||
|
|
07cadf17af | ||
|
|
2794c52c2a | ||
|
|
56b3a53a2a | ||
|
|
7ec931dda5 | ||
|
|
a3ac1001f6 | ||
|
|
c11600c770 | ||
|
|
180a090195 | ||
|
|
ca2ecdcfc7 | ||
|
|
876c6f571c | ||
|
|
299af3b759 | ||
|
|
3034544ca4 | ||
|
|
c56adf394c | ||
|
|
0a6d89bd77 | ||
|
|
c5f3c5eca5 | ||
|
|
f8e01bf487 | ||
|
|
779a5ca281 | ||
|
|
854e4642ab | ||
|
|
15f5ad49e7 | ||
|
|
5e247a3c3a | ||
|
|
9548754d6c | ||
|
|
fe39f10382 | ||
|
|
df0738ac7f | ||
|
|
0dd7829733 | ||
|
|
0b81bfc2f6 | ||
|
|
33191a32cc | ||
|
|
3fe75f511d | ||
|
|
9abad390f1 | ||
|
|
8bbd4bb7c8 | ||
|
|
8e0443a6bb | ||
|
|
9d341011df | ||
|
|
df75cd25e0 | ||
|
|
28b7bf6a89 | ||
|
|
9e367d3542 | ||
|
|
4a7d2c39be | ||
|
|
e08c94ec57 | ||
|
|
5a1bf4ca41 | ||
|
|
de326abe25 | ||
|
|
57f66d3619 | ||
|
|
a23938961f | ||
|
|
4fe8bfaf0e | ||
|
|
944822060c | ||
|
|
31a7097cdc | ||
|
|
8ef9a21a93 | ||
|
|
87ecb6e5ad | ||
|
|
abf4154432 | ||
|
|
9c0a2e37b7 | ||
|
|
f861155551 | ||
|
|
6e0c0654af | ||
|
|
6b6bc1b015 | ||
|
|
69ec59d0ee | ||
|
|
27ad654cd9 | ||
|
|
dc9755cbb8 | ||
|
|
c66dc81df3 | ||
|
|
3de38ee5cf | ||
|
|
fe984d517d | ||
|
|
f3a7040cb9 | ||
|
|
c4d4d8a15b |
Vendored
+1
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"editor.formatOnSave": true,
|
||||||
"dotnet.defaultSolution": "AnthropicClient.sln",
|
"dotnet.defaultSolution": "AnthropicClient.sln",
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"Browsable",
|
"Browsable",
|
||||||
|
|||||||
@@ -105,9 +105,105 @@ The primary use case for working with the Anthropic API is to create a message i
|
|||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> The following examples assume that you have already created an instance of the `AnthropicApiClient` class named `client`. You can also find these snippets in the examples directory.
|
> The following examples assume that you have already created an instance of the `AnthropicApiClient` class named `client`. You can also find these snippets in the examples directory.
|
||||||
|
|
||||||
|
### Count Message Tokens
|
||||||
|
|
||||||
|
The `AnthropicApiClient` exposes a method named `CountMessageTokensAsync` that can be used to count the number of tokens in a message. The method requires a `CountMessageTokensRequest` instance as a parameter.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
using AnthropicClient;
|
||||||
|
using AnthropicClient.Models;
|
||||||
|
|
||||||
|
var response = await client.CountMessageTokensAsync(new CountMessageTokensRequest(
|
||||||
|
AnthropicModels.Claude3Haiku,
|
||||||
|
[
|
||||||
|
new(
|
||||||
|
MessageRole.User,
|
||||||
|
[new TextContent("Please write a haiku about the ocean.")]
|
||||||
|
)
|
||||||
|
]
|
||||||
|
));
|
||||||
|
|
||||||
|
if (response.IsFailure)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Failed to count message tokens");
|
||||||
|
Console.WriteLine("Error Type: {0}", response.Error.Error.Type);
|
||||||
|
Console.WriteLine("Error Message: {0}", response.Error.Error.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("Token Count: {0}", response.Value.InputTokens);
|
||||||
|
```
|
||||||
|
|
||||||
|
### List Models
|
||||||
|
|
||||||
|
The `AnthropicApiClient` exposes a method named `ListModelsAsync` that can be used to list the available models. The method takes an optional `PagingRequest` instance as a parameter.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
using AnthropicClient;
|
||||||
|
|
||||||
|
var response = await client.ListModelsAsync();
|
||||||
|
|
||||||
|
if (response.IsFailure)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Failed to list models");
|
||||||
|
Console.WriteLine("Error Type: {0}", response.Error.Error.Type);
|
||||||
|
Console.WriteLine("Error Message: {0}", response.Error.Error.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var model in response.Value.Data)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Model Id: {0}", model.Id);
|
||||||
|
Console.WriteLine("Model Name: {0}", model.DisplayName);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Using the `PagingRequest` instance allows you to specify the number of models to return and the page of models to return.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
using AnthropicClient;
|
||||||
|
using AnthropicClient.Models;
|
||||||
|
|
||||||
|
var response = await client.ListModelsAsync(new PagingRequest(afterId: "claude-3-5-sonnet-20241022", limit: 2));
|
||||||
|
|
||||||
|
if (response.IsFailure)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Failed to list models");
|
||||||
|
Console.WriteLine("Error Type: {0}", response.Error.Error.Type);
|
||||||
|
Console.WriteLine("Error Message: {0}", response.Error.Error.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var model in response.Value.Data)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Model Id: {0}", model.Id);
|
||||||
|
Console.WriteLine("Model Name: {0}", model.DisplayName);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Get Model
|
||||||
|
|
||||||
|
The `AnthropicApiClient` exposes a method named `GetModelAsync` that can be used to get a model by its id.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
using AnthropicClient;
|
||||||
|
|
||||||
|
var response = await client.GetModelAsync("claude-3-5-sonnet-20241022");
|
||||||
|
|
||||||
|
if (response.IsFailure)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Failed to get model");
|
||||||
|
Console.WriteLine("Error Type: {0}", response.Error.Error.Type);
|
||||||
|
Console.WriteLine("Error Message: {0}", response.Error.Error.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("Model Id: {0}", response.Value.Id);
|
||||||
|
```
|
||||||
|
|
||||||
### Create a message
|
### Create a message
|
||||||
|
|
||||||
The `AnthropicApiClient` exposes a single method named `CreateMessageAsync` that can be used to create a message. The method requires a `MessageRequest` or a `StreamMessageRequest` instance as a parameter. The `MessageRequest` class is used to create a message whose response is not streamed and the `StreamMessageRequest` class is used to create a message whose response is streamed. The `MessageRequest` instance's properties can be set to configure how the message is created.
|
The `AnthropicApiClient` exposes a method named `CreateMessageAsync` that can be used to create a message. The method requires a `MessageRequest` or a `StreamMessageRequest` instance as a parameter. The `MessageRequest` class is used to create a message whose response is not streamed and the `StreamMessageRequest` class is used to create a message whose response is streamed. The `MessageRequest` instance's properties can be set to configure how the message is created.
|
||||||
|
|
||||||
#### Non-Streaming
|
#### Non-Streaming
|
||||||
|
|
||||||
@@ -694,22 +790,7 @@ foreach (var content in response.Value.Content)
|
|||||||
|
|
||||||
### Prompt Caching
|
### Prompt Caching
|
||||||
|
|
||||||
Anthropic has recently introduced a feature called [Prompt Caching](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching) that allows you to cache all or part of the prompt you send to the model. This can be used to improve the performance of your application by reducing latency and token usage. This feature is covered in depth in [Anthropic's API Documentation](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching).
|
Anthropic provides a feature called [Prompt Caching](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching) that allows you to cache all or part of the prompt you send to the model. This can be used to improve the performance of your application by reducing latency and token usage. This feature is covered in depth in [Anthropic's API Documentation](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching).
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> This feature is in beta and requires you to set an `anthropic-beta` header on your requests to use it.
|
|
||||||
> The value of the header should be `prompt-caching-2024-07-31`.
|
|
||||||
|
|
||||||
When using this library you can opt-in to prompt caching by adding the required header to the `HttpClient` instance you provide to the `AnthropicApiClient` constructor.
|
|
||||||
|
|
||||||
```csharp
|
|
||||||
using AnthropicClient;
|
|
||||||
|
|
||||||
var httpClient = new HttpClient();
|
|
||||||
httpClient.DefaultRequestHeaders.Add("anthropic-beta", "prompt-caching-2024-07-31");
|
|
||||||
|
|
||||||
var client = new AnthropicApiClient(apiKey, httpClient);
|
|
||||||
```
|
|
||||||
|
|
||||||
Prompt caching can be used to cache all parts of the prompt including system messages, user messages, and tools. You should refer to the [Anthropic API Documentation](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching) for specifics on limitations and requirements for using prompt caching. This library aims to make using prompt caching convenient and give you complete control over what parts of the prompt are cached. Currently there is only one type of cache control available - `EphemeralCacheControl`.
|
Prompt caching can be used to cache all parts of the prompt including system messages, user messages, and tools. You should refer to the [Anthropic API Documentation](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching) for specifics on limitations and requirements for using prompt caching. This library aims to make using prompt caching convenient and give you complete control over what parts of the prompt are cached. Currently there is only one type of cache control available - `EphemeralCacheControl`.
|
||||||
|
|
||||||
@@ -847,3 +928,236 @@ foreach (var content in response.Value.Content)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### PDF Support
|
||||||
|
|
||||||
|
Anthropic provides a feature called [PDF Support](https://docs.anthropic.com/en/docs/build-with-claude/pdf-support) that allows Claude to support PDF input and understand both text and visual content within documents. This feature is covered in depth in [Anthropic's API Documentation](https://docs.anthropic.com/en/docs/build-with-claude/pdf-support).
|
||||||
|
|
||||||
|
PDF support can be used to provide a PDF document as input to the model. This can be used to provide additional context to the model or to ask for additional information from the model. This library aims to make using PDF support convenient by allowing you to provide the PDF document you want Anthropic's models to consider for use when creating a message.
|
||||||
|
|
||||||
|
#### PDF Document
|
||||||
|
|
||||||
|
You can provide a PDF document by providing its base64 encoded content as a `DocumentContent` instance in the list of messages in the `MessageRequest` or `StreamMessageRequest` constructor.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
using AnthropicClient;
|
||||||
|
using AnthropicClient.Models;
|
||||||
|
|
||||||
|
var request = new MessageRequest(
|
||||||
|
model: AnthropicModels.Claude35Sonnet,
|
||||||
|
messages: [
|
||||||
|
new(MessageRole.User, [new TextContent("What is the title of this paper?")]),
|
||||||
|
new(MessageRole.User, [new DocumentContent("application/pdf", base64Data)])
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
var response = await client.CreateMessageAsync(request);
|
||||||
|
|
||||||
|
if (response.IsSuccess is false)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Failed to create message");
|
||||||
|
Console.WriteLine("Error Type: {0}", response.Error.Error.Type);
|
||||||
|
Console.WriteLine("Error Message: {0}", response.Error.Error.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var content in response.Value.Content)
|
||||||
|
{
|
||||||
|
switch (content)
|
||||||
|
{
|
||||||
|
case TextContent textContent:
|
||||||
|
Console.WriteLine(textContent.Text);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Message Batches
|
||||||
|
|
||||||
|
Anthropic provides a feature called [Message Batches](https://docs.anthropic.com/en/docs/build-with-claude/message-batches) that allows you to send multiple messages in a single request. This feature is covered in depth in [Anthropic's API Documentation](https://docs.anthropic.com/en/docs/build-with-claude/message-batches).
|
||||||
|
|
||||||
|
#### Create a message batch
|
||||||
|
|
||||||
|
You can create a message batch that will consist of one or more requests to create messages.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
using AnthropicClient;
|
||||||
|
using AnthropicClient.Models;
|
||||||
|
|
||||||
|
var request = new MessageBatchRequest([
|
||||||
|
new(
|
||||||
|
Guid.NewGuid().ToString(),
|
||||||
|
new(
|
||||||
|
model: AnthropicModels.Claude3Haiku,
|
||||||
|
messages: [new(MessageRole.User, [new TextContent("Hello!")])]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
|
||||||
|
var response = await client.CreateMessageBatchAsync(request);
|
||||||
|
|
||||||
|
if (response.IsFailure)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Failed to create message batch");
|
||||||
|
Console.WriteLine("Error Type: {0}", response.Error.Error.Type);
|
||||||
|
Console.WriteLine("Error Message: {0}", response.Error.Error.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("Message Batch Id: {0}", response.Value.Id);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Get a message batch
|
||||||
|
|
||||||
|
You can retrieve a message batch by its id.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
using AnthropicClient;
|
||||||
|
using AnthropicClient.Models;
|
||||||
|
|
||||||
|
var response = await client.GetMessageBatchAsync("batch-id");
|
||||||
|
|
||||||
|
if (response.IsFailure)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Failed to get message batch");
|
||||||
|
Console.WriteLine("Error Type: {0}", response.Error.Error.Type);
|
||||||
|
Console.WriteLine("Error Message: {0}", response.Error.Error.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("Message Batch Id: {0}", response.Value.Id);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Get a message batch results
|
||||||
|
|
||||||
|
You can retrieve the results of a message batch by its id. The results are returned as an `IAsyncEnumerable` collection so that they can be streamed and processed as they are received.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
using AnthropicClient;
|
||||||
|
using AnthropicClient.Models;
|
||||||
|
|
||||||
|
var response = await client.GetMessageBatchResultsAsync("batch-id");
|
||||||
|
|
||||||
|
if (response.IsFailure)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Failed to get message batch results");
|
||||||
|
Console.WriteLine("Error Type: {0}", response.Error.Error.Type);
|
||||||
|
Console.WriteLine("Error Message: {0}", response.Error.Error.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await foreach (var item in response.Value)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Item Custom Id: {0}", result.CustomId);
|
||||||
|
|
||||||
|
switch (item.Result)
|
||||||
|
{
|
||||||
|
case SucceededMessageBatchResult successResult:
|
||||||
|
foreach (var content in successResult.Message.Content)
|
||||||
|
{
|
||||||
|
if (content is TextContent textContent)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Message Batch Result: {0}", textContent.Text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Console.WriteLine("Message Batch Result: {0}", item.Result.Type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### List message batches
|
||||||
|
|
||||||
|
You can retrieve a page of message batches.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
using AnthropicClient;
|
||||||
|
using AnthropicClient.Models;
|
||||||
|
|
||||||
|
var response = await client.ListMessageBatchesAsync();
|
||||||
|
|
||||||
|
if (response.IsFailure)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Failed to list message batches");
|
||||||
|
Console.WriteLine("Error Type: {0}", response.Error.Error.Type);
|
||||||
|
Console.WriteLine("Error Message: {0}", response.Error.Error.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var batch in response.Value.Data)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Message Batch Id: {0}", batch.Id);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### List all message batches
|
||||||
|
|
||||||
|
You can also retrieve all the pages of message batches without having to implement pagination yourself. This is done by returning an `IAsyncEnumerable` collection that can be streamed and processed as the pages are received.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
using AnthropicClient;
|
||||||
|
using AnthropicClient.Models;
|
||||||
|
|
||||||
|
var pageResponses = client.ListAllMessageBatchesAsync();
|
||||||
|
|
||||||
|
await foreach (var response in pageResponses)
|
||||||
|
{
|
||||||
|
if (response.IsFailure)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Failed to list message batches");
|
||||||
|
Console.WriteLine("Error Type: {0}", response.Error.Error.Type);
|
||||||
|
Console.WriteLine("Error Message: {0}", response.Error.Error.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var batch in response.Value.Data)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Message Batch Id: {0}", batch.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Cancel a message batch
|
||||||
|
|
||||||
|
You can cancel a message batch by its id.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
using AnthropicClient;
|
||||||
|
using AnthropicClient.Models;
|
||||||
|
|
||||||
|
var response = await client.CancelMessageBatchAsync("batch-id");
|
||||||
|
|
||||||
|
if (response.IsFailure)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Failed to cancel message batch");
|
||||||
|
Console.WriteLine("Error Type: {0}", response.Error.Error.Type);
|
||||||
|
Console.WriteLine("Error Message: {0}", response.Error.Error.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("Message Batch Id: {0}", response.Value.Id);
|
||||||
|
Console.WriteLine("Message Batch Status: {0}", response.Value.ProcessingStatus);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Delete a message batch
|
||||||
|
|
||||||
|
You can delete a message batch that is no longer being processed by its id.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
using AnthropicClient;
|
||||||
|
using AnthropicClient.Models;
|
||||||
|
|
||||||
|
var response = await client.DeleteMessageBatchAsync("batch-id");
|
||||||
|
|
||||||
|
if (response.IsFailure)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Failed to delete message batch");
|
||||||
|
Console.WriteLine("Error Type: {0}", response.Error.Error.Type);
|
||||||
|
Console.WriteLine("Error Message: {0}", response.Error.Error.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("Message Batch Id: {0}", response.Value.Id);
|
||||||
|
```
|
||||||
|
|||||||
@@ -89,7 +89,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<h1 id="AnthropicClient_AnthropicApiClient" data-uid="AnthropicClient.AnthropicApiClient" class="text-break">
|
<h1 id="AnthropicClient_AnthropicApiClient" data-uid="AnthropicClient.AnthropicApiClient" class="text-break">
|
||||||
Class AnthropicApiClient <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L32"><i class="bi bi-code-slash"></i></a>
|
Class AnthropicApiClient <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L62"><i class="bi bi-code-slash"></i></a>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div class="facts text-secondary">
|
<div class="facts text-secondary">
|
||||||
@@ -163,7 +163,7 @@ Class AnthropicApiClient <a class="header-action link-secondary" title="View so
|
|||||||
|
|
||||||
<h3 id="AnthropicClient_AnthropicApiClient__ctor_System_String_System_Net_Http_HttpClient_" data-uid="AnthropicClient.AnthropicApiClient.#ctor(System.String,System.Net.Http.HttpClient)">
|
<h3 id="AnthropicClient_AnthropicApiClient__ctor_System_String_System_Net_Http_HttpClient_" data-uid="AnthropicClient.AnthropicApiClient.#ctor(System.String,System.Net.Http.HttpClient)">
|
||||||
AnthropicApiClient(string, HttpClient)
|
AnthropicApiClient(string, HttpClient)
|
||||||
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L53"><i class="bi bi-code-slash"></i></a>
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L85"><i class="bi bi-code-slash"></i></a>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.AnthropicApiClient.html">AnthropicApiClient</a> class.</p>
|
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.AnthropicApiClient.html">AnthropicApiClient</a> class.</p>
|
||||||
@@ -205,11 +205,50 @@ Class AnthropicApiClient <a class="header-action link-secondary" title="View so
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_AnthropicApiClient_CountMessageTokensAsync_" data-uid="AnthropicClient.AnthropicApiClient.CountMessageTokensAsync*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_AnthropicApiClient_CountMessageTokensAsync_AnthropicClient_Models_CountMessageTokensRequest_" data-uid="AnthropicClient.AnthropicApiClient.CountMessageTokensAsync(AnthropicClient.Models.CountMessageTokensRequest)">
|
||||||
|
CountMessageTokensAsync(CountMessageTokensRequest)
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L291"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Counts the tokens in a message asynchronously.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public Task<AnthropicResult<TokenCountResponse>> CountMessageTokensAsync(CountMessageTokensRequest request)</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="section">Parameters</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><code>request</code> <a class="xref" href="AnthropicClient.Models.CountMessageTokensRequest.html">CountMessageTokensRequest</a></dt>
|
||||||
|
<dd><p>The count message tokens request.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<h4 class="section">Returns</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="AnthropicClient.Models.TokenCountResponse.html">TokenCountResponse</a>>></dt>
|
||||||
|
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult<T></a> where T is <a class="xref" href="AnthropicClient.Models.TokenCountResponse.html">TokenCountResponse</a>.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a id="AnthropicClient_AnthropicApiClient_CreateMessageAsync_" data-uid="AnthropicClient.AnthropicApiClient.CreateMessageAsync*"></a>
|
<a id="AnthropicClient_AnthropicApiClient_CreateMessageAsync_" data-uid="AnthropicClient.AnthropicApiClient.CreateMessageAsync*"></a>
|
||||||
|
|
||||||
<h3 id="AnthropicClient_AnthropicApiClient_CreateMessageAsync_AnthropicClient_Models_MessageRequest_" data-uid="AnthropicClient.AnthropicApiClient.CreateMessageAsync(AnthropicClient.Models.MessageRequest)">
|
<h3 id="AnthropicClient_AnthropicApiClient_CreateMessageAsync_AnthropicClient_Models_MessageRequest_" data-uid="AnthropicClient.AnthropicApiClient.CreateMessageAsync(AnthropicClient.Models.MessageRequest)">
|
||||||
CreateMessageAsync(MessageRequest)
|
CreateMessageAsync(MessageRequest)
|
||||||
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L72"><i class="bi bi-code-slash"></i></a>
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L104"><i class="bi bi-code-slash"></i></a>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div class="markdown level1 summary"><p>Creates a message asynchronously.</p>
|
<div class="markdown level1 summary"><p>Creates a message asynchronously.</p>
|
||||||
@@ -248,7 +287,7 @@ Class AnthropicApiClient <a class="header-action link-secondary" title="View so
|
|||||||
|
|
||||||
<h3 id="AnthropicClient_AnthropicApiClient_CreateMessageAsync_AnthropicClient_Models_StreamMessageRequest_" data-uid="AnthropicClient.AnthropicApiClient.CreateMessageAsync(AnthropicClient.Models.StreamMessageRequest)">
|
<h3 id="AnthropicClient_AnthropicApiClient_CreateMessageAsync_AnthropicClient_Models_StreamMessageRequest_" data-uid="AnthropicClient.AnthropicApiClient.CreateMessageAsync(AnthropicClient.Models.StreamMessageRequest)">
|
||||||
CreateMessageAsync(StreamMessageRequest)
|
CreateMessageAsync(StreamMessageRequest)
|
||||||
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L95"><i class="bi bi-code-slash"></i></a>
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L127"><i class="bi bi-code-slash"></i></a>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div class="markdown level1 summary"><p>Creates a message asynchronously and streams the response.</p>
|
<div class="markdown level1 summary"><p>Creates a message asynchronously and streams the response.</p>
|
||||||
@@ -283,11 +322,128 @@ Class AnthropicApiClient <a class="header-action link-secondary" title="View so
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_AnthropicApiClient_GetModelAsync_" data-uid="AnthropicClient.AnthropicApiClient.GetModelAsync*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_AnthropicApiClient_GetModelAsync_System_String_" data-uid="AnthropicClient.AnthropicApiClient.GetModelAsync(System.String)">
|
||||||
|
GetModelAsync(string)
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L363"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Gets a model by its ID asynchronously.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public Task<AnthropicResult<AnthropicModel>> GetModelAsync(string modelId)</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="section">Parameters</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><code>modelId</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd><p>The ID of the model to get.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<h4 class="section">Returns</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="AnthropicClient.Models.AnthropicModel.html">AnthropicModel</a>>></dt>
|
||||||
|
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult<T></a> where T is <a class="xref" href="AnthropicClient.Models.AnthropicModel.html">AnthropicModel</a>.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_AnthropicApiClient_ListAllModelsAsync_" data-uid="AnthropicClient.AnthropicApiClient.ListAllModelsAsync*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_AnthropicApiClient_ListAllModelsAsync_System_Int32_" data-uid="AnthropicClient.AnthropicApiClient.ListAllModelsAsync(System.Int32)">
|
||||||
|
ListAllModelsAsync(int)
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L327"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Lists the models asynchronously</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public IAsyncEnumerable<AnthropicResult<Page<AnthropicModel>>> ListAllModelsAsync(int limit = 20)</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="section">Parameters</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><code>limit</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
|
||||||
|
<dd><p>The maximum number of models to return in each page.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<h4 class="section">Returns</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerable-1">IAsyncEnumerable</a><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="AnthropicClient.Models.Page-1.html">Page</a><<a class="xref" href="AnthropicClient.Models.AnthropicModel.html">AnthropicModel</a>>>></dt>
|
||||||
|
<dd><p>An asynchronous enumerable that yields the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult<T></a> where T is <a class="xref" href="AnthropicClient.Models.Page-1.html">Page<T></a> where T is <a class="xref" href="AnthropicClient.Models.AnthropicModel.html">AnthropicModel</a>.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_AnthropicApiClient_ListModelsAsync_" data-uid="AnthropicClient.AnthropicApiClient.ListModelsAsync*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_AnthropicApiClient_ListModelsAsync_AnthropicClient_Models_PagingRequest_" data-uid="AnthropicClient.AnthropicApiClient.ListModelsAsync(AnthropicClient.Models.PagingRequest)">
|
||||||
|
ListModelsAsync(PagingRequest?)
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L308"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Lists the models asynchronously.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public Task<AnthropicResult<Page<AnthropicModel>>> ListModelsAsync(PagingRequest? request = null)</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="section">Parameters</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><code>request</code> <a class="xref" href="AnthropicClient.Models.PagingRequest.html">PagingRequest</a></dt>
|
||||||
|
<dd><p>The paging request to use for listing the models.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<h4 class="section">Returns</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="AnthropicClient.Models.Page-1.html">Page</a><<a class="xref" href="AnthropicClient.Models.AnthropicModel.html">AnthropicModel</a>>>></dt>
|
||||||
|
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult<T></a> where T is <a class="xref" href="AnthropicClient.Models.Page-1.html">Page<T></a> where T is <a class="xref" href="AnthropicClient.Models.AnthropicModel.html">AnthropicModel</a>.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<div class="contribution d-print-none">
|
<div class="contribution d-print-none">
|
||||||
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L32" class="edit-link">Edit this page</a>
|
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L62" class="edit-link">Edit this page</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<h1 id="AnthropicClient_IAnthropicApiClient" data-uid="AnthropicClient.IAnthropicApiClient" class="text-break">
|
<h1 id="AnthropicClient_IAnthropicApiClient" data-uid="AnthropicClient.IAnthropicApiClient" class="text-break">
|
||||||
Interface IAnthropicApiClient <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L14"><i class="bi bi-code-slash"></i></a>
|
Interface IAnthropicApiClient <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L15"><i class="bi bi-code-slash"></i></a>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div class="facts text-secondary">
|
<div class="facts text-secondary">
|
||||||
@@ -121,11 +121,50 @@ Interface IAnthropicApiClient <a class="header-action link-secondary" title="Vi
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_IAnthropicApiClient_CountMessageTokensAsync_" data-uid="AnthropicClient.IAnthropicApiClient.CountMessageTokensAsync*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_IAnthropicApiClient_CountMessageTokensAsync_AnthropicClient_Models_CountMessageTokensRequest_" data-uid="AnthropicClient.IAnthropicApiClient.CountMessageTokensAsync(AnthropicClient.Models.CountMessageTokensRequest)">
|
||||||
|
CountMessageTokensAsync(CountMessageTokensRequest)
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L36"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Counts the tokens in a message asynchronously.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">Task<AnthropicResult<TokenCountResponse>> CountMessageTokensAsync(CountMessageTokensRequest request)</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="section">Parameters</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><code>request</code> <a class="xref" href="AnthropicClient.Models.CountMessageTokensRequest.html">CountMessageTokensRequest</a></dt>
|
||||||
|
<dd><p>The count message tokens request.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<h4 class="section">Returns</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="AnthropicClient.Models.TokenCountResponse.html">TokenCountResponse</a>>></dt>
|
||||||
|
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult<T></a> where T is <a class="xref" href="AnthropicClient.Models.TokenCountResponse.html">TokenCountResponse</a>.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a id="AnthropicClient_IAnthropicApiClient_CreateMessageAsync_" data-uid="AnthropicClient.IAnthropicApiClient.CreateMessageAsync*"></a>
|
<a id="AnthropicClient_IAnthropicApiClient_CreateMessageAsync_" data-uid="AnthropicClient.IAnthropicApiClient.CreateMessageAsync*"></a>
|
||||||
|
|
||||||
<h3 id="AnthropicClient_IAnthropicApiClient_CreateMessageAsync_AnthropicClient_Models_MessageRequest_" data-uid="AnthropicClient.IAnthropicApiClient.CreateMessageAsync(AnthropicClient.Models.MessageRequest)">
|
<h3 id="AnthropicClient_IAnthropicApiClient_CreateMessageAsync_AnthropicClient_Models_MessageRequest_" data-uid="AnthropicClient.IAnthropicApiClient.CreateMessageAsync(AnthropicClient.Models.MessageRequest)">
|
||||||
CreateMessageAsync(MessageRequest)
|
CreateMessageAsync(MessageRequest)
|
||||||
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L21"><i class="bi bi-code-slash"></i></a>
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L22"><i class="bi bi-code-slash"></i></a>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div class="markdown level1 summary"><p>Creates a message asynchronously.</p>
|
<div class="markdown level1 summary"><p>Creates a message asynchronously.</p>
|
||||||
@@ -164,7 +203,7 @@ Interface IAnthropicApiClient <a class="header-action link-secondary" title="Vi
|
|||||||
|
|
||||||
<h3 id="AnthropicClient_IAnthropicApiClient_CreateMessageAsync_AnthropicClient_Models_StreamMessageRequest_" data-uid="AnthropicClient.IAnthropicApiClient.CreateMessageAsync(AnthropicClient.Models.StreamMessageRequest)">
|
<h3 id="AnthropicClient_IAnthropicApiClient_CreateMessageAsync_AnthropicClient_Models_StreamMessageRequest_" data-uid="AnthropicClient.IAnthropicApiClient.CreateMessageAsync(AnthropicClient.Models.StreamMessageRequest)">
|
||||||
CreateMessageAsync(StreamMessageRequest)
|
CreateMessageAsync(StreamMessageRequest)
|
||||||
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L28"><i class="bi bi-code-slash"></i></a>
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L29"><i class="bi bi-code-slash"></i></a>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div class="markdown level1 summary"><p>Creates a message asynchronously and streams the response.</p>
|
<div class="markdown level1 summary"><p>Creates a message asynchronously and streams the response.</p>
|
||||||
@@ -199,11 +238,128 @@ Interface IAnthropicApiClient <a class="header-action link-secondary" title="Vi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_IAnthropicApiClient_GetModelAsync_" data-uid="AnthropicClient.IAnthropicApiClient.GetModelAsync*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_IAnthropicApiClient_GetModelAsync_System_String_" data-uid="AnthropicClient.IAnthropicApiClient.GetModelAsync(System.String)">
|
||||||
|
GetModelAsync(string)
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L58"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Gets a model by its ID asynchronously.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">Task<AnthropicResult<AnthropicModel>> GetModelAsync(string modelId)</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="section">Parameters</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><code>modelId</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd><p>The ID of the model to get.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<h4 class="section">Returns</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="AnthropicClient.Models.AnthropicModel.html">AnthropicModel</a>>></dt>
|
||||||
|
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult<T></a> where T is <a class="xref" href="AnthropicClient.Models.AnthropicModel.html">AnthropicModel</a>.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_IAnthropicApiClient_ListAllModelsAsync_" data-uid="AnthropicClient.IAnthropicApiClient.ListAllModelsAsync*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_IAnthropicApiClient_ListAllModelsAsync_System_Int32_" data-uid="AnthropicClient.IAnthropicApiClient.ListAllModelsAsync(System.Int32)">
|
||||||
|
ListAllModelsAsync(int)
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L51"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Lists the models asynchronously</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">IAsyncEnumerable<AnthropicResult<Page<AnthropicModel>>> ListAllModelsAsync(int limit = 20)</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="section">Parameters</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><code>limit</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
|
||||||
|
<dd><p>The maximum number of models to return in each page.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<h4 class="section">Returns</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerable-1">IAsyncEnumerable</a><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="AnthropicClient.Models.Page-1.html">Page</a><<a class="xref" href="AnthropicClient.Models.AnthropicModel.html">AnthropicModel</a>>>></dt>
|
||||||
|
<dd><p>An asynchronous enumerable that yields the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult<T></a> where T is <a class="xref" href="AnthropicClient.Models.Page-1.html">Page<T></a> where T is <a class="xref" href="AnthropicClient.Models.AnthropicModel.html">AnthropicModel</a>.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_IAnthropicApiClient_ListModelsAsync_" data-uid="AnthropicClient.IAnthropicApiClient.ListModelsAsync*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_IAnthropicApiClient_ListModelsAsync_AnthropicClient_Models_PagingRequest_" data-uid="AnthropicClient.IAnthropicApiClient.ListModelsAsync(AnthropicClient.Models.PagingRequest)">
|
||||||
|
ListModelsAsync(PagingRequest?)
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L43"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Lists the models asynchronously.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">Task<AnthropicResult<Page<AnthropicModel>>> ListModelsAsync(PagingRequest? request = null)</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="section">Parameters</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><code>request</code> <a class="xref" href="AnthropicClient.Models.PagingRequest.html">PagingRequest</a></dt>
|
||||||
|
<dd><p>The paging request to use for listing the models.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<h4 class="section">Returns</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="AnthropicClient.Models.Page-1.html">Page</a><<a class="xref" href="AnthropicClient.Models.AnthropicModel.html">AnthropicModel</a>>>></dt>
|
||||||
|
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult<T></a> where T is <a class="xref" href="AnthropicClient.Models.Page-1.html">Page<T></a> where T is <a class="xref" href="AnthropicClient.Models.AnthropicModel.html">AnthropicModel</a>.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<div class="contribution d-print-none">
|
<div class="contribution d-print-none">
|
||||||
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L14" class="edit-link">Edit this page</a>
|
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L15" class="edit-link">Edit this page</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,311 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Class AnthropicModel | AnthropicClient </title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="title" content="Class AnthropicModel | AnthropicClient ">
|
||||||
|
|
||||||
|
<meta name="description" content="Represents an Anthropic model.">
|
||||||
|
<link rel="icon" href="../favicon.ico">
|
||||||
|
<link rel="stylesheet" href="../public/docfx.min.css">
|
||||||
|
<link rel="stylesheet" href="../public/main.css">
|
||||||
|
<meta name="docfx:navrel" content="../toc.html">
|
||||||
|
<meta name="docfx:tocrel" content="toc.html">
|
||||||
|
|
||||||
|
<meta name="docfx:rel" content="../">
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="docfx:docurl" content="https://github.com/StevanFreeborn/anthropic-client/new/main/apiSpec/new?filename=AnthropicClient_Models_AnthropicModel.md&value=---%0Auid%3A%20AnthropicClient.Models.AnthropicModel%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">
|
||||||
|
<meta name="loc:inThisArticle" content="In this article">
|
||||||
|
<meta name="loc:searchResultsCount" content="{count} results for "{query}"">
|
||||||
|
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
||||||
|
<meta name="loc:tocFilter" content="Filter by title">
|
||||||
|
<meta name="loc:nextArticle" content="Next">
|
||||||
|
<meta name="loc:prevArticle" content="Previous">
|
||||||
|
<meta name="loc:themeLight" content="Light">
|
||||||
|
<meta name="loc:themeDark" content="Dark">
|
||||||
|
<meta name="loc:themeAuto" content="Auto">
|
||||||
|
<meta name="loc:changeTheme" content="Change theme">
|
||||||
|
<meta name="loc:copy" content="Copy">
|
||||||
|
<meta name="loc:downloadPdf" content="Download PDF">
|
||||||
|
|
||||||
|
<script type="module" src="./../public/docfx.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const theme = localStorage.getItem('theme') || 'auto'
|
||||||
|
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
|
||||||
|
<header class="bg-body border-bottom">
|
||||||
|
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
|
||||||
|
<div class="container-xxl flex-nowrap">
|
||||||
|
<a class="navbar-brand" href="../index.html">
|
||||||
|
<img id="logo" class="svg" src="../logo.svg" alt="AnthropicClient">
|
||||||
|
AnthropicClient
|
||||||
|
</a>
|
||||||
|
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<i class="bi bi-three-dots"></i>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navpanel">
|
||||||
|
<div id="navbar">
|
||||||
|
<form class="search" role="search" id="search">
|
||||||
|
<i class="bi bi-search"></i>
|
||||||
|
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="container-xxl">
|
||||||
|
<div class="toc-offcanvas">
|
||||||
|
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
|
||||||
|
<div class="offcanvas-header">
|
||||||
|
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="offcanvas-body">
|
||||||
|
<nav class="toc" id="toc"></nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<div class="actionbar">
|
||||||
|
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
|
||||||
|
<i class="bi bi-list"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<nav id="breadcrumb"></nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article data-uid="AnthropicClient.Models.AnthropicModel">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 id="AnthropicClient_Models_AnthropicModel" data-uid="AnthropicClient.Models.AnthropicModel" class="text-break">
|
||||||
|
Class AnthropicModel <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModel.cs/#L8"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div class="facts text-secondary">
|
||||||
|
<dl><dt>Namespace</dt><dd><a class="xref" href="AnthropicClient.html">AnthropicClient</a>.<a class="xref" href="AnthropicClient.Models.html">Models</a></dd></dl>
|
||||||
|
<dl><dt>Assembly</dt><dd>AnthropicClient.dll</dd></dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="markdown summary"><p>Represents an Anthropic model.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public class AnthropicModel</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="typelist inheritance">
|
||||||
|
<dt>Inheritance</dt>
|
||||||
|
<dd>
|
||||||
|
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
|
||||||
|
<div><span class="xref">AnthropicModel</span></div>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="typelist inheritedMembers">
|
||||||
|
<dt>Inherited Members</dt>
|
||||||
|
<dd>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
|
||||||
|
</div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2 class="section" id="properties">Properties
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_AnthropicModel_CreatedAt_" data-uid="AnthropicClient.Models.AnthropicModel.CreatedAt*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_AnthropicModel_CreatedAt" data-uid="AnthropicClient.Models.AnthropicModel.CreatedAt">
|
||||||
|
CreatedAt
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModel.cs/#L29"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The created date of the model.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">[JsonPropertyName("created_at")]
|
||||||
|
public DateTimeOffset CreatedAt { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.datetimeoffset">DateTimeOffset</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_AnthropicModel_DisplayName_" data-uid="AnthropicClient.Models.AnthropicModel.DisplayName*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_AnthropicModel_DisplayName" data-uid="AnthropicClient.Models.AnthropicModel.DisplayName">
|
||||||
|
DisplayName
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModel.cs/#L23"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The display name of the model.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">[JsonPropertyName("display_name")]
|
||||||
|
public string DisplayName { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_AnthropicModel_Id_" data-uid="AnthropicClient.Models.AnthropicModel.Id*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_AnthropicModel_Id" data-uid="AnthropicClient.Models.AnthropicModel.Id">
|
||||||
|
Id
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModel.cs/#L18"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The id of the model.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public string Id { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_AnthropicModel_Type_" data-uid="AnthropicClient.Models.AnthropicModel.Type*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_AnthropicModel_Type" data-uid="AnthropicClient.Models.AnthropicModel.Type">
|
||||||
|
Type
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModel.cs/#L13"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The type of the model.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public string Type { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<div class="contribution d-print-none">
|
||||||
|
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModel.cs/#L8" class="edit-link">Edit this page</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="affix">
|
||||||
|
<nav id="affix"></nav>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<div class="container-xxl search-results" id="search-results"></div>
|
||||||
|
|
||||||
|
<footer class="border-top text-secondary">
|
||||||
|
<div class="container-xxl">
|
||||||
|
<div class="flex-fill">
|
||||||
|
<span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -154,12 +154,74 @@ Class AnthropicModels <a class="header-action link-secondary" title="View sourc
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h3 id="AnthropicClient_Models_AnthropicModels_Claude35Sonnet" data-uid="AnthropicClient.Models.AnthropicModels.Claude35Sonnet">
|
<h3 id="AnthropicClient_Models_AnthropicModels_Claude35Haiku20241022" data-uid="AnthropicClient.Models.AnthropicModels.Claude35Haiku20241022">
|
||||||
Claude35Sonnet
|
Claude35Haiku20241022
|
||||||
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L21"><i class="bi bi-code-slash"></i></a>
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L66"><i class="bi bi-code-slash"></i></a>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div class="markdown level1 summary"><p>The Claude-3.5 Sonnet model.</p>
|
<div class="markdown level1 summary"><p>The Claude 3.5 Haiku model.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public const string Claude35Haiku20241022 = "claude-3-5-haiku-20241022"</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Field Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_AnthropicModels_Claude35HaikuLatest" data-uid="AnthropicClient.Models.AnthropicModels.Claude35HaikuLatest">
|
||||||
|
Claude35HaikuLatest
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L71"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The Claude 3.5 Haiku model.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public const string Claude35HaikuLatest = "claude-3-5-haiku-latest"</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Field Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_AnthropicModels_Claude35Sonnet" data-uid="AnthropicClient.Models.AnthropicModels.Claude35Sonnet">
|
||||||
|
Claude35Sonnet
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L36"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The Claude 3.5 Sonnet model.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="markdown level1 conceptual"></div>
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
@@ -185,12 +247,105 @@ Class AnthropicModels <a class="header-action link-secondary" title="View sourc
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h3 id="AnthropicClient_Models_AnthropicModels_Claude3Haiku" data-uid="AnthropicClient.Models.AnthropicModels.Claude3Haiku">
|
<h3 id="AnthropicClient_Models_AnthropicModels_Claude35Sonnet20240620" data-uid="AnthropicClient.Models.AnthropicModels.Claude35Sonnet20240620">
|
||||||
Claude3Haiku
|
Claude35Sonnet20240620
|
||||||
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L26"><i class="bi bi-code-slash"></i></a>
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L41"><i class="bi bi-code-slash"></i></a>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div class="markdown level1 summary"><p>The Claude-3 Haiku model.</p>
|
<div class="markdown level1 summary"><p>The Claude 3.5 Sonnet model.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public const string Claude35Sonnet20240620 = "claude-3-5-sonnet-20240620"</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Field Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_AnthropicModels_Claude35Sonnet20241022" data-uid="AnthropicClient.Models.AnthropicModels.Claude35Sonnet20241022">
|
||||||
|
Claude35Sonnet20241022
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L46"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The Claude 3.5 Sonnet model.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public const string Claude35Sonnet20241022 = "claude-3-5-sonnet-20241022"</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Field Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_AnthropicModels_Claude35SonnetLatest" data-uid="AnthropicClient.Models.AnthropicModels.Claude35SonnetLatest">
|
||||||
|
Claude35SonnetLatest
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L51"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The Claude 3.5 Sonnet model.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public const string Claude35SonnetLatest = "claude-3-5-sonnet-latest"</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Field Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_AnthropicModels_Claude3Haiku" data-uid="AnthropicClient.Models.AnthropicModels.Claude3Haiku">
|
||||||
|
Claude3Haiku
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L56"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The Claude 3 Haiku model.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="markdown level1 conceptual"></div>
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
@@ -216,12 +371,43 @@ Class AnthropicModels <a class="header-action link-secondary" title="View sourc
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_AnthropicModels_Claude3Haiku20240307" data-uid="AnthropicClient.Models.AnthropicModels.Claude3Haiku20240307">
|
||||||
|
Claude3Haiku20240307
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L61"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The Claude 3 Haiku model.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public const string Claude3Haiku20240307 = "claude-3-haiku-20240307"</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Field Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h3 id="AnthropicClient_Models_AnthropicModels_Claude3Opus" data-uid="AnthropicClient.Models.AnthropicModels.Claude3Opus">
|
<h3 id="AnthropicClient_Models_AnthropicModels_Claude3Opus" data-uid="AnthropicClient.Models.AnthropicModels.Claude3Opus">
|
||||||
Claude3Opus
|
Claude3Opus
|
||||||
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L11"><i class="bi bi-code-slash"></i></a>
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L11"><i class="bi bi-code-slash"></i></a>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div class="markdown level1 summary"><p>The Claude-3 Opus model.</p>
|
<div class="markdown level1 summary"><p>The Claude 3 Opus model.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="markdown level1 conceptual"></div>
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
@@ -247,12 +433,74 @@ Class AnthropicModels <a class="header-action link-secondary" title="View sourc
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h3 id="AnthropicClient_Models_AnthropicModels_Claude3Sonnet" data-uid="AnthropicClient.Models.AnthropicModels.Claude3Sonnet">
|
<h3 id="AnthropicClient_Models_AnthropicModels_Claude3Opus20241022" data-uid="AnthropicClient.Models.AnthropicModels.Claude3Opus20241022">
|
||||||
Claude3Sonnet
|
Claude3Opus20241022
|
||||||
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L16"><i class="bi bi-code-slash"></i></a>
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L16"><i class="bi bi-code-slash"></i></a>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div class="markdown level1 summary"><p>The Claude-3 Sonnet model.</p>
|
<div class="markdown level1 summary"><p>The Claude 3 Opus model.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public const string Claude3Opus20241022 = "claude-3-opus-20240229"</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Field Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_AnthropicModels_Claude3OpusLatest" data-uid="AnthropicClient.Models.AnthropicModels.Claude3OpusLatest">
|
||||||
|
Claude3OpusLatest
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L21"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The Claude 3 Opus model.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public const string Claude3OpusLatest = "claude-3-opus-latest"</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Field Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_AnthropicModels_Claude3Sonnet" data-uid="AnthropicClient.Models.AnthropicModels.Claude3Sonnet">
|
||||||
|
Claude3Sonnet
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L26"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The Claude 3 Sonnet model.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="markdown level1 conceptual"></div>
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
@@ -278,6 +526,37 @@ Class AnthropicModels <a class="header-action link-secondary" title="View sourc
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_AnthropicModels_Claude3Sonnet20240229" data-uid="AnthropicClient.Models.AnthropicModels.Claude3Sonnet20240229">
|
||||||
|
Claude3Sonnet20240229
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L31"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The Claude 3 Sonnet model.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public const string Claude3Sonnet20240229 = "claude-3-sonnet-20240229"</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Field Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<div class="contribution d-print-none">
|
<div class="contribution d-print-none">
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ Class BaseMessageRequest <a class="header-action link-secondary" title="View so
|
|||||||
|
|
||||||
<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__System_Collections_Generic_List_AnthropicClient_Models_TextContent__" 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},System.Collections.Generic.List{AnthropicClient.Models.TextContent})">
|
<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__System_Collections_Generic_List_AnthropicClient_Models_TextContent__" 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},System.Collections.Generic.List{AnthropicClient.Models.TextContent})">
|
||||||
BaseMessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, bool, List<string>?, List<TextContent>?)
|
BaseMessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, bool, List<string>?, List<TextContent>?)
|
||||||
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/BaseMessageRequest.cs/#L135"><i class="bi bi-code-slash"></i></a>
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/BaseMessageRequest.cs/#L134"><i class="bi bi-code-slash"></i></a>
|
||||||
</h3>
|
</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>
|
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.Models.BaseMessageRequest.html">BaseMessageRequest</a> class.</p>
|
||||||
@@ -228,9 +228,6 @@ Class BaseMessageRequest <a class="header-action link-secondary" title="View so
|
|||||||
|
|
||||||
<h4 class="section">Exceptions</h4>
|
<h4 class="section">Exceptions</h4>
|
||||||
<dl class="parameters">
|
<dl class="parameters">
|
||||||
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentexception">ArgumentException</a></dt>
|
|
||||||
<dd><p>Thrown when the model ID is invalid.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
|
||||||
<dd><p>Thrown when the model or messages is null.</p>
|
<dd><p>Thrown when the model or messages is null.</p>
|
||||||
</dd>
|
</dd>
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ Class Content <a class="header-action link-secondary" title="View source" href=
|
|||||||
<dl class="typelist derived">
|
<dl class="typelist derived">
|
||||||
<dt>Derived</dt>
|
<dt>Derived</dt>
|
||||||
<dd>
|
<dd>
|
||||||
|
<div><a class="xref" href="AnthropicClient.Models.DocumentContent.html">DocumentContent</a></div>
|
||||||
<div><a class="xref" href="AnthropicClient.Models.ImageContent.html">ImageContent</a></div>
|
<div><a class="xref" href="AnthropicClient.Models.ImageContent.html">ImageContent</a></div>
|
||||||
<div><a class="xref" href="AnthropicClient.Models.TextContent.html">TextContent</a></div>
|
<div><a class="xref" href="AnthropicClient.Models.TextContent.html">TextContent</a></div>
|
||||||
<div><a class="xref" href="AnthropicClient.Models.ToolResultContent.html">ToolResultContent</a></div>
|
<div><a class="xref" href="AnthropicClient.Models.ToolResultContent.html">ToolResultContent</a></div>
|
||||||
|
|||||||
@@ -154,6 +154,37 @@ Class ContentType <a class="header-action link-secondary" title="View source" h
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_ContentType_Document" data-uid="AnthropicClient.Models.ContentType.Document">
|
||||||
|
Document
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/ContentType.cs/#L31"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Represents the document content type.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public const string Document = "document"</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Field Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h3 id="AnthropicClient_Models_ContentType_Image" data-uid="AnthropicClient.Models.ContentType.Image">
|
<h3 id="AnthropicClient_Models_ContentType_Image" data-uid="AnthropicClient.Models.ContentType.Image">
|
||||||
Image
|
Image
|
||||||
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/ContentType.cs/#L16"><i class="bi bi-code-slash"></i></a>
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/ContentType.cs/#L16"><i class="bi bi-code-slash"></i></a>
|
||||||
|
|||||||
@@ -0,0 +1,401 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Class CountMessageTokensRequest | AnthropicClient </title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="title" content="Class CountMessageTokensRequest | AnthropicClient ">
|
||||||
|
|
||||||
|
<meta name="description" content="Represents a request to count the number of tokens in a message.">
|
||||||
|
<link rel="icon" href="../favicon.ico">
|
||||||
|
<link rel="stylesheet" href="../public/docfx.min.css">
|
||||||
|
<link rel="stylesheet" href="../public/main.css">
|
||||||
|
<meta name="docfx:navrel" content="../toc.html">
|
||||||
|
<meta name="docfx:tocrel" content="toc.html">
|
||||||
|
|
||||||
|
<meta name="docfx:rel" content="../">
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="docfx:docurl" content="https://github.com/StevanFreeborn/anthropic-client/new/main/apiSpec/new?filename=AnthropicClient_Models_CountMessageTokensRequest.md&value=---%0Auid%3A%20AnthropicClient.Models.CountMessageTokensRequest%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">
|
||||||
|
<meta name="loc:inThisArticle" content="In this article">
|
||||||
|
<meta name="loc:searchResultsCount" content="{count} results for "{query}"">
|
||||||
|
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
||||||
|
<meta name="loc:tocFilter" content="Filter by title">
|
||||||
|
<meta name="loc:nextArticle" content="Next">
|
||||||
|
<meta name="loc:prevArticle" content="Previous">
|
||||||
|
<meta name="loc:themeLight" content="Light">
|
||||||
|
<meta name="loc:themeDark" content="Dark">
|
||||||
|
<meta name="loc:themeAuto" content="Auto">
|
||||||
|
<meta name="loc:changeTheme" content="Change theme">
|
||||||
|
<meta name="loc:copy" content="Copy">
|
||||||
|
<meta name="loc:downloadPdf" content="Download PDF">
|
||||||
|
|
||||||
|
<script type="module" src="./../public/docfx.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const theme = localStorage.getItem('theme') || 'auto'
|
||||||
|
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
|
||||||
|
<header class="bg-body border-bottom">
|
||||||
|
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
|
||||||
|
<div class="container-xxl flex-nowrap">
|
||||||
|
<a class="navbar-brand" href="../index.html">
|
||||||
|
<img id="logo" class="svg" src="../logo.svg" alt="AnthropicClient">
|
||||||
|
AnthropicClient
|
||||||
|
</a>
|
||||||
|
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<i class="bi bi-three-dots"></i>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navpanel">
|
||||||
|
<div id="navbar">
|
||||||
|
<form class="search" role="search" id="search">
|
||||||
|
<i class="bi bi-search"></i>
|
||||||
|
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="container-xxl">
|
||||||
|
<div class="toc-offcanvas">
|
||||||
|
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
|
||||||
|
<div class="offcanvas-header">
|
||||||
|
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="offcanvas-body">
|
||||||
|
<nav class="toc" id="toc"></nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<div class="actionbar">
|
||||||
|
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
|
||||||
|
<i class="bi bi-list"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<nav id="breadcrumb"></nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article data-uid="AnthropicClient.Models.CountMessageTokensRequest">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 id="AnthropicClient_Models_CountMessageTokensRequest" data-uid="AnthropicClient.Models.CountMessageTokensRequest" class="text-break">
|
||||||
|
Class CountMessageTokensRequest <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/CountMessageTokensRequest.cs/#L10"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div class="facts text-secondary">
|
||||||
|
<dl><dt>Namespace</dt><dd><a class="xref" href="AnthropicClient.html">AnthropicClient</a>.<a class="xref" href="AnthropicClient.Models.html">Models</a></dd></dl>
|
||||||
|
<dl><dt>Assembly</dt><dd>AnthropicClient.dll</dd></dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="markdown summary"><p>Represents a request to count the number of tokens in a message.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public class CountMessageTokensRequest</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="typelist inheritance">
|
||||||
|
<dt>Inheritance</dt>
|
||||||
|
<dd>
|
||||||
|
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
|
||||||
|
<div><span class="xref">CountMessageTokensRequest</span></div>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="typelist inheritedMembers">
|
||||||
|
<dt>Inherited Members</dt>
|
||||||
|
<dd>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
|
||||||
|
</div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2 class="section" id="constructors">Constructors
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_CountMessageTokensRequest__ctor_" data-uid="AnthropicClient.Models.CountMessageTokensRequest.#ctor*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_CountMessageTokensRequest__ctor_System_String_System_Collections_Generic_List_AnthropicClient_Models_Message__AnthropicClient_Models_ToolChoice_System_Collections_Generic_List_AnthropicClient_Models_Tool__System_Collections_Generic_List_AnthropicClient_Models_TextContent__" data-uid="AnthropicClient.Models.CountMessageTokensRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool},System.Collections.Generic.List{AnthropicClient.Models.TextContent})">
|
||||||
|
CountMessageTokensRequest(string, List<Message>, ToolChoice?, List<Tool>?, List<TextContent>?)
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/CountMessageTokensRequest.cs/#L50"><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.CountMessageTokensRequest.html">CountMessageTokensRequest</a> class.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public CountMessageTokensRequest(string model, List<Message> messages, ToolChoice? toolChoice = null, List<Tool>? tools = null, List<TextContent>? systemPrompt = null)</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="section">Parameters</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><code>model</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd><p>The model ID to use for the request.</p>
|
||||||
|
</dd>
|
||||||
|
<dt><code>messages</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a><<a class="xref" href="AnthropicClient.Models.Message.html">Message</a>></dt>
|
||||||
|
<dd><p>The messages to count the number of tokens in.</p>
|
||||||
|
</dd>
|
||||||
|
<dt><code>toolChoice</code> <a class="xref" href="AnthropicClient.Models.ToolChoice.html">ToolChoice</a></dt>
|
||||||
|
<dd><p>The tool choice mode to use for the request.</p>
|
||||||
|
</dd>
|
||||||
|
<dt><code>tools</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a><<a class="xref" href="AnthropicClient.Models.Tool.html">Tool</a>></dt>
|
||||||
|
<dd><p>The tools to use for the request.</p>
|
||||||
|
</dd>
|
||||||
|
<dt><code>systemPrompt</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a><<a class="xref" href="AnthropicClient.Models.TextContent.html">TextContent</a>></dt>
|
||||||
|
<dd><p>The system prompt to use for the request.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Exceptions</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
|
||||||
|
<dd><p>Thrown when <code class="paramref">model</code> or <code class="paramref">messages</code> is null.</p>
|
||||||
|
</dd>
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentexception">ArgumentException</a></dt>
|
||||||
|
<dd><p>Thrown when <code class="paramref">messages</code> is empty.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2 class="section" id="properties">Properties
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_CountMessageTokensRequest_Messages_" data-uid="AnthropicClient.Models.CountMessageTokensRequest.Messages*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_CountMessageTokensRequest_Messages" data-uid="AnthropicClient.Models.CountMessageTokensRequest.Messages">
|
||||||
|
Messages
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/CountMessageTokensRequest.cs/#L20"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Gets the messages to count the number of tokens in.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public List<Message> Messages { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a><<a class="xref" href="AnthropicClient.Models.Message.html">Message</a>></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_CountMessageTokensRequest_Model_" data-uid="AnthropicClient.Models.CountMessageTokensRequest.Model*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_CountMessageTokensRequest_Model" data-uid="AnthropicClient.Models.CountMessageTokensRequest.Model">
|
||||||
|
Model
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/CountMessageTokensRequest.cs/#L15"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Gets the model ID to be used for the request.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public string Model { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_CountMessageTokensRequest_SystemPrompt_" data-uid="AnthropicClient.Models.CountMessageTokensRequest.SystemPrompt*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_CountMessageTokensRequest_SystemPrompt" data-uid="AnthropicClient.Models.CountMessageTokensRequest.SystemPrompt">
|
||||||
|
SystemPrompt
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/CountMessageTokensRequest.cs/#L36"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Gets the system prompt to use for the request.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">[JsonPropertyName("system")]
|
||||||
|
public List<TextContent>? SystemPrompt { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a><<a class="xref" href="AnthropicClient.Models.TextContent.html">TextContent</a>></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_CountMessageTokensRequest_ToolChoice_" data-uid="AnthropicClient.Models.CountMessageTokensRequest.ToolChoice*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_CountMessageTokensRequest_ToolChoice" data-uid="AnthropicClient.Models.CountMessageTokensRequest.ToolChoice">
|
||||||
|
ToolChoice
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/CountMessageTokensRequest.cs/#L25"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Gets the tool choice mode to use for the request.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">[JsonPropertyName("tool_choice")]
|
||||||
|
public ToolChoice? ToolChoice { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="AnthropicClient.Models.ToolChoice.html">ToolChoice</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_CountMessageTokensRequest_Tools_" data-uid="AnthropicClient.Models.CountMessageTokensRequest.Tools*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_CountMessageTokensRequest_Tools" data-uid="AnthropicClient.Models.CountMessageTokensRequest.Tools">
|
||||||
|
Tools
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/CountMessageTokensRequest.cs/#L31"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Gets the tools to use for the request.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public List<Tool>? Tools { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a><<a class="xref" href="AnthropicClient.Models.Tool.html">Tool</a>></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<div class="contribution d-print-none">
|
||||||
|
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/CountMessageTokensRequest.cs/#L10" class="edit-link">Edit this page</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="affix">
|
||||||
|
<nav id="affix"></nav>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<div class="container-xxl search-results" id="search-results"></div>
|
||||||
|
|
||||||
|
<footer class="border-top text-secondary">
|
||||||
|
<div class="container-xxl">
|
||||||
|
<div class="flex-fill">
|
||||||
|
<span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,311 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Class DocumentContent | AnthropicClient </title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="title" content="Class DocumentContent | AnthropicClient ">
|
||||||
|
|
||||||
|
<meta name="description" content="Represents content from a document that is part of a message.">
|
||||||
|
<link rel="icon" href="../favicon.ico">
|
||||||
|
<link rel="stylesheet" href="../public/docfx.min.css">
|
||||||
|
<link rel="stylesheet" href="../public/main.css">
|
||||||
|
<meta name="docfx:navrel" content="../toc.html">
|
||||||
|
<meta name="docfx:tocrel" content="toc.html">
|
||||||
|
|
||||||
|
<meta name="docfx:rel" content="../">
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="docfx:docurl" content="https://github.com/StevanFreeborn/anthropic-client/new/main/apiSpec/new?filename=AnthropicClient_Models_DocumentContent.md&value=---%0Auid%3A%20AnthropicClient.Models.DocumentContent%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">
|
||||||
|
<meta name="loc:inThisArticle" content="In this article">
|
||||||
|
<meta name="loc:searchResultsCount" content="{count} results for "{query}"">
|
||||||
|
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
||||||
|
<meta name="loc:tocFilter" content="Filter by title">
|
||||||
|
<meta name="loc:nextArticle" content="Next">
|
||||||
|
<meta name="loc:prevArticle" content="Previous">
|
||||||
|
<meta name="loc:themeLight" content="Light">
|
||||||
|
<meta name="loc:themeDark" content="Dark">
|
||||||
|
<meta name="loc:themeAuto" content="Auto">
|
||||||
|
<meta name="loc:changeTheme" content="Change theme">
|
||||||
|
<meta name="loc:copy" content="Copy">
|
||||||
|
<meta name="loc:downloadPdf" content="Download PDF">
|
||||||
|
|
||||||
|
<script type="module" src="./../public/docfx.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const theme = localStorage.getItem('theme') || 'auto'
|
||||||
|
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
|
||||||
|
<header class="bg-body border-bottom">
|
||||||
|
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
|
||||||
|
<div class="container-xxl flex-nowrap">
|
||||||
|
<a class="navbar-brand" href="../index.html">
|
||||||
|
<img id="logo" class="svg" src="../logo.svg" alt="AnthropicClient">
|
||||||
|
AnthropicClient
|
||||||
|
</a>
|
||||||
|
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<i class="bi bi-three-dots"></i>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navpanel">
|
||||||
|
<div id="navbar">
|
||||||
|
<form class="search" role="search" id="search">
|
||||||
|
<i class="bi bi-search"></i>
|
||||||
|
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="container-xxl">
|
||||||
|
<div class="toc-offcanvas">
|
||||||
|
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
|
||||||
|
<div class="offcanvas-header">
|
||||||
|
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="offcanvas-body">
|
||||||
|
<nav class="toc" id="toc"></nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<div class="actionbar">
|
||||||
|
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
|
||||||
|
<i class="bi bi-list"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<nav id="breadcrumb"></nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article data-uid="AnthropicClient.Models.DocumentContent">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 id="AnthropicClient_Models_DocumentContent" data-uid="AnthropicClient.Models.DocumentContent" class="text-break">
|
||||||
|
Class DocumentContent <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/DocumentContent.cs/#L10"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div class="facts text-secondary">
|
||||||
|
<dl><dt>Namespace</dt><dd><a class="xref" href="AnthropicClient.html">AnthropicClient</a>.<a class="xref" href="AnthropicClient.Models.html">Models</a></dd></dl>
|
||||||
|
<dl><dt>Assembly</dt><dd>AnthropicClient.dll</dd></dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="markdown summary"><p>Represents content from a document that is part of a message.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public class DocumentContent : Content</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="typelist inheritance">
|
||||||
|
<dt>Inheritance</dt>
|
||||||
|
<dd>
|
||||||
|
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
|
||||||
|
<div><a class="xref" href="AnthropicClient.Models.Content.html">Content</a></div>
|
||||||
|
<div><span class="xref">DocumentContent</span></div>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="typelist inheritedMembers">
|
||||||
|
<dt>Inherited Members</dt>
|
||||||
|
<dd>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="AnthropicClient.Models.Content.html#AnthropicClient_Models_Content_Type">Content.Type</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="AnthropicClient.Models.Content.html#AnthropicClient_Models_Content_CacheControl">Content.CacheControl</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
|
||||||
|
</div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2 class="section" id="constructors">Constructors
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_DocumentContent__ctor_" data-uid="AnthropicClient.Models.DocumentContent.#ctor*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_DocumentContent__ctor_System_String_System_String_" data-uid="AnthropicClient.Models.DocumentContent.#ctor(System.String,System.String)">
|
||||||
|
DocumentContent(string, string)
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/DocumentContent.cs/#L35"><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.DocumentContent.html">DocumentContent</a> class.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public DocumentContent(string mediaType, string data)</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="section">Parameters</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><code>mediaType</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd><p>The media type of the document.</p>
|
||||||
|
</dd>
|
||||||
|
<dt><code>data</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd><p>The data of the document.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Exceptions</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
|
||||||
|
<dd><p>Thrown when the media type or data is null.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_DocumentContent__ctor_" data-uid="AnthropicClient.Models.DocumentContent.#ctor*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_DocumentContent__ctor_System_String_System_String_AnthropicClient_Models_CacheControl_" data-uid="AnthropicClient.Models.DocumentContent.#ctor(System.String,System.String,AnthropicClient.Models.CacheControl)">
|
||||||
|
DocumentContent(string, string, CacheControl)
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/DocumentContent.cs/#L50"><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.DocumentContent.html">DocumentContent</a> class.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public DocumentContent(string mediaType, string data, CacheControl cacheControl)</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="section">Parameters</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><code>mediaType</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd><p>The media type of the document.</p>
|
||||||
|
</dd>
|
||||||
|
<dt><code>data</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd><p>The data of the document.</p>
|
||||||
|
</dd>
|
||||||
|
<dt><code>cacheControl</code> <a class="xref" href="AnthropicClient.Models.CacheControl.html">CacheControl</a></dt>
|
||||||
|
<dd><p>The cache control to be used for the content.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Exceptions</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
|
||||||
|
<dd><p>Thrown when the media type, data, or cache control is null.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2 class="section" id="properties">Properties
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_DocumentContent_Source_" data-uid="AnthropicClient.Models.DocumentContent.Source*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_DocumentContent_Source" data-uid="AnthropicClient.Models.DocumentContent.Source">
|
||||||
|
Source
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/DocumentContent.cs/#L15"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Gets the source of the document.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public DocumentSource Source { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="AnthropicClient.Models.DocumentSource.html">DocumentSource</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<div class="contribution d-print-none">
|
||||||
|
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/DocumentContent.cs/#L10" class="edit-link">Edit this page</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="affix">
|
||||||
|
<nav id="affix"></nav>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<div class="container-xxl search-results" id="search-results"></div>
|
||||||
|
|
||||||
|
<footer class="border-top text-secondary">
|
||||||
|
<div class="container-xxl">
|
||||||
|
<div class="flex-fill">
|
||||||
|
<span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,327 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Class DocumentSource | AnthropicClient </title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="title" content="Class DocumentSource | AnthropicClient ">
|
||||||
|
|
||||||
|
<meta name="description" content="Represents a document source.">
|
||||||
|
<link rel="icon" href="../favicon.ico">
|
||||||
|
<link rel="stylesheet" href="../public/docfx.min.css">
|
||||||
|
<link rel="stylesheet" href="../public/main.css">
|
||||||
|
<meta name="docfx:navrel" content="../toc.html">
|
||||||
|
<meta name="docfx:tocrel" content="toc.html">
|
||||||
|
|
||||||
|
<meta name="docfx:rel" content="../">
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="docfx:docurl" content="https://github.com/StevanFreeborn/anthropic-client/new/main/apiSpec/new?filename=AnthropicClient_Models_DocumentSource.md&value=---%0Auid%3A%20AnthropicClient.Models.DocumentSource%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">
|
||||||
|
<meta name="loc:inThisArticle" content="In this article">
|
||||||
|
<meta name="loc:searchResultsCount" content="{count} results for "{query}"">
|
||||||
|
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
||||||
|
<meta name="loc:tocFilter" content="Filter by title">
|
||||||
|
<meta name="loc:nextArticle" content="Next">
|
||||||
|
<meta name="loc:prevArticle" content="Previous">
|
||||||
|
<meta name="loc:themeLight" content="Light">
|
||||||
|
<meta name="loc:themeDark" content="Dark">
|
||||||
|
<meta name="loc:themeAuto" content="Auto">
|
||||||
|
<meta name="loc:changeTheme" content="Change theme">
|
||||||
|
<meta name="loc:copy" content="Copy">
|
||||||
|
<meta name="loc:downloadPdf" content="Download PDF">
|
||||||
|
|
||||||
|
<script type="module" src="./../public/docfx.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const theme = localStorage.getItem('theme') || 'auto'
|
||||||
|
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
|
||||||
|
<header class="bg-body border-bottom">
|
||||||
|
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
|
||||||
|
<div class="container-xxl flex-nowrap">
|
||||||
|
<a class="navbar-brand" href="../index.html">
|
||||||
|
<img id="logo" class="svg" src="../logo.svg" alt="AnthropicClient">
|
||||||
|
AnthropicClient
|
||||||
|
</a>
|
||||||
|
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<i class="bi bi-three-dots"></i>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navpanel">
|
||||||
|
<div id="navbar">
|
||||||
|
<form class="search" role="search" id="search">
|
||||||
|
<i class="bi bi-search"></i>
|
||||||
|
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="container-xxl">
|
||||||
|
<div class="toc-offcanvas">
|
||||||
|
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
|
||||||
|
<div class="offcanvas-header">
|
||||||
|
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="offcanvas-body">
|
||||||
|
<nav class="toc" id="toc"></nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<div class="actionbar">
|
||||||
|
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
|
||||||
|
<i class="bi bi-list"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<nav id="breadcrumb"></nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article data-uid="AnthropicClient.Models.DocumentSource">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 id="AnthropicClient_Models_DocumentSource" data-uid="AnthropicClient.Models.DocumentSource" class="text-break">
|
||||||
|
Class DocumentSource <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/DocumentSource.cs/#L10"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div class="facts text-secondary">
|
||||||
|
<dl><dt>Namespace</dt><dd><a class="xref" href="AnthropicClient.html">AnthropicClient</a>.<a class="xref" href="AnthropicClient.Models.html">Models</a></dd></dl>
|
||||||
|
<dl><dt>Assembly</dt><dd>AnthropicClient.dll</dd></dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="markdown summary"><p>Represents a document source.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public class DocumentSource</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="typelist inheritance">
|
||||||
|
<dt>Inheritance</dt>
|
||||||
|
<dd>
|
||||||
|
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
|
||||||
|
<div><span class="xref">DocumentSource</span></div>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="typelist inheritedMembers">
|
||||||
|
<dt>Inherited Members</dt>
|
||||||
|
<dd>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
|
||||||
|
</div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2 class="section" id="constructors">Constructors
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_DocumentSource__ctor_" data-uid="AnthropicClient.Models.DocumentSource.#ctor*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_DocumentSource__ctor_System_String_System_String_" data-uid="AnthropicClient.Models.DocumentSource.#ctor(System.String,System.String)">
|
||||||
|
DocumentSource(string, string)
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/DocumentSource.cs/#L41"><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.DocumentSource.html">DocumentSource</a> class.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public DocumentSource(string mediaType, string data)</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="section">Parameters</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><code>mediaType</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd><p>The media type of the document.</p>
|
||||||
|
</dd>
|
||||||
|
<dt><code>data</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd><p>The data of the document.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Exceptions</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentexception">ArgumentException</a></dt>
|
||||||
|
<dd><p>Thrown when the media type is invalid.</p>
|
||||||
|
</dd>
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
|
||||||
|
<dd><p>Thrown when the media type or data is null.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2 class="section" id="properties">Properties
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_DocumentSource_Data_" data-uid="AnthropicClient.Models.DocumentSource.Data*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_DocumentSource_Data" data-uid="AnthropicClient.Models.DocumentSource.Data">
|
||||||
|
Data
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/DocumentSource.cs/#L21"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Gets the data of the document.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public string Data { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_DocumentSource_MediaType_" data-uid="AnthropicClient.Models.DocumentSource.MediaType*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_DocumentSource_MediaType" data-uid="AnthropicClient.Models.DocumentSource.MediaType">
|
||||||
|
MediaType
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/DocumentSource.cs/#L15"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Gets the media type of the document.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">[JsonPropertyName("media_type")]
|
||||||
|
public string MediaType { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_DocumentSource_Type_" data-uid="AnthropicClient.Models.DocumentSource.Type*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_DocumentSource_Type" data-uid="AnthropicClient.Models.DocumentSource.Type">
|
||||||
|
Type
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/DocumentSource.cs/#L26"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Gets the type of encoding of the document data.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public string Type { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<div class="contribution d-print-none">
|
||||||
|
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/DocumentSource.cs/#L10" class="edit-link">Edit this page</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="affix">
|
||||||
|
<nav id="affix"></nav>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<div class="container-xxl search-results" id="search-results"></div>
|
||||||
|
|
||||||
|
<footer class="border-top text-secondary">
|
||||||
|
<div class="container-xxl">
|
||||||
|
<div class="flex-fill">
|
||||||
|
<span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -200,7 +200,7 @@ Class MessageRequest <a class="header-action link-secondary" title="View source
|
|||||||
|
|
||||||
<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__System_Collections_Generic_List_AnthropicClient_Models_TextContent__" 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},System.Collections.Generic.List{AnthropicClient.Models.TextContent})">
|
<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__System_Collections_Generic_List_AnthropicClient_Models_TextContent__" 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},System.Collections.Generic.List{AnthropicClient.Models.TextContent})">
|
||||||
MessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, List<string>?, List<TextContent>?)
|
MessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, List<string>?, List<TextContent>?)
|
||||||
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/MessageRequest.cs/#L34"><i class="bi bi-code-slash"></i></a>
|
<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>
|
</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>
|
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.Models.MessageRequest.html">MessageRequest</a> class.</p>
|
||||||
@@ -261,9 +261,6 @@ Class MessageRequest <a class="header-action link-secondary" title="View source
|
|||||||
|
|
||||||
<h4 class="section">Exceptions</h4>
|
<h4 class="section">Exceptions</h4>
|
||||||
<dl class="parameters">
|
<dl class="parameters">
|
||||||
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentexception">ArgumentException</a></dt>
|
|
||||||
<dd><p>Thrown when the model ID is invalid.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
|
||||||
<dd><p>Thrown when the model or messages is null.</p>
|
<dd><p>Thrown when the model or messages is null.</p>
|
||||||
</dd>
|
</dd>
|
||||||
|
|||||||
@@ -0,0 +1,228 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Class Page<T> | AnthropicClient </title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="title" content="Class Page<T> | AnthropicClient ">
|
||||||
|
|
||||||
|
<meta name="description" content="Represents a page with data.">
|
||||||
|
<link rel="icon" href="../favicon.ico">
|
||||||
|
<link rel="stylesheet" href="../public/docfx.min.css">
|
||||||
|
<link rel="stylesheet" href="../public/main.css">
|
||||||
|
<meta name="docfx:navrel" content="../toc.html">
|
||||||
|
<meta name="docfx:tocrel" content="toc.html">
|
||||||
|
|
||||||
|
<meta name="docfx:rel" content="../">
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="docfx:docurl" content="https://github.com/StevanFreeborn/anthropic-client/new/main/apiSpec/new?filename=AnthropicClient_Models_Page_1.md&value=---%0Auid%3A%20AnthropicClient.Models.Page%601%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">
|
||||||
|
<meta name="loc:inThisArticle" content="In this article">
|
||||||
|
<meta name="loc:searchResultsCount" content="{count} results for "{query}"">
|
||||||
|
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
||||||
|
<meta name="loc:tocFilter" content="Filter by title">
|
||||||
|
<meta name="loc:nextArticle" content="Next">
|
||||||
|
<meta name="loc:prevArticle" content="Previous">
|
||||||
|
<meta name="loc:themeLight" content="Light">
|
||||||
|
<meta name="loc:themeDark" content="Dark">
|
||||||
|
<meta name="loc:themeAuto" content="Auto">
|
||||||
|
<meta name="loc:changeTheme" content="Change theme">
|
||||||
|
<meta name="loc:copy" content="Copy">
|
||||||
|
<meta name="loc:downloadPdf" content="Download PDF">
|
||||||
|
|
||||||
|
<script type="module" src="./../public/docfx.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const theme = localStorage.getItem('theme') || 'auto'
|
||||||
|
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
|
||||||
|
<header class="bg-body border-bottom">
|
||||||
|
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
|
||||||
|
<div class="container-xxl flex-nowrap">
|
||||||
|
<a class="navbar-brand" href="../index.html">
|
||||||
|
<img id="logo" class="svg" src="../logo.svg" alt="AnthropicClient">
|
||||||
|
AnthropicClient
|
||||||
|
</a>
|
||||||
|
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<i class="bi bi-three-dots"></i>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navpanel">
|
||||||
|
<div id="navbar">
|
||||||
|
<form class="search" role="search" id="search">
|
||||||
|
<i class="bi bi-search"></i>
|
||||||
|
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="container-xxl">
|
||||||
|
<div class="toc-offcanvas">
|
||||||
|
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
|
||||||
|
<div class="offcanvas-header">
|
||||||
|
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="offcanvas-body">
|
||||||
|
<nav class="toc" id="toc"></nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<div class="actionbar">
|
||||||
|
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
|
||||||
|
<i class="bi bi-list"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<nav id="breadcrumb"></nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article data-uid="AnthropicClient.Models.Page`1">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 id="AnthropicClient_Models_Page_1" data-uid="AnthropicClient.Models.Page`1" class="text-break">
|
||||||
|
Class Page<T> <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/Page.cs/#L32"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div class="facts text-secondary">
|
||||||
|
<dl><dt>Namespace</dt><dd><a class="xref" href="AnthropicClient.html">AnthropicClient</a>.<a class="xref" href="AnthropicClient.Models.html">Models</a></dd></dl>
|
||||||
|
<dl><dt>Assembly</dt><dd>AnthropicClient.dll</dd></dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="markdown summary"><p>Represents a page with data.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public class Page<T> : Page</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Type Parameters</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><code>T</code></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<dl class="typelist inheritance">
|
||||||
|
<dt>Inheritance</dt>
|
||||||
|
<dd>
|
||||||
|
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
|
||||||
|
<div><a class="xref" href="AnthropicClient.Models.Page.html">Page</a></div>
|
||||||
|
<div><span class="xref">Page<T></span></div>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="typelist inheritedMembers">
|
||||||
|
<dt>Inherited Members</dt>
|
||||||
|
<dd>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="AnthropicClient.Models.Page.html#AnthropicClient_Models_Page_FirstId">Page.FirstId</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="AnthropicClient.Models.Page.html#AnthropicClient_Models_Page_LastId">Page.LastId</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="AnthropicClient.Models.Page.html#AnthropicClient_Models_Page_HasMore">Page.HasMore</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
|
||||||
|
</div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2 class="section" id="properties">Properties
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_Page_1_Data_" data-uid="AnthropicClient.Models.Page`1.Data*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_Page_1_Data" data-uid="AnthropicClient.Models.Page`1.Data">
|
||||||
|
Data
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/Page.cs/#L37"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The data in the page.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public T[] Data { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt>T[]</dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<div class="contribution d-print-none">
|
||||||
|
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/Page.cs/#L32" class="edit-link">Edit this page</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="affix">
|
||||||
|
<nav id="affix"></nav>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<div class="container-xxl search-results" id="search-results"></div>
|
||||||
|
|
||||||
|
<footer class="border-top text-secondary">
|
||||||
|
<div class="container-xxl">
|
||||||
|
<div class="flex-fill">
|
||||||
|
<span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,286 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Class Page | AnthropicClient </title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="title" content="Class Page | AnthropicClient ">
|
||||||
|
|
||||||
|
<meta name="description" content="Represents a page.">
|
||||||
|
<link rel="icon" href="../favicon.ico">
|
||||||
|
<link rel="stylesheet" href="../public/docfx.min.css">
|
||||||
|
<link rel="stylesheet" href="../public/main.css">
|
||||||
|
<meta name="docfx:navrel" content="../toc.html">
|
||||||
|
<meta name="docfx:tocrel" content="toc.html">
|
||||||
|
|
||||||
|
<meta name="docfx:rel" content="../">
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="docfx:docurl" content="https://github.com/StevanFreeborn/anthropic-client/new/main/apiSpec/new?filename=AnthropicClient_Models_Page.md&value=---%0Auid%3A%20AnthropicClient.Models.Page%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">
|
||||||
|
<meta name="loc:inThisArticle" content="In this article">
|
||||||
|
<meta name="loc:searchResultsCount" content="{count} results for "{query}"">
|
||||||
|
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
||||||
|
<meta name="loc:tocFilter" content="Filter by title">
|
||||||
|
<meta name="loc:nextArticle" content="Next">
|
||||||
|
<meta name="loc:prevArticle" content="Previous">
|
||||||
|
<meta name="loc:themeLight" content="Light">
|
||||||
|
<meta name="loc:themeDark" content="Dark">
|
||||||
|
<meta name="loc:themeAuto" content="Auto">
|
||||||
|
<meta name="loc:changeTheme" content="Change theme">
|
||||||
|
<meta name="loc:copy" content="Copy">
|
||||||
|
<meta name="loc:downloadPdf" content="Download PDF">
|
||||||
|
|
||||||
|
<script type="module" src="./../public/docfx.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const theme = localStorage.getItem('theme') || 'auto'
|
||||||
|
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
|
||||||
|
<header class="bg-body border-bottom">
|
||||||
|
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
|
||||||
|
<div class="container-xxl flex-nowrap">
|
||||||
|
<a class="navbar-brand" href="../index.html">
|
||||||
|
<img id="logo" class="svg" src="../logo.svg" alt="AnthropicClient">
|
||||||
|
AnthropicClient
|
||||||
|
</a>
|
||||||
|
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<i class="bi bi-three-dots"></i>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navpanel">
|
||||||
|
<div id="navbar">
|
||||||
|
<form class="search" role="search" id="search">
|
||||||
|
<i class="bi bi-search"></i>
|
||||||
|
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="container-xxl">
|
||||||
|
<div class="toc-offcanvas">
|
||||||
|
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
|
||||||
|
<div class="offcanvas-header">
|
||||||
|
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="offcanvas-body">
|
||||||
|
<nav class="toc" id="toc"></nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<div class="actionbar">
|
||||||
|
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
|
||||||
|
<i class="bi bi-list"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<nav id="breadcrumb"></nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article data-uid="AnthropicClient.Models.Page">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 id="AnthropicClient_Models_Page" data-uid="AnthropicClient.Models.Page" class="text-break">
|
||||||
|
Class Page <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/Page.cs/#L8"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div class="facts text-secondary">
|
||||||
|
<dl><dt>Namespace</dt><dd><a class="xref" href="AnthropicClient.html">AnthropicClient</a>.<a class="xref" href="AnthropicClient.Models.html">Models</a></dd></dl>
|
||||||
|
<dl><dt>Assembly</dt><dd>AnthropicClient.dll</dd></dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="markdown summary"><p>Represents a page.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public class Page</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="typelist inheritance">
|
||||||
|
<dt>Inheritance</dt>
|
||||||
|
<dd>
|
||||||
|
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
|
||||||
|
<div><span class="xref">Page</span></div>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="typelist derived">
|
||||||
|
<dt>Derived</dt>
|
||||||
|
<dd>
|
||||||
|
<div><a class="xref" href="AnthropicClient.Models.Page-1.html">Page<T></a></div>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<dl class="typelist inheritedMembers">
|
||||||
|
<dt>Inherited Members</dt>
|
||||||
|
<dd>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
|
||||||
|
</div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2 class="section" id="properties">Properties
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_Page_FirstId_" data-uid="AnthropicClient.Models.Page.FirstId*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_Page_FirstId" data-uid="AnthropicClient.Models.Page.FirstId">
|
||||||
|
FirstId
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/Page.cs/#L13"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The id of the first item in the page.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">[JsonPropertyName("first_id")]
|
||||||
|
public string? FirstId { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_Page_HasMore_" data-uid="AnthropicClient.Models.Page.HasMore*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_Page_HasMore" data-uid="AnthropicClient.Models.Page.HasMore">
|
||||||
|
HasMore
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/Page.cs/#L25"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Indicates whether there is more data to be retrieved.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">[JsonPropertyName("has_more")]
|
||||||
|
public bool HasMore { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_Page_LastId_" data-uid="AnthropicClient.Models.Page.LastId*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_Page_LastId" data-uid="AnthropicClient.Models.Page.LastId">
|
||||||
|
LastId
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/Page.cs/#L19"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The id of the last item in the page.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">[JsonPropertyName("last_id")]
|
||||||
|
public string? LastId { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<div class="contribution d-print-none">
|
||||||
|
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/Page.cs/#L8" class="edit-link">Edit this page</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="affix">
|
||||||
|
<nav id="affix"></nav>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<div class="container-xxl search-results" id="search-results"></div>
|
||||||
|
|
||||||
|
<footer class="border-top text-secondary">
|
||||||
|
<div class="container-xxl">
|
||||||
|
<div class="flex-fill">
|
||||||
|
<span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,368 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Class PagingRequest | AnthropicClient </title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="title" content="Class PagingRequest | AnthropicClient ">
|
||||||
|
|
||||||
|
<meta name="description" content="Represents a request to page through a collection of items.">
|
||||||
|
<link rel="icon" href="../favicon.ico">
|
||||||
|
<link rel="stylesheet" href="../public/docfx.min.css">
|
||||||
|
<link rel="stylesheet" href="../public/main.css">
|
||||||
|
<meta name="docfx:navrel" content="../toc.html">
|
||||||
|
<meta name="docfx:tocrel" content="toc.html">
|
||||||
|
|
||||||
|
<meta name="docfx:rel" content="../">
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="docfx:docurl" content="https://github.com/StevanFreeborn/anthropic-client/new/main/apiSpec/new?filename=AnthropicClient_Models_PagingRequest.md&value=---%0Auid%3A%20AnthropicClient.Models.PagingRequest%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">
|
||||||
|
<meta name="loc:inThisArticle" content="In this article">
|
||||||
|
<meta name="loc:searchResultsCount" content="{count} results for "{query}"">
|
||||||
|
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
||||||
|
<meta name="loc:tocFilter" content="Filter by title">
|
||||||
|
<meta name="loc:nextArticle" content="Next">
|
||||||
|
<meta name="loc:prevArticle" content="Previous">
|
||||||
|
<meta name="loc:themeLight" content="Light">
|
||||||
|
<meta name="loc:themeDark" content="Dark">
|
||||||
|
<meta name="loc:themeAuto" content="Auto">
|
||||||
|
<meta name="loc:changeTheme" content="Change theme">
|
||||||
|
<meta name="loc:copy" content="Copy">
|
||||||
|
<meta name="loc:downloadPdf" content="Download PDF">
|
||||||
|
|
||||||
|
<script type="module" src="./../public/docfx.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const theme = localStorage.getItem('theme') || 'auto'
|
||||||
|
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
|
||||||
|
<header class="bg-body border-bottom">
|
||||||
|
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
|
||||||
|
<div class="container-xxl flex-nowrap">
|
||||||
|
<a class="navbar-brand" href="../index.html">
|
||||||
|
<img id="logo" class="svg" src="../logo.svg" alt="AnthropicClient">
|
||||||
|
AnthropicClient
|
||||||
|
</a>
|
||||||
|
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<i class="bi bi-three-dots"></i>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navpanel">
|
||||||
|
<div id="navbar">
|
||||||
|
<form class="search" role="search" id="search">
|
||||||
|
<i class="bi bi-search"></i>
|
||||||
|
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="container-xxl">
|
||||||
|
<div class="toc-offcanvas">
|
||||||
|
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
|
||||||
|
<div class="offcanvas-header">
|
||||||
|
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="offcanvas-body">
|
||||||
|
<nav class="toc" id="toc"></nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<div class="actionbar">
|
||||||
|
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
|
||||||
|
<i class="bi bi-list"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<nav id="breadcrumb"></nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article data-uid="AnthropicClient.Models.PagingRequest">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 id="AnthropicClient_Models_PagingRequest" data-uid="AnthropicClient.Models.PagingRequest" class="text-break">
|
||||||
|
Class PagingRequest <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/PagingRequest.cs/#L8"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div class="facts text-secondary">
|
||||||
|
<dl><dt>Namespace</dt><dd><a class="xref" href="AnthropicClient.html">AnthropicClient</a>.<a class="xref" href="AnthropicClient.Models.html">Models</a></dd></dl>
|
||||||
|
<dl><dt>Assembly</dt><dd>AnthropicClient.dll</dd></dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="markdown summary"><p>Represents a request to page through a collection of items.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public class PagingRequest</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="typelist inheritance">
|
||||||
|
<dt>Inheritance</dt>
|
||||||
|
<dd>
|
||||||
|
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
|
||||||
|
<div><span class="xref">PagingRequest</span></div>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="typelist inheritedMembers">
|
||||||
|
<dt>Inherited Members</dt>
|
||||||
|
<dd>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
|
||||||
|
</div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2 class="section" id="constructors">Constructors
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_PagingRequest__ctor_" data-uid="AnthropicClient.Models.PagingRequest.#ctor*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_PagingRequest__ctor_System_String_System_String_System_Int32_" data-uid="AnthropicClient.Models.PagingRequest.#ctor(System.String,System.String,System.Int32)">
|
||||||
|
PagingRequest(string, string, int)
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/PagingRequest.cs/#L40"><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.PagingRequest.html">PagingRequest</a> class.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public PagingRequest(string beforeId = "", string afterId = "", int limit = 20)</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="section">Parameters</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><code>beforeId</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd><p>The ID of the item before which to start the page.</p>
|
||||||
|
</dd>
|
||||||
|
<dt><code>afterId</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd><p>The ID of the item after which to start the page.</p>
|
||||||
|
</dd>
|
||||||
|
<dt><code>limit</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
|
||||||
|
<dd><p>The maximum number of items to return in the page.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Exceptions</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentexception">ArgumentException</a></dt>
|
||||||
|
<dd><p>Thrown when both <code class="paramref">beforeId</code> and <code class="paramref">afterId</code> are specified.</p>
|
||||||
|
</dd>
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception">ArgumentOutOfRangeException</a></dt>
|
||||||
|
<dd><p>Thrown when <code class="paramref">limit</code> is less than 1 or greater than 1000.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2 class="section" id="properties">Properties
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_PagingRequest_AfterId_" data-uid="AnthropicClient.Models.PagingRequest.AfterId*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_PagingRequest_AfterId" data-uid="AnthropicClient.Models.PagingRequest.AfterId">
|
||||||
|
AfterId
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/PagingRequest.cs/#L23"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The ID of the item after which to start the page.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">[JsonPropertyName("after_id")]
|
||||||
|
public string AfterId { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_PagingRequest_BeforeId_" data-uid="AnthropicClient.Models.PagingRequest.BeforeId*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_PagingRequest_BeforeId" data-uid="AnthropicClient.Models.PagingRequest.BeforeId">
|
||||||
|
BeforeId
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/PagingRequest.cs/#L17"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The ID of the item before which to start the page.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">[JsonPropertyName("before_id")]
|
||||||
|
public string BeforeId { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_PagingRequest_Limit_" data-uid="AnthropicClient.Models.PagingRequest.Limit*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_PagingRequest_Limit" data-uid="AnthropicClient.Models.PagingRequest.Limit">
|
||||||
|
Limit
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/PagingRequest.cs/#L29"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The maximum number of items to return in the page.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public int Limit { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2 class="section" id="methods">Methods
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_PagingRequest_ToQueryParameters_" data-uid="AnthropicClient.Models.PagingRequest.ToQueryParameters*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_PagingRequest_ToQueryParameters" data-uid="AnthropicClient.Models.PagingRequest.ToQueryParameters">
|
||||||
|
ToQueryParameters()
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/PagingRequest.cs/#L65"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>Converts the <a class="xref" href="AnthropicClient.Models.PagingRequest.html">PagingRequest</a> to a query string.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public string ToQueryParameters()</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Returns</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||||
|
<dd><p>The query string representation of the <a class="xref" href="AnthropicClient.Models.PagingRequest.html">PagingRequest</a>.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<div class="contribution d-print-none">
|
||||||
|
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/PagingRequest.cs/#L8" class="edit-link">Edit this page</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="affix">
|
||||||
|
<nav id="affix"></nav>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<div class="container-xxl search-results" id="search-results"></div>
|
||||||
|
|
||||||
|
<footer class="border-top text-secondary">
|
||||||
|
<div class="container-xxl">
|
||||||
|
<div class="flex-fill">
|
||||||
|
<span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -200,7 +200,7 @@ Class StreamMessageRequest <a class="header-action link-secondary" title="View
|
|||||||
|
|
||||||
<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__System_Collections_Generic_List_AnthropicClient_Models_TextContent__" 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},System.Collections.Generic.List{AnthropicClient.Models.TextContent})">
|
<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__System_Collections_Generic_List_AnthropicClient_Models_TextContent__" 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},System.Collections.Generic.List{AnthropicClient.Models.TextContent})">
|
||||||
StreamMessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, List<string>?, List<TextContent>?)
|
StreamMessageRequest(string, List<Message>, int, string?, Dictionary<string, object>?, decimal, int?, decimal?, ToolChoice?, List<Tool>?, List<string>?, List<TextContent>?)
|
||||||
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/StreamMessageRequest.cs/#L34"><i class="bi bi-code-slash"></i></a>
|
<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>
|
</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>
|
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.Models.StreamMessageRequest.html">StreamMessageRequest</a> class.</p>
|
||||||
@@ -261,9 +261,6 @@ Class StreamMessageRequest <a class="header-action link-secondary" title="View
|
|||||||
|
|
||||||
<h4 class="section">Exceptions</h4>
|
<h4 class="section">Exceptions</h4>
|
||||||
<dl class="parameters">
|
<dl class="parameters">
|
||||||
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentexception">ArgumentException</a></dt>
|
|
||||||
<dd><p>Thrown when the model ID is invalid.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
|
||||||
<dd><p>Thrown when the model or messages is null.</p>
|
<dd><p>Thrown when the model or messages is null.</p>
|
||||||
</dd>
|
</dd>
|
||||||
|
|||||||
@@ -0,0 +1,214 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Class TokenCountResponse | AnthropicClient </title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="title" content="Class TokenCountResponse | AnthropicClient ">
|
||||||
|
|
||||||
|
<meta name="description" content="Represents a response to a token count request.">
|
||||||
|
<link rel="icon" href="../favicon.ico">
|
||||||
|
<link rel="stylesheet" href="../public/docfx.min.css">
|
||||||
|
<link rel="stylesheet" href="../public/main.css">
|
||||||
|
<meta name="docfx:navrel" content="../toc.html">
|
||||||
|
<meta name="docfx:tocrel" content="toc.html">
|
||||||
|
|
||||||
|
<meta name="docfx:rel" content="../">
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="docfx:docurl" content="https://github.com/StevanFreeborn/anthropic-client/new/main/apiSpec/new?filename=AnthropicClient_Models_TokenCountResponse.md&value=---%0Auid%3A%20AnthropicClient.Models.TokenCountResponse%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">
|
||||||
|
<meta name="loc:inThisArticle" content="In this article">
|
||||||
|
<meta name="loc:searchResultsCount" content="{count} results for "{query}"">
|
||||||
|
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
||||||
|
<meta name="loc:tocFilter" content="Filter by title">
|
||||||
|
<meta name="loc:nextArticle" content="Next">
|
||||||
|
<meta name="loc:prevArticle" content="Previous">
|
||||||
|
<meta name="loc:themeLight" content="Light">
|
||||||
|
<meta name="loc:themeDark" content="Dark">
|
||||||
|
<meta name="loc:themeAuto" content="Auto">
|
||||||
|
<meta name="loc:changeTheme" content="Change theme">
|
||||||
|
<meta name="loc:copy" content="Copy">
|
||||||
|
<meta name="loc:downloadPdf" content="Download PDF">
|
||||||
|
|
||||||
|
<script type="module" src="./../public/docfx.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const theme = localStorage.getItem('theme') || 'auto'
|
||||||
|
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
|
||||||
|
<header class="bg-body border-bottom">
|
||||||
|
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
|
||||||
|
<div class="container-xxl flex-nowrap">
|
||||||
|
<a class="navbar-brand" href="../index.html">
|
||||||
|
<img id="logo" class="svg" src="../logo.svg" alt="AnthropicClient">
|
||||||
|
AnthropicClient
|
||||||
|
</a>
|
||||||
|
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<i class="bi bi-three-dots"></i>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navpanel">
|
||||||
|
<div id="navbar">
|
||||||
|
<form class="search" role="search" id="search">
|
||||||
|
<i class="bi bi-search"></i>
|
||||||
|
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="container-xxl">
|
||||||
|
<div class="toc-offcanvas">
|
||||||
|
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
|
||||||
|
<div class="offcanvas-header">
|
||||||
|
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="offcanvas-body">
|
||||||
|
<nav class="toc" id="toc"></nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<div class="actionbar">
|
||||||
|
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
|
||||||
|
<i class="bi bi-list"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<nav id="breadcrumb"></nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article data-uid="AnthropicClient.Models.TokenCountResponse">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 id="AnthropicClient_Models_TokenCountResponse" data-uid="AnthropicClient.Models.TokenCountResponse" class="text-break">
|
||||||
|
Class TokenCountResponse <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/TokenCountResponse.cs/#L8"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div class="facts text-secondary">
|
||||||
|
<dl><dt>Namespace</dt><dd><a class="xref" href="AnthropicClient.html">AnthropicClient</a>.<a class="xref" href="AnthropicClient.Models.html">Models</a></dd></dl>
|
||||||
|
<dl><dt>Assembly</dt><dd>AnthropicClient.dll</dd></dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="markdown summary"><p>Represents a response to a token count request.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">public class TokenCountResponse</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="typelist inheritance">
|
||||||
|
<dt>Inheritance</dt>
|
||||||
|
<dd>
|
||||||
|
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
|
||||||
|
<div><span class="xref">TokenCountResponse</span></div>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="typelist inheritedMembers">
|
||||||
|
<dt>Inherited Members</dt>
|
||||||
|
<dd>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
|
||||||
|
</div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2 class="section" id="properties">Properties
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<a id="AnthropicClient_Models_TokenCountResponse_InputTokens_" data-uid="AnthropicClient.Models.TokenCountResponse.InputTokens*"></a>
|
||||||
|
|
||||||
|
<h3 id="AnthropicClient_Models_TokenCountResponse_InputTokens" data-uid="AnthropicClient.Models.TokenCountResponse.InputTokens">
|
||||||
|
InputTokens
|
||||||
|
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/TokenCountResponse.cs/#L13"><i class="bi bi-code-slash"></i></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="markdown level1 summary"><p>The number of input tokens counted.</p>
|
||||||
|
</div>
|
||||||
|
<div class="markdown level1 conceptual"></div>
|
||||||
|
|
||||||
|
<div class="codewrapper">
|
||||||
|
<pre><code class="lang-csharp hljs">[JsonPropertyName("input_tokens")]
|
||||||
|
public int InputTokens { get; init; }</code></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="section">Property Value</h4>
|
||||||
|
<dl class="parameters">
|
||||||
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<div class="contribution d-print-none">
|
||||||
|
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/TokenCountResponse.cs/#L8" class="edit-link">Edit this page</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="affix">
|
||||||
|
<nav id="affix"></nav>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<div class="container-xxl search-results" id="search-results"></div>
|
||||||
|
|
||||||
|
<footer class="border-top text-secondary">
|
||||||
|
<div class="container-xxl">
|
||||||
|
<div class="flex-fill">
|
||||||
|
<span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -112,6 +112,11 @@ Classes
|
|||||||
<dl class="jumplist">
|
<dl class="jumplist">
|
||||||
<dt><a class="xref" href="AnthropicClient.Models.AnthropicHeaders.html">AnthropicHeaders</a></dt>
|
<dt><a class="xref" href="AnthropicClient.Models.AnthropicHeaders.html">AnthropicHeaders</a></dt>
|
||||||
<dd><p>Represents headers included in Anthropic API responses.</p>
|
<dd><p>Represents headers included in Anthropic API responses.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl class="jumplist">
|
||||||
|
<dt><a class="xref" href="AnthropicClient.Models.AnthropicModel.html">AnthropicModel</a></dt>
|
||||||
|
<dd><p>Represents an Anthropic model.</p>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl class="jumplist">
|
<dl class="jumplist">
|
||||||
@@ -187,6 +192,21 @@ Classes
|
|||||||
<dl class="jumplist">
|
<dl class="jumplist">
|
||||||
<dt><a class="xref" href="AnthropicClient.Models.ContentType.html">ContentType</a></dt>
|
<dt><a class="xref" href="AnthropicClient.Models.ContentType.html">ContentType</a></dt>
|
||||||
<dd><p>Represents the content type.</p>
|
<dd><p>Represents the content type.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl class="jumplist">
|
||||||
|
<dt><a class="xref" href="AnthropicClient.Models.CountMessageTokensRequest.html">CountMessageTokensRequest</a></dt>
|
||||||
|
<dd><p>Represents a request to count the number of tokens in a message.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl class="jumplist">
|
||||||
|
<dt><a class="xref" href="AnthropicClient.Models.DocumentContent.html">DocumentContent</a></dt>
|
||||||
|
<dd><p>Represents content from a document that is part of a message.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl class="jumplist">
|
||||||
|
<dt><a class="xref" href="AnthropicClient.Models.DocumentSource.html">DocumentSource</a></dt>
|
||||||
|
<dd><p>Represents a document source.</p>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl class="jumplist">
|
<dl class="jumplist">
|
||||||
@@ -317,6 +337,21 @@ Classes
|
|||||||
<dl class="jumplist">
|
<dl class="jumplist">
|
||||||
<dt><a class="xref" href="AnthropicClient.Models.OverloadedError.html">OverloadedError</a></dt>
|
<dt><a class="xref" href="AnthropicClient.Models.OverloadedError.html">OverloadedError</a></dt>
|
||||||
<dd><p>Represents an overloaded error.</p>
|
<dd><p>Represents an overloaded error.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl class="jumplist">
|
||||||
|
<dt><a class="xref" href="AnthropicClient.Models.Page.html">Page</a></dt>
|
||||||
|
<dd><p>Represents a page.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl class="jumplist">
|
||||||
|
<dt><a class="xref" href="AnthropicClient.Models.Page-1.html">Page<T></a></dt>
|
||||||
|
<dd><p>Represents a page with data.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl class="jumplist">
|
||||||
|
<dt><a class="xref" href="AnthropicClient.Models.PagingRequest.html">PagingRequest</a></dt>
|
||||||
|
<dd><p>Represents a request to page through a collection of items.</p>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl class="jumplist">
|
<dl class="jumplist">
|
||||||
@@ -357,6 +392,11 @@ Classes
|
|||||||
<dl class="jumplist">
|
<dl class="jumplist">
|
||||||
<dt><a class="xref" href="AnthropicClient.Models.TextDelta.html">TextDelta</a></dt>
|
<dt><a class="xref" href="AnthropicClient.Models.TextDelta.html">TextDelta</a></dt>
|
||||||
<dd><p>Represents a text delta.</p>
|
<dd><p>Represents a text delta.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl class="jumplist">
|
||||||
|
<dt><a class="xref" href="AnthropicClient.Models.TokenCountResponse.html">TokenCountResponse</a></dt>
|
||||||
|
<dd><p>Represents a response to a token count request.</p>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl class="jumplist">
|
<dl class="jumplist">
|
||||||
|
|||||||
@@ -42,6 +42,9 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="AnthropicClient.Models.AnthropicHeaders.html" name="" title="AnthropicHeaders">AnthropicHeaders</a>
|
<a href="AnthropicClient.Models.AnthropicHeaders.html" name="" title="AnthropicHeaders">AnthropicHeaders</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="AnthropicClient.Models.AnthropicModel.html" name="" title="AnthropicModel">AnthropicModel</a>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="AnthropicClient.Models.AnthropicModels.html" name="" title="AnthropicModels">AnthropicModels</a>
|
<a href="AnthropicClient.Models.AnthropicModels.html" name="" title="AnthropicModels">AnthropicModels</a>
|
||||||
</li>
|
</li>
|
||||||
@@ -87,6 +90,15 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="AnthropicClient.Models.ContentType.html" name="" title="ContentType">ContentType</a>
|
<a href="AnthropicClient.Models.ContentType.html" name="" title="ContentType">ContentType</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="AnthropicClient.Models.CountMessageTokensRequest.html" name="" title="CountMessageTokensRequest">CountMessageTokensRequest</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="AnthropicClient.Models.DocumentContent.html" name="" title="DocumentContent">DocumentContent</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="AnthropicClient.Models.DocumentSource.html" name="" title="DocumentSource">DocumentSource</a>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="AnthropicClient.Models.EphemeralCacheControl.html" name="" title="EphemeralCacheControl">EphemeralCacheControl</a>
|
<a href="AnthropicClient.Models.EphemeralCacheControl.html" name="" title="EphemeralCacheControl">EphemeralCacheControl</a>
|
||||||
</li>
|
</li>
|
||||||
@@ -168,6 +180,15 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="AnthropicClient.Models.OverloadedError.html" name="" title="OverloadedError">OverloadedError</a>
|
<a href="AnthropicClient.Models.OverloadedError.html" name="" title="OverloadedError">OverloadedError</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="AnthropicClient.Models.Page.html" name="" title="Page">Page</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="AnthropicClient.Models.Page-1.html" name="" title="Page<T>">Page<T></a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="AnthropicClient.Models.PagingRequest.html" name="" title="PagingRequest">PagingRequest</a>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="AnthropicClient.Models.PermissionError.html" name="" title="PermissionError">PermissionError</a>
|
<a href="AnthropicClient.Models.PermissionError.html" name="" title="PermissionError">PermissionError</a>
|
||||||
</li>
|
</li>
|
||||||
@@ -192,6 +213,9 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="AnthropicClient.Models.TextDelta.html" name="" title="TextDelta">TextDelta</a>
|
<a href="AnthropicClient.Models.TextDelta.html" name="" title="TextDelta">TextDelta</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="AnthropicClient.Models.TokenCountResponse.html" name="" title="TokenCountResponse">TokenCountResponse</a>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="AnthropicClient.Models.Tool.html" name="" title="Tool">Tool</a>
|
<a href="AnthropicClient.Models.Tool.html" name="" title="Tool">Tool</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
+119
-15
@@ -146,8 +146,89 @@ var client = new AnthropicApiClient(apiKey, new HttpClient());
|
|||||||
<h5>Note</h5>
|
<h5>Note</h5>
|
||||||
<p>The following examples assume that you have already created an instance of the <code>AnthropicApiClient</code> class named <code>client</code>. You can also find these snippets in the examples directory.</p>
|
<p>The following examples assume that you have already created an instance of the <code>AnthropicApiClient</code> class named <code>client</code>. You can also find these snippets in the examples directory.</p>
|
||||||
</div>
|
</div>
|
||||||
|
<h3 id="count-message-tokens">Count Message Tokens</h3>
|
||||||
|
<p>The <code>AnthropicApiClient</code> exposes a method named <code>CountMessageTokensAsync</code> that can be used to count the number of tokens in a message. The method requires a <code>CountMessageTokensRequest</code> instance as a parameter.</p>
|
||||||
|
<pre><code class="lang-csharp">using AnthropicClient;
|
||||||
|
using AnthropicClient.Models;
|
||||||
|
|
||||||
|
var response = await client.CountMessageTokensAsync(new CountMessageTokensRequest(
|
||||||
|
AnthropicModels.Claude3Haiku,
|
||||||
|
[
|
||||||
|
new(
|
||||||
|
MessageRole.User,
|
||||||
|
[new TextContent("Please write a haiku about the ocean.")]
|
||||||
|
)
|
||||||
|
]
|
||||||
|
));
|
||||||
|
|
||||||
|
if (response.IsFailure)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Failed to count message tokens");
|
||||||
|
Console.WriteLine("Error Type: {0}", response.Error.Error.Type);
|
||||||
|
Console.WriteLine("Error Message: {0}", response.Error.Error.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("Token Count: {0}", response.Value.InputTokens);
|
||||||
|
</code></pre>
|
||||||
|
<h3 id="list-models">List Models</h3>
|
||||||
|
<p>The <code>AnthropicApiClient</code> exposes a method named <code>ListModelsAsync</code> that can be used to list the available models. The method takes an optional <code>PagingRequest</code> instance as a parameter.</p>
|
||||||
|
<pre><code class="lang-csharp">using AnthropicClient;
|
||||||
|
|
||||||
|
var response = await client.ListModelsAsync();
|
||||||
|
|
||||||
|
if (response.IsFailure)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Failed to list models");
|
||||||
|
Console.WriteLine("Error Type: {0}", response.Error.Error.Type);
|
||||||
|
Console.WriteLine("Error Message: {0}", response.Error.Error.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var model in response.Value.Data)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Model Id: {0}", model.Id);
|
||||||
|
Console.WriteLine("Model Name: {0}", model.DisplayName);
|
||||||
|
}
|
||||||
|
</code></pre>
|
||||||
|
<p>Using the <code>PagingRequest</code> instance allows you to specify the number of models to return and the page of models to return.</p>
|
||||||
|
<pre><code class="lang-csharp">using AnthropicClient;
|
||||||
|
using AnthropicClient.Models;
|
||||||
|
|
||||||
|
var response = await client.ListModelsAsync(new PagingRequest(afterId: "claude-3-5-sonnet-20241022", limit: 2));
|
||||||
|
|
||||||
|
if (response.IsFailure)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Failed to list models");
|
||||||
|
Console.WriteLine("Error Type: {0}", response.Error.Error.Type);
|
||||||
|
Console.WriteLine("Error Message: {0}", response.Error.Error.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var model in response.Value.Data)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Model Id: {0}", model.Id);
|
||||||
|
Console.WriteLine("Model Name: {0}", model.DisplayName);
|
||||||
|
}
|
||||||
|
</code></pre>
|
||||||
|
<h3 id="get-model">Get Model</h3>
|
||||||
|
<p>The <code>AnthropicApiClient</code> exposes a method named <code>GetModelAsync</code> that can be used to get a model by its id.</p>
|
||||||
|
<pre><code class="lang-csharp">using AnthropicClient;
|
||||||
|
|
||||||
|
var response = await client.GetModelAsync("claude-3-5-sonnet-20241022");
|
||||||
|
|
||||||
|
if (response.IsFailure)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Failed to get model");
|
||||||
|
Console.WriteLine("Error Type: {0}", response.Error.Error.Type);
|
||||||
|
Console.WriteLine("Error Message: {0}", response.Error.Error.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("Model Id: {0}", response.Value.Id);
|
||||||
|
</code></pre>
|
||||||
<h3 id="create-a-message">Create a message</h3>
|
<h3 id="create-a-message">Create a message</h3>
|
||||||
<p>The <code>AnthropicApiClient</code> exposes a single method named <code>CreateMessageAsync</code> that can be used to create a message. The method requires a <code>MessageRequest</code> or a <code>StreamMessageRequest</code> instance as a parameter. The <code>MessageRequest</code> class is used to create a message whose response is not streamed and the <code>StreamMessageRequest</code> class is used to create a message whose response is streamed. The <code>MessageRequest</code> instance's properties can be set to configure how the message is created.</p>
|
<p>The <code>AnthropicApiClient</code> exposes a method named <code>CreateMessageAsync</code> that can be used to create a message. The method requires a <code>MessageRequest</code> or a <code>StreamMessageRequest</code> instance as a parameter. The <code>MessageRequest</code> class is used to create a message whose response is not streamed and the <code>StreamMessageRequest</code> class is used to create a message whose response is streamed. The <code>MessageRequest</code> instance's properties can be set to configure how the message is created.</p>
|
||||||
<h4 id="non-streaming">Non-Streaming</h4>
|
<h4 id="non-streaming">Non-Streaming</h4>
|
||||||
<pre><code class="lang-csharp">using AnthropicClient;
|
<pre><code class="lang-csharp">using AnthropicClient;
|
||||||
using AnthropicClient.Models;
|
using AnthropicClient.Models;
|
||||||
@@ -674,20 +755,7 @@ foreach (var content in response.Value.Content)
|
|||||||
}
|
}
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<h3 id="prompt-caching">Prompt Caching</h3>
|
<h3 id="prompt-caching">Prompt Caching</h3>
|
||||||
<p>Anthropic has recently introduced a feature called <a href="https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching">Prompt Caching</a> that allows you to cache all or part of the prompt you send to the model. This can be used to improve the performance of your application by reducing latency and token usage. This feature is covered in depth in <a href="https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching">Anthropic's API Documentation</a>.</p>
|
<p>Anthropic provides a feature called <a href="https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching">Prompt Caching</a> that allows you to cache all or part of the prompt you send to the model. This can be used to improve the performance of your application by reducing latency and token usage. This feature is covered in depth in <a href="https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching">Anthropic's API Documentation</a>.</p>
|
||||||
<div class="NOTE">
|
|
||||||
<h5>Note</h5>
|
|
||||||
<p>This feature is in beta and requires you to set an <code>anthropic-beta</code> header on your requests to use it.
|
|
||||||
The value of the header should be <code>prompt-caching-2024-07-31</code>.</p>
|
|
||||||
</div>
|
|
||||||
<p>When using this library you can opt-in to prompt caching by adding the required header to the <code>HttpClient</code> instance you provide to the <code>AnthropicApiClient</code> constructor.</p>
|
|
||||||
<pre><code class="lang-csharp">using AnthropicClient;
|
|
||||||
|
|
||||||
var httpClient = new HttpClient();
|
|
||||||
httpClient.DefaultRequestHeaders.Add("anthropic-beta", "prompt-caching-2024-07-31");
|
|
||||||
|
|
||||||
var client = new AnthropicApiClient(apiKey, httpClient);
|
|
||||||
</code></pre>
|
|
||||||
<p>Prompt caching can be used to cache all parts of the prompt including system messages, user messages, and tools. You should refer to the <a href="https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching">Anthropic API Documentation</a> for specifics on limitations and requirements for using prompt caching. This library aims to make using prompt caching convenient and give you complete control over what parts of the prompt are cached. Currently there is only one type of cache control available - <code>EphemeralCacheControl</code>.</p>
|
<p>Prompt caching can be used to cache all parts of the prompt including system messages, user messages, and tools. You should refer to the <a href="https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching">Anthropic API Documentation</a> for specifics on limitations and requirements for using prompt caching. This library aims to make using prompt caching convenient and give you complete control over what parts of the prompt are cached. Currently there is only one type of cache control available - <code>EphemeralCacheControl</code>.</p>
|
||||||
<h4 id="caching-system-messages">Caching System Messages</h4>
|
<h4 id="caching-system-messages">Caching System Messages</h4>
|
||||||
<p>System messages can be cached by providing a <code>List<TextContent></code> as the <code>systemMessages</code> parameter in the <code>MessageRequest</code> or <code>StreamMessageRequest</code> constructor and having one or more of the <code>TextContent</code> instances have the <code>CacheControl</code> property set.</p>
|
<p>System messages can be cached by providing a <code>List<TextContent></code> as the <code>systemMessages</code> parameter in the <code>MessageRequest</code> or <code>StreamMessageRequest</code> constructor and having one or more of the <code>TextContent</code> instances have the <code>CacheControl</code> property set.</p>
|
||||||
@@ -812,6 +880,42 @@ foreach (var content in response.Value.Content)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
<h3 id="pdf-support">PDF Support</h3>
|
||||||
|
<p>Anthropic provides a feature called <a href="https://docs.anthropic.com/en/docs/build-with-claude/pdf-support">PDF Support</a> that allows Claude to support PDF input and understand both text and visual content within documents. This feature is covered in depth in <a href="https://docs.anthropic.com/en/docs/build-with-claude/pdf-support">Anthropic's API Documentation</a>.</p>
|
||||||
|
<p>PDF support can be used to provide a PDF document as input to the model. This can be used to provide additional context to the model or to ask for additional information from the model. This library aims to make using PDF support convenient by allowing you to provide the PDF document you want Anthropic's models to consider for use when creating a message.</p>
|
||||||
|
<h4 id="pdf-document">PDF Document</h4>
|
||||||
|
<p>You can provide a PDF document by providing its base64 encoded content as a <code>DocumentContent</code> instance in the list of messages in the <code>MessageRequest</code> or <code>StreamMessageRequest</code> constructor.</p>
|
||||||
|
<pre><code class="lang-csharp">using AnthropicClient;
|
||||||
|
using AnthropicClient.Models;
|
||||||
|
|
||||||
|
var request = new MessageRequest(
|
||||||
|
model: AnthropicModels.Claude35Sonnet,
|
||||||
|
messages: [
|
||||||
|
new(MessageRole.User, [new TextContent("What is the title of this paper?")]),
|
||||||
|
new(MessageRole.User, [new DocumentContent("application/pdf", base64Data)])
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
var response = await client.CreateMessageAsync(request);
|
||||||
|
|
||||||
|
if (response.IsSuccess is false)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Failed to create message");
|
||||||
|
Console.WriteLine("Error Type: {0}", response.Error.Error.Type);
|
||||||
|
Console.WriteLine("Error Message: {0}", response.Error.Error.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var content in response.Value.Content)
|
||||||
|
{
|
||||||
|
switch (content)
|
||||||
|
{
|
||||||
|
case TextContent textContent:
|
||||||
|
Console.WriteLine(textContent.Text);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
|
|||||||
+50
-10
File diff suppressed because one or more lines are too long
+86
-6
@@ -70,6 +70,16 @@
|
|||||||
},
|
},
|
||||||
"version": ""
|
"version": ""
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "ManagedReference",
|
||||||
|
"source_relative_path": "api/AnthropicClient.Models.AnthropicModel.yml",
|
||||||
|
"output": {
|
||||||
|
".html": {
|
||||||
|
"relative_path": "api/AnthropicClient.Models.AnthropicModel.html"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"version": ""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "ManagedReference",
|
"type": "ManagedReference",
|
||||||
"source_relative_path": "api/AnthropicClient.Models.AnthropicModels.yml",
|
"source_relative_path": "api/AnthropicClient.Models.AnthropicModels.yml",
|
||||||
@@ -220,6 +230,36 @@
|
|||||||
},
|
},
|
||||||
"version": ""
|
"version": ""
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "ManagedReference",
|
||||||
|
"source_relative_path": "api/AnthropicClient.Models.CountMessageTokensRequest.yml",
|
||||||
|
"output": {
|
||||||
|
".html": {
|
||||||
|
"relative_path": "api/AnthropicClient.Models.CountMessageTokensRequest.html"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"version": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ManagedReference",
|
||||||
|
"source_relative_path": "api/AnthropicClient.Models.DocumentContent.yml",
|
||||||
|
"output": {
|
||||||
|
".html": {
|
||||||
|
"relative_path": "api/AnthropicClient.Models.DocumentContent.html"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"version": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ManagedReference",
|
||||||
|
"source_relative_path": "api/AnthropicClient.Models.DocumentSource.yml",
|
||||||
|
"output": {
|
||||||
|
".html": {
|
||||||
|
"relative_path": "api/AnthropicClient.Models.DocumentSource.html"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"version": ""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "ManagedReference",
|
"type": "ManagedReference",
|
||||||
"source_relative_path": "api/AnthropicClient.Models.EphemeralCacheControl.yml",
|
"source_relative_path": "api/AnthropicClient.Models.EphemeralCacheControl.yml",
|
||||||
@@ -490,6 +530,36 @@
|
|||||||
},
|
},
|
||||||
"version": ""
|
"version": ""
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "ManagedReference",
|
||||||
|
"source_relative_path": "api/AnthropicClient.Models.Page-1.yml",
|
||||||
|
"output": {
|
||||||
|
".html": {
|
||||||
|
"relative_path": "api/AnthropicClient.Models.Page-1.html"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"version": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ManagedReference",
|
||||||
|
"source_relative_path": "api/AnthropicClient.Models.Page.yml",
|
||||||
|
"output": {
|
||||||
|
".html": {
|
||||||
|
"relative_path": "api/AnthropicClient.Models.Page.html"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"version": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ManagedReference",
|
||||||
|
"source_relative_path": "api/AnthropicClient.Models.PagingRequest.yml",
|
||||||
|
"output": {
|
||||||
|
".html": {
|
||||||
|
"relative_path": "api/AnthropicClient.Models.PagingRequest.html"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"version": ""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "ManagedReference",
|
"type": "ManagedReference",
|
||||||
"source_relative_path": "api/AnthropicClient.Models.PermissionError.yml",
|
"source_relative_path": "api/AnthropicClient.Models.PermissionError.yml",
|
||||||
@@ -570,6 +640,16 @@
|
|||||||
},
|
},
|
||||||
"version": ""
|
"version": ""
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "ManagedReference",
|
||||||
|
"source_relative_path": "api/AnthropicClient.Models.TokenCountResponse.yml",
|
||||||
|
"output": {
|
||||||
|
".html": {
|
||||||
|
"relative_path": "api/AnthropicClient.Models.TokenCountResponse.html"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"version": ""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "ManagedReference",
|
"type": "ManagedReference",
|
||||||
"source_relative_path": "api/AnthropicClient.Models.Tool.yml",
|
"source_relative_path": "api/AnthropicClient.Models.Tool.yml",
|
||||||
@@ -674,11 +754,11 @@
|
|||||||
"type": "Toc",
|
"type": "Toc",
|
||||||
"source_relative_path": "api/toc.yml",
|
"source_relative_path": "api/toc.yml",
|
||||||
"output": {
|
"output": {
|
||||||
".json": {
|
|
||||||
"relative_path": "api/toc.json"
|
|
||||||
},
|
|
||||||
".html": {
|
".html": {
|
||||||
"relative_path": "api/toc.html"
|
"relative_path": "api/toc.html"
|
||||||
|
},
|
||||||
|
".json": {
|
||||||
|
"relative_path": "api/toc.json"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"version": ""
|
"version": ""
|
||||||
@@ -697,11 +777,11 @@
|
|||||||
"type": "Toc",
|
"type": "Toc",
|
||||||
"source_relative_path": "toc.yml",
|
"source_relative_path": "toc.yml",
|
||||||
"output": {
|
"output": {
|
||||||
".json": {
|
|
||||||
"relative_path": "toc.json"
|
|
||||||
},
|
|
||||||
".html": {
|
".html": {
|
||||||
"relative_path": "toc.html"
|
"relative_path": "toc.html"
|
||||||
|
},
|
||||||
|
".json": {
|
||||||
|
"relative_path": "toc.json"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"version": ""
|
"version": ""
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Vendored
+20
-20
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -32,6 +32,19 @@ references:
|
|||||||
fullName.vb: AnthropicClient.AnthropicApiClient.New
|
fullName.vb: AnthropicClient.AnthropicApiClient.New
|
||||||
nameWithType: AnthropicApiClient.AnthropicApiClient
|
nameWithType: AnthropicApiClient.AnthropicApiClient
|
||||||
nameWithType.vb: AnthropicApiClient.New
|
nameWithType.vb: AnthropicApiClient.New
|
||||||
|
- uid: AnthropicClient.AnthropicApiClient.CountMessageTokensAsync(AnthropicClient.Models.CountMessageTokensRequest)
|
||||||
|
name: CountMessageTokensAsync(CountMessageTokensRequest)
|
||||||
|
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_CountMessageTokensAsync_AnthropicClient_Models_CountMessageTokensRequest_
|
||||||
|
commentId: M:AnthropicClient.AnthropicApiClient.CountMessageTokensAsync(AnthropicClient.Models.CountMessageTokensRequest)
|
||||||
|
fullName: AnthropicClient.AnthropicApiClient.CountMessageTokensAsync(AnthropicClient.Models.CountMessageTokensRequest)
|
||||||
|
nameWithType: AnthropicApiClient.CountMessageTokensAsync(CountMessageTokensRequest)
|
||||||
|
- uid: AnthropicClient.AnthropicApiClient.CountMessageTokensAsync*
|
||||||
|
name: CountMessageTokensAsync
|
||||||
|
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_CountMessageTokensAsync_
|
||||||
|
commentId: Overload:AnthropicClient.AnthropicApiClient.CountMessageTokensAsync
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.AnthropicApiClient.CountMessageTokensAsync
|
||||||
|
nameWithType: AnthropicApiClient.CountMessageTokensAsync
|
||||||
- uid: AnthropicClient.AnthropicApiClient.CreateMessageAsync(AnthropicClient.Models.MessageRequest)
|
- uid: AnthropicClient.AnthropicApiClient.CreateMessageAsync(AnthropicClient.Models.MessageRequest)
|
||||||
name: CreateMessageAsync(MessageRequest)
|
name: CreateMessageAsync(MessageRequest)
|
||||||
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_CreateMessageAsync_AnthropicClient_Models_MessageRequest_
|
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_CreateMessageAsync_AnthropicClient_Models_MessageRequest_
|
||||||
@@ -51,12 +64,73 @@ references:
|
|||||||
isSpec: "True"
|
isSpec: "True"
|
||||||
fullName: AnthropicClient.AnthropicApiClient.CreateMessageAsync
|
fullName: AnthropicClient.AnthropicApiClient.CreateMessageAsync
|
||||||
nameWithType: AnthropicApiClient.CreateMessageAsync
|
nameWithType: AnthropicApiClient.CreateMessageAsync
|
||||||
|
- uid: AnthropicClient.AnthropicApiClient.GetModelAsync(System.String)
|
||||||
|
name: GetModelAsync(string)
|
||||||
|
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_GetModelAsync_System_String_
|
||||||
|
commentId: M:AnthropicClient.AnthropicApiClient.GetModelAsync(System.String)
|
||||||
|
name.vb: GetModelAsync(String)
|
||||||
|
fullName: AnthropicClient.AnthropicApiClient.GetModelAsync(string)
|
||||||
|
fullName.vb: AnthropicClient.AnthropicApiClient.GetModelAsync(String)
|
||||||
|
nameWithType: AnthropicApiClient.GetModelAsync(string)
|
||||||
|
nameWithType.vb: AnthropicApiClient.GetModelAsync(String)
|
||||||
|
- uid: AnthropicClient.AnthropicApiClient.GetModelAsync*
|
||||||
|
name: GetModelAsync
|
||||||
|
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_GetModelAsync_
|
||||||
|
commentId: Overload:AnthropicClient.AnthropicApiClient.GetModelAsync
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.AnthropicApiClient.GetModelAsync
|
||||||
|
nameWithType: AnthropicApiClient.GetModelAsync
|
||||||
|
- uid: AnthropicClient.AnthropicApiClient.ListAllModelsAsync(System.Int32)
|
||||||
|
name: ListAllModelsAsync(int)
|
||||||
|
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_ListAllModelsAsync_System_Int32_
|
||||||
|
commentId: M:AnthropicClient.AnthropicApiClient.ListAllModelsAsync(System.Int32)
|
||||||
|
name.vb: ListAllModelsAsync(Integer)
|
||||||
|
fullName: AnthropicClient.AnthropicApiClient.ListAllModelsAsync(int)
|
||||||
|
fullName.vb: AnthropicClient.AnthropicApiClient.ListAllModelsAsync(Integer)
|
||||||
|
nameWithType: AnthropicApiClient.ListAllModelsAsync(int)
|
||||||
|
nameWithType.vb: AnthropicApiClient.ListAllModelsAsync(Integer)
|
||||||
|
- uid: AnthropicClient.AnthropicApiClient.ListAllModelsAsync*
|
||||||
|
name: ListAllModelsAsync
|
||||||
|
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_ListAllModelsAsync_
|
||||||
|
commentId: Overload:AnthropicClient.AnthropicApiClient.ListAllModelsAsync
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.AnthropicApiClient.ListAllModelsAsync
|
||||||
|
nameWithType: AnthropicApiClient.ListAllModelsAsync
|
||||||
|
- uid: AnthropicClient.AnthropicApiClient.ListModelsAsync(AnthropicClient.Models.PagingRequest)
|
||||||
|
name: ListModelsAsync(PagingRequest?)
|
||||||
|
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_ListModelsAsync_AnthropicClient_Models_PagingRequest_
|
||||||
|
commentId: M:AnthropicClient.AnthropicApiClient.ListModelsAsync(AnthropicClient.Models.PagingRequest)
|
||||||
|
name.vb: ListModelsAsync(PagingRequest)
|
||||||
|
fullName: AnthropicClient.AnthropicApiClient.ListModelsAsync(AnthropicClient.Models.PagingRequest?)
|
||||||
|
fullName.vb: AnthropicClient.AnthropicApiClient.ListModelsAsync(AnthropicClient.Models.PagingRequest)
|
||||||
|
nameWithType: AnthropicApiClient.ListModelsAsync(PagingRequest?)
|
||||||
|
nameWithType.vb: AnthropicApiClient.ListModelsAsync(PagingRequest)
|
||||||
|
- uid: AnthropicClient.AnthropicApiClient.ListModelsAsync*
|
||||||
|
name: ListModelsAsync
|
||||||
|
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_ListModelsAsync_
|
||||||
|
commentId: Overload:AnthropicClient.AnthropicApiClient.ListModelsAsync
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.AnthropicApiClient.ListModelsAsync
|
||||||
|
nameWithType: AnthropicApiClient.ListModelsAsync
|
||||||
- uid: AnthropicClient.IAnthropicApiClient
|
- uid: AnthropicClient.IAnthropicApiClient
|
||||||
name: IAnthropicApiClient
|
name: IAnthropicApiClient
|
||||||
href: api/AnthropicClient.IAnthropicApiClient.html
|
href: api/AnthropicClient.IAnthropicApiClient.html
|
||||||
commentId: T:AnthropicClient.IAnthropicApiClient
|
commentId: T:AnthropicClient.IAnthropicApiClient
|
||||||
fullName: AnthropicClient.IAnthropicApiClient
|
fullName: AnthropicClient.IAnthropicApiClient
|
||||||
nameWithType: IAnthropicApiClient
|
nameWithType: IAnthropicApiClient
|
||||||
|
- uid: AnthropicClient.IAnthropicApiClient.CountMessageTokensAsync(AnthropicClient.Models.CountMessageTokensRequest)
|
||||||
|
name: CountMessageTokensAsync(CountMessageTokensRequest)
|
||||||
|
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_CountMessageTokensAsync_AnthropicClient_Models_CountMessageTokensRequest_
|
||||||
|
commentId: M:AnthropicClient.IAnthropicApiClient.CountMessageTokensAsync(AnthropicClient.Models.CountMessageTokensRequest)
|
||||||
|
fullName: AnthropicClient.IAnthropicApiClient.CountMessageTokensAsync(AnthropicClient.Models.CountMessageTokensRequest)
|
||||||
|
nameWithType: IAnthropicApiClient.CountMessageTokensAsync(CountMessageTokensRequest)
|
||||||
|
- uid: AnthropicClient.IAnthropicApiClient.CountMessageTokensAsync*
|
||||||
|
name: CountMessageTokensAsync
|
||||||
|
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_CountMessageTokensAsync_
|
||||||
|
commentId: Overload:AnthropicClient.IAnthropicApiClient.CountMessageTokensAsync
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.IAnthropicApiClient.CountMessageTokensAsync
|
||||||
|
nameWithType: IAnthropicApiClient.CountMessageTokensAsync
|
||||||
- uid: AnthropicClient.IAnthropicApiClient.CreateMessageAsync(AnthropicClient.Models.MessageRequest)
|
- uid: AnthropicClient.IAnthropicApiClient.CreateMessageAsync(AnthropicClient.Models.MessageRequest)
|
||||||
name: CreateMessageAsync(MessageRequest)
|
name: CreateMessageAsync(MessageRequest)
|
||||||
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_CreateMessageAsync_AnthropicClient_Models_MessageRequest_
|
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_CreateMessageAsync_AnthropicClient_Models_MessageRequest_
|
||||||
@@ -76,6 +150,54 @@ references:
|
|||||||
isSpec: "True"
|
isSpec: "True"
|
||||||
fullName: AnthropicClient.IAnthropicApiClient.CreateMessageAsync
|
fullName: AnthropicClient.IAnthropicApiClient.CreateMessageAsync
|
||||||
nameWithType: IAnthropicApiClient.CreateMessageAsync
|
nameWithType: IAnthropicApiClient.CreateMessageAsync
|
||||||
|
- uid: AnthropicClient.IAnthropicApiClient.GetModelAsync(System.String)
|
||||||
|
name: GetModelAsync(string)
|
||||||
|
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_GetModelAsync_System_String_
|
||||||
|
commentId: M:AnthropicClient.IAnthropicApiClient.GetModelAsync(System.String)
|
||||||
|
name.vb: GetModelAsync(String)
|
||||||
|
fullName: AnthropicClient.IAnthropicApiClient.GetModelAsync(string)
|
||||||
|
fullName.vb: AnthropicClient.IAnthropicApiClient.GetModelAsync(String)
|
||||||
|
nameWithType: IAnthropicApiClient.GetModelAsync(string)
|
||||||
|
nameWithType.vb: IAnthropicApiClient.GetModelAsync(String)
|
||||||
|
- uid: AnthropicClient.IAnthropicApiClient.GetModelAsync*
|
||||||
|
name: GetModelAsync
|
||||||
|
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_GetModelAsync_
|
||||||
|
commentId: Overload:AnthropicClient.IAnthropicApiClient.GetModelAsync
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.IAnthropicApiClient.GetModelAsync
|
||||||
|
nameWithType: IAnthropicApiClient.GetModelAsync
|
||||||
|
- uid: AnthropicClient.IAnthropicApiClient.ListAllModelsAsync(System.Int32)
|
||||||
|
name: ListAllModelsAsync(int)
|
||||||
|
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_ListAllModelsAsync_System_Int32_
|
||||||
|
commentId: M:AnthropicClient.IAnthropicApiClient.ListAllModelsAsync(System.Int32)
|
||||||
|
name.vb: ListAllModelsAsync(Integer)
|
||||||
|
fullName: AnthropicClient.IAnthropicApiClient.ListAllModelsAsync(int)
|
||||||
|
fullName.vb: AnthropicClient.IAnthropicApiClient.ListAllModelsAsync(Integer)
|
||||||
|
nameWithType: IAnthropicApiClient.ListAllModelsAsync(int)
|
||||||
|
nameWithType.vb: IAnthropicApiClient.ListAllModelsAsync(Integer)
|
||||||
|
- uid: AnthropicClient.IAnthropicApiClient.ListAllModelsAsync*
|
||||||
|
name: ListAllModelsAsync
|
||||||
|
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_ListAllModelsAsync_
|
||||||
|
commentId: Overload:AnthropicClient.IAnthropicApiClient.ListAllModelsAsync
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.IAnthropicApiClient.ListAllModelsAsync
|
||||||
|
nameWithType: IAnthropicApiClient.ListAllModelsAsync
|
||||||
|
- uid: AnthropicClient.IAnthropicApiClient.ListModelsAsync(AnthropicClient.Models.PagingRequest)
|
||||||
|
name: ListModelsAsync(PagingRequest?)
|
||||||
|
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_ListModelsAsync_AnthropicClient_Models_PagingRequest_
|
||||||
|
commentId: M:AnthropicClient.IAnthropicApiClient.ListModelsAsync(AnthropicClient.Models.PagingRequest)
|
||||||
|
name.vb: ListModelsAsync(PagingRequest)
|
||||||
|
fullName: AnthropicClient.IAnthropicApiClient.ListModelsAsync(AnthropicClient.Models.PagingRequest?)
|
||||||
|
fullName.vb: AnthropicClient.IAnthropicApiClient.ListModelsAsync(AnthropicClient.Models.PagingRequest)
|
||||||
|
nameWithType: IAnthropicApiClient.ListModelsAsync(PagingRequest?)
|
||||||
|
nameWithType.vb: IAnthropicApiClient.ListModelsAsync(PagingRequest)
|
||||||
|
- uid: AnthropicClient.IAnthropicApiClient.ListModelsAsync*
|
||||||
|
name: ListModelsAsync
|
||||||
|
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_ListModelsAsync_
|
||||||
|
commentId: Overload:AnthropicClient.IAnthropicApiClient.ListModelsAsync
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.IAnthropicApiClient.ListModelsAsync
|
||||||
|
nameWithType: IAnthropicApiClient.ListModelsAsync
|
||||||
- uid: AnthropicClient.Models
|
- uid: AnthropicClient.Models
|
||||||
name: AnthropicClient.Models
|
name: AnthropicClient.Models
|
||||||
href: api/AnthropicClient.Models.html
|
href: api/AnthropicClient.Models.html
|
||||||
@@ -345,36 +467,148 @@ references:
|
|||||||
isSpec: "True"
|
isSpec: "True"
|
||||||
fullName: AnthropicClient.Models.AnthropicHeaders.RetryAfter
|
fullName: AnthropicClient.Models.AnthropicHeaders.RetryAfter
|
||||||
nameWithType: AnthropicHeaders.RetryAfter
|
nameWithType: AnthropicHeaders.RetryAfter
|
||||||
|
- uid: AnthropicClient.Models.AnthropicModel
|
||||||
|
name: AnthropicModel
|
||||||
|
href: api/AnthropicClient.Models.AnthropicModel.html
|
||||||
|
commentId: T:AnthropicClient.Models.AnthropicModel
|
||||||
|
fullName: AnthropicClient.Models.AnthropicModel
|
||||||
|
nameWithType: AnthropicModel
|
||||||
|
- uid: AnthropicClient.Models.AnthropicModel.CreatedAt
|
||||||
|
name: CreatedAt
|
||||||
|
href: api/AnthropicClient.Models.AnthropicModel.html#AnthropicClient_Models_AnthropicModel_CreatedAt
|
||||||
|
commentId: P:AnthropicClient.Models.AnthropicModel.CreatedAt
|
||||||
|
fullName: AnthropicClient.Models.AnthropicModel.CreatedAt
|
||||||
|
nameWithType: AnthropicModel.CreatedAt
|
||||||
|
- uid: AnthropicClient.Models.AnthropicModel.CreatedAt*
|
||||||
|
name: CreatedAt
|
||||||
|
href: api/AnthropicClient.Models.AnthropicModel.html#AnthropicClient_Models_AnthropicModel_CreatedAt_
|
||||||
|
commentId: Overload:AnthropicClient.Models.AnthropicModel.CreatedAt
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.AnthropicModel.CreatedAt
|
||||||
|
nameWithType: AnthropicModel.CreatedAt
|
||||||
|
- uid: AnthropicClient.Models.AnthropicModel.DisplayName
|
||||||
|
name: DisplayName
|
||||||
|
href: api/AnthropicClient.Models.AnthropicModel.html#AnthropicClient_Models_AnthropicModel_DisplayName
|
||||||
|
commentId: P:AnthropicClient.Models.AnthropicModel.DisplayName
|
||||||
|
fullName: AnthropicClient.Models.AnthropicModel.DisplayName
|
||||||
|
nameWithType: AnthropicModel.DisplayName
|
||||||
|
- uid: AnthropicClient.Models.AnthropicModel.DisplayName*
|
||||||
|
name: DisplayName
|
||||||
|
href: api/AnthropicClient.Models.AnthropicModel.html#AnthropicClient_Models_AnthropicModel_DisplayName_
|
||||||
|
commentId: Overload:AnthropicClient.Models.AnthropicModel.DisplayName
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.AnthropicModel.DisplayName
|
||||||
|
nameWithType: AnthropicModel.DisplayName
|
||||||
|
- uid: AnthropicClient.Models.AnthropicModel.Id
|
||||||
|
name: Id
|
||||||
|
href: api/AnthropicClient.Models.AnthropicModel.html#AnthropicClient_Models_AnthropicModel_Id
|
||||||
|
commentId: P:AnthropicClient.Models.AnthropicModel.Id
|
||||||
|
fullName: AnthropicClient.Models.AnthropicModel.Id
|
||||||
|
nameWithType: AnthropicModel.Id
|
||||||
|
- uid: AnthropicClient.Models.AnthropicModel.Id*
|
||||||
|
name: Id
|
||||||
|
href: api/AnthropicClient.Models.AnthropicModel.html#AnthropicClient_Models_AnthropicModel_Id_
|
||||||
|
commentId: Overload:AnthropicClient.Models.AnthropicModel.Id
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.AnthropicModel.Id
|
||||||
|
nameWithType: AnthropicModel.Id
|
||||||
|
- uid: AnthropicClient.Models.AnthropicModel.Type
|
||||||
|
name: Type
|
||||||
|
href: api/AnthropicClient.Models.AnthropicModel.html#AnthropicClient_Models_AnthropicModel_Type
|
||||||
|
commentId: P:AnthropicClient.Models.AnthropicModel.Type
|
||||||
|
fullName: AnthropicClient.Models.AnthropicModel.Type
|
||||||
|
nameWithType: AnthropicModel.Type
|
||||||
|
- uid: AnthropicClient.Models.AnthropicModel.Type*
|
||||||
|
name: Type
|
||||||
|
href: api/AnthropicClient.Models.AnthropicModel.html#AnthropicClient_Models_AnthropicModel_Type_
|
||||||
|
commentId: Overload:AnthropicClient.Models.AnthropicModel.Type
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.AnthropicModel.Type
|
||||||
|
nameWithType: AnthropicModel.Type
|
||||||
- uid: AnthropicClient.Models.AnthropicModels
|
- uid: AnthropicClient.Models.AnthropicModels
|
||||||
name: AnthropicModels
|
name: AnthropicModels
|
||||||
href: api/AnthropicClient.Models.AnthropicModels.html
|
href: api/AnthropicClient.Models.AnthropicModels.html
|
||||||
commentId: T:AnthropicClient.Models.AnthropicModels
|
commentId: T:AnthropicClient.Models.AnthropicModels
|
||||||
fullName: AnthropicClient.Models.AnthropicModels
|
fullName: AnthropicClient.Models.AnthropicModels
|
||||||
nameWithType: AnthropicModels
|
nameWithType: AnthropicModels
|
||||||
|
- uid: AnthropicClient.Models.AnthropicModels.Claude35Haiku20241022
|
||||||
|
name: Claude35Haiku20241022
|
||||||
|
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude35Haiku20241022
|
||||||
|
commentId: F:AnthropicClient.Models.AnthropicModels.Claude35Haiku20241022
|
||||||
|
fullName: AnthropicClient.Models.AnthropicModels.Claude35Haiku20241022
|
||||||
|
nameWithType: AnthropicModels.Claude35Haiku20241022
|
||||||
|
- uid: AnthropicClient.Models.AnthropicModels.Claude35HaikuLatest
|
||||||
|
name: Claude35HaikuLatest
|
||||||
|
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude35HaikuLatest
|
||||||
|
commentId: F:AnthropicClient.Models.AnthropicModels.Claude35HaikuLatest
|
||||||
|
fullName: AnthropicClient.Models.AnthropicModels.Claude35HaikuLatest
|
||||||
|
nameWithType: AnthropicModels.Claude35HaikuLatest
|
||||||
- uid: AnthropicClient.Models.AnthropicModels.Claude35Sonnet
|
- uid: AnthropicClient.Models.AnthropicModels.Claude35Sonnet
|
||||||
name: Claude35Sonnet
|
name: Claude35Sonnet
|
||||||
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude35Sonnet
|
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude35Sonnet
|
||||||
commentId: F:AnthropicClient.Models.AnthropicModels.Claude35Sonnet
|
commentId: F:AnthropicClient.Models.AnthropicModels.Claude35Sonnet
|
||||||
fullName: AnthropicClient.Models.AnthropicModels.Claude35Sonnet
|
fullName: AnthropicClient.Models.AnthropicModels.Claude35Sonnet
|
||||||
nameWithType: AnthropicModels.Claude35Sonnet
|
nameWithType: AnthropicModels.Claude35Sonnet
|
||||||
|
- uid: AnthropicClient.Models.AnthropicModels.Claude35Sonnet20240620
|
||||||
|
name: Claude35Sonnet20240620
|
||||||
|
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude35Sonnet20240620
|
||||||
|
commentId: F:AnthropicClient.Models.AnthropicModels.Claude35Sonnet20240620
|
||||||
|
fullName: AnthropicClient.Models.AnthropicModels.Claude35Sonnet20240620
|
||||||
|
nameWithType: AnthropicModels.Claude35Sonnet20240620
|
||||||
|
- uid: AnthropicClient.Models.AnthropicModels.Claude35Sonnet20241022
|
||||||
|
name: Claude35Sonnet20241022
|
||||||
|
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude35Sonnet20241022
|
||||||
|
commentId: F:AnthropicClient.Models.AnthropicModels.Claude35Sonnet20241022
|
||||||
|
fullName: AnthropicClient.Models.AnthropicModels.Claude35Sonnet20241022
|
||||||
|
nameWithType: AnthropicModels.Claude35Sonnet20241022
|
||||||
|
- uid: AnthropicClient.Models.AnthropicModels.Claude35SonnetLatest
|
||||||
|
name: Claude35SonnetLatest
|
||||||
|
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude35SonnetLatest
|
||||||
|
commentId: F:AnthropicClient.Models.AnthropicModels.Claude35SonnetLatest
|
||||||
|
fullName: AnthropicClient.Models.AnthropicModels.Claude35SonnetLatest
|
||||||
|
nameWithType: AnthropicModels.Claude35SonnetLatest
|
||||||
- uid: AnthropicClient.Models.AnthropicModels.Claude3Haiku
|
- uid: AnthropicClient.Models.AnthropicModels.Claude3Haiku
|
||||||
name: Claude3Haiku
|
name: Claude3Haiku
|
||||||
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude3Haiku
|
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude3Haiku
|
||||||
commentId: F:AnthropicClient.Models.AnthropicModels.Claude3Haiku
|
commentId: F:AnthropicClient.Models.AnthropicModels.Claude3Haiku
|
||||||
fullName: AnthropicClient.Models.AnthropicModels.Claude3Haiku
|
fullName: AnthropicClient.Models.AnthropicModels.Claude3Haiku
|
||||||
nameWithType: AnthropicModels.Claude3Haiku
|
nameWithType: AnthropicModels.Claude3Haiku
|
||||||
|
- uid: AnthropicClient.Models.AnthropicModels.Claude3Haiku20240307
|
||||||
|
name: Claude3Haiku20240307
|
||||||
|
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude3Haiku20240307
|
||||||
|
commentId: F:AnthropicClient.Models.AnthropicModels.Claude3Haiku20240307
|
||||||
|
fullName: AnthropicClient.Models.AnthropicModels.Claude3Haiku20240307
|
||||||
|
nameWithType: AnthropicModels.Claude3Haiku20240307
|
||||||
- uid: AnthropicClient.Models.AnthropicModels.Claude3Opus
|
- uid: AnthropicClient.Models.AnthropicModels.Claude3Opus
|
||||||
name: Claude3Opus
|
name: Claude3Opus
|
||||||
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude3Opus
|
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude3Opus
|
||||||
commentId: F:AnthropicClient.Models.AnthropicModels.Claude3Opus
|
commentId: F:AnthropicClient.Models.AnthropicModels.Claude3Opus
|
||||||
fullName: AnthropicClient.Models.AnthropicModels.Claude3Opus
|
fullName: AnthropicClient.Models.AnthropicModels.Claude3Opus
|
||||||
nameWithType: AnthropicModels.Claude3Opus
|
nameWithType: AnthropicModels.Claude3Opus
|
||||||
|
- uid: AnthropicClient.Models.AnthropicModels.Claude3Opus20241022
|
||||||
|
name: Claude3Opus20241022
|
||||||
|
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude3Opus20241022
|
||||||
|
commentId: F:AnthropicClient.Models.AnthropicModels.Claude3Opus20241022
|
||||||
|
fullName: AnthropicClient.Models.AnthropicModels.Claude3Opus20241022
|
||||||
|
nameWithType: AnthropicModels.Claude3Opus20241022
|
||||||
|
- uid: AnthropicClient.Models.AnthropicModels.Claude3OpusLatest
|
||||||
|
name: Claude3OpusLatest
|
||||||
|
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude3OpusLatest
|
||||||
|
commentId: F:AnthropicClient.Models.AnthropicModels.Claude3OpusLatest
|
||||||
|
fullName: AnthropicClient.Models.AnthropicModels.Claude3OpusLatest
|
||||||
|
nameWithType: AnthropicModels.Claude3OpusLatest
|
||||||
- uid: AnthropicClient.Models.AnthropicModels.Claude3Sonnet
|
- uid: AnthropicClient.Models.AnthropicModels.Claude3Sonnet
|
||||||
name: Claude3Sonnet
|
name: Claude3Sonnet
|
||||||
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude3Sonnet
|
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude3Sonnet
|
||||||
commentId: F:AnthropicClient.Models.AnthropicModels.Claude3Sonnet
|
commentId: F:AnthropicClient.Models.AnthropicModels.Claude3Sonnet
|
||||||
fullName: AnthropicClient.Models.AnthropicModels.Claude3Sonnet
|
fullName: AnthropicClient.Models.AnthropicModels.Claude3Sonnet
|
||||||
nameWithType: AnthropicModels.Claude3Sonnet
|
nameWithType: AnthropicModels.Claude3Sonnet
|
||||||
|
- uid: AnthropicClient.Models.AnthropicModels.Claude3Sonnet20240229
|
||||||
|
name: Claude3Sonnet20240229
|
||||||
|
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude3Sonnet20240229
|
||||||
|
commentId: F:AnthropicClient.Models.AnthropicModels.Claude3Sonnet20240229
|
||||||
|
fullName: AnthropicClient.Models.AnthropicModels.Claude3Sonnet20240229
|
||||||
|
nameWithType: AnthropicModels.Claude3Sonnet20240229
|
||||||
- uid: AnthropicClient.Models.AnyToolChoice
|
- uid: AnthropicClient.Models.AnyToolChoice
|
||||||
name: AnyToolChoice
|
name: AnyToolChoice
|
||||||
href: api/AnthropicClient.Models.AnyToolChoice.html
|
href: api/AnthropicClient.Models.AnyToolChoice.html
|
||||||
@@ -994,6 +1228,12 @@ references:
|
|||||||
commentId: T:AnthropicClient.Models.ContentType
|
commentId: T:AnthropicClient.Models.ContentType
|
||||||
fullName: AnthropicClient.Models.ContentType
|
fullName: AnthropicClient.Models.ContentType
|
||||||
nameWithType: ContentType
|
nameWithType: ContentType
|
||||||
|
- uid: AnthropicClient.Models.ContentType.Document
|
||||||
|
name: Document
|
||||||
|
href: api/AnthropicClient.Models.ContentType.html#AnthropicClient_Models_ContentType_Document
|
||||||
|
commentId: F:AnthropicClient.Models.ContentType.Document
|
||||||
|
fullName: AnthropicClient.Models.ContentType.Document
|
||||||
|
nameWithType: ContentType.Document
|
||||||
- uid: AnthropicClient.Models.ContentType.Image
|
- uid: AnthropicClient.Models.ContentType.Image
|
||||||
name: Image
|
name: Image
|
||||||
href: api/AnthropicClient.Models.ContentType.html#AnthropicClient_Models_ContentType_Image
|
href: api/AnthropicClient.Models.ContentType.html#AnthropicClient_Models_ContentType_Image
|
||||||
@@ -1018,6 +1258,207 @@ references:
|
|||||||
commentId: F:AnthropicClient.Models.ContentType.ToolUse
|
commentId: F:AnthropicClient.Models.ContentType.ToolUse
|
||||||
fullName: AnthropicClient.Models.ContentType.ToolUse
|
fullName: AnthropicClient.Models.ContentType.ToolUse
|
||||||
nameWithType: ContentType.ToolUse
|
nameWithType: ContentType.ToolUse
|
||||||
|
- uid: AnthropicClient.Models.CountMessageTokensRequest
|
||||||
|
name: CountMessageTokensRequest
|
||||||
|
href: api/AnthropicClient.Models.CountMessageTokensRequest.html
|
||||||
|
commentId: T:AnthropicClient.Models.CountMessageTokensRequest
|
||||||
|
fullName: AnthropicClient.Models.CountMessageTokensRequest
|
||||||
|
nameWithType: CountMessageTokensRequest
|
||||||
|
- uid: AnthropicClient.Models.CountMessageTokensRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool},System.Collections.Generic.List{AnthropicClient.Models.TextContent})
|
||||||
|
name: CountMessageTokensRequest(string, List<Message>, ToolChoice?, List<Tool>?, List<TextContent>?)
|
||||||
|
href: api/AnthropicClient.Models.CountMessageTokensRequest.html#AnthropicClient_Models_CountMessageTokensRequest__ctor_System_String_System_Collections_Generic_List_AnthropicClient_Models_Message__AnthropicClient_Models_ToolChoice_System_Collections_Generic_List_AnthropicClient_Models_Tool__System_Collections_Generic_List_AnthropicClient_Models_TextContent__
|
||||||
|
commentId: M:AnthropicClient.Models.CountMessageTokensRequest.#ctor(System.String,System.Collections.Generic.List{AnthropicClient.Models.Message},AnthropicClient.Models.ToolChoice,System.Collections.Generic.List{AnthropicClient.Models.Tool},System.Collections.Generic.List{AnthropicClient.Models.TextContent})
|
||||||
|
name.vb: New(String, List(Of Message), ToolChoice, List(Of Tool), List(Of TextContent))
|
||||||
|
fullName: AnthropicClient.Models.CountMessageTokensRequest.CountMessageTokensRequest(string, System.Collections.Generic.List<AnthropicClient.Models.Message>, AnthropicClient.Models.ToolChoice?, System.Collections.Generic.List<AnthropicClient.Models.Tool>?, System.Collections.Generic.List<AnthropicClient.Models.TextContent>?)
|
||||||
|
fullName.vb: AnthropicClient.Models.CountMessageTokensRequest.New(String, System.Collections.Generic.List(Of AnthropicClient.Models.Message), AnthropicClient.Models.ToolChoice, System.Collections.Generic.List(Of AnthropicClient.Models.Tool), System.Collections.Generic.List(Of AnthropicClient.Models.TextContent))
|
||||||
|
nameWithType: CountMessageTokensRequest.CountMessageTokensRequest(string, List<Message>, ToolChoice?, List<Tool>?, List<TextContent>?)
|
||||||
|
nameWithType.vb: CountMessageTokensRequest.New(String, List(Of Message), ToolChoice, List(Of Tool), List(Of TextContent))
|
||||||
|
- uid: AnthropicClient.Models.CountMessageTokensRequest.#ctor*
|
||||||
|
name: CountMessageTokensRequest
|
||||||
|
href: api/AnthropicClient.Models.CountMessageTokensRequest.html#AnthropicClient_Models_CountMessageTokensRequest__ctor_
|
||||||
|
commentId: Overload:AnthropicClient.Models.CountMessageTokensRequest.#ctor
|
||||||
|
isSpec: "True"
|
||||||
|
name.vb: New
|
||||||
|
fullName: AnthropicClient.Models.CountMessageTokensRequest.CountMessageTokensRequest
|
||||||
|
fullName.vb: AnthropicClient.Models.CountMessageTokensRequest.New
|
||||||
|
nameWithType: CountMessageTokensRequest.CountMessageTokensRequest
|
||||||
|
nameWithType.vb: CountMessageTokensRequest.New
|
||||||
|
- uid: AnthropicClient.Models.CountMessageTokensRequest.Messages
|
||||||
|
name: Messages
|
||||||
|
href: api/AnthropicClient.Models.CountMessageTokensRequest.html#AnthropicClient_Models_CountMessageTokensRequest_Messages
|
||||||
|
commentId: P:AnthropicClient.Models.CountMessageTokensRequest.Messages
|
||||||
|
fullName: AnthropicClient.Models.CountMessageTokensRequest.Messages
|
||||||
|
nameWithType: CountMessageTokensRequest.Messages
|
||||||
|
- uid: AnthropicClient.Models.CountMessageTokensRequest.Messages*
|
||||||
|
name: Messages
|
||||||
|
href: api/AnthropicClient.Models.CountMessageTokensRequest.html#AnthropicClient_Models_CountMessageTokensRequest_Messages_
|
||||||
|
commentId: Overload:AnthropicClient.Models.CountMessageTokensRequest.Messages
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.CountMessageTokensRequest.Messages
|
||||||
|
nameWithType: CountMessageTokensRequest.Messages
|
||||||
|
- uid: AnthropicClient.Models.CountMessageTokensRequest.Model
|
||||||
|
name: Model
|
||||||
|
href: api/AnthropicClient.Models.CountMessageTokensRequest.html#AnthropicClient_Models_CountMessageTokensRequest_Model
|
||||||
|
commentId: P:AnthropicClient.Models.CountMessageTokensRequest.Model
|
||||||
|
fullName: AnthropicClient.Models.CountMessageTokensRequest.Model
|
||||||
|
nameWithType: CountMessageTokensRequest.Model
|
||||||
|
- uid: AnthropicClient.Models.CountMessageTokensRequest.Model*
|
||||||
|
name: Model
|
||||||
|
href: api/AnthropicClient.Models.CountMessageTokensRequest.html#AnthropicClient_Models_CountMessageTokensRequest_Model_
|
||||||
|
commentId: Overload:AnthropicClient.Models.CountMessageTokensRequest.Model
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.CountMessageTokensRequest.Model
|
||||||
|
nameWithType: CountMessageTokensRequest.Model
|
||||||
|
- uid: AnthropicClient.Models.CountMessageTokensRequest.SystemPrompt
|
||||||
|
name: SystemPrompt
|
||||||
|
href: api/AnthropicClient.Models.CountMessageTokensRequest.html#AnthropicClient_Models_CountMessageTokensRequest_SystemPrompt
|
||||||
|
commentId: P:AnthropicClient.Models.CountMessageTokensRequest.SystemPrompt
|
||||||
|
fullName: AnthropicClient.Models.CountMessageTokensRequest.SystemPrompt
|
||||||
|
nameWithType: CountMessageTokensRequest.SystemPrompt
|
||||||
|
- uid: AnthropicClient.Models.CountMessageTokensRequest.SystemPrompt*
|
||||||
|
name: SystemPrompt
|
||||||
|
href: api/AnthropicClient.Models.CountMessageTokensRequest.html#AnthropicClient_Models_CountMessageTokensRequest_SystemPrompt_
|
||||||
|
commentId: Overload:AnthropicClient.Models.CountMessageTokensRequest.SystemPrompt
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.CountMessageTokensRequest.SystemPrompt
|
||||||
|
nameWithType: CountMessageTokensRequest.SystemPrompt
|
||||||
|
- uid: AnthropicClient.Models.CountMessageTokensRequest.ToolChoice
|
||||||
|
name: ToolChoice
|
||||||
|
href: api/AnthropicClient.Models.CountMessageTokensRequest.html#AnthropicClient_Models_CountMessageTokensRequest_ToolChoice
|
||||||
|
commentId: P:AnthropicClient.Models.CountMessageTokensRequest.ToolChoice
|
||||||
|
fullName: AnthropicClient.Models.CountMessageTokensRequest.ToolChoice
|
||||||
|
nameWithType: CountMessageTokensRequest.ToolChoice
|
||||||
|
- uid: AnthropicClient.Models.CountMessageTokensRequest.ToolChoice*
|
||||||
|
name: ToolChoice
|
||||||
|
href: api/AnthropicClient.Models.CountMessageTokensRequest.html#AnthropicClient_Models_CountMessageTokensRequest_ToolChoice_
|
||||||
|
commentId: Overload:AnthropicClient.Models.CountMessageTokensRequest.ToolChoice
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.CountMessageTokensRequest.ToolChoice
|
||||||
|
nameWithType: CountMessageTokensRequest.ToolChoice
|
||||||
|
- uid: AnthropicClient.Models.CountMessageTokensRequest.Tools
|
||||||
|
name: Tools
|
||||||
|
href: api/AnthropicClient.Models.CountMessageTokensRequest.html#AnthropicClient_Models_CountMessageTokensRequest_Tools
|
||||||
|
commentId: P:AnthropicClient.Models.CountMessageTokensRequest.Tools
|
||||||
|
fullName: AnthropicClient.Models.CountMessageTokensRequest.Tools
|
||||||
|
nameWithType: CountMessageTokensRequest.Tools
|
||||||
|
- uid: AnthropicClient.Models.CountMessageTokensRequest.Tools*
|
||||||
|
name: Tools
|
||||||
|
href: api/AnthropicClient.Models.CountMessageTokensRequest.html#AnthropicClient_Models_CountMessageTokensRequest_Tools_
|
||||||
|
commentId: Overload:AnthropicClient.Models.CountMessageTokensRequest.Tools
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.CountMessageTokensRequest.Tools
|
||||||
|
nameWithType: CountMessageTokensRequest.Tools
|
||||||
|
- uid: AnthropicClient.Models.DocumentContent
|
||||||
|
name: DocumentContent
|
||||||
|
href: api/AnthropicClient.Models.DocumentContent.html
|
||||||
|
commentId: T:AnthropicClient.Models.DocumentContent
|
||||||
|
fullName: AnthropicClient.Models.DocumentContent
|
||||||
|
nameWithType: DocumentContent
|
||||||
|
- uid: AnthropicClient.Models.DocumentContent.#ctor(System.String,System.String)
|
||||||
|
name: DocumentContent(string, string)
|
||||||
|
href: api/AnthropicClient.Models.DocumentContent.html#AnthropicClient_Models_DocumentContent__ctor_System_String_System_String_
|
||||||
|
commentId: M:AnthropicClient.Models.DocumentContent.#ctor(System.String,System.String)
|
||||||
|
name.vb: New(String, String)
|
||||||
|
fullName: AnthropicClient.Models.DocumentContent.DocumentContent(string, string)
|
||||||
|
fullName.vb: AnthropicClient.Models.DocumentContent.New(String, String)
|
||||||
|
nameWithType: DocumentContent.DocumentContent(string, string)
|
||||||
|
nameWithType.vb: DocumentContent.New(String, String)
|
||||||
|
- uid: AnthropicClient.Models.DocumentContent.#ctor(System.String,System.String,AnthropicClient.Models.CacheControl)
|
||||||
|
name: DocumentContent(string, string, CacheControl)
|
||||||
|
href: api/AnthropicClient.Models.DocumentContent.html#AnthropicClient_Models_DocumentContent__ctor_System_String_System_String_AnthropicClient_Models_CacheControl_
|
||||||
|
commentId: M:AnthropicClient.Models.DocumentContent.#ctor(System.String,System.String,AnthropicClient.Models.CacheControl)
|
||||||
|
name.vb: New(String, String, CacheControl)
|
||||||
|
fullName: AnthropicClient.Models.DocumentContent.DocumentContent(string, string, AnthropicClient.Models.CacheControl)
|
||||||
|
fullName.vb: AnthropicClient.Models.DocumentContent.New(String, String, AnthropicClient.Models.CacheControl)
|
||||||
|
nameWithType: DocumentContent.DocumentContent(string, string, CacheControl)
|
||||||
|
nameWithType.vb: DocumentContent.New(String, String, CacheControl)
|
||||||
|
- uid: AnthropicClient.Models.DocumentContent.#ctor*
|
||||||
|
name: DocumentContent
|
||||||
|
href: api/AnthropicClient.Models.DocumentContent.html#AnthropicClient_Models_DocumentContent__ctor_
|
||||||
|
commentId: Overload:AnthropicClient.Models.DocumentContent.#ctor
|
||||||
|
isSpec: "True"
|
||||||
|
name.vb: New
|
||||||
|
fullName: AnthropicClient.Models.DocumentContent.DocumentContent
|
||||||
|
fullName.vb: AnthropicClient.Models.DocumentContent.New
|
||||||
|
nameWithType: DocumentContent.DocumentContent
|
||||||
|
nameWithType.vb: DocumentContent.New
|
||||||
|
- uid: AnthropicClient.Models.DocumentContent.Source
|
||||||
|
name: Source
|
||||||
|
href: api/AnthropicClient.Models.DocumentContent.html#AnthropicClient_Models_DocumentContent_Source
|
||||||
|
commentId: P:AnthropicClient.Models.DocumentContent.Source
|
||||||
|
fullName: AnthropicClient.Models.DocumentContent.Source
|
||||||
|
nameWithType: DocumentContent.Source
|
||||||
|
- uid: AnthropicClient.Models.DocumentContent.Source*
|
||||||
|
name: Source
|
||||||
|
href: api/AnthropicClient.Models.DocumentContent.html#AnthropicClient_Models_DocumentContent_Source_
|
||||||
|
commentId: Overload:AnthropicClient.Models.DocumentContent.Source
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.DocumentContent.Source
|
||||||
|
nameWithType: DocumentContent.Source
|
||||||
|
- uid: AnthropicClient.Models.DocumentSource
|
||||||
|
name: DocumentSource
|
||||||
|
href: api/AnthropicClient.Models.DocumentSource.html
|
||||||
|
commentId: T:AnthropicClient.Models.DocumentSource
|
||||||
|
fullName: AnthropicClient.Models.DocumentSource
|
||||||
|
nameWithType: DocumentSource
|
||||||
|
- uid: AnthropicClient.Models.DocumentSource.#ctor(System.String,System.String)
|
||||||
|
name: DocumentSource(string, string)
|
||||||
|
href: api/AnthropicClient.Models.DocumentSource.html#AnthropicClient_Models_DocumentSource__ctor_System_String_System_String_
|
||||||
|
commentId: M:AnthropicClient.Models.DocumentSource.#ctor(System.String,System.String)
|
||||||
|
name.vb: New(String, String)
|
||||||
|
fullName: AnthropicClient.Models.DocumentSource.DocumentSource(string, string)
|
||||||
|
fullName.vb: AnthropicClient.Models.DocumentSource.New(String, String)
|
||||||
|
nameWithType: DocumentSource.DocumentSource(string, string)
|
||||||
|
nameWithType.vb: DocumentSource.New(String, String)
|
||||||
|
- uid: AnthropicClient.Models.DocumentSource.#ctor*
|
||||||
|
name: DocumentSource
|
||||||
|
href: api/AnthropicClient.Models.DocumentSource.html#AnthropicClient_Models_DocumentSource__ctor_
|
||||||
|
commentId: Overload:AnthropicClient.Models.DocumentSource.#ctor
|
||||||
|
isSpec: "True"
|
||||||
|
name.vb: New
|
||||||
|
fullName: AnthropicClient.Models.DocumentSource.DocumentSource
|
||||||
|
fullName.vb: AnthropicClient.Models.DocumentSource.New
|
||||||
|
nameWithType: DocumentSource.DocumentSource
|
||||||
|
nameWithType.vb: DocumentSource.New
|
||||||
|
- uid: AnthropicClient.Models.DocumentSource.Data
|
||||||
|
name: Data
|
||||||
|
href: api/AnthropicClient.Models.DocumentSource.html#AnthropicClient_Models_DocumentSource_Data
|
||||||
|
commentId: P:AnthropicClient.Models.DocumentSource.Data
|
||||||
|
fullName: AnthropicClient.Models.DocumentSource.Data
|
||||||
|
nameWithType: DocumentSource.Data
|
||||||
|
- uid: AnthropicClient.Models.DocumentSource.Data*
|
||||||
|
name: Data
|
||||||
|
href: api/AnthropicClient.Models.DocumentSource.html#AnthropicClient_Models_DocumentSource_Data_
|
||||||
|
commentId: Overload:AnthropicClient.Models.DocumentSource.Data
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.DocumentSource.Data
|
||||||
|
nameWithType: DocumentSource.Data
|
||||||
|
- uid: AnthropicClient.Models.DocumentSource.MediaType
|
||||||
|
name: MediaType
|
||||||
|
href: api/AnthropicClient.Models.DocumentSource.html#AnthropicClient_Models_DocumentSource_MediaType
|
||||||
|
commentId: P:AnthropicClient.Models.DocumentSource.MediaType
|
||||||
|
fullName: AnthropicClient.Models.DocumentSource.MediaType
|
||||||
|
nameWithType: DocumentSource.MediaType
|
||||||
|
- uid: AnthropicClient.Models.DocumentSource.MediaType*
|
||||||
|
name: MediaType
|
||||||
|
href: api/AnthropicClient.Models.DocumentSource.html#AnthropicClient_Models_DocumentSource_MediaType_
|
||||||
|
commentId: Overload:AnthropicClient.Models.DocumentSource.MediaType
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.DocumentSource.MediaType
|
||||||
|
nameWithType: DocumentSource.MediaType
|
||||||
|
- uid: AnthropicClient.Models.DocumentSource.Type
|
||||||
|
name: Type
|
||||||
|
href: api/AnthropicClient.Models.DocumentSource.html#AnthropicClient_Models_DocumentSource_Type
|
||||||
|
commentId: P:AnthropicClient.Models.DocumentSource.Type
|
||||||
|
fullName: AnthropicClient.Models.DocumentSource.Type
|
||||||
|
nameWithType: DocumentSource.Type
|
||||||
|
- uid: AnthropicClient.Models.DocumentSource.Type*
|
||||||
|
name: Type
|
||||||
|
href: api/AnthropicClient.Models.DocumentSource.html#AnthropicClient_Models_DocumentSource_Type_
|
||||||
|
commentId: Overload:AnthropicClient.Models.DocumentSource.Type
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.DocumentSource.Type
|
||||||
|
nameWithType: DocumentSource.Type
|
||||||
- uid: AnthropicClient.Models.EphemeralCacheControl
|
- uid: AnthropicClient.Models.EphemeralCacheControl
|
||||||
name: EphemeralCacheControl
|
name: EphemeralCacheControl
|
||||||
href: api/AnthropicClient.Models.EphemeralCacheControl.html
|
href: api/AnthropicClient.Models.EphemeralCacheControl.html
|
||||||
@@ -2266,6 +2707,154 @@ references:
|
|||||||
fullName.vb: AnthropicClient.Models.OverloadedError.New
|
fullName.vb: AnthropicClient.Models.OverloadedError.New
|
||||||
nameWithType: OverloadedError.OverloadedError
|
nameWithType: OverloadedError.OverloadedError
|
||||||
nameWithType.vb: OverloadedError.New
|
nameWithType.vb: OverloadedError.New
|
||||||
|
- uid: AnthropicClient.Models.Page
|
||||||
|
name: Page
|
||||||
|
href: api/AnthropicClient.Models.Page.html
|
||||||
|
commentId: T:AnthropicClient.Models.Page
|
||||||
|
fullName: AnthropicClient.Models.Page
|
||||||
|
nameWithType: Page
|
||||||
|
- uid: AnthropicClient.Models.Page.FirstId
|
||||||
|
name: FirstId
|
||||||
|
href: api/AnthropicClient.Models.Page.html#AnthropicClient_Models_Page_FirstId
|
||||||
|
commentId: P:AnthropicClient.Models.Page.FirstId
|
||||||
|
fullName: AnthropicClient.Models.Page.FirstId
|
||||||
|
nameWithType: Page.FirstId
|
||||||
|
- uid: AnthropicClient.Models.Page.FirstId*
|
||||||
|
name: FirstId
|
||||||
|
href: api/AnthropicClient.Models.Page.html#AnthropicClient_Models_Page_FirstId_
|
||||||
|
commentId: Overload:AnthropicClient.Models.Page.FirstId
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.Page.FirstId
|
||||||
|
nameWithType: Page.FirstId
|
||||||
|
- uid: AnthropicClient.Models.Page.HasMore
|
||||||
|
name: HasMore
|
||||||
|
href: api/AnthropicClient.Models.Page.html#AnthropicClient_Models_Page_HasMore
|
||||||
|
commentId: P:AnthropicClient.Models.Page.HasMore
|
||||||
|
fullName: AnthropicClient.Models.Page.HasMore
|
||||||
|
nameWithType: Page.HasMore
|
||||||
|
- uid: AnthropicClient.Models.Page.HasMore*
|
||||||
|
name: HasMore
|
||||||
|
href: api/AnthropicClient.Models.Page.html#AnthropicClient_Models_Page_HasMore_
|
||||||
|
commentId: Overload:AnthropicClient.Models.Page.HasMore
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.Page.HasMore
|
||||||
|
nameWithType: Page.HasMore
|
||||||
|
- uid: AnthropicClient.Models.Page.LastId
|
||||||
|
name: LastId
|
||||||
|
href: api/AnthropicClient.Models.Page.html#AnthropicClient_Models_Page_LastId
|
||||||
|
commentId: P:AnthropicClient.Models.Page.LastId
|
||||||
|
fullName: AnthropicClient.Models.Page.LastId
|
||||||
|
nameWithType: Page.LastId
|
||||||
|
- uid: AnthropicClient.Models.Page.LastId*
|
||||||
|
name: LastId
|
||||||
|
href: api/AnthropicClient.Models.Page.html#AnthropicClient_Models_Page_LastId_
|
||||||
|
commentId: Overload:AnthropicClient.Models.Page.LastId
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.Page.LastId
|
||||||
|
nameWithType: Page.LastId
|
||||||
|
- uid: AnthropicClient.Models.Page`1
|
||||||
|
name: Page<T>
|
||||||
|
href: api/AnthropicClient.Models.Page-1.html
|
||||||
|
commentId: T:AnthropicClient.Models.Page`1
|
||||||
|
name.vb: Page(Of T)
|
||||||
|
fullName: AnthropicClient.Models.Page<T>
|
||||||
|
fullName.vb: AnthropicClient.Models.Page(Of T)
|
||||||
|
nameWithType: Page<T>
|
||||||
|
nameWithType.vb: Page(Of T)
|
||||||
|
- uid: AnthropicClient.Models.Page`1.Data
|
||||||
|
name: Data
|
||||||
|
href: api/AnthropicClient.Models.Page-1.html#AnthropicClient_Models_Page_1_Data
|
||||||
|
commentId: P:AnthropicClient.Models.Page`1.Data
|
||||||
|
fullName: AnthropicClient.Models.Page<T>.Data
|
||||||
|
fullName.vb: AnthropicClient.Models.Page(Of T).Data
|
||||||
|
nameWithType: Page<T>.Data
|
||||||
|
nameWithType.vb: Page(Of T).Data
|
||||||
|
- uid: AnthropicClient.Models.Page`1.Data*
|
||||||
|
name: Data
|
||||||
|
href: api/AnthropicClient.Models.Page-1.html#AnthropicClient_Models_Page_1_Data_
|
||||||
|
commentId: Overload:AnthropicClient.Models.Page`1.Data
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.Page<T>.Data
|
||||||
|
fullName.vb: AnthropicClient.Models.Page(Of T).Data
|
||||||
|
nameWithType: Page<T>.Data
|
||||||
|
nameWithType.vb: Page(Of T).Data
|
||||||
|
- uid: AnthropicClient.Models.PagingRequest
|
||||||
|
name: PagingRequest
|
||||||
|
href: api/AnthropicClient.Models.PagingRequest.html
|
||||||
|
commentId: T:AnthropicClient.Models.PagingRequest
|
||||||
|
fullName: AnthropicClient.Models.PagingRequest
|
||||||
|
nameWithType: PagingRequest
|
||||||
|
- uid: AnthropicClient.Models.PagingRequest.#ctor(System.String,System.String,System.Int32)
|
||||||
|
name: PagingRequest(string, string, int)
|
||||||
|
href: api/AnthropicClient.Models.PagingRequest.html#AnthropicClient_Models_PagingRequest__ctor_System_String_System_String_System_Int32_
|
||||||
|
commentId: M:AnthropicClient.Models.PagingRequest.#ctor(System.String,System.String,System.Int32)
|
||||||
|
name.vb: New(String, String, Integer)
|
||||||
|
fullName: AnthropicClient.Models.PagingRequest.PagingRequest(string, string, int)
|
||||||
|
fullName.vb: AnthropicClient.Models.PagingRequest.New(String, String, Integer)
|
||||||
|
nameWithType: PagingRequest.PagingRequest(string, string, int)
|
||||||
|
nameWithType.vb: PagingRequest.New(String, String, Integer)
|
||||||
|
- uid: AnthropicClient.Models.PagingRequest.#ctor*
|
||||||
|
name: PagingRequest
|
||||||
|
href: api/AnthropicClient.Models.PagingRequest.html#AnthropicClient_Models_PagingRequest__ctor_
|
||||||
|
commentId: Overload:AnthropicClient.Models.PagingRequest.#ctor
|
||||||
|
isSpec: "True"
|
||||||
|
name.vb: New
|
||||||
|
fullName: AnthropicClient.Models.PagingRequest.PagingRequest
|
||||||
|
fullName.vb: AnthropicClient.Models.PagingRequest.New
|
||||||
|
nameWithType: PagingRequest.PagingRequest
|
||||||
|
nameWithType.vb: PagingRequest.New
|
||||||
|
- uid: AnthropicClient.Models.PagingRequest.AfterId
|
||||||
|
name: AfterId
|
||||||
|
href: api/AnthropicClient.Models.PagingRequest.html#AnthropicClient_Models_PagingRequest_AfterId
|
||||||
|
commentId: P:AnthropicClient.Models.PagingRequest.AfterId
|
||||||
|
fullName: AnthropicClient.Models.PagingRequest.AfterId
|
||||||
|
nameWithType: PagingRequest.AfterId
|
||||||
|
- uid: AnthropicClient.Models.PagingRequest.AfterId*
|
||||||
|
name: AfterId
|
||||||
|
href: api/AnthropicClient.Models.PagingRequest.html#AnthropicClient_Models_PagingRequest_AfterId_
|
||||||
|
commentId: Overload:AnthropicClient.Models.PagingRequest.AfterId
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.PagingRequest.AfterId
|
||||||
|
nameWithType: PagingRequest.AfterId
|
||||||
|
- uid: AnthropicClient.Models.PagingRequest.BeforeId
|
||||||
|
name: BeforeId
|
||||||
|
href: api/AnthropicClient.Models.PagingRequest.html#AnthropicClient_Models_PagingRequest_BeforeId
|
||||||
|
commentId: P:AnthropicClient.Models.PagingRequest.BeforeId
|
||||||
|
fullName: AnthropicClient.Models.PagingRequest.BeforeId
|
||||||
|
nameWithType: PagingRequest.BeforeId
|
||||||
|
- uid: AnthropicClient.Models.PagingRequest.BeforeId*
|
||||||
|
name: BeforeId
|
||||||
|
href: api/AnthropicClient.Models.PagingRequest.html#AnthropicClient_Models_PagingRequest_BeforeId_
|
||||||
|
commentId: Overload:AnthropicClient.Models.PagingRequest.BeforeId
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.PagingRequest.BeforeId
|
||||||
|
nameWithType: PagingRequest.BeforeId
|
||||||
|
- uid: AnthropicClient.Models.PagingRequest.Limit
|
||||||
|
name: Limit
|
||||||
|
href: api/AnthropicClient.Models.PagingRequest.html#AnthropicClient_Models_PagingRequest_Limit
|
||||||
|
commentId: P:AnthropicClient.Models.PagingRequest.Limit
|
||||||
|
fullName: AnthropicClient.Models.PagingRequest.Limit
|
||||||
|
nameWithType: PagingRequest.Limit
|
||||||
|
- uid: AnthropicClient.Models.PagingRequest.Limit*
|
||||||
|
name: Limit
|
||||||
|
href: api/AnthropicClient.Models.PagingRequest.html#AnthropicClient_Models_PagingRequest_Limit_
|
||||||
|
commentId: Overload:AnthropicClient.Models.PagingRequest.Limit
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.PagingRequest.Limit
|
||||||
|
nameWithType: PagingRequest.Limit
|
||||||
|
- uid: AnthropicClient.Models.PagingRequest.ToQueryParameters
|
||||||
|
name: ToQueryParameters()
|
||||||
|
href: api/AnthropicClient.Models.PagingRequest.html#AnthropicClient_Models_PagingRequest_ToQueryParameters
|
||||||
|
commentId: M:AnthropicClient.Models.PagingRequest.ToQueryParameters
|
||||||
|
fullName: AnthropicClient.Models.PagingRequest.ToQueryParameters()
|
||||||
|
nameWithType: PagingRequest.ToQueryParameters()
|
||||||
|
- uid: AnthropicClient.Models.PagingRequest.ToQueryParameters*
|
||||||
|
name: ToQueryParameters
|
||||||
|
href: api/AnthropicClient.Models.PagingRequest.html#AnthropicClient_Models_PagingRequest_ToQueryParameters_
|
||||||
|
commentId: Overload:AnthropicClient.Models.PagingRequest.ToQueryParameters
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.PagingRequest.ToQueryParameters
|
||||||
|
nameWithType: PagingRequest.ToQueryParameters
|
||||||
- uid: AnthropicClient.Models.PermissionError
|
- uid: AnthropicClient.Models.PermissionError
|
||||||
name: PermissionError
|
name: PermissionError
|
||||||
href: api/AnthropicClient.Models.PermissionError.html
|
href: api/AnthropicClient.Models.PermissionError.html
|
||||||
@@ -2519,6 +3108,25 @@ references:
|
|||||||
isSpec: "True"
|
isSpec: "True"
|
||||||
fullName: AnthropicClient.Models.TextDelta.Text
|
fullName: AnthropicClient.Models.TextDelta.Text
|
||||||
nameWithType: TextDelta.Text
|
nameWithType: TextDelta.Text
|
||||||
|
- uid: AnthropicClient.Models.TokenCountResponse
|
||||||
|
name: TokenCountResponse
|
||||||
|
href: api/AnthropicClient.Models.TokenCountResponse.html
|
||||||
|
commentId: T:AnthropicClient.Models.TokenCountResponse
|
||||||
|
fullName: AnthropicClient.Models.TokenCountResponse
|
||||||
|
nameWithType: TokenCountResponse
|
||||||
|
- uid: AnthropicClient.Models.TokenCountResponse.InputTokens
|
||||||
|
name: InputTokens
|
||||||
|
href: api/AnthropicClient.Models.TokenCountResponse.html#AnthropicClient_Models_TokenCountResponse_InputTokens
|
||||||
|
commentId: P:AnthropicClient.Models.TokenCountResponse.InputTokens
|
||||||
|
fullName: AnthropicClient.Models.TokenCountResponse.InputTokens
|
||||||
|
nameWithType: TokenCountResponse.InputTokens
|
||||||
|
- uid: AnthropicClient.Models.TokenCountResponse.InputTokens*
|
||||||
|
name: InputTokens
|
||||||
|
href: api/AnthropicClient.Models.TokenCountResponse.html#AnthropicClient_Models_TokenCountResponse_InputTokens_
|
||||||
|
commentId: Overload:AnthropicClient.Models.TokenCountResponse.InputTokens
|
||||||
|
isSpec: "True"
|
||||||
|
fullName: AnthropicClient.Models.TokenCountResponse.InputTokens
|
||||||
|
nameWithType: TokenCountResponse.InputTokens
|
||||||
- uid: AnthropicClient.Models.Tool
|
- uid: AnthropicClient.Models.Tool
|
||||||
name: Tool
|
name: Tool
|
||||||
href: api/AnthropicClient.Models.Tool.html
|
href: api/AnthropicClient.Models.Tool.html
|
||||||
|
|||||||
@@ -8,32 +8,15 @@ using AnthropicClient.Utils;
|
|||||||
|
|
||||||
namespace AnthropicClient;
|
namespace AnthropicClient;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a client for interacting with the Anthropic API.
|
|
||||||
/// </summary>
|
|
||||||
public interface IAnthropicApiClient
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a message asynchronously.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="request">The message request to create.</param>
|
|
||||||
/// <returns>A task that represents the asynchronous operation. The task result contains the response as an <see cref="AnthropicResult{T}"/>.</returns>
|
|
||||||
Task<AnthropicResult<MessageResponse>> CreateMessageAsync(MessageRequest request);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a message asynchronously and streams the response.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="request">The message request to create.</param>
|
|
||||||
/// <returns>An asynchronous enumerable that yields the response event by event.</returns>
|
|
||||||
IAsyncEnumerable<AnthropicEvent> CreateMessageAsync(StreamMessageRequest request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc cref="IAnthropicApiClient"/>
|
/// <inheritdoc cref="IAnthropicApiClient"/>
|
||||||
public class AnthropicApiClient : IAnthropicApiClient
|
public class AnthropicApiClient : IAnthropicApiClient
|
||||||
{
|
{
|
||||||
private const string BaseUrl = "https://api.anthropic.com/v1/";
|
private const string BaseUrl = "https://api.anthropic.com/v1/";
|
||||||
private const string ApiKeyHeader = "x-api-key";
|
private const string ApiKeyHeader = "x-api-key";
|
||||||
private const string MessagesEndpoint = "messages";
|
private const string MessagesEndpoint = "messages";
|
||||||
|
private string CountTokensEndpoint => $"{MessagesEndpoint}/count_tokens";
|
||||||
|
private string MessageBatchesEndpoint => $"{MessagesEndpoint}/batches";
|
||||||
|
private const string ModelsEndpoint = "models";
|
||||||
private const string JsonContentType = "application/json";
|
private const string JsonContentType = "application/json";
|
||||||
private const string EventPrefix = "event:";
|
private const string EventPrefix = "event:";
|
||||||
private const string DataPrefix = "data:";
|
private const string DataPrefix = "data:";
|
||||||
@@ -71,7 +54,7 @@ public class AnthropicApiClient : IAnthropicApiClient
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public async Task<AnthropicResult<MessageResponse>> CreateMessageAsync(MessageRequest request)
|
public async Task<AnthropicResult<MessageResponse>> CreateMessageAsync(MessageRequest request)
|
||||||
{
|
{
|
||||||
var response = await SendRequestAsync(request);
|
var response = await SendRequestAsync(MessagesEndpoint, request);
|
||||||
var anthropicHeaders = new AnthropicHeaders(response.Headers);
|
var anthropicHeaders = new AnthropicHeaders(response.Headers);
|
||||||
var responseContent = await response.Content.ReadAsStringAsync();
|
var responseContent = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
@@ -94,7 +77,7 @@ public class AnthropicApiClient : IAnthropicApiClient
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public async IAsyncEnumerable<AnthropicEvent> CreateMessageAsync(StreamMessageRequest request)
|
public async IAsyncEnumerable<AnthropicEvent> CreateMessageAsync(StreamMessageRequest request)
|
||||||
{
|
{
|
||||||
var response = await SendRequestAsync(request);
|
var response = await SendRequestAsync(MessagesEndpoint, request);
|
||||||
|
|
||||||
if (response.IsSuccessStatusCode is false)
|
if (response.IsSuccessStatusCode is false)
|
||||||
{
|
{
|
||||||
@@ -255,6 +238,154 @@ public class AnthropicApiClient : IAnthropicApiClient
|
|||||||
} while (true);
|
} while (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public async Task<AnthropicResult<MessageBatchResponse>> CreateMessageBatchAsync(MessageBatchRequest request)
|
||||||
|
{
|
||||||
|
var response = await SendRequestAsync(MessageBatchesEndpoint, request);
|
||||||
|
return await CreateResultAsync<MessageBatchResponse>(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public async Task<AnthropicResult<MessageBatchResponse>> GetMessageBatchAsync(string batchId)
|
||||||
|
{
|
||||||
|
var response = await SendRequestAsync($"{MessageBatchesEndpoint}/{batchId}");
|
||||||
|
return await CreateResultAsync<MessageBatchResponse>(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public async Task<AnthropicResult<Page<MessageBatchResponse>>> ListMessageBatchesAsync(PagingRequest? request = null)
|
||||||
|
{
|
||||||
|
var pagingRequest = request ?? new PagingRequest();
|
||||||
|
var endpoint = $"{MessageBatchesEndpoint}?{pagingRequest.ToQueryParameters()}";
|
||||||
|
var response = await SendRequestAsync(endpoint);
|
||||||
|
return await CreateResultAsync<Page<MessageBatchResponse>>(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public async IAsyncEnumerable<AnthropicResult<Page<MessageBatchResponse>>> ListAllMessageBatchesAsync(int limit = 20)
|
||||||
|
{
|
||||||
|
await foreach (var result in GetAllPagesAsync<MessageBatchResponse>(MessageBatchesEndpoint, limit))
|
||||||
|
{
|
||||||
|
yield return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public async Task<AnthropicResult<MessageBatchResponse>> CancelMessageBatchAsync(string batchId)
|
||||||
|
{
|
||||||
|
var endpoint = $"{MessageBatchesEndpoint}/{batchId}/cancel";
|
||||||
|
var response = await SendRequestAsync(endpoint, HttpMethod.Post);
|
||||||
|
return await CreateResultAsync<MessageBatchResponse>(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public async Task<AnthropicResult<MessageBatchDeleteResponse>> DeleteMessageBatchAsync(string batchId)
|
||||||
|
{
|
||||||
|
var endpoint = $"{MessageBatchesEndpoint}/{batchId}";
|
||||||
|
var response = await SendRequestAsync(endpoint, HttpMethod.Delete);
|
||||||
|
return await CreateResultAsync<MessageBatchDeleteResponse>(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public async Task<AnthropicResult<IAsyncEnumerable<MessageBatchResultItem>>> GetMessageBatchResultsAsync(string batchId)
|
||||||
|
{
|
||||||
|
var response = await SendRequestAsync($"{MessageBatchesEndpoint}/{batchId}/results");
|
||||||
|
var anthropicHeaders = new AnthropicHeaders(response.Headers);
|
||||||
|
|
||||||
|
if (response.IsSuccessStatusCode is false)
|
||||||
|
{
|
||||||
|
var content = await response.Content.ReadAsStringAsync();
|
||||||
|
var error = Deserialize<AnthropicError>(content) ?? new AnthropicError();
|
||||||
|
return AnthropicResult<IAsyncEnumerable<MessageBatchResultItem>>.Failure(error, anthropicHeaders);
|
||||||
|
}
|
||||||
|
|
||||||
|
return AnthropicResult<IAsyncEnumerable<MessageBatchResultItem>>.Success(ReadResultsAsync(), anthropicHeaders);
|
||||||
|
|
||||||
|
async IAsyncEnumerable<MessageBatchResultItem> ReadResultsAsync()
|
||||||
|
{
|
||||||
|
using var responseContent = await response.Content.ReadAsStreamAsync();
|
||||||
|
using var streamReader = new StreamReader(responseContent);
|
||||||
|
|
||||||
|
var line = await streamReader.ReadLineAsync();
|
||||||
|
|
||||||
|
while (line is not null)
|
||||||
|
{
|
||||||
|
var resultItem = Deserialize<MessageBatchResultItem>(line) ?? new MessageBatchResultItem();
|
||||||
|
yield return resultItem;
|
||||||
|
|
||||||
|
line = await streamReader.ReadLineAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public async Task<AnthropicResult<TokenCountResponse>> CountMessageTokensAsync(CountMessageTokensRequest request)
|
||||||
|
{
|
||||||
|
var response = await SendRequestAsync(CountTokensEndpoint, request);
|
||||||
|
return await CreateResultAsync<TokenCountResponse>(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public async Task<AnthropicResult<Page<AnthropicModel>>> ListModelsAsync(PagingRequest? request = null)
|
||||||
|
{
|
||||||
|
var pagingRequest = request ?? new PagingRequest();
|
||||||
|
var endpoint = $"{ModelsEndpoint}?{pagingRequest.ToQueryParameters()}";
|
||||||
|
var response = await SendRequestAsync(endpoint);
|
||||||
|
return await CreateResultAsync<Page<AnthropicModel>>(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public async IAsyncEnumerable<AnthropicResult<Page<AnthropicModel>>> ListAllModelsAsync(int limit = 20)
|
||||||
|
{
|
||||||
|
await foreach (var result in GetAllPagesAsync<AnthropicModel>(ModelsEndpoint, limit))
|
||||||
|
{
|
||||||
|
yield return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public async Task<AnthropicResult<AnthropicModel>> GetModelAsync(string modelId)
|
||||||
|
{
|
||||||
|
var endpoint = $"{ModelsEndpoint}/{modelId}";
|
||||||
|
var response = await SendRequestAsync(endpoint);
|
||||||
|
return await CreateResultAsync<AnthropicModel>(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async IAsyncEnumerable<AnthropicResult<Page<T>>> GetAllPagesAsync<T>(string endpoint, int limit = 20)
|
||||||
|
{
|
||||||
|
var pagingRequest = new PagingRequest(limit: limit);
|
||||||
|
string Endpoint() => $"{endpoint}?{pagingRequest.ToQueryParameters()}";
|
||||||
|
bool hasMore;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
var response = await SendRequestAsync(Endpoint());
|
||||||
|
var anthropicHeaders = new AnthropicHeaders(response.Headers);
|
||||||
|
var responseContent = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
if (response.IsSuccessStatusCode is false)
|
||||||
|
{
|
||||||
|
var error = Deserialize<AnthropicError>(responseContent) ?? new AnthropicError();
|
||||||
|
yield return AnthropicResult<Page<T>>.Failure(error, anthropicHeaders);
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var page = Deserialize<Page<T>>(responseContent) ?? new Page<T>();
|
||||||
|
|
||||||
|
if (page.HasMore && page.LastId is not null)
|
||||||
|
{
|
||||||
|
hasMore = true;
|
||||||
|
pagingRequest = new PagingRequest(limit: limit, afterId: page.LastId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hasMore = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return AnthropicResult<Page<T>>.Success(page, anthropicHeaders);
|
||||||
|
} while (hasMore);
|
||||||
|
}
|
||||||
|
|
||||||
private ToolCall? GetToolCall(MessageResponse response, List<Tool> tools)
|
private ToolCall? GetToolCall(MessageResponse response, List<Tool> tools)
|
||||||
{
|
{
|
||||||
var toolUse = response.Content.OfType<ToolUseContent>().FirstOrDefault();
|
var toolUse = response.Content.OfType<ToolUseContent>().FirstOrDefault();
|
||||||
@@ -274,11 +405,32 @@ public class AnthropicApiClient : IAnthropicApiClient
|
|||||||
return new ToolCall(tool, toolUse);
|
return new ToolCall(tool, toolUse);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<HttpResponseMessage> SendRequestAsync(BaseMessageRequest request)
|
private async Task<AnthropicResult<T>> CreateResultAsync<T>(HttpResponseMessage response) where T : new()
|
||||||
|
{
|
||||||
|
var anthropicHeaders = new AnthropicHeaders(response.Headers);
|
||||||
|
var responseContent = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
if (response.IsSuccessStatusCode is false)
|
||||||
|
{
|
||||||
|
var error = Deserialize<AnthropicError>(responseContent) ?? new AnthropicError();
|
||||||
|
return AnthropicResult<T>.Failure(error, anthropicHeaders);
|
||||||
|
}
|
||||||
|
|
||||||
|
var model = Deserialize<T>(responseContent) ?? new T();
|
||||||
|
return AnthropicResult<T>.Success(model, anthropicHeaders);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<HttpResponseMessage> SendRequestAsync(string endpoint, HttpMethod? method = null)
|
||||||
|
{
|
||||||
|
var request = new HttpRequestMessage(method ?? HttpMethod.Get, endpoint);
|
||||||
|
return await _httpClient.SendAsync(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<HttpResponseMessage> SendRequestAsync<T>(string endpoint, T request)
|
||||||
{
|
{
|
||||||
var requestJson = Serialize(request);
|
var requestJson = Serialize(request);
|
||||||
var requestContent = new StringContent(requestJson, Encoding.UTF8, JsonContentType);
|
var requestContent = new StringContent(requestJson, Encoding.UTF8, JsonContentType);
|
||||||
return await _httpClient.PostAsync(MessagesEndpoint, requestContent);
|
return await _httpClient.PostAsync(endpoint, requestContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string Serialize<T>(T obj) => JsonSerializer.Serialize(obj, JsonSerializationOptions.DefaultOptions);
|
private string Serialize<T>(T obj) => JsonSerializer.Serialize(obj, JsonSerializationOptions.DefaultOptions);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<PackageId>AnthropicClient</PackageId>
|
<PackageId>AnthropicClient</PackageId>
|
||||||
<Version>0.1.1</Version>
|
<Version>0.6.0</Version>
|
||||||
<Authors>Stevan Freeborn</Authors>
|
<Authors>Stevan Freeborn</Authors>
|
||||||
<Description>Anthropic Client Library</Description>
|
<Description>Anthropic Client Library</Description>
|
||||||
<PackageProjectUrl>https://anthropicclient.stevanfreeborn.com/</PackageProjectUrl>
|
<PackageProjectUrl>https://anthropicclient.stevanfreeborn.com/</PackageProjectUrl>
|
||||||
|
|||||||
@@ -2,6 +2,66 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [versionize](https://github.com/versionize/versionize) for commit guidelines.
|
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.6.0"></a>
|
||||||
|
## [0.6.0](https://www.github.com/StevanFreeborn/anthropic-client/releases/tag/v0.6.0) (2025-01-15)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add CancelMessageBatchAsync method and corresponding tests ([c11600c](https://www.github.com/StevanFreeborn/anthropic-client/commit/c11600c77040eebfab4df1153d07774357d87ce2))
|
||||||
|
* add class for representing batch statuses ([f8e01bf](https://www.github.com/StevanFreeborn/anthropic-client/commit/f8e01bf4878e07f823d524408ed59a2232960a7b))
|
||||||
|
* add DeleteMessageBatchAsync method and MessageBatchDeleteResponse model with tests ([56b3a53](https://www.github.com/StevanFreeborn/anthropic-client/commit/56b3a53a2a31070693351525379b6a675b068496))
|
||||||
|
* add ListAllMessageBatchesAsync method and corresponding tests ([180a090](https://www.github.com/StevanFreeborn/anthropic-client/commit/180a0901959b88b27981f063b0be7a267a141802))
|
||||||
|
* implement CreateMessageBatchAsync method ([9548754](https://www.github.com/StevanFreeborn/anthropic-client/commit/9548754d6cab73d21c7b7a28264374e79dcb8bab))
|
||||||
|
* implement GetMessageBatchAsync method ([c5f3c5e](https://www.github.com/StevanFreeborn/anthropic-client/commit/c5f3c5eca549a89ac6b8197b833767c0ca4465c5))
|
||||||
|
* implement GetMessageBatchResultsAsync method ([c56adf3](https://www.github.com/StevanFreeborn/anthropic-client/commit/c56adf394c62aca10c89f1d8650635cefe248d50))
|
||||||
|
* implement ListMessageBatchesAsync method ([ca2ecdc](https://www.github.com/StevanFreeborn/anthropic-client/commit/ca2ecdcfc79a5ff96c22eb564e7fc8be22e82a6f))
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* default nullable properties to actually datetimeoffset min value when new'd up ([0a6d89b](https://www.github.com/StevanFreeborn/anthropic-client/commit/0a6d89bd77e165a0ae63dacd9f854bd49ba817ce))
|
||||||
|
* make correct properties nullable ([15f5ad4](https://www.github.com/StevanFreeborn/anthropic-client/commit/15f5ad49e7f41215c3b089cdfe3873182223ce2d))
|
||||||
|
* use proper count tokens endpoint ([5e247a3](https://www.github.com/StevanFreeborn/anthropic-client/commit/5e247a3c3afb9a3dad954eaa5890de106ae2edb9))
|
||||||
|
|
||||||
|
<a name="0.5.0"></a>
|
||||||
|
## [0.5.0](https://www.github.com/StevanFreeborn/anthropic-client/releases/tag/v0.5.0) (2025-01-06)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add classes to model response to get model list endpoint ([28b7bf6](https://www.github.com/StevanFreeborn/anthropic-client/commit/28b7bf6a897cf3b2e2aad7df767b0f4428bec7a4))
|
||||||
|
* add model to represent paged request ([df75cd2](https://www.github.com/StevanFreeborn/anthropic-client/commit/df75cd25e0a1beb55be97d5fcb8a718806793f51))
|
||||||
|
* implement GetModelAsync method ([8bbd4bb](https://www.github.com/StevanFreeborn/anthropic-client/commit/8bbd4bb7c8c3f4e6fdd6d85d68d728794b85831f))
|
||||||
|
* implement ListAllModelsAsync and ListModelsAsync ([8e0443a](https://www.github.com/StevanFreeborn/anthropic-client/commit/8e0443a6bb4736207d5ddf173f8ec966d03cec46))
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* only allow afterId or beforeId to be set. not both at same time. ([3fe75f5](https://www.github.com/StevanFreeborn/anthropic-client/commit/3fe75f511d6c6adae7971b6402353c7408b6d513))
|
||||||
|
|
||||||
|
<a name="0.4.0"></a>
|
||||||
|
## [0.4.0](https://www.github.com/StevanFreeborn/anthropic-client/releases/tag/v0.4.0) (2025-01-03)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add support for count tokens endpoint ([9448220](https://www.github.com/StevanFreeborn/anthropic-client/commit/944822060cd297c5720d8a1dc366f08ca0ec79ec))
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* remove model id validation ([31a7097](https://www.github.com/StevanFreeborn/anthropic-client/commit/31a7097cdc9f9f60a7b6576b8bcee7a49a00552c))
|
||||||
|
|
||||||
|
<a name="0.3.0"></a>
|
||||||
|
## [0.3.0](https://www.github.com/StevanFreeborn/anthropic-client/releases/tag/v0.3.0) (2025-01-02)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add missing model identifiers ([6e0c065](https://www.github.com/StevanFreeborn/anthropic-client/commit/6e0c0654af6a7daebac541995e4f082bae4a052e))
|
||||||
|
|
||||||
|
<a name="0.2.0"></a>
|
||||||
|
## [0.2.0](https://www.github.com/StevanFreeborn/anthropic-client/releases/tag/v0.2.0) (2024-11-21)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add content type ([c4d4d8a](https://www.github.com/StevanFreeborn/anthropic-client/commit/c4d4d8a15bb690ae2b766a8f797b9e49f6965e60))
|
||||||
|
* add model for DocumentContent and DocumentSource ([f3a7040](https://www.github.com/StevanFreeborn/anthropic-client/commit/f3a7040cb929ac55df2b8369a26bb1b1a8e29fc8))
|
||||||
|
|
||||||
<a name="0.1.1"></a>
|
<a name="0.1.1"></a>
|
||||||
## [0.1.1](https://www.github.com/StevanFreeborn/anthropic-client/releases/tag/v0.1.1) (2024-11-19)
|
## [0.1.1](https://www.github.com/StevanFreeborn/anthropic-client/releases/tag/v0.1.1) (2024-11-19)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,101 @@
|
|||||||
|
using AnthropicClient.Models;
|
||||||
|
|
||||||
|
namespace AnthropicClient;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a client for interacting with the Anthropic API.
|
||||||
|
/// </summary>
|
||||||
|
public interface IAnthropicApiClient
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a message asynchronously.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">The message request to create.</param>
|
||||||
|
/// <returns>A task that represents the asynchronous operation. The task result contains the response as an <see cref="AnthropicResult{T}"/>.</returns>
|
||||||
|
Task<AnthropicResult<MessageResponse>> CreateMessageAsync(MessageRequest request);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a message asynchronously and streams the response.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">The message request to create.</param>
|
||||||
|
/// <returns>An asynchronous enumerable that yields the response event by event.</returns>
|
||||||
|
IAsyncEnumerable<AnthropicEvent> CreateMessageAsync(StreamMessageRequest request);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a batch of messages asynchronously.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">The message batch request to create.</param>
|
||||||
|
/// <returns>A task that represents the asynchronous operation. The task result contains the response as an <see cref="AnthropicResult{T}"/> where T is <see cref="MessageBatchResponse"/>.</returns>
|
||||||
|
Task<AnthropicResult<MessageBatchResponse>> CreateMessageBatchAsync(MessageBatchRequest request);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a message batch asynchronously.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="batchId">The ID of the message batch to get.</param>
|
||||||
|
/// <returns>A task that represents the asynchronous operation. The task result contains the response as an <see cref="AnthropicResult{T}"/> where T is <see cref="MessageBatchResponse"/>.</returns>
|
||||||
|
Task<AnthropicResult<MessageBatchResponse>> GetMessageBatchAsync(string batchId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Lists the message batches asynchronously.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">The paging request to use for listing the message batches.</param>
|
||||||
|
/// <returns>A task that represents the asynchronous operation. The task result contains the response as an <see cref="AnthropicResult{T}"/> where T is <see cref="Page{T}"/> where T is <see cref="MessageBatchResponse"/>.</returns>
|
||||||
|
Task<AnthropicResult<Page<MessageBatchResponse>>> ListMessageBatchesAsync(PagingRequest? request = null);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Lists all message batches asynchronously.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="limit">The maximum number of message batches to return in each page.</param>
|
||||||
|
/// <returns>An asynchronous enumerable that yields the response as an <see cref="AnthropicResult{T}"/> where T is <see cref="Page{T}"/> where T is <see cref="MessageBatchResponse"/>.</returns>
|
||||||
|
IAsyncEnumerable<AnthropicResult<Page<MessageBatchResponse>>> ListAllMessageBatchesAsync(int limit = 20);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cancels a message batch asynchronously.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="batchId">The ID of the message batch to cancel.</param>
|
||||||
|
/// <returns>A task that represents the asynchronous operation. The task result contains the response as an <see cref="AnthropicResult{T}"/> where T is <see cref="MessageBatchResponse"/>.</returns>
|
||||||
|
Task<AnthropicResult<MessageBatchResponse>> CancelMessageBatchAsync(string batchId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes a message batch asynchronously.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="batchId">The ID of the message batch to delete.</param>
|
||||||
|
/// <returns>A task that represents the asynchronous operation. The task result contains the response as an <see cref="AnthropicResult{T}"/> where T is <see cref="MessageBatchDeleteResponse"/>.</returns>
|
||||||
|
Task<AnthropicResult<MessageBatchDeleteResponse>> DeleteMessageBatchAsync(string batchId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the results of a message batch asynchronously.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="batchId">The ID of the message batch to get the results for.</param>
|
||||||
|
/// <returns>A task that represents the asynchronous operation. The task result contains the response as an <see cref="AnthropicResult{T}"/> where T is <see cref="IAsyncEnumerable{T}"/> where T is <see cref="MessageBatchResultItem"/>.</returns>
|
||||||
|
Task<AnthropicResult<IAsyncEnumerable<MessageBatchResultItem>>> GetMessageBatchResultsAsync(string batchId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Counts the tokens in a message asynchronously.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">The count message tokens request.</param>
|
||||||
|
/// <returns>A task that represents the asynchronous operation. The task result contains the response as an <see cref="AnthropicResult{T}"/> where T is <see cref="TokenCountResponse"/>.</returns>
|
||||||
|
Task<AnthropicResult<TokenCountResponse>> CountMessageTokensAsync(CountMessageTokensRequest request);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Lists the models asynchronously.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">The paging request to use for listing the models.</param>
|
||||||
|
/// <returns>A task that represents the asynchronous operation. The task result contains the response as an <see cref="AnthropicResult{T}"/> where T is <see cref="Page{T}"/> where T is <see cref="AnthropicModel"/>.</returns>
|
||||||
|
Task<AnthropicResult<Page<AnthropicModel>>> ListModelsAsync(PagingRequest? request = null);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Lists the models asynchronously
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="limit">The maximum number of models to return in each page.</param>
|
||||||
|
/// <returns>An asynchronous enumerable that yields the response as an <see cref="AnthropicResult{T}"/> where T is <see cref="Page{T}"/> where T is <see cref="AnthropicModel"/>.</returns>
|
||||||
|
///
|
||||||
|
IAsyncEnumerable<AnthropicResult<Page<AnthropicModel>>> ListAllModelsAsync(int limit = 20);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a model by its ID asynchronously.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="modelId">The ID of the model to get.</param>
|
||||||
|
/// <returns>A task that represents the asynchronous operation. The task result contains the response as an <see cref="AnthropicResult{T}"/> where T is <see cref="AnthropicModel"/>.</returns>
|
||||||
|
Task<AnthropicResult<AnthropicModel>> GetModelAsync(string modelId);
|
||||||
|
}
|
||||||
@@ -16,6 +16,7 @@ class ContentConverter : JsonConverter<Content>
|
|||||||
{
|
{
|
||||||
ContentType.Text => JsonSerializer.Deserialize<TextContent>(root.GetRawText(), options)!,
|
ContentType.Text => JsonSerializer.Deserialize<TextContent>(root.GetRawText(), options)!,
|
||||||
ContentType.Image => JsonSerializer.Deserialize<ImageContent>(root.GetRawText(), options)!,
|
ContentType.Image => JsonSerializer.Deserialize<ImageContent>(root.GetRawText(), options)!,
|
||||||
|
ContentType.Document => JsonSerializer.Deserialize<DocumentContent>(root.GetRawText(), options)!,
|
||||||
ContentType.ToolUse => JsonSerializer.Deserialize<ToolUseContent>(root.GetRawText(), options)!,
|
ContentType.ToolUse => JsonSerializer.Deserialize<ToolUseContent>(root.GetRawText(), options)!,
|
||||||
ContentType.ToolResult => JsonSerializer.Deserialize<ToolResultContent>(root.GetRawText(), options)!,
|
ContentType.ToolResult => JsonSerializer.Deserialize<ToolResultContent>(root.GetRawText(), options)!,
|
||||||
_ => throw new JsonException($"Unknown content type: {type}")
|
_ => throw new JsonException($"Unknown content type: {type}")
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using System.Diagnostics;
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using System.Diagnostics;
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ static class JsonSerializationOptions
|
|||||||
new EventDataConverter(),
|
new EventDataConverter(),
|
||||||
new ContentDeltaConverter(),
|
new ContentDeltaConverter(),
|
||||||
new JsonStringEnumConverter(),
|
new JsonStringEnumConverter(),
|
||||||
|
new MessageBatchResultConverter(),
|
||||||
},
|
},
|
||||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
using AnthropicClient.Models;
|
||||||
|
|
||||||
|
namespace AnthropicClient.Json;
|
||||||
|
|
||||||
|
class MessageBatchResultConverter : JsonConverter<MessageBatchResult>
|
||||||
|
{
|
||||||
|
public override MessageBatchResult Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
using var jsonDocument = JsonDocument.ParseValue(ref reader);
|
||||||
|
var root = jsonDocument.RootElement;
|
||||||
|
var type = root.GetProperty("type").GetString();
|
||||||
|
return type switch
|
||||||
|
{
|
||||||
|
MessageBatchResultType.Succeeded => JsonSerializer.Deserialize<SucceededMessageBatchResult>(root.GetRawText(), options)!,
|
||||||
|
MessageBatchResultType.Errored => JsonSerializer.Deserialize<ErroredMessageBatchResult>(root.GetRawText(), options)!,
|
||||||
|
MessageBatchResultType.Canceled => JsonSerializer.Deserialize<CanceledMessageBatchResult>(root.GetRawText(), options)!,
|
||||||
|
MessageBatchResultType.Expired => JsonSerializer.Deserialize<ExpiredMessageBatchResult>(root.GetRawText(), options)!,
|
||||||
|
_ => throw new JsonException($"Unknown message batch result type: {type}")
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Write(Utf8JsonWriter writer, MessageBatchResult value, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
JsonSerializer.Serialize(writer, value, value.GetType(), options);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace AnthropicClient.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents an Anthropic model.
|
||||||
|
/// </summary>
|
||||||
|
public class AnthropicModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The type of the model.
|
||||||
|
/// </summary>
|
||||||
|
public string Type { get; init; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The id of the model.
|
||||||
|
/// </summary>
|
||||||
|
public string Id { get; init; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The display name of the model.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("display_name")]
|
||||||
|
public string DisplayName { get; init; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The created date of the model.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("created_at")]
|
||||||
|
public DateTimeOffset CreatedAt { get; init; }
|
||||||
|
}
|
||||||
@@ -6,24 +6,67 @@ namespace AnthropicClient.Models;
|
|||||||
public static class AnthropicModels
|
public static class AnthropicModels
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Claude-3 Opus model.
|
/// The Claude 3 Opus model.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string Claude3Opus = "claude-3-opus-20240229";
|
public const string Claude3Opus = "claude-3-opus-20240229";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Claude-3 Sonnet model.
|
/// The Claude 3 Opus model.
|
||||||
|
/// </summary>
|
||||||
|
public const string Claude3Opus20241022 = "claude-3-opus-20240229";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Claude 3 Opus model.
|
||||||
|
/// </summary>
|
||||||
|
public const string Claude3OpusLatest = "claude-3-opus-latest";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Claude 3 Sonnet model.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string Claude3Sonnet = "claude-3-sonnet-20240229";
|
public const string Claude3Sonnet = "claude-3-sonnet-20240229";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Claude-3.5 Sonnet model.
|
/// The Claude 3 Sonnet model.
|
||||||
|
/// </summary>
|
||||||
|
public const string Claude3Sonnet20240229 = "claude-3-sonnet-20240229";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Claude 3.5 Sonnet model.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string Claude35Sonnet = "claude-3-5-sonnet-20240620";
|
public const string Claude35Sonnet = "claude-3-5-sonnet-20240620";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Claude-3 Haiku model.
|
/// The Claude 3.5 Sonnet model.
|
||||||
|
/// </summary>
|
||||||
|
public const string Claude35Sonnet20240620 = "claude-3-5-sonnet-20240620";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Claude 3.5 Sonnet model.
|
||||||
|
/// </summary>
|
||||||
|
public const string Claude35Sonnet20241022 = "claude-3-5-sonnet-20241022";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Claude 3.5 Sonnet model.
|
||||||
|
/// </summary>
|
||||||
|
public const string Claude35SonnetLatest = "claude-3-5-sonnet-latest";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Claude 3 Haiku model.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string Claude3Haiku = "claude-3-haiku-20240307";
|
public const string Claude3Haiku = "claude-3-haiku-20240307";
|
||||||
|
|
||||||
internal static bool IsValidModel(string modelId) => modelId is Claude3Opus or Claude3Sonnet or Claude35Sonnet or Claude3Haiku;
|
/// <summary>
|
||||||
|
/// The Claude 3 Haiku model.
|
||||||
|
/// </summary>
|
||||||
|
public const string Claude3Haiku20240307 = "claude-3-haiku-20240307";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Claude 3.5 Haiku model.
|
||||||
|
/// </summary>
|
||||||
|
public const string Claude35Haiku20241022 = "claude-3-5-haiku-20241022";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Claude 3.5 Haiku model.
|
||||||
|
/// </summary>
|
||||||
|
public const string Claude35HaikuLatest = "claude-3-5-haiku-latest";
|
||||||
}
|
}
|
||||||
@@ -126,7 +126,6 @@ public abstract class BaseMessageRequest
|
|||||||
/// <param name="stream">A value indicating whether the message should be streamed.</param>
|
/// <param name="stream">A value indicating whether the message should be streamed.</param>
|
||||||
/// <param name="stopSequences">The prompt stop sequences.</param>
|
/// <param name="stopSequences">The prompt stop sequences.</param>
|
||||||
/// <param name="systemMessages">The system messages to use for the request.</param>
|
/// <param name="systemMessages">The system messages to use for the request.</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="ArgumentNullException">Thrown when the model or messages is null.</exception>
|
||||||
/// <exception cref="ArgumentException">Thrown when the messages contain no messages.</exception>
|
/// <exception cref="ArgumentException">Thrown when the messages contain no messages.</exception>
|
||||||
/// <exception cref="ArgumentException">Thrown when the max tokens is less than one.</exception>
|
/// <exception cref="ArgumentException">Thrown when the max tokens is less than one.</exception>
|
||||||
@@ -151,11 +150,6 @@ public abstract class BaseMessageRequest
|
|||||||
ArgumentValidator.ThrowIfNull(model, nameof(model));
|
ArgumentValidator.ThrowIfNull(model, nameof(model));
|
||||||
ArgumentValidator.ThrowIfNull(messages, nameof(messages));
|
ArgumentValidator.ThrowIfNull(messages, nameof(messages));
|
||||||
|
|
||||||
if (AnthropicModels.IsValidModel(model) is false)
|
|
||||||
{
|
|
||||||
throw new ArgumentException($"Invalid model ID: {model}");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (messages.Count < 1)
|
if (messages.Count < 1)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Messages must contain at least one message");
|
throw new ArgumentException("Messages must contain at least one message");
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
namespace AnthropicClient.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a message batch result that was cancelled.
|
||||||
|
/// </summary>
|
||||||
|
public class CanceledMessageBatchResult : MessageBatchResult
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="CanceledMessageBatchResult"/> class.
|
||||||
|
/// </summary>
|
||||||
|
public CanceledMessageBatchResult() : base(MessageBatchResultType.Canceled)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,4 +24,9 @@ public static class ContentType
|
|||||||
/// Represents the tool result content type.
|
/// Represents the tool result content type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ToolResult = "tool_result";
|
public const string ToolResult = "tool_result";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents the document content type.
|
||||||
|
/// </summary>
|
||||||
|
public const string Document = "document";
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
using AnthropicClient.Utils;
|
||||||
|
|
||||||
|
namespace AnthropicClient.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a request to count the number of tokens in a message.
|
||||||
|
/// </summary>
|
||||||
|
public class CountMessageTokensRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the model ID to be used for the request.
|
||||||
|
/// </summary>
|
||||||
|
public string Model { get; init; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the messages to count the number of tokens in.
|
||||||
|
/// </summary>
|
||||||
|
public List<Message> Messages { get; init; } = [];
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the tool choice mode to use for the request.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("tool_choice")]
|
||||||
|
public ToolChoice? ToolChoice { get; init; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the tools to use for the request.
|
||||||
|
/// </summary>
|
||||||
|
public List<Tool>? Tools { get; init; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the system prompt to use for the request.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("system")]
|
||||||
|
public List<TextContent>? SystemPrompt { get; init; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="CountMessageTokensRequest"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model">The model ID to use for the request.</param>
|
||||||
|
/// <param name="messages">The messages to count the number of tokens in.</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="systemPrompt">The system prompt to use for the request.</param>
|
||||||
|
/// <exception cref="ArgumentNullException">Thrown when <paramref name="model"/> or <paramref name="messages"/> is null.</exception>
|
||||||
|
/// <exception cref="ArgumentException">Thrown when <paramref name="messages"/> is empty.</exception>
|
||||||
|
/// <returns>A new instance of the <see cref="CountMessageTokensRequest"/> class.</returns>
|
||||||
|
public CountMessageTokensRequest(
|
||||||
|
string model,
|
||||||
|
List<Message> messages,
|
||||||
|
ToolChoice? toolChoice = null,
|
||||||
|
List<Tool>? tools = null,
|
||||||
|
List<TextContent>? systemPrompt = null
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ArgumentValidator.ThrowIfNull(model, nameof(model));
|
||||||
|
ArgumentValidator.ThrowIfNull(messages, nameof(messages));
|
||||||
|
|
||||||
|
if (messages.Count < 1)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Messages must contain at least one message");
|
||||||
|
}
|
||||||
|
|
||||||
|
Model = model;
|
||||||
|
Messages = messages;
|
||||||
|
ToolChoice = toolChoice;
|
||||||
|
Tools = tools;
|
||||||
|
SystemPrompt = systemPrompt;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
using AnthropicClient.Utils;
|
||||||
|
|
||||||
|
namespace AnthropicClient.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents content from a document that is part of a message.
|
||||||
|
/// </summary>
|
||||||
|
public class DocumentContent : Content
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the source of the document.
|
||||||
|
/// </summary>
|
||||||
|
public DocumentSource Source { get; init; } = new();
|
||||||
|
|
||||||
|
[JsonConstructor]
|
||||||
|
internal DocumentContent()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Validate(string mediaType, string data)
|
||||||
|
{
|
||||||
|
ArgumentValidator.ThrowIfNull(mediaType, nameof(mediaType));
|
||||||
|
ArgumentValidator.ThrowIfNull(data, nameof(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="DocumentContent"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mediaType">The media type of the document.</param>
|
||||||
|
/// <param name="data">The data of the document.</param>
|
||||||
|
/// <exception cref="ArgumentNullException">Thrown when the media type or data is null.</exception>
|
||||||
|
/// <returns>A new instance of the <see cref="DocumentContent"/> class.</returns>
|
||||||
|
public DocumentContent(string mediaType, string data) : base(ContentType.Document)
|
||||||
|
{
|
||||||
|
Validate(mediaType, data);
|
||||||
|
|
||||||
|
Source = new(mediaType, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="DocumentContent"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mediaType">The media type of the document.</param>
|
||||||
|
/// <param name="data">The data of the document.</param>
|
||||||
|
/// <param name="cacheControl">The cache control to be used for the content.</param>
|
||||||
|
/// <returns>A new instance of the <see cref="DocumentContent"/> class.</returns>
|
||||||
|
/// <exception cref="ArgumentNullException">Thrown when the media type, data, or cache control is null.</exception>
|
||||||
|
public DocumentContent(string mediaType, string data, CacheControl cacheControl) : base(ContentType.Document, cacheControl)
|
||||||
|
{
|
||||||
|
Validate(mediaType, data);
|
||||||
|
|
||||||
|
Source = new(mediaType, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
using AnthropicClient.Utils;
|
||||||
|
|
||||||
|
namespace AnthropicClient.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a document source.
|
||||||
|
/// </summary>
|
||||||
|
public class DocumentSource
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the media type of the document.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("media_type")]
|
||||||
|
public string MediaType { get; init; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the data of the document.
|
||||||
|
/// </summary>
|
||||||
|
public string Data { get; init; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the type of encoding of the document data.
|
||||||
|
/// </summary>
|
||||||
|
public string Type { get; init; } = "base64";
|
||||||
|
|
||||||
|
[JsonConstructor]
|
||||||
|
internal DocumentSource()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="DocumentSource"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mediaType">The media type of the document.</param>
|
||||||
|
/// <param name="data">The data of the document.</param>
|
||||||
|
/// <exception cref="ArgumentException">Thrown when the media type is invalid.</exception>
|
||||||
|
/// <exception cref="ArgumentNullException">Thrown when the media type or data is null.</exception>
|
||||||
|
/// <returns>A new instance of the <see cref="DocumentSource"/> class.</returns>
|
||||||
|
public DocumentSource(string mediaType, string data)
|
||||||
|
{
|
||||||
|
ArgumentValidator.ThrowIfNull(mediaType, nameof(mediaType));
|
||||||
|
ArgumentValidator.ThrowIfNull(data, nameof(data));
|
||||||
|
|
||||||
|
MediaType = mediaType;
|
||||||
|
Data = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
namespace AnthropicClient.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a message batch result that contains an error response.
|
||||||
|
/// </summary>
|
||||||
|
public class ErroredMessageBatchResult : MessageBatchResult
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the error of the message batch result.
|
||||||
|
/// </summary>
|
||||||
|
public AnthropicError Error { get; init; } = new AnthropicError();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="ErroredMessageBatchResult"/> class.
|
||||||
|
/// </summary>
|
||||||
|
public ErroredMessageBatchResult() : base(MessageBatchResultType.Errored)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
namespace AnthropicClient.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a message batch result that has expired.
|
||||||
|
/// </summary>
|
||||||
|
public class ExpiredMessageBatchResult : MessageBatchResult
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="ExpiredMessageBatchResult"/> class.
|
||||||
|
/// </summary>
|
||||||
|
public ExpiredMessageBatchResult() : base(MessageBatchResultType.Expired)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
namespace AnthropicClient.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a message batch delete response.
|
||||||
|
/// </summary>
|
||||||
|
public class MessageBatchDeleteResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the ID of the message batch that was deleted.
|
||||||
|
/// </summary>
|
||||||
|
public string Id { get; init; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the type of the message batch response.
|
||||||
|
/// </summary>
|
||||||
|
public string Type { get; init; } = string.Empty;
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
namespace AnthropicClient.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a request to create a batch of messages.
|
||||||
|
/// </summary>
|
||||||
|
public class MessageBatchRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the requests to create messages.
|
||||||
|
/// </summary>
|
||||||
|
public List<MessageBatchRequestItem> Requests { get; init; } = [];
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="MessageBatchRequest"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="requests">The requests to create messages.</param>
|
||||||
|
/// <exception cref="ArgumentException">Thrown when <paramref name="requests"/> is empty.</exception>
|
||||||
|
/// <returns>An instance of the <see cref="MessageBatchRequest"/> class.</returns>
|
||||||
|
public MessageBatchRequest(List<MessageBatchRequestItem> requests)
|
||||||
|
{
|
||||||
|
if (requests.Count == 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentException($"{nameof(requests)} must not be empty.", nameof(requests));
|
||||||
|
}
|
||||||
|
|
||||||
|
Requests = requests;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
using AnthropicClient.Utils;
|
||||||
|
|
||||||
|
namespace AnthropicClient.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents an item in a batch of messages.
|
||||||
|
/// </summary>
|
||||||
|
public class MessageBatchRequestItem
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the custom identifier for the message.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("custom_id")]
|
||||||
|
public string CustomId { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the message request parameters.
|
||||||
|
/// </summary>
|
||||||
|
public MessageRequest Params { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="MessageBatchRequestItem"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="customId">The custom identifier for the message.</param>
|
||||||
|
/// <param name="messageRequest">The message request parameters.</param>
|
||||||
|
/// <exception cref="ArgumentException">Thrown when <paramref name="customId"/> is null or whitespace.</exception>
|
||||||
|
/// <exception cref="ArgumentException">Thrown when <paramref name="messageRequest"/> is null.</exception>
|
||||||
|
/// <returns>An instance of the <see cref="MessageBatchRequestItem"/> class.</returns>
|
||||||
|
public MessageBatchRequestItem(string customId, MessageRequest messageRequest)
|
||||||
|
{
|
||||||
|
ArgumentValidator.ThrowIfNullOrWhitespace(customId, nameof(customId));
|
||||||
|
ArgumentValidator.ThrowIfNull(messageRequest, nameof(messageRequest));
|
||||||
|
|
||||||
|
CustomId = customId;
|
||||||
|
Params = messageRequest;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace AnthropicClient.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a response to a batch of messages.
|
||||||
|
/// </summary>
|
||||||
|
public class MessageBatchResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the identifier of the batch.
|
||||||
|
/// </summary>
|
||||||
|
public string Id { get; init; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the type of the batch.
|
||||||
|
/// </summary>
|
||||||
|
public string Type { get; init; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the processing status of the batch.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("processing_status")]
|
||||||
|
public string ProcessingStatus { get; init; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the counts of requests in the batch.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("request_counts")]
|
||||||
|
public MessageBatchRequestCounts RequestCounts { get; init; } = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the date and time when the batch ended.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("ended_at")]
|
||||||
|
public DateTimeOffset? EndedAt { get; init; } = DateTimeOffset.MinValue;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the date and time when the batch was created.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("created_at")]
|
||||||
|
public DateTimeOffset CreatedAt { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the date and time when the batch expires.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("expires_at")]
|
||||||
|
public DateTimeOffset ExpiresAt { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the date and time when the batch was archived.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("archived_at")]
|
||||||
|
public DateTimeOffset? ArchivedAt { get; init; } = DateTimeOffset.MinValue;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the date and time when the batch cancellation was initiated.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("cancel_initiated_at")]
|
||||||
|
public DateTimeOffset? CancelInitiatedAt { get; init; } = DateTimeOffset.MinValue;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the URL to the results of the batch.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("results_url")]
|
||||||
|
public string? ResultsUrl { get; init; } = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents the counts of requests in a batch of messages.
|
||||||
|
/// </summary>
|
||||||
|
public class MessageBatchRequestCounts
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the number of requests in the batch that are processing.
|
||||||
|
/// </summary>
|
||||||
|
public int Processing { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the number of requests in the batch that succeeded.
|
||||||
|
/// </summary>
|
||||||
|
public int Succeeded { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the number of requests in the batch that errored.
|
||||||
|
/// </summary>
|
||||||
|
public int Errored { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the number of requests in the batch that were cancelled.
|
||||||
|
/// </summary>
|
||||||
|
public int Canceled { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the number of requests in the batch that expired.
|
||||||
|
/// </summary>
|
||||||
|
public int Expired { get; init; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
using AnthropicClient.Utils;
|
||||||
|
|
||||||
|
namespace AnthropicClient.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a message batch result.
|
||||||
|
/// </summary>
|
||||||
|
public abstract class MessageBatchResult
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the type of the message batch result.
|
||||||
|
/// </summary>
|
||||||
|
public string Type { get; init; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="MessageBatchResult"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">The type of the message batch result.</param>
|
||||||
|
/// <returns>An instance of the <see cref="MessageBatchResult"/> class.</returns>
|
||||||
|
public MessageBatchResult(string type)
|
||||||
|
{
|
||||||
|
ArgumentValidator.ThrowIfNullOrWhitespace(type, nameof(type));
|
||||||
|
|
||||||
|
Type = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace AnthropicClient.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a message batch result item.
|
||||||
|
/// </summary>
|
||||||
|
public class MessageBatchResultItem
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the custom ID of the message batch result item.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("custom_id")]
|
||||||
|
public string CustomId { get; init; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the result of the message batch result item.
|
||||||
|
/// </summary>
|
||||||
|
public MessageBatchResult Result { get; init; } = default!;
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
namespace AnthropicClient.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents the types of message batch results.
|
||||||
|
/// </summary>
|
||||||
|
public static class MessageBatchResultType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a succeeded message batch result.
|
||||||
|
/// </summary>
|
||||||
|
public const string Succeeded = "succeeded";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents an errored message batch result.
|
||||||
|
/// </summary>
|
||||||
|
public const string Errored = "errored";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a canceled message batch result.
|
||||||
|
/// </summary>
|
||||||
|
public const string Canceled = "canceled";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents an expired message batch result.
|
||||||
|
/// </summary>
|
||||||
|
public const string Expired = "expired";
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
namespace AnthropicClient.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents the status of a message batch.
|
||||||
|
/// </summary>
|
||||||
|
public static class MessageBatchStatus
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The status of a message batch that is being canceled.
|
||||||
|
/// </summary>
|
||||||
|
public const string Canceling = "canceling";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The status of a message batch that is in progress.
|
||||||
|
/// </summary>
|
||||||
|
public const string InProgress = "in_progress";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The status of a message batch that has ended.
|
||||||
|
/// </summary>
|
||||||
|
public const string Ended = "ended";
|
||||||
|
}
|
||||||
@@ -25,7 +25,6 @@ public class MessageRequest : BaseMessageRequest
|
|||||||
/// <param name="tools">The tools 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>
|
/// <param name="stopSequences">The prompt stop sequences.</param>
|
||||||
/// <param name="systemMessages">The system messages to include with the request.</param>
|
/// <param name="systemMessages">The system messages to include with the request.</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="ArgumentNullException">Thrown when the model or messages is null.</exception>
|
||||||
/// <exception cref="ArgumentException">Thrown when the messages contain no messages.</exception>
|
/// <exception cref="ArgumentException">Thrown when the messages contain no messages.</exception>
|
||||||
/// <exception cref="ArgumentException">Thrown when the max tokens is less than one.</exception>
|
/// <exception cref="ArgumentException">Thrown when the max tokens is less than one.</exception>
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace AnthropicClient.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a page.
|
||||||
|
/// </summary>
|
||||||
|
public class Page
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The id of the first item in the page.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("first_id")]
|
||||||
|
public string? FirstId { get; init; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The id of the last item in the page.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("last_id")]
|
||||||
|
public string? LastId { get; init; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether there is more data to be retrieved.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("has_more")]
|
||||||
|
public bool HasMore { get; init; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a page with data.
|
||||||
|
/// </summary>
|
||||||
|
public class Page<T> : Page
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The data in the page.
|
||||||
|
/// </summary>
|
||||||
|
public T[] Data { get; init; } = [];
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace AnthropicClient.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a request to page through a collection of items.
|
||||||
|
/// </summary>
|
||||||
|
public class PagingRequest
|
||||||
|
{
|
||||||
|
private const int LimitMinimum = 1;
|
||||||
|
private const int LimitMaximum = 1000;
|
||||||
|
private const int DefaultLimit = 20;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The ID of the item before which to start the page.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("before_id")]
|
||||||
|
public string BeforeId { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The ID of the item after which to start the page.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("after_id")]
|
||||||
|
public string AfterId { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The maximum number of items to return in the page.
|
||||||
|
/// </summary>
|
||||||
|
public int Limit { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="PagingRequest"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="beforeId">The ID of the item before which to start the page.</param>
|
||||||
|
/// <param name="afterId">The ID of the item after which to start the page.</param>
|
||||||
|
/// <param name="limit">The maximum number of items to return in the page.</param>
|
||||||
|
/// <exception cref="ArgumentException">Thrown when both <paramref name="beforeId"/> and <paramref name="afterId"/> are specified.</exception>
|
||||||
|
/// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="limit"/> is less than 1 or greater than 1000.</exception>
|
||||||
|
/// <returns>A new instance of the <see cref="PagingRequest"/> class.</returns>
|
||||||
|
public PagingRequest(
|
||||||
|
string beforeId = "",
|
||||||
|
string afterId = "",
|
||||||
|
int limit = DefaultLimit
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (limit is < LimitMinimum or > LimitMaximum)
|
||||||
|
{
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(limit), $"{nameof(limit)} must be between {LimitMinimum} and {LimitMaximum}.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(beforeId) is false && string.IsNullOrEmpty(afterId) is false)
|
||||||
|
{
|
||||||
|
throw new ArgumentException($"Only one of {nameof(beforeId)} or {nameof(afterId)} can be set.");
|
||||||
|
}
|
||||||
|
|
||||||
|
BeforeId = beforeId;
|
||||||
|
AfterId = afterId;
|
||||||
|
Limit = limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts the <see cref="PagingRequest"/> to a query string.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The query string representation of the <see cref="PagingRequest"/>.</returns>
|
||||||
|
public string ToQueryParameters()
|
||||||
|
{
|
||||||
|
var parameters = new List<string>();
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(BeforeId) is false)
|
||||||
|
{
|
||||||
|
parameters.Add($"before_id={BeforeId}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(AfterId) is false)
|
||||||
|
{
|
||||||
|
parameters.Add($"after_id={AfterId}");
|
||||||
|
}
|
||||||
|
|
||||||
|
parameters.Add($"limit={Limit}");
|
||||||
|
|
||||||
|
return string.Join("&", parameters);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,7 +25,6 @@ public class StreamMessageRequest : BaseMessageRequest
|
|||||||
/// <param name="tools">The tools 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>
|
/// <param name="stopSequences">The prompt stop sequences.</param>
|
||||||
/// <param name="systemMessages">The system messages to include with the request.</param>
|
/// <param name="systemMessages">The system messages to include with the request.</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="ArgumentNullException">Thrown when the model or messages is null.</exception>
|
||||||
/// <exception cref="ArgumentException">Thrown when the messages contain no messages.</exception>
|
/// <exception cref="ArgumentException">Thrown when the messages contain no messages.</exception>
|
||||||
/// <exception cref="ArgumentException">Thrown when the max tokens is less than one.</exception>
|
/// <exception cref="ArgumentException">Thrown when the max tokens is less than one.</exception>
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
namespace AnthropicClient.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a message batch result that contains a message response.
|
||||||
|
/// </summary>
|
||||||
|
public class SucceededMessageBatchResult : MessageBatchResult
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the message of the message batch result.
|
||||||
|
/// </summary>
|
||||||
|
public MessageResponse Message { get; init; } = new MessageResponse();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="SucceededMessageBatchResult"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>An instance of the <see cref="SucceededMessageBatchResult"/> class.</returns>
|
||||||
|
public SucceededMessageBatchResult() : base(MessageBatchResultType.Succeeded)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace AnthropicClient.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a response to a token count request.
|
||||||
|
/// </summary>
|
||||||
|
public class TokenCountResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The number of input tokens counted.
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("input_tokens")]
|
||||||
|
public int InputTokens { get; init; }
|
||||||
|
}
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
|
using AnthropicClient.Tests.Files;
|
||||||
|
|
||||||
namespace AnthropicClient.Tests.EndToEnd;
|
namespace AnthropicClient.Tests.EndToEnd;
|
||||||
|
|
||||||
public class ClientTests(ConfigurationFixture configFixture) : EndToEndTest(configFixture)
|
public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndToEndTest(configFixture)
|
||||||
{
|
{
|
||||||
private string GetTestFilePath(string fileName) =>
|
|
||||||
Path.Combine(Directory.GetCurrentDirectory(), "Files", fileName);
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task CreateMessageAsync_WhenCalled_ItShouldReturnResponse()
|
public async Task CreateMessageAsync_WhenCalled_ItShouldReturnResponse()
|
||||||
{
|
{
|
||||||
@@ -63,7 +62,7 @@ public class ClientTests(ConfigurationFixture configFixture) : EndToEndTest(conf
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task CreateMessageAsync_WhenImageIsSent_ItShouldReturnResponse()
|
public async Task CreateMessageAsync_WhenImageIsSent_ItShouldReturnResponse()
|
||||||
{
|
{
|
||||||
var imagePath = GetTestFilePath("elephant.jpg");
|
var imagePath = TestFileHelper.GetTestFilePath("elephant.jpg");
|
||||||
var mediaType = "image/jpeg";
|
var mediaType = "image/jpeg";
|
||||||
var bytes = await File.ReadAllBytesAsync(imagePath);
|
var bytes = await File.ReadAllBytesAsync(imagePath);
|
||||||
var base64Data = Convert.ToBase64String(bytes);
|
var base64Data = Convert.ToBase64String(bytes);
|
||||||
@@ -100,12 +99,9 @@ public class ClientTests(ConfigurationFixture configFixture) : EndToEndTest(conf
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task CreateMessageAsync_WhenSystemMessagesContainCacheControl_ItShouldUseCache()
|
public async Task CreateMessageAsync_WhenSystemMessagesContainCacheControl_ItShouldUseCache()
|
||||||
{
|
{
|
||||||
var httpClient = new HttpClient();
|
var client = CreateClient(new HttpClient());
|
||||||
httpClient.DefaultRequestHeaders.Add("anthropic-beta", "prompt-caching-2024-07-31");
|
|
||||||
|
|
||||||
var client = CreateClient(httpClient);
|
var storyPath = TestFileHelper.GetTestFilePath("story.txt");
|
||||||
|
|
||||||
var storyPath = GetTestFilePath("story.txt");
|
|
||||||
var storyText = await File.ReadAllTextAsync(storyPath);
|
var storyText = await File.ReadAllTextAsync(storyPath);
|
||||||
|
|
||||||
var request = new MessageRequest(
|
var request = new MessageRequest(
|
||||||
@@ -121,7 +117,7 @@ public class ClientTests(ConfigurationFixture configFixture) : EndToEndTest(conf
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
var resultOne = await client.CreateMessageAsync(request);
|
var resultOne = await _client.CreateMessageAsync(request);
|
||||||
|
|
||||||
resultOne.IsSuccess.Should().BeTrue();
|
resultOne.IsSuccess.Should().BeTrue();
|
||||||
resultOne.Value.Should().BeOfType<MessageResponse>();
|
resultOne.Value.Should().BeOfType<MessageResponse>();
|
||||||
@@ -142,12 +138,9 @@ public class ClientTests(ConfigurationFixture configFixture) : EndToEndTest(conf
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task CreateMessageAsync_WhenMessagesContainCacheControl_ItShouldUseCache()
|
public async Task CreateMessageAsync_WhenMessagesContainCacheControl_ItShouldUseCache()
|
||||||
{
|
{
|
||||||
var httpClient = new HttpClient();
|
var client = CreateClient(new HttpClient());
|
||||||
httpClient.DefaultRequestHeaders.Add("anthropic-beta", "prompt-caching-2024-07-31");
|
|
||||||
|
|
||||||
var client = CreateClient(httpClient);
|
var storyPath = TestFileHelper.GetTestFilePath("story.txt");
|
||||||
|
|
||||||
var storyPath = GetTestFilePath("story.txt");
|
|
||||||
var storyText = await File.ReadAllTextAsync(storyPath);
|
var storyText = await File.ReadAllTextAsync(storyPath);
|
||||||
|
|
||||||
var request = new MessageRequest(
|
var request = new MessageRequest(
|
||||||
@@ -181,10 +174,7 @@ public class ClientTests(ConfigurationFixture configFixture) : EndToEndTest(conf
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task CreateMessageAsync_WhenToolsContainCacheControl_ItShouldUseCache()
|
public async Task CreateMessageAsync_WhenToolsContainCacheControl_ItShouldUseCache()
|
||||||
{
|
{
|
||||||
var httpClient = new HttpClient();
|
var client = CreateClient(new HttpClient());
|
||||||
httpClient.DefaultRequestHeaders.Add("anthropic-beta", "prompt-caching-2024-07-31");
|
|
||||||
|
|
||||||
var client = CreateClient(httpClient);
|
|
||||||
|
|
||||||
var func = (string ticker) => ticker;
|
var func = (string ticker) => ticker;
|
||||||
|
|
||||||
@@ -222,4 +212,249 @@ public class ClientTests(ConfigurationFixture configFixture) : EndToEndTest(conf
|
|||||||
resultTwo.Value.Content.Should().NotBeNullOrEmpty();
|
resultTwo.Value.Content.Should().NotBeNullOrEmpty();
|
||||||
resultTwo.Value.Usage.CacheReadInputTokens.Should().BeGreaterThan(0);
|
resultTwo.Value.Usage.CacheReadInputTokens.Should().BeGreaterThan(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task CreateMessageAsync_WhenProvidedWithPDF_ItShouldReturnResponse()
|
||||||
|
{
|
||||||
|
var pdfPath = TestFileHelper.GetTestFilePath("addendum.pdf");
|
||||||
|
var bytes = await File.ReadAllBytesAsync(pdfPath);
|
||||||
|
var base64Data = Convert.ToBase64String(bytes);
|
||||||
|
|
||||||
|
var request = new MessageRequest(
|
||||||
|
model: AnthropicModels.Claude35Sonnet,
|
||||||
|
messages: [
|
||||||
|
new(MessageRole.User, [new TextContent("What is the title of this paper?")]),
|
||||||
|
new(MessageRole.User, [new DocumentContent("application/pdf", base64Data)])
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
var client = CreateClient(new HttpClient());
|
||||||
|
|
||||||
|
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("Model Card Addendum: Claude 3.5 Haiku and Upgraded Claude 3.5 Sonnet");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task CreateMessageAsync_WhenProvidedWithPDFWithCacheControl_ItShouldUseCache()
|
||||||
|
{
|
||||||
|
var pdfPath = TestFileHelper.GetTestFilePath("addendum.pdf");
|
||||||
|
var bytes = await File.ReadAllBytesAsync(pdfPath);
|
||||||
|
var base64Data = Convert.ToBase64String(bytes);
|
||||||
|
|
||||||
|
var client = CreateClient(new HttpClient());
|
||||||
|
|
||||||
|
var request = new MessageRequest(
|
||||||
|
model: AnthropicModels.Claude35Sonnet,
|
||||||
|
messages: [
|
||||||
|
new(MessageRole.User, [
|
||||||
|
new DocumentContent("application/pdf", base64Data, new EphemeralCacheControl()),
|
||||||
|
new TextContent("What is the title of this paper?")
|
||||||
|
]),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
var resultOne = await client.CreateMessageAsync(request);
|
||||||
|
|
||||||
|
resultOne.IsSuccess.Should().BeTrue();
|
||||||
|
resultOne.Value.Should().BeOfType<MessageResponse>();
|
||||||
|
resultOne.Value.Content.Should().NotBeNullOrEmpty();
|
||||||
|
resultOne.Value.Usage.Should().Match<Usage>(u => u.CacheCreationInputTokens > 0 || u.CacheReadInputTokens > 0);
|
||||||
|
|
||||||
|
request.Messages.Add(new(MessageRole.Assistant, resultOne.Value.Content));
|
||||||
|
request.Messages.Add(new(MessageRole.User, [new TextContent("What is the main theme of this paper?")]));
|
||||||
|
|
||||||
|
var resultTwo = await client.CreateMessageAsync(request);
|
||||||
|
|
||||||
|
resultTwo.IsSuccess.Should().BeTrue();
|
||||||
|
resultTwo.Value.Should().BeOfType<MessageResponse>();
|
||||||
|
resultTwo.Value.Content.Should().NotBeNullOrEmpty();
|
||||||
|
resultTwo.Value.Usage.CacheReadInputTokens.Should().BeGreaterThan(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task CountMessageTokensAsync_WhenCalled_ItShouldReturnResponse()
|
||||||
|
{
|
||||||
|
var request = new CountMessageTokensRequest(
|
||||||
|
model: AnthropicModels.Claude3Haiku,
|
||||||
|
messages: [
|
||||||
|
new(MessageRole.User, [new TextContent("Hello!")])
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
var result = await _client.CountMessageTokensAsync(request);
|
||||||
|
|
||||||
|
result.IsSuccess.Should().BeTrue();
|
||||||
|
result.Value.Should().BeOfType<TokenCountResponse>();
|
||||||
|
result.Value.InputTokens.Should().BeGreaterThan(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task ListModelsAsync_WhenCalled_ItShouldReturnResponse()
|
||||||
|
{
|
||||||
|
var result = await _client.ListModelsAsync();
|
||||||
|
|
||||||
|
result.IsSuccess.Should().BeTrue();
|
||||||
|
result.Value.Should().BeOfType<Page<AnthropicModel>>();
|
||||||
|
result.Value.Data.Should().HaveCountGreaterThan(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task ListModelsAsync_WhenCalledWithPagination_ItShouldReturnResponse()
|
||||||
|
{
|
||||||
|
var result = await _client.ListModelsAsync(new PagingRequest(limit: 1));
|
||||||
|
|
||||||
|
result.IsSuccess.Should().BeTrue();
|
||||||
|
result.Value.Should().BeOfType<Page<AnthropicModel>>();
|
||||||
|
result.Value.Data.Should().HaveCount(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task ListAllModelsAsync_WhenCalled_ItShouldReturnResponse()
|
||||||
|
{
|
||||||
|
var responses = await _client.ListAllModelsAsync(limit: 1).ToListAsync();
|
||||||
|
|
||||||
|
responses.Should().HaveCountGreaterThan(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task GetModelAsync_WhenCalled_ItShouldReturnResponse()
|
||||||
|
{
|
||||||
|
var result = await _client.GetModelAsync(AnthropicModels.Claude3Haiku);
|
||||||
|
|
||||||
|
result.IsSuccess.Should().BeTrue();
|
||||||
|
result.Value.Should().BeOfType<AnthropicModel>();
|
||||||
|
result.Value.Id.Should().Be(AnthropicModels.Claude3Haiku);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task CreateMessageBatchAsync_WhenCalled_ItShouldReturnResponse()
|
||||||
|
{
|
||||||
|
var request = new MessageBatchRequest([
|
||||||
|
new(
|
||||||
|
Guid.NewGuid().ToString(),
|
||||||
|
new(
|
||||||
|
model: AnthropicModels.Claude3Haiku,
|
||||||
|
messages: [new(MessageRole.User, [new TextContent("Hello!")])]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
|
||||||
|
var result = await _client.CreateMessageBatchAsync(request);
|
||||||
|
|
||||||
|
result.IsSuccess.Should().BeTrue();
|
||||||
|
result.Value.Should().BeOfType<MessageBatchResponse>();
|
||||||
|
result.Value.Id.Should().NotBeNullOrEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task GetMessageBatchAsync_WhenCalled_ItShouldReturnResponse()
|
||||||
|
{
|
||||||
|
var request = new MessageBatchRequest([
|
||||||
|
new(
|
||||||
|
Guid.NewGuid().ToString(),
|
||||||
|
new(
|
||||||
|
model: AnthropicModels.Claude3Haiku,
|
||||||
|
messages: [new(MessageRole.User, [new TextContent("Hello!")])]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
|
||||||
|
var createResult = await _client.CreateMessageBatchAsync(request);
|
||||||
|
var getResult = await _client.GetMessageBatchAsync(createResult.Value.Id);
|
||||||
|
|
||||||
|
getResult.IsSuccess.Should().BeTrue();
|
||||||
|
getResult.Value.Should().BeOfType<MessageBatchResponse>();
|
||||||
|
getResult.Value.Id.Should().Be(createResult.Value.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task ListMessageBatchesAsync_WhenCalled_ItShouldReturnResponse()
|
||||||
|
{
|
||||||
|
var request = new MessageBatchRequest([
|
||||||
|
new(
|
||||||
|
Guid.NewGuid().ToString(),
|
||||||
|
new(
|
||||||
|
model: AnthropicModels.Claude3Haiku,
|
||||||
|
messages: [new(MessageRole.User, [new TextContent("Hello!")])]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
|
||||||
|
var createResult = await _client.CreateMessageBatchAsync(request);
|
||||||
|
var result = await _client.ListMessageBatchesAsync();
|
||||||
|
|
||||||
|
result.IsSuccess.Should().BeTrue();
|
||||||
|
result.Value.Should().BeOfType<Page<MessageBatchResponse>>();
|
||||||
|
result.Value.Data.Should().HaveCountGreaterThan(0);
|
||||||
|
result.Value.Data.Should().ContainSingle(b => b.Id == createResult.Value.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task ListAllMessageBatchesAsync_WhenCalled_ItShouldReturnResponse()
|
||||||
|
{
|
||||||
|
var createRequest = (string id) => new MessageBatchRequest([
|
||||||
|
new(
|
||||||
|
id,
|
||||||
|
new(
|
||||||
|
model: AnthropicModels.Claude3Haiku,
|
||||||
|
messages: [new(MessageRole.User, [new TextContent("Hello!")])]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
|
||||||
|
var requestNumberOne = createRequest(Guid.NewGuid().ToString());
|
||||||
|
var requestNumberTwo = createRequest(Guid.NewGuid().ToString());
|
||||||
|
|
||||||
|
var createResultOne = await _client.CreateMessageBatchAsync(requestNumberOne);
|
||||||
|
var createResultTwo = await _client.CreateMessageBatchAsync(requestNumberTwo);
|
||||||
|
|
||||||
|
var responses = await _client.ListAllMessageBatchesAsync(limit: 1).ToListAsync();
|
||||||
|
|
||||||
|
responses.Should().HaveCountGreaterThan(2);
|
||||||
|
|
||||||
|
var batches = responses
|
||||||
|
.Where(r => r.IsSuccess)
|
||||||
|
.Select(r => r.Value)
|
||||||
|
.SelectMany(r => r.Data);
|
||||||
|
|
||||||
|
batches.Should().ContainSingle(b => b.Id == createResultOne.Value.Id);
|
||||||
|
batches.Should().ContainSingle(b => b.Id == createResultTwo.Value.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task CancelMessageBatchAsync_WhenCalled_ItShouldReturnResponse()
|
||||||
|
{
|
||||||
|
var request = new MessageBatchRequest([
|
||||||
|
new(
|
||||||
|
Guid.NewGuid().ToString(),
|
||||||
|
new(
|
||||||
|
model: AnthropicModels.Claude3Haiku,
|
||||||
|
messages: [new(MessageRole.User, [new TextContent("Hello!")])]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
|
||||||
|
var createResult = await _client.CreateMessageBatchAsync(request);
|
||||||
|
var result = await _client.CancelMessageBatchAsync(createResult.Value.Id);
|
||||||
|
|
||||||
|
result.IsSuccess.Should().BeTrue();
|
||||||
|
result.Value.Should().BeOfType<MessageBatchResponse>();
|
||||||
|
result.Value.Id.Should().Be(createResult.Value.Id);
|
||||||
|
result.Value.ProcessingStatus.Should().Be(MessageBatchStatus.Canceling);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace AnthropicClient.Tests.Files;
|
||||||
|
|
||||||
|
static class TestFileHelper
|
||||||
|
{
|
||||||
|
public static string GetTestFilePath(string fileName) =>
|
||||||
|
Path.Combine(Directory.GetCurrentDirectory(), "Files", fileName);
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -0,0 +1,5 @@
|
|||||||
|
{"custom_id":"my-fifth-request","result":{"type":"errored","error":{"type":"error","error":{"type":"not_found_error","message":"The requested resource could not be found."}}}}
|
||||||
|
{"custom_id":"my-fourth-request","result":{"type":"expired"}}
|
||||||
|
{"custom_id":"my-third-request","result":{"type":"canceled"}}
|
||||||
|
{"custom_id":"my-second-request","result":{"type":"succeeded","message":{"id":"msg_014VwiXbi91y3JMjcpyGBHX5","type":"message","role":"assistant","model":"claude-3-5-sonnet-20240620","content":[{"type":"text","text":"Hello again! It's nice to see you. How can I assist you today? Is there anything specific you'd like to chat about or any questions you have?"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":11,"output_tokens":36}}}}
|
||||||
|
{"custom_id":"my-first-request","result":{"type":"succeeded","message":{"id":"msg_01FqfsLoHwgeFbguDgpz48m7","type":"message","role":"assistant","model":"claude-3-5-sonnet-20240620","content":[{"type":"text","text":"Hello! How can I assist you today? Feel free to ask me any questions or let me know if there's anything you'd like to chat about."}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":10,"output_tokens":34}}}}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,8 @@
|
|||||||
|
using AnthropicClient.Tests.Unit;
|
||||||
|
|
||||||
namespace AnthropicClient.Tests.Integration;
|
namespace AnthropicClient.Tests.Integration;
|
||||||
|
|
||||||
public class IntegrationTest
|
public class IntegrationTest : SerializationTest
|
||||||
{
|
{
|
||||||
protected readonly MockHttpMessageHandler _mockHttpMessageHandler = new();
|
protected readonly MockHttpMessageHandler _mockHttpMessageHandler = new();
|
||||||
protected AnthropicApiClient Client => CreateClient();
|
protected AnthropicApiClient Client => CreateClient();
|
||||||
@@ -13,10 +15,20 @@ public class IntegrationTest
|
|||||||
|
|
||||||
public static class MockHttpMessageHandlerExtensions
|
public static class MockHttpMessageHandlerExtensions
|
||||||
{
|
{
|
||||||
private static MockedRequest SetupBaseRequest(this MockHttpMessageHandler mockHttpMessageHandler)
|
private const string BaseUrl = "https://api.anthropic.com/v1";
|
||||||
|
private static readonly string MessagesEndpoint = $"{BaseUrl}/messages";
|
||||||
|
private static readonly string CountTokensEndpoint = $"{BaseUrl}/messages/count_tokens";
|
||||||
|
private static readonly string MessageBatchesEndpoint = $"{BaseUrl}/messages/batches";
|
||||||
|
private static readonly string ModelsEndpoint = $"{BaseUrl}/models";
|
||||||
|
|
||||||
|
private static MockedRequest SetupBaseRequest(
|
||||||
|
this MockHttpMessageHandler mockHttpMessageHandler,
|
||||||
|
HttpMethod method,
|
||||||
|
string url
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return mockHttpMessageHandler
|
return mockHttpMessageHandler
|
||||||
.When(HttpMethod.Post, "https://api.anthropic.com/v1/messages")
|
.When(method, url)
|
||||||
.WithHeaders(new Dictionary<string, string>
|
.WithHeaders(new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{ "anthropic-version", "2023-06-01" },
|
{ "anthropic-version", "2023-06-01" },
|
||||||
@@ -27,14 +39,68 @@ public static class MockHttpMessageHandlerExtensions
|
|||||||
public static MockedRequest WhenCreateMessageRequest(this MockHttpMessageHandler mockHttpMessageHandler)
|
public static MockedRequest WhenCreateMessageRequest(this MockHttpMessageHandler mockHttpMessageHandler)
|
||||||
{
|
{
|
||||||
return mockHttpMessageHandler
|
return mockHttpMessageHandler
|
||||||
.SetupBaseRequest()
|
.SetupBaseRequest(HttpMethod.Post, MessagesEndpoint)
|
||||||
.WithJsonContent<MessageRequest>(r => r.Stream == false, JsonSerializationOptions.DefaultOptions);
|
.WithJsonContent<MessageRequest>(r => r.Stream == false, JsonSerializationOptions.DefaultOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MockedRequest WhenCreateStreamMessageRequest(this MockHttpMessageHandler mockHttpMessageHandler)
|
public static MockedRequest WhenCreateStreamMessageRequest(this MockHttpMessageHandler mockHttpMessageHandler)
|
||||||
{
|
{
|
||||||
return mockHttpMessageHandler
|
return mockHttpMessageHandler
|
||||||
.SetupBaseRequest()
|
.SetupBaseRequest(HttpMethod.Post, MessagesEndpoint)
|
||||||
.WithJsonContent<StreamMessageRequest>(r => r.Stream == true, JsonSerializationOptions.DefaultOptions);
|
.WithJsonContent<StreamMessageRequest>(r => r.Stream == true, JsonSerializationOptions.DefaultOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MockedRequest WhenCountMessageTokensRequest(this MockHttpMessageHandler mockHttpMessageHandler)
|
||||||
|
{
|
||||||
|
return mockHttpMessageHandler
|
||||||
|
.SetupBaseRequest(HttpMethod.Post, CountTokensEndpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MockedRequest WhenListModelsRequest(this MockHttpMessageHandler mockHttpMessageHandler)
|
||||||
|
{
|
||||||
|
return mockHttpMessageHandler
|
||||||
|
.SetupBaseRequest(HttpMethod.Get, ModelsEndpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MockedRequest WhenGetModelRequest(this MockHttpMessageHandler mockHttpMessageHandler, string modelId)
|
||||||
|
{
|
||||||
|
return mockHttpMessageHandler
|
||||||
|
.SetupBaseRequest(HttpMethod.Get, $"{ModelsEndpoint}/{modelId}");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MockedRequest WhenCreateMessageBatchRequest(this MockHttpMessageHandler mockHttpMessageHandler)
|
||||||
|
{
|
||||||
|
return mockHttpMessageHandler
|
||||||
|
.SetupBaseRequest(HttpMethod.Post, MessageBatchesEndpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MockedRequest WhenGetMessageBatchRequest(this MockHttpMessageHandler mockHttpMessageHandler, string batchId)
|
||||||
|
{
|
||||||
|
return mockHttpMessageHandler
|
||||||
|
.SetupBaseRequest(HttpMethod.Get, $"{MessageBatchesEndpoint}/{batchId}");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MockedRequest WhenGetMessageBatchResultsRequest(this MockHttpMessageHandler mockHttpMessageHandler, string batchId)
|
||||||
|
{
|
||||||
|
return mockHttpMessageHandler
|
||||||
|
.SetupBaseRequest(HttpMethod.Get, $"{MessageBatchesEndpoint}/{batchId}/results");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MockedRequest WhenListMessageBatchesRequest(this MockHttpMessageHandler mockHttpMessageHandler)
|
||||||
|
{
|
||||||
|
return mockHttpMessageHandler
|
||||||
|
.SetupBaseRequest(HttpMethod.Get, MessageBatchesEndpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MockedRequest WhenCancelMessageBatchRequest(this MockHttpMessageHandler mockHttpMessageHandler, string batchId)
|
||||||
|
{
|
||||||
|
return mockHttpMessageHandler
|
||||||
|
.SetupBaseRequest(HttpMethod.Post, $"{MessageBatchesEndpoint}/{batchId}/cancel");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MockedRequest WhenDeleteMessageBatchRequest(this MockHttpMessageHandler mockHttpMessageHandler, string batchId)
|
||||||
|
{
|
||||||
|
return mockHttpMessageHandler
|
||||||
|
.SetupBaseRequest(HttpMethod.Delete, $"{MessageBatchesEndpoint}/{batchId}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
|
public class AnthropicModelTests : SerializationTest
|
||||||
|
{
|
||||||
|
private const string SampleJson = @"{
|
||||||
|
""type"": ""model"",
|
||||||
|
""id"": ""claude-3-opus-20240229"",
|
||||||
|
""display_name"": ""Claude 3 Opus"",
|
||||||
|
""created_at"": ""2024-02-29T00:00:00Z""
|
||||||
|
}";
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalled_ItShouldReturnAnInstanceWithPropertiesSet()
|
||||||
|
{
|
||||||
|
var model = new AnthropicModel();
|
||||||
|
|
||||||
|
model.Type.Should().BeEmpty();
|
||||||
|
model.Id.Should().BeEmpty();
|
||||||
|
model.DisplayName.Should().BeEmpty();
|
||||||
|
model.CreatedAt.Should().Be(default);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonDeserialization_WhenDeserialized_ItShouldHaveExpectedValues()
|
||||||
|
{
|
||||||
|
var result = Deserialize<AnthropicModel>(SampleJson);
|
||||||
|
|
||||||
|
result.Should().NotBeNull();
|
||||||
|
result!.Type.Should().Be("model");
|
||||||
|
result.Id.Should().Be("claude-3-opus-20240229");
|
||||||
|
result.DisplayName.Should().Be("Claude 3 Opus");
|
||||||
|
result.CreatedAt.Should().Be(new DateTimeOffset(2024, 2, 29, 0, 0, 0, TimeSpan.Zero));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonSerialization_WhenSerialized_ItShouldReturnExpectedShape()
|
||||||
|
{
|
||||||
|
var model = new AnthropicModel
|
||||||
|
{
|
||||||
|
Type = "model",
|
||||||
|
Id = "claude-3-opus-20240229",
|
||||||
|
DisplayName = "Claude 3 Opus",
|
||||||
|
CreatedAt = new DateTimeOffset(2024, 2, 29, 0, 0, 0, TimeSpan.Zero)
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = Serialize(model);
|
||||||
|
|
||||||
|
var expectedJson = @"{
|
||||||
|
""type"": ""model"",
|
||||||
|
""id"": ""claude-3-opus-20240229"",
|
||||||
|
""display_name"": ""Claude 3 Opus"",
|
||||||
|
""created_at"": ""2024-02-29T00:00:00+00:00""
|
||||||
|
}";
|
||||||
|
|
||||||
|
JsonAssert.Equal(expectedJson, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,26 @@ public class AnthropicModelsTests
|
|||||||
actual.Should().Be(expected);
|
actual.Should().Be(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Claude3Opus20241022_WhenCalled_ItShouldReturnExpectedValue()
|
||||||
|
{
|
||||||
|
var expected = "claude-3-opus-20240229";
|
||||||
|
|
||||||
|
var actual = AnthropicModels.Claude3Opus20241022;
|
||||||
|
|
||||||
|
actual.Should().Be(expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Claude3OpusLatest_WhenCalled_ItShouldReturnExpectedValue()
|
||||||
|
{
|
||||||
|
var expected = "claude-3-opus-latest";
|
||||||
|
|
||||||
|
var actual = AnthropicModels.Claude3OpusLatest;
|
||||||
|
|
||||||
|
actual.Should().Be(expected);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Claude3Sonnet_WhenCalled_ItShouldReturnExpectedValue()
|
public void Claude3Sonnet_WhenCalled_ItShouldReturnExpectedValue()
|
||||||
{
|
{
|
||||||
@@ -22,6 +42,16 @@ public class AnthropicModelsTests
|
|||||||
actual.Should().Be(expected);
|
actual.Should().Be(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Claude3Sonnet20240229_WhenCalled_ItShouldReturnExpectedValue()
|
||||||
|
{
|
||||||
|
var expected = "claude-3-sonnet-20240229";
|
||||||
|
|
||||||
|
var actual = AnthropicModels.Claude3Sonnet20240229;
|
||||||
|
|
||||||
|
actual.Should().Be(expected);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Claude35Sonnet_WhenCalled_ItShouldReturnExpectedValue()
|
public void Claude35Sonnet_WhenCalled_ItShouldReturnExpectedValue()
|
||||||
{
|
{
|
||||||
@@ -32,6 +62,36 @@ public class AnthropicModelsTests
|
|||||||
actual.Should().Be(expected);
|
actual.Should().Be(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Claude35Sonnet20240620_WhenCalled_ItShouldReturnExpectedValue()
|
||||||
|
{
|
||||||
|
var expected = "claude-3-5-sonnet-20240620";
|
||||||
|
|
||||||
|
var actual = AnthropicModels.Claude35Sonnet20240620;
|
||||||
|
|
||||||
|
actual.Should().Be(expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Claude35Sonnet20241022_WhenCalled_ItShouldReturnExpectedValue()
|
||||||
|
{
|
||||||
|
var expected = "claude-3-5-sonnet-20241022";
|
||||||
|
|
||||||
|
var actual = AnthropicModels.Claude35Sonnet20241022;
|
||||||
|
|
||||||
|
actual.Should().Be(expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Claude35SonnetLatest_WhenCalled_ItShouldReturnExpectedValue()
|
||||||
|
{
|
||||||
|
var expected = "claude-3-5-sonnet-latest";
|
||||||
|
|
||||||
|
var actual = AnthropicModels.Claude35SonnetLatest;
|
||||||
|
|
||||||
|
actual.Should().Be(expected);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Claude3Haiku_WhenCalled_ItShouldReturnExpectedValue()
|
public void Claude3Haiku_WhenCalled_ItShouldReturnExpectedValue()
|
||||||
{
|
{
|
||||||
@@ -43,24 +103,31 @@ public class AnthropicModelsTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Claude35Sonnet_WhenCalled_ItShouldExpectedValue()
|
public void Claude3Haiku20240307_WhenCalled_ItShouldReturnExpectedValue()
|
||||||
{
|
{
|
||||||
var expected = "claude-3-5-sonnet-20240620";
|
var expected = "claude-3-haiku-20240307";
|
||||||
|
|
||||||
var actual = AnthropicModels.Claude35Sonnet;
|
var actual = AnthropicModels.Claude3Haiku20240307;
|
||||||
|
|
||||||
actual.Should().Be(expected);
|
actual.Should().Be(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Fact]
|
||||||
[InlineData("claude-3-opus-20240229", true)]
|
public void Claude35Haiku_WhenCalled_ItShouldReturnExpectedValue()
|
||||||
[InlineData("claude-3-sonnet-20240229", true)]
|
|
||||||
[InlineData("claude-3-5-sonnet-20240620", true)]
|
|
||||||
[InlineData("claude-3-haiku-20240307", true)]
|
|
||||||
[InlineData("invalid", false)]
|
|
||||||
public void IsValidModel_WhenCalled_ItShouldReturnExpectedValue(string modelId, bool expected)
|
|
||||||
{
|
{
|
||||||
var actual = AnthropicModels.IsValidModel(modelId);
|
var expected = "claude-3-5-haiku-20241022";
|
||||||
|
|
||||||
|
var actual = AnthropicModels.Claude35Haiku20241022;
|
||||||
|
|
||||||
|
actual.Should().Be(expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Claude35HaikuLatest_WhenCalled_ItShouldReturnExpectedValue()
|
||||||
|
{
|
||||||
|
var expected = "claude-3-5-haiku-latest";
|
||||||
|
|
||||||
|
var actual = AnthropicModels.Claude35HaikuLatest;
|
||||||
|
|
||||||
actual.Should().Be(expected);
|
actual.Should().Be(expected);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
|
public class CanceledMessageBatchResultTests : SerializationTest
|
||||||
|
{
|
||||||
|
private const string SampleJson = @"{
|
||||||
|
""type"": ""canceled""
|
||||||
|
}";
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalled_ItShouldReturnAnInstanceWithPropertiesSet()
|
||||||
|
{
|
||||||
|
var result = new CanceledMessageBatchResult();
|
||||||
|
|
||||||
|
result.Type.Should().Be(MessageBatchResultType.Canceled);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonSerialization_WhenSerialized_ItShouldHaveExpectedShape()
|
||||||
|
{
|
||||||
|
var result = new CanceledMessageBatchResult();
|
||||||
|
|
||||||
|
var json = Serialize(result);
|
||||||
|
|
||||||
|
JsonAssert.Equal(SampleJson, json);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonDeserialization_WhenDeserialized_ItShouldHaveExpectedProperties()
|
||||||
|
{
|
||||||
|
var result = Deserialize<CanceledMessageBatchResult>(SampleJson);
|
||||||
|
|
||||||
|
result!.Type.Should().Be(MessageBatchResultType.Canceled);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,40 +5,30 @@ public class ContentTypeTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void Text_WhenCalled_ItShouldReturnText()
|
public void Text_WhenCalled_ItShouldReturnText()
|
||||||
{
|
{
|
||||||
var expected = "text";
|
ContentType.Text.Should().Be("text");
|
||||||
|
|
||||||
var actual = ContentType.Text;
|
|
||||||
|
|
||||||
actual.Should().Be(expected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Image_WhenCalled_ItShouldReturnImage()
|
public void Image_WhenCalled_ItShouldReturnImage()
|
||||||
{
|
{
|
||||||
var expected = "image";
|
ContentType.Image.Should().Be("image");
|
||||||
|
|
||||||
var actual = ContentType.Image;
|
|
||||||
|
|
||||||
actual.Should().Be(expected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void ToolUse_WhenCalled_ItShouldReturnToolUse()
|
public void ToolUse_WhenCalled_ItShouldReturnToolUse()
|
||||||
{
|
{
|
||||||
var expected = "tool_use";
|
ContentType.ToolUse.Should().Be("tool_use");
|
||||||
|
|
||||||
var actual = ContentType.ToolUse;
|
|
||||||
|
|
||||||
actual.Should().Be(expected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void ToolResult_WhenCalled_ItShouldReturnToolResult()
|
public void ToolResult_WhenCalled_ItShouldReturnToolResult()
|
||||||
{
|
{
|
||||||
var expected = "tool_result";
|
ContentType.ToolResult.Should().Be("tool_result");
|
||||||
|
}
|
||||||
|
|
||||||
var actual = ContentType.ToolResult;
|
[Fact]
|
||||||
|
public void Document_WhenCalled_ItShouldReturnDocument()
|
||||||
actual.Should().Be(expected);
|
{
|
||||||
|
ContentType.Document.Should().Be("document");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
|
public class CountMessageTokensRequestTests : SerializationTest
|
||||||
|
{
|
||||||
|
private readonly string _testJson = @"{
|
||||||
|
""model"": ""claude-3-sonnet-20240229"",
|
||||||
|
""system"": [{
|
||||||
|
""type"": ""text"",
|
||||||
|
""text"": ""test-system""
|
||||||
|
}],
|
||||||
|
""messages"": [
|
||||||
|
{ ""role"": ""user"", ""content"": [{ ""text"": ""Hello!"", ""type"": ""text"" }] }
|
||||||
|
],
|
||||||
|
""tool_choice"": { ""type"":""auto"" },
|
||||||
|
""tools"": []
|
||||||
|
}";
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalled_ItShouldInitializeProperties()
|
||||||
|
{
|
||||||
|
var model = AnthropicModels.Claude3Sonnet;
|
||||||
|
var messages = new List<Message> { new() };
|
||||||
|
var systemPrompt = new List<TextContent>() { new("test-system") };
|
||||||
|
var toolChoice = new AutoToolChoice();
|
||||||
|
var tools = new List<Tool>();
|
||||||
|
|
||||||
|
var request = new CountMessageTokensRequest(
|
||||||
|
model: model,
|
||||||
|
messages: messages,
|
||||||
|
toolChoice: toolChoice,
|
||||||
|
tools: tools,
|
||||||
|
systemPrompt: systemPrompt
|
||||||
|
);
|
||||||
|
|
||||||
|
request.Model.Should().Be(model);
|
||||||
|
request.Messages.Should().BeSameAs(messages);
|
||||||
|
request.ToolChoice.Should().Be(toolChoice);
|
||||||
|
request.Tools.Should().BeSameAs(tools);
|
||||||
|
request.SystemPrompt.Should().BeSameAs(systemPrompt);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalledAndModelIsNull_ItShouldThrowArgumentNullException()
|
||||||
|
{
|
||||||
|
var action = () => new CountMessageTokensRequest(
|
||||||
|
model: null!,
|
||||||
|
messages: [new()]
|
||||||
|
);
|
||||||
|
|
||||||
|
action.Should().Throw<ArgumentNullException>();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalledAndMessagesIsNull_ItShouldThrowArgumentNullException()
|
||||||
|
{
|
||||||
|
var action = () => new CountMessageTokensRequest(
|
||||||
|
model: AnthropicModels.Claude3Sonnet,
|
||||||
|
messages: null!
|
||||||
|
);
|
||||||
|
|
||||||
|
action.Should().Throw<ArgumentNullException>();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalledAndMessagesIsEmpty_ItShouldThrowArgumentException()
|
||||||
|
{
|
||||||
|
var action = () => new CountMessageTokensRequest(
|
||||||
|
model: AnthropicModels.Claude3Sonnet,
|
||||||
|
messages: []
|
||||||
|
);
|
||||||
|
|
||||||
|
action.Should().Throw<ArgumentException>();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonSerialization_WhenSerialized_ItShouldHaveExpectedShape()
|
||||||
|
{
|
||||||
|
var messages = new List<Message>()
|
||||||
|
{
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Role = MessageRole.User,
|
||||||
|
Content = [new TextContent("Hello!")]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var model = AnthropicModels.Claude3Sonnet;
|
||||||
|
var systemPrompt = new List<TextContent>() { new("test-system") };
|
||||||
|
var toolChoice = new AutoToolChoice();
|
||||||
|
var tools = new List<Tool>();
|
||||||
|
|
||||||
|
var request = new CountMessageTokensRequest(
|
||||||
|
model: model,
|
||||||
|
messages: messages,
|
||||||
|
toolChoice: toolChoice,
|
||||||
|
tools: tools,
|
||||||
|
systemPrompt: systemPrompt
|
||||||
|
);
|
||||||
|
|
||||||
|
var actual = Serialize(request);
|
||||||
|
|
||||||
|
JsonAssert.Equal(_testJson, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonDeserialization_WhenDeserialized_ItShouldHaveExpectedShape()
|
||||||
|
{
|
||||||
|
var request = Deserialize<CountMessageTokensRequest>(_testJson);
|
||||||
|
|
||||||
|
request!.Model.Should().Be(AnthropicModels.Claude3Sonnet);
|
||||||
|
request.SystemPrompt.Should().BeEquivalentTo(new List<TextContent> { new("test-system") });
|
||||||
|
request.Messages.Should().HaveCount(1);
|
||||||
|
request.ToolChoice.Should().BeOfType<AutoToolChoice>();
|
||||||
|
request.ToolChoice!.Type.Should().Be("auto");
|
||||||
|
request.Tools.Should().HaveCount(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
|
public class DocumentContentTests : SerializationTest
|
||||||
|
{
|
||||||
|
private readonly string _testJson = @"{
|
||||||
|
""source"": {
|
||||||
|
""media_type"": ""application/pdf"",
|
||||||
|
""data"": ""data"",
|
||||||
|
""type"": ""base64""
|
||||||
|
},
|
||||||
|
""type"": ""document""
|
||||||
|
}";
|
||||||
|
|
||||||
|
private readonly string _testJsonWithCacheControl = @"{
|
||||||
|
""source"": {
|
||||||
|
""media_type"": ""application/pdf"",
|
||||||
|
""data"": ""data"",
|
||||||
|
""type"": ""base64""
|
||||||
|
},
|
||||||
|
""cache_control"": { ""type"": ""ephemeral"" },
|
||||||
|
""type"": ""document""
|
||||||
|
}";
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalled_ItShouldInitializeSource()
|
||||||
|
{
|
||||||
|
var expectedMediaType = "application/pdf";
|
||||||
|
var expectedData = "data";
|
||||||
|
|
||||||
|
var result = new DocumentContent(expectedMediaType, expectedData);
|
||||||
|
|
||||||
|
result.Source.Should().BeEquivalentTo(new DocumentSource(expectedMediaType, expectedData));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalledAndMediaTypeIsNull_ItShouldThrowArgumentNullException()
|
||||||
|
{
|
||||||
|
var expectedData = "data";
|
||||||
|
|
||||||
|
var action = () => new DocumentContent(null!, expectedData);
|
||||||
|
|
||||||
|
action.Should().Throw<ArgumentNullException>();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalledAndDataIsNull_ItShouldThrowArgumentNullException()
|
||||||
|
{
|
||||||
|
var expectedMediaType = "application/pdf";
|
||||||
|
|
||||||
|
var action = () => new DocumentContent(expectedMediaType, null!);
|
||||||
|
|
||||||
|
action.Should().Throw<ArgumentNullException>();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalledWithCacheControl_ItShouldInitializeSourceAndCacheControl()
|
||||||
|
{
|
||||||
|
var expectedMediaType = "application/pdf";
|
||||||
|
var expectedData = "data";
|
||||||
|
var cacheControl = new EphemeralCacheControl();
|
||||||
|
|
||||||
|
var result = new DocumentContent(expectedMediaType, expectedData, cacheControl);
|
||||||
|
|
||||||
|
result.Source.Should().BeEquivalentTo(new DocumentSource(expectedMediaType, expectedData));
|
||||||
|
result.CacheControl.Should().BeSameAs(cacheControl);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalledWithCacheControlAndMediaTypeIsNull_ItShouldThrowArgumentNullException()
|
||||||
|
{
|
||||||
|
var expectedData = "data";
|
||||||
|
var cacheControl = new EphemeralCacheControl();
|
||||||
|
|
||||||
|
var action = () => new DocumentContent(null!, expectedData, cacheControl);
|
||||||
|
|
||||||
|
action.Should().Throw<ArgumentNullException>();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalledWithCacheControlAndDataIsNull_ItShouldThrowArgumentNullException()
|
||||||
|
{
|
||||||
|
var expectedMediaType = "application/pdf";
|
||||||
|
var cacheControl = new EphemeralCacheControl();
|
||||||
|
|
||||||
|
var action = () => new DocumentContent(expectedMediaType, null!, cacheControl);
|
||||||
|
|
||||||
|
action.Should().Throw<ArgumentNullException>();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonSerialization_WhenSerialized_ItShouldHaveExpectedShape()
|
||||||
|
{
|
||||||
|
var content = new DocumentContent("application/pdf", "data");
|
||||||
|
|
||||||
|
var actual = Serialize(content);
|
||||||
|
|
||||||
|
JsonAssert.Equal(_testJson, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonSerialization_WhenSerializedWithCacheControl_ItShouldHaveExpectedShape()
|
||||||
|
{
|
||||||
|
var content = new DocumentContent("application/pdf", "data", new EphemeralCacheControl());
|
||||||
|
|
||||||
|
var actual = Serialize(content);
|
||||||
|
|
||||||
|
JsonAssert.Equal(_testJsonWithCacheControl, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonDeserialization_WhenDeserialized_ItShouldHaveExpectedShape()
|
||||||
|
{
|
||||||
|
var expected = new DocumentContent("application/pdf", "data");
|
||||||
|
|
||||||
|
var actual = Deserialize<DocumentContent>(_testJson);
|
||||||
|
|
||||||
|
actual.Should().BeEquivalentTo(expected);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
|
public class DocumentSourceTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalledWithValidArguments_ItShouldSetProperties()
|
||||||
|
{
|
||||||
|
var mediaType = "application/pdf";
|
||||||
|
var data = "base64data";
|
||||||
|
|
||||||
|
var source = new DocumentSource(mediaType, data);
|
||||||
|
|
||||||
|
source.MediaType.Should().Be(mediaType);
|
||||||
|
source.Data.Should().Be(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalledWithNullMediaType_ItShouldThrowArgumentNullException()
|
||||||
|
{
|
||||||
|
string? mediaType = null;
|
||||||
|
var data = "base64data";
|
||||||
|
|
||||||
|
var action = () => new DocumentSource(mediaType!, data);
|
||||||
|
|
||||||
|
action.Should().Throw<ArgumentNullException>();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalledWithNullData_ItShouldThrowArgumentNullException()
|
||||||
|
{
|
||||||
|
var mediaType = "application/pdf";
|
||||||
|
string? data = null;
|
||||||
|
|
||||||
|
var action = () => new DocumentSource(mediaType, data!);
|
||||||
|
|
||||||
|
action.Should().Throw<ArgumentNullException>();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalled_ItShouldHaveTypePropertySetToBase64()
|
||||||
|
{
|
||||||
|
var mediaType = "application/pdf";
|
||||||
|
var data = "base64data";
|
||||||
|
|
||||||
|
var source = new DocumentSource(mediaType, data);
|
||||||
|
|
||||||
|
source.Type.Should().Be("base64");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
|
public class ErroredMessageBatchResultTests : SerializationTest
|
||||||
|
{
|
||||||
|
private const string SampleJson = @"{
|
||||||
|
""type"": ""errored"",
|
||||||
|
""error"": {
|
||||||
|
""type"": ""error"",
|
||||||
|
""error"": {
|
||||||
|
""type"": ""api_error"",
|
||||||
|
""message"": ""An error occurred.""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}";
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalled_ItShouldReturnAnInstanceWithPropertiesSet()
|
||||||
|
{
|
||||||
|
var result = new ErroredMessageBatchResult();
|
||||||
|
|
||||||
|
result.Type.Should().Be(MessageBatchResultType.Errored);
|
||||||
|
result.Error.Error.Should().BeOfType<ApiError>();
|
||||||
|
result.Error.Error.Message.Should().BeEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonSerialization_WhenSerialized_ItShouldHaveExpectedShape()
|
||||||
|
{
|
||||||
|
var result = new ErroredMessageBatchResult
|
||||||
|
{
|
||||||
|
Error = new(new ApiError("An error occurred."))
|
||||||
|
};
|
||||||
|
|
||||||
|
var json = Serialize(result);
|
||||||
|
|
||||||
|
JsonAssert.Equal(SampleJson, json);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonDeserialization_WhenDeserialized_ItShouldHaveExpectedProperties()
|
||||||
|
{
|
||||||
|
var result = Deserialize<ErroredMessageBatchResult>(SampleJson);
|
||||||
|
|
||||||
|
result!.Type.Should().Be(MessageBatchResultType.Errored);
|
||||||
|
result.Error.Error.Should().BeOfType<ApiError>();
|
||||||
|
result.Error.Error.Message.Should().Be("An error occurred.");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
|
public class ExpiredMessageBatchResultTests : SerializationTest
|
||||||
|
{
|
||||||
|
private const string SampleJson = @"{
|
||||||
|
""type"": ""expired""
|
||||||
|
}";
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalled_ItShouldReturnAnInstanceWithPropertiesSet()
|
||||||
|
{
|
||||||
|
var result = new ExpiredMessageBatchResult();
|
||||||
|
|
||||||
|
result.Type.Should().Be(MessageBatchResultType.Expired);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonSerialization_WhenSerialized_ItShouldHaveExpectedShape()
|
||||||
|
{
|
||||||
|
var result = new ExpiredMessageBatchResult();
|
||||||
|
|
||||||
|
var json = Serialize(result);
|
||||||
|
|
||||||
|
JsonAssert.Equal(SampleJson, json);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonDeserialization_WhenDeserialized_ItShouldHaveExpectedProperties()
|
||||||
|
{
|
||||||
|
var result = Deserialize<ExpiredMessageBatchResult>(SampleJson);
|
||||||
|
|
||||||
|
result!.Type.Should().Be(MessageBatchResultType.Expired);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
|
public class MessageBatchDeleteResponseTests : SerializationTest
|
||||||
|
{
|
||||||
|
private const string SampleJson = @"{
|
||||||
|
""id"": ""test-id"",
|
||||||
|
""type"": ""test-type""
|
||||||
|
}";
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalled_ItShouldReturnAnInstanceWithPropertiesSet()
|
||||||
|
{
|
||||||
|
var result = new MessageBatchDeleteResponse();
|
||||||
|
|
||||||
|
result.Id.Should().BeEmpty();
|
||||||
|
result.Type.Should().BeEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonSerialization_WhenSerialized_ItShouldHaveExpectedShape()
|
||||||
|
{
|
||||||
|
var result = new MessageBatchDeleteResponse
|
||||||
|
{
|
||||||
|
Id = "test-id",
|
||||||
|
Type = "test-type"
|
||||||
|
};
|
||||||
|
|
||||||
|
var json = Serialize(result);
|
||||||
|
|
||||||
|
JsonAssert.Equal(SampleJson, json);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonDeserialization_WhenDeserialized_ItShouldHaveExpectedValues()
|
||||||
|
{
|
||||||
|
var result = Deserialize<MessageBatchDeleteResponse>(SampleJson);
|
||||||
|
|
||||||
|
result!.Id.Should().Be("test-id");
|
||||||
|
result.Type.Should().Be("test-type");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
|
public class MessageBatchRequestItemTests : SerializationTest
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalled_ItShouldReturnInstanceWithPropertiesSet()
|
||||||
|
{
|
||||||
|
var customId = "custom_id";
|
||||||
|
var messageRequest = new MessageRequest();
|
||||||
|
|
||||||
|
var result = new MessageBatchRequestItem(customId, messageRequest);
|
||||||
|
|
||||||
|
result.Should().BeOfType<MessageBatchRequestItem>();
|
||||||
|
result.CustomId.Should().Be(customId);
|
||||||
|
result.Params.Should().BeSameAs(messageRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("")]
|
||||||
|
[InlineData(" ")]
|
||||||
|
[InlineData(null)]
|
||||||
|
public void Constructor_WhenCalledAndCustomIdIsInvalid_ItShouldThrowException(string? customId)
|
||||||
|
{
|
||||||
|
var act = () => new MessageBatchRequestItem(customId!, new MessageRequest());
|
||||||
|
|
||||||
|
act.Should().Throw<ArgumentException>();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalledAndMessageRequestIsNull_ItShouldThrowException()
|
||||||
|
{
|
||||||
|
var act = () => new MessageBatchRequestItem("custom_id", null!);
|
||||||
|
|
||||||
|
act.Should().Throw<ArgumentException>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
|
public class MessageBatchRequestTests : SerializationTest
|
||||||
|
{
|
||||||
|
private const string SampleJson = @"{
|
||||||
|
""requests"": [
|
||||||
|
{
|
||||||
|
""custom_id"": ""my-first-request"",
|
||||||
|
""params"": {
|
||||||
|
""model"": ""claude-3-5-sonnet-20241022"",
|
||||||
|
""messages"": [
|
||||||
|
{""role"": ""user"", ""content"": [{ ""text"": ""Hello, world"", ""type"": ""text"" }]}
|
||||||
|
],
|
||||||
|
""max_tokens"": 1024,
|
||||||
|
""stop_sequences"": [],
|
||||||
|
""temperature"": 0.0,
|
||||||
|
""stream"": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
""custom_id"": ""my-second-request"",
|
||||||
|
""params"": {
|
||||||
|
""model"": ""claude-3-5-sonnet-20241022"",
|
||||||
|
""messages"": [
|
||||||
|
{""role"": ""user"", ""content"": [{ ""text"": ""Hi again, friend"", ""type"": ""text"" }]}
|
||||||
|
],
|
||||||
|
""max_tokens"": 1024,
|
||||||
|
""stop_sequences"": [],
|
||||||
|
""temperature"": 0.0,
|
||||||
|
""stream"": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}";
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalled_ItShouldReturnInstanceWithPropertiesSet()
|
||||||
|
{
|
||||||
|
var requests = new List<MessageBatchRequestItem> { new("custom_id", new()) };
|
||||||
|
|
||||||
|
var result = new MessageBatchRequest(requests);
|
||||||
|
|
||||||
|
result.Should().BeOfType<MessageBatchRequest>();
|
||||||
|
result.Requests.Should().BeSameAs(requests);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalledWithEmptyRequests_ItShouldThrowException()
|
||||||
|
{
|
||||||
|
var act = () => new MessageBatchRequest([]);
|
||||||
|
|
||||||
|
act.Should().Throw<ArgumentException>();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonSerialization_WhenSerialized_ItShouldHaveExpectedShape()
|
||||||
|
{
|
||||||
|
var requests = new List<MessageBatchRequestItem>
|
||||||
|
{
|
||||||
|
new("my-first-request", new()
|
||||||
|
{
|
||||||
|
Model = "claude-3-5-sonnet-20241022",
|
||||||
|
MaxTokens = 1024,
|
||||||
|
Messages = [
|
||||||
|
new() { Role = "user", Content = [new TextContent("Hello, world")] }
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
new("my-second-request", new()
|
||||||
|
{
|
||||||
|
Model = "claude-3-5-sonnet-20241022",
|
||||||
|
MaxTokens = 1024,
|
||||||
|
Messages = [
|
||||||
|
new() { Role = "user", Content = [new TextContent("Hi again, friend")] }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = new MessageBatchRequest(requests);
|
||||||
|
|
||||||
|
var json = Serialize(result);
|
||||||
|
|
||||||
|
JsonAssert.Equal(SampleJson, json);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
|
public class MessageBatchResponseTests : SerializationTest
|
||||||
|
{
|
||||||
|
private const string SampleJson = @"{
|
||||||
|
""id"": ""msgbatch_013Zva2CMHLNnXjNJJKqJ2EF"",
|
||||||
|
""type"": ""message_batch"",
|
||||||
|
""processing_status"": ""in_progress"",
|
||||||
|
""request_counts"": {
|
||||||
|
""processing"": 100,
|
||||||
|
""succeeded"": 50,
|
||||||
|
""errored"": 30,
|
||||||
|
""canceled"": 10,
|
||||||
|
""expired"": 10
|
||||||
|
},
|
||||||
|
""ended_at"": ""2024-08-20T18:37:24.100435Z"",
|
||||||
|
""created_at"": ""2024-08-20T18:37:24.100435Z"",
|
||||||
|
""expires_at"": ""2024-08-20T18:37:24.100435Z"",
|
||||||
|
""archived_at"": ""2024-08-20T18:37:24.100435Z"",
|
||||||
|
""cancel_initiated_at"": ""2024-08-20T18:37:24.100435Z"",
|
||||||
|
""results_url"": ""https://api.anthropic.com/v1/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/results""
|
||||||
|
}";
|
||||||
|
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalled_ItShouldReturnInstanceWithPropertiesSet()
|
||||||
|
{
|
||||||
|
var result = new MessageBatchResponse();
|
||||||
|
|
||||||
|
result.Should().BeOfType<MessageBatchResponse>();
|
||||||
|
result.Id.Should().BeEmpty();
|
||||||
|
result.Type.Should().BeEmpty();
|
||||||
|
result.ProcessingStatus.Should().BeEmpty();
|
||||||
|
result.RequestCounts.Should().BeEquivalentTo(new MessageBatchRequestCounts());
|
||||||
|
result.EndedAt.Should().Be(DateTimeOffset.MinValue);
|
||||||
|
result.CreatedAt.Should().Be(DateTimeOffset.MinValue);
|
||||||
|
result.ExpiresAt.Should().Be(DateTimeOffset.MinValue);
|
||||||
|
result.ArchivedAt.Should().Be(DateTimeOffset.MinValue);
|
||||||
|
result.CancelInitiatedAt.Should().Be(DateTimeOffset.MinValue);
|
||||||
|
result.ResultsUrl.Should().BeEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonSerialization_WhenDeserialized_ItShouldHaveExpectedValues()
|
||||||
|
{
|
||||||
|
var result = Deserialize<MessageBatchResponse>(SampleJson);
|
||||||
|
|
||||||
|
result.Should().BeEquivalentTo(new MessageBatchResponse
|
||||||
|
{
|
||||||
|
Id = "msgbatch_013Zva2CMHLNnXjNJJKqJ2EF",
|
||||||
|
Type = "message_batch",
|
||||||
|
ProcessingStatus = "in_progress",
|
||||||
|
RequestCounts = new()
|
||||||
|
{
|
||||||
|
Processing = 100,
|
||||||
|
Succeeded = 50,
|
||||||
|
Errored = 30,
|
||||||
|
Canceled = 10,
|
||||||
|
Expired = 10
|
||||||
|
},
|
||||||
|
EndedAt = DateTimeOffset.Parse("2024-08-20T18:37:24.100435Z"),
|
||||||
|
CreatedAt = DateTimeOffset.Parse("2024-08-20T18:37:24.100435Z"),
|
||||||
|
ExpiresAt = DateTimeOffset.Parse("2024-08-20T18:37:24.100435Z"),
|
||||||
|
ArchivedAt = DateTimeOffset.Parse("2024-08-20T18:37:24.100435Z"),
|
||||||
|
CancelInitiatedAt = DateTimeOffset.Parse("2024-08-20T18:37:24.100435Z"),
|
||||||
|
ResultsUrl = "https://api.anthropic.com/v1/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/results"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonSerialization_WhenSerialized_ItShouldHaveExpectedShape()
|
||||||
|
{
|
||||||
|
var expectedJson = @"{
|
||||||
|
""id"": ""msgbatch_013Zva2CMHLNnXjNJJKqJ2EF"",
|
||||||
|
""type"": ""message_batch"",
|
||||||
|
""processing_status"": ""in_progress"",
|
||||||
|
""request_counts"": {
|
||||||
|
""processing"": 100,
|
||||||
|
""succeeded"": 50,
|
||||||
|
""errored"": 30,
|
||||||
|
""canceled"": 10,
|
||||||
|
""expired"": 10
|
||||||
|
},
|
||||||
|
""ended_at"": ""2024-08-20T18:37:24.100435+00:00"",
|
||||||
|
""created_at"": ""2024-08-20T18:37:24.100435+00:00"",
|
||||||
|
""expires_at"": ""2024-08-20T18:37:24.100435+00:00"",
|
||||||
|
""archived_at"": ""2024-08-20T18:37:24.100435+00:00"",
|
||||||
|
""cancel_initiated_at"": ""2024-08-20T18:37:24.100435+00:00"",
|
||||||
|
""results_url"": ""https://api.anthropic.com/v1/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/results""
|
||||||
|
}";
|
||||||
|
|
||||||
|
var result = Serialize(new MessageBatchResponse
|
||||||
|
{
|
||||||
|
Id = "msgbatch_013Zva2CMHLNnXjNJJKqJ2EF",
|
||||||
|
Type = "message_batch",
|
||||||
|
ProcessingStatus = "in_progress",
|
||||||
|
RequestCounts = new()
|
||||||
|
{
|
||||||
|
Processing = 100,
|
||||||
|
Succeeded = 50,
|
||||||
|
Errored = 30,
|
||||||
|
Canceled = 10,
|
||||||
|
Expired = 10
|
||||||
|
},
|
||||||
|
EndedAt = DateTimeOffset.Parse("2024-08-20T18:37:24.100435Z"),
|
||||||
|
CreatedAt = DateTimeOffset.Parse("2024-08-20T18:37:24.100435Z"),
|
||||||
|
ExpiresAt = DateTimeOffset.Parse("2024-08-20T18:37:24.100435Z"),
|
||||||
|
ArchivedAt = DateTimeOffset.Parse("2024-08-20T18:37:24.100435Z"),
|
||||||
|
CancelInitiatedAt = DateTimeOffset.Parse("2024-08-20T18:37:24.100435Z"),
|
||||||
|
ResultsUrl = "https://api.anthropic.com/v1/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/results"
|
||||||
|
});
|
||||||
|
|
||||||
|
JsonAssert.Equal(expectedJson, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
|
public class MessageBatchResultItemTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalled_ItShouldReturnInstanceWithPropertiesSet()
|
||||||
|
{
|
||||||
|
var result = new MessageBatchResultItem();
|
||||||
|
|
||||||
|
result.Should().BeOfType<MessageBatchResultItem>();
|
||||||
|
result.CustomId.Should().BeEmpty();
|
||||||
|
result.Result.Should().Be(default);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
|
public class MessageBatchResultTests : SerializationTest
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void JsonDeserialization_WhenHasUnknownType_ItShouldThrowException()
|
||||||
|
{
|
||||||
|
var json = @"{""type"":""unknown""}";
|
||||||
|
|
||||||
|
var action = () => Deserialize<MessageBatchResult>(json);
|
||||||
|
|
||||||
|
action.Should().Throw<JsonException>();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonSerialization_WhenSerialized_ItShouldHaveExpectedShape()
|
||||||
|
{
|
||||||
|
var expectedJson = @"{""type"":""expired""}";
|
||||||
|
var messageBatchResult = new ExpiredMessageBatchResult();
|
||||||
|
|
||||||
|
var json = Serialize<MessageBatchResult>(messageBatchResult);
|
||||||
|
|
||||||
|
JsonAssert.Equal(expectedJson, json);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
|
public class MessageBatchResultTypeTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Succeeded_WhenCalled_ItShouldReturnExpectedValue()
|
||||||
|
{
|
||||||
|
var result = MessageBatchResultType.Succeeded;
|
||||||
|
|
||||||
|
result.Should().Be("succeeded");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Errored_WhenCalled_ItShouldReturnExpectedValue()
|
||||||
|
{
|
||||||
|
var result = MessageBatchResultType.Errored;
|
||||||
|
|
||||||
|
result.Should().Be("errored");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Canceled_WhenCalled_ItShouldReturnExpectedValue()
|
||||||
|
{
|
||||||
|
var result = MessageBatchResultType.Canceled;
|
||||||
|
|
||||||
|
result.Should().Be("canceled");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Expired_WhenCalled_ItShouldReturnExpectedValue()
|
||||||
|
{
|
||||||
|
var result = MessageBatchResultType.Expired;
|
||||||
|
|
||||||
|
result.Should().Be("expired");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
|
public class MessageBatchStatusTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Canceling_WhenCalled_ItShouldReturnCancelingStatus()
|
||||||
|
{
|
||||||
|
MessageBatchStatus.Canceling.Should().Be("canceling");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void InProgress_WhenCalled_ItShouldReturnCancelingStatus()
|
||||||
|
{
|
||||||
|
MessageBatchStatus.InProgress.Should().Be("in_progress");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Ended_WhenCalled_ItShouldReturnCancelingStatus()
|
||||||
|
{
|
||||||
|
MessageBatchStatus.Ended.Should().Be("ended");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -232,14 +232,14 @@ public class MessageRequestTests : SerializationTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Constructor_WhenCalledAndModelIsInvalid_ItShouldThrowArgumentException()
|
public void Constructor_WhenCalledAndModelIsInvalid_ItShouldNotThrowException()
|
||||||
{
|
{
|
||||||
var action = () => new MessageRequest(
|
var action = () => new MessageRequest(
|
||||||
model: "invalid-model",
|
model: "invalid-model",
|
||||||
messages: [new()]
|
messages: [new()]
|
||||||
);
|
);
|
||||||
|
|
||||||
action.Should().Throw<ArgumentException>();
|
action.Should().NotThrow();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -0,0 +1,111 @@
|
|||||||
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
|
public class PageTests : SerializationTest
|
||||||
|
{
|
||||||
|
private const string BasePageJson = @"{
|
||||||
|
""first_id"": ""msg_123"",
|
||||||
|
""last_id"": ""msg_456"",
|
||||||
|
""has_more"": true
|
||||||
|
}";
|
||||||
|
|
||||||
|
private const string GenericPageJson = @"{
|
||||||
|
""first_id"": ""msg_123"",
|
||||||
|
""last_id"": ""msg_456"",
|
||||||
|
""has_more"": true,
|
||||||
|
""data"": [""item1"", ""item2""]
|
||||||
|
}";
|
||||||
|
|
||||||
|
private const string EmptyPageJson = @"{
|
||||||
|
""first_id"": """",
|
||||||
|
""last_id"": """",
|
||||||
|
""has_more"": false,
|
||||||
|
""data"": []
|
||||||
|
}";
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalled_ItShouldReturnAnInstanceWithPropertiesSet()
|
||||||
|
{
|
||||||
|
var page = new Page();
|
||||||
|
|
||||||
|
page.FirstId.Should().BeEmpty();
|
||||||
|
page.LastId.Should().BeEmpty();
|
||||||
|
page.HasMore.Should().BeFalse();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalledWithGeneric_ItShouldReturnAnInstanceWithPropertiesSet()
|
||||||
|
{
|
||||||
|
var page = new Page<string>();
|
||||||
|
|
||||||
|
page.FirstId.Should().BeEmpty();
|
||||||
|
page.LastId.Should().BeEmpty();
|
||||||
|
page.HasMore.Should().BeFalse();
|
||||||
|
page.Data.Should().BeEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonDeserialization_WhenCalled_ItShouldHaveCorrectValues()
|
||||||
|
{
|
||||||
|
var result = Deserialize<Page>(BasePageJson);
|
||||||
|
|
||||||
|
result.Should().NotBeNull();
|
||||||
|
result!.FirstId.Should().Be("msg_123");
|
||||||
|
result.LastId.Should().Be("msg_456");
|
||||||
|
result.HasMore.Should().BeTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonSerialization_WhenCalled_ItShouldHaveExpectedShape()
|
||||||
|
{
|
||||||
|
var page = new Page
|
||||||
|
{
|
||||||
|
FirstId = "msg_123",
|
||||||
|
LastId = "msg_456",
|
||||||
|
HasMore = true
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = Serialize(page);
|
||||||
|
|
||||||
|
JsonAssert.Equal(BasePageJson, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonDeserialization_WhenCalledWithData_ItShouldHaveCorrectValues()
|
||||||
|
{
|
||||||
|
var result = Deserialize<Page<string>>(GenericPageJson);
|
||||||
|
|
||||||
|
result.Should().NotBeNull();
|
||||||
|
result!.FirstId.Should().Be("msg_123");
|
||||||
|
result.LastId.Should().Be("msg_456");
|
||||||
|
result.HasMore.Should().BeTrue();
|
||||||
|
result.Data.Should().BeEquivalentTo(["item1", "item2"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonSerialization_WhenCalledWithData_ItShouldHaveExpectedShape()
|
||||||
|
{
|
||||||
|
var page = new Page<string>
|
||||||
|
{
|
||||||
|
FirstId = "msg_123",
|
||||||
|
LastId = "msg_456",
|
||||||
|
HasMore = true,
|
||||||
|
Data = ["item1", "item2"]
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = Serialize(page);
|
||||||
|
|
||||||
|
JsonAssert.Equal(GenericPageJson, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonDeserialization_WhenCalledWithEmptyData_ItShouldHaveCorrectValues()
|
||||||
|
{
|
||||||
|
var result = Deserialize<Page<string>>(EmptyPageJson);
|
||||||
|
|
||||||
|
result.Should().NotBeNull();
|
||||||
|
result!.FirstId.Should().BeEmpty();
|
||||||
|
result.LastId.Should().BeEmpty();
|
||||||
|
result.HasMore.Should().BeFalse();
|
||||||
|
result.Data.Should().BeEmpty();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
|
public class PagingRequestTests : SerializationTest
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenLimitIsLessThanMinimum_ItShouldThrowArgumentOutOfRangeException()
|
||||||
|
{
|
||||||
|
var act = () => new PagingRequest(limit: 0);
|
||||||
|
|
||||||
|
act.Should().Throw<ArgumentOutOfRangeException>().WithMessage("limit must be between 1 and 1000. (Parameter 'limit')");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenLimitIsGreaterThanMaximum_ItShouldThrowArgumentOutOfRangeException()
|
||||||
|
{
|
||||||
|
var act = () => new PagingRequest(limit: 1001);
|
||||||
|
|
||||||
|
act.Should().Throw<ArgumentOutOfRangeException>().WithMessage("limit must be between 1 and 1000. (Parameter 'limit')");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenBothBeforeIdAndAfterIdAreSet_ItShouldThrowArgumentException()
|
||||||
|
{
|
||||||
|
var act = () => new PagingRequest(beforeId: "before-id", afterId: "after-id");
|
||||||
|
|
||||||
|
act.Should().Throw<ArgumentException>().WithMessage("Only one of beforeId or afterId can be set.");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ToQueryParameters_WhenNoPropertiesSet_ItShouldReturnEmptyString()
|
||||||
|
{
|
||||||
|
var pagingRequest = new PagingRequest();
|
||||||
|
|
||||||
|
var result = pagingRequest.ToQueryParameters();
|
||||||
|
|
||||||
|
result.Should().Be("limit=20");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ToQueryParameters_WhenBeforeIdIsSet_ItShouldReturnBeforeId()
|
||||||
|
{
|
||||||
|
var pagingRequest = new PagingRequest(beforeId: "before-id");
|
||||||
|
|
||||||
|
var result = pagingRequest.ToQueryParameters();
|
||||||
|
|
||||||
|
result.Should().Be("before_id=before-id&limit=20");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ToQueryParameters_WhenAfterIdIsSet_ItShouldReturnAfterId()
|
||||||
|
{
|
||||||
|
var pagingRequest = new PagingRequest(afterId: "after-id");
|
||||||
|
|
||||||
|
var result = pagingRequest.ToQueryParameters();
|
||||||
|
|
||||||
|
result.Should().Be("after_id=after-id&limit=20");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ToQueryParameters_WhenLimitIsSetToNonDefaultValue_ItShouldReturnLimit()
|
||||||
|
{
|
||||||
|
var pagingRequest = new PagingRequest(limit: 10);
|
||||||
|
|
||||||
|
var result = pagingRequest.ToQueryParameters();
|
||||||
|
|
||||||
|
result.Should().Be("limit=10");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -85,14 +85,14 @@ public class StreamMessageRequestTests : SerializationTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Constructor_WhenCalledAndModelIsInvalid_ItShouldThrowArgumentException()
|
public void Constructor_WhenCalledAndModelIsInvalid_ItShouldNotThrowException()
|
||||||
{
|
{
|
||||||
var action = () => new StreamMessageRequest(
|
var action = () => new StreamMessageRequest(
|
||||||
model: "invalid-model",
|
model: "invalid-model",
|
||||||
messages: [new()]
|
messages: [new()]
|
||||||
);
|
);
|
||||||
|
|
||||||
action.Should().Throw<ArgumentException>();
|
action.Should().NotThrow();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
|
public class SucceededMessageBatchResultTests : SerializationTest
|
||||||
|
{
|
||||||
|
private const string SampleJson = @"{
|
||||||
|
""message"": {
|
||||||
|
""id"": ""msg_01FqfsLoHwgeFbguDgpz48m7"",
|
||||||
|
""model"": ""claude-3-5-sonnet-20240620"",
|
||||||
|
""role"": ""assistant"",
|
||||||
|
""stop_reason"": ""end_turn"",
|
||||||
|
""type"": ""message"",
|
||||||
|
""usage"": {
|
||||||
|
""input_tokens"": 10,
|
||||||
|
""output_tokens"": 34,
|
||||||
|
""cache_creation_input_tokens"": 0,
|
||||||
|
""cache_read_input_tokens"": 0
|
||||||
|
},
|
||||||
|
""content"": [
|
||||||
|
{
|
||||||
|
""text"": ""Hello! How can I assist you today? Feel free to ask me any questions or let me know if there\u0027s anything you\u0027d like to chat about."",
|
||||||
|
""type"": ""text""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
""type"": ""succeeded""
|
||||||
|
}";
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalled_ItShouldReturnAnInstanceWithPropertiesSet()
|
||||||
|
{
|
||||||
|
var result = new SucceededMessageBatchResult();
|
||||||
|
|
||||||
|
result.Type.Should().Be(MessageBatchResultType.Succeeded);
|
||||||
|
result.Message.Should().BeEquivalentTo(new MessageResponse());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonSerialization_WhenSerialized_ItShouldHaveExpectedShape()
|
||||||
|
{
|
||||||
|
var result = new SucceededMessageBatchResult
|
||||||
|
{
|
||||||
|
Message = new MessageResponse
|
||||||
|
{
|
||||||
|
Id = "msg_01FqfsLoHwgeFbguDgpz48m7",
|
||||||
|
Type = "message",
|
||||||
|
Role = "assistant",
|
||||||
|
Model = "claude-3-5-sonnet-20240620",
|
||||||
|
Content = [
|
||||||
|
new TextContent()
|
||||||
|
{
|
||||||
|
Text = "Hello! How can I assist you today? Feel free to ask me any questions or let me know if there's anything you'd like to chat about."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
StopReason = "end_turn",
|
||||||
|
Usage = new()
|
||||||
|
{
|
||||||
|
InputTokens = 10,
|
||||||
|
OutputTokens = 34
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var json = Serialize(result);
|
||||||
|
|
||||||
|
JsonAssert.Equal(SampleJson, json);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonDeserialization_WhenDeserialized_ItShouldHaveExpectedValues()
|
||||||
|
{
|
||||||
|
var result = Deserialize<SucceededMessageBatchResult>(SampleJson);
|
||||||
|
|
||||||
|
result!.Type.Should().Be(MessageBatchResultType.Succeeded);
|
||||||
|
result.Message.Should().BeEquivalentTo(new MessageResponse
|
||||||
|
{
|
||||||
|
Id = "msg_01FqfsLoHwgeFbguDgpz48m7",
|
||||||
|
Type = "message",
|
||||||
|
Role = "assistant",
|
||||||
|
Model = "claude-3-5-sonnet-20240620",
|
||||||
|
Content = [
|
||||||
|
new TextContent()
|
||||||
|
{
|
||||||
|
Text = "Hello! How can I assist you today? Feel free to ask me any questions or let me know if there's anything you'd like to chat about."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
StopReason = "end_turn",
|
||||||
|
StopSequence = null,
|
||||||
|
Usage = new()
|
||||||
|
{
|
||||||
|
InputTokens = 10,
|
||||||
|
OutputTokens = 34
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
|
public class TokenCountResponseTests : SerializationTest
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Constructor_WhenCalled_ShouldInitializeProperties()
|
||||||
|
{
|
||||||
|
var expectedTokenCount = 1;
|
||||||
|
|
||||||
|
var response = new TokenCountResponse
|
||||||
|
{
|
||||||
|
InputTokens = expectedTokenCount
|
||||||
|
};
|
||||||
|
|
||||||
|
response.InputTokens.Should().Be(expectedTokenCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonSerialization_WhenCalled_ItShouldSerializeCorrectly()
|
||||||
|
{
|
||||||
|
var expectedJson = @"{
|
||||||
|
""input_tokens"": 1
|
||||||
|
}";
|
||||||
|
|
||||||
|
var response = new TokenCountResponse
|
||||||
|
{
|
||||||
|
InputTokens = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
var actual = Serialize(response);
|
||||||
|
|
||||||
|
JsonAssert.Equal(expectedJson, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonDeserialization_WhenCalled_ItShouldDeserializeCorrectly()
|
||||||
|
{
|
||||||
|
var json = @"{
|
||||||
|
""input_tokens"": 1
|
||||||
|
}";
|
||||||
|
|
||||||
|
var response = Deserialize<TokenCountResponse>(json);
|
||||||
|
|
||||||
|
response!.InputTokens.Should().Be(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
using System.Text.Json.Nodes;
|
|
||||||
|
|
||||||
namespace AnthropicClient.Tests.Unit.Models;
|
namespace AnthropicClient.Tests.Unit.Models;
|
||||||
|
|
||||||
public class ToolCallTests : SerializationTest
|
public class ToolCallTests : SerializationTest
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
using AnthropicClient.Json;
|
|
||||||
|
|
||||||
namespace AnthropicClient.Tests.Unit;
|
namespace AnthropicClient.Tests.Unit;
|
||||||
|
|
||||||
public class SerializationTest
|
public class SerializationTest
|
||||||
|
|||||||
Reference in New Issue
Block a user