chore: run dotnet format

This commit is contained in:
Stevan Freeborn
2024-08-18 14:59:47 -05:00
parent c2fa796bd0
commit afe70a9012
9 changed files with 28 additions and 28 deletions
+1 -1
View File
@@ -275,7 +275,7 @@ public class AnthropicApiClient : IAnthropicApiClient
} }
private async Task<HttpResponseMessage> SendRequestAsync(BaseMessageRequest request) private async Task<HttpResponseMessage> SendRequestAsync(BaseMessageRequest 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(MessagesEndpoint, requestContent);
@@ -109,7 +109,7 @@ public abstract class BaseMessageRequest
[JsonConstructor] [JsonConstructor]
internal BaseMessageRequest() { } internal BaseMessageRequest() { }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="BaseMessageRequest"/> class. /// Initializes a new instance of the <see cref="BaseMessageRequest"/> class.
/// </summary> /// </summary>
+1 -1
View File
@@ -6,7 +6,7 @@ namespace AnthropicClient.Models;
/// Represents the cache control to be used for content. /// Represents the cache control to be used for content.
/// </summary> /// </summary>
public abstract class CacheControl public abstract class CacheControl
{ {
/// <summary> /// <summary>
/// Gets the type of the cache control. /// Gets the type of the cache control.
/// </summary> /// </summary>
+1 -1
View File
@@ -11,7 +11,7 @@ public abstract class Content
/// Gets the type of the content. /// Gets the type of the content.
/// </summary> /// </summary>
public string Type { get; init; } = string.Empty; public string Type { get; init; } = string.Empty;
/// <summary> /// <summary>
/// Gets the cache control to be used for the content. /// Gets the cache control to be used for the content.
/// </summary> /// </summary>
+1 -1
View File
@@ -47,7 +47,7 @@ public class TextContent : Content
public TextContent(string text, CacheControl cacheControl) : base(ContentType.Text, cacheControl) public TextContent(string text, CacheControl cacheControl) : base(ContentType.Text, cacheControl)
{ {
Validate(text); Validate(text);
Text = text; Text = text;
} }
} }
+12 -12
View File
@@ -131,9 +131,9 @@ public class Tool
/// <returns>The created tool as instance of <see cref="Tool"/>.</returns> /// <returns>The created tool as instance of <see cref="Tool"/>.</returns>
/// <remarks>The name of the tool will be sanitized to conform to the Anthropic tool naming rules.</remarks> /// <remarks>The name of the tool will be sanitized to conform to the Anthropic tool naming rules.</remarks>
public static Tool CreateFromStaticMethod( public static Tool CreateFromStaticMethod(
string name, string name,
string description, string description,
Type type, Type type,
string methodName, string methodName,
CacheControl? cacheControl = null CacheControl? cacheControl = null
) )
@@ -165,9 +165,9 @@ public class Tool
/// <returns>The created tool as instance of <see cref="Tool"/>.</returns> /// <returns>The created tool as instance of <see cref="Tool"/>.</returns>
/// <remarks>The name of the tool will be sanitized to conform to the Anthropic tool naming rules.</remarks> /// <remarks>The name of the tool will be sanitized to conform to the Anthropic tool naming rules.</remarks>
public static Tool CreateFromInstanceMethod( public static Tool CreateFromInstanceMethod(
string name, string name,
string description, string description,
object instance, object instance,
string methodName, string methodName,
CacheControl? cacheControl = null CacheControl? cacheControl = null
) )
@@ -197,8 +197,8 @@ public class Tool
/// <returns>The created tool as instance of <see cref="Tool"/>.</returns> /// <returns>The created tool as instance of <see cref="Tool"/>.</returns>
/// <remarks>The name of the tool will be sanitized to conform to the Anthropic tool naming rules.</remarks> /// <remarks>The name of the tool will be sanitized to conform to the Anthropic tool naming rules.</remarks>
public static Tool CreateFromFunction<TResult>( public static Tool CreateFromFunction<TResult>(
string name, string name,
string description, string description,
Func<TResult> func, Func<TResult> func,
CacheControl? cacheControl = null CacheControl? cacheControl = null
) )
@@ -221,8 +221,8 @@ public class Tool
/// <returns>The created tool as instance of <see cref="Tool"/>.</returns> /// <returns>The created tool as instance of <see cref="Tool"/>.</returns>
/// <remarks>The name of the tool will be sanitized to conform to the Anthropic tool naming rules.</remarks> /// <remarks>The name of the tool will be sanitized to conform to the Anthropic tool naming rules.</remarks>
public static Tool CreateFromFunction<T1, TResult>( public static Tool CreateFromFunction<T1, TResult>(
string name, string name,
string description, string description,
Func<T1, TResult> func, Func<T1, TResult> func,
CacheControl? cacheControl = null CacheControl? cacheControl = null
) )
@@ -246,8 +246,8 @@ public class Tool
/// <returns>The created tool as instance of <see cref="Tool"/>.</returns> /// <returns>The created tool as instance of <see cref="Tool"/>.</returns>
/// <remarks>The name of the tool will be sanitized to conform to the Anthropic tool naming rules.</remarks> /// <remarks>The name of the tool will be sanitized to conform to the Anthropic tool naming rules.</remarks>
public static Tool CreateFromFunction<T1, T2, TResult>( public static Tool CreateFromFunction<T1, T2, TResult>(
string name, string name,
string description, string description,
Func<T1, T2, TResult> func, Func<T1, T2, TResult> func,
CacheControl? cacheControl = null CacheControl? cacheControl = null
) )
@@ -44,7 +44,7 @@ public class ToolResultContent : Content
Content = content; Content = content;
} }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ToolResultContent"/> class. /// Initializes a new instance of the <see cref="ToolResultContent"/> class.
/// </summary> /// </summary>
/// <param name="toolUseId">The tool use ID of the content.</param> /// <param name="toolUseId">The tool use ID of the content.</param>
@@ -20,9 +20,9 @@ public class MessageDeltaEventDataTests : SerializationTest
public void Constructor_WhenCalled_ItShouldInitializeProperties() public void Constructor_WhenCalled_ItShouldInitializeProperties()
{ {
var expectedDelta = new MessageDelta("max_tokens", "max_tokens"); var expectedDelta = new MessageDelta("max_tokens", "max_tokens");
var expectedUsage = new Usage var expectedUsage = new Usage
{ {
InputTokens = 1, InputTokens = 1,
OutputTokens = 1, OutputTokens = 1,
CacheCreationInputTokens = 1, CacheCreationInputTokens = 1,
CacheReadInputTokens = 1, CacheReadInputTokens = 1,
@@ -38,9 +38,9 @@ public class MessageDeltaEventDataTests : SerializationTest
public void JsonSerialization_WhenSerialized_ItShouldHaveExpectedShape() public void JsonSerialization_WhenSerialized_ItShouldHaveExpectedShape()
{ {
var expectedDelta = new MessageDelta("max_tokens", "max_tokens"); var expectedDelta = new MessageDelta("max_tokens", "max_tokens");
var expectedUsage = new Usage var expectedUsage = new Usage
{ {
InputTokens = 1, InputTokens = 1,
OutputTokens = 1, OutputTokens = 1,
CacheCreationInputTokens = 1, CacheCreationInputTokens = 1,
CacheReadInputTokens = 1, CacheReadInputTokens = 1,
@@ -57,9 +57,9 @@ public class MessageDeltaEventDataTests : SerializationTest
public void JsonDeserialization_WhenDeserialized_ItShouldHaveExpectedValues() public void JsonDeserialization_WhenDeserialized_ItShouldHaveExpectedValues()
{ {
var expectedDelta = new MessageDelta("max_tokens", "max_tokens"); var expectedDelta = new MessageDelta("max_tokens", "max_tokens");
var expectedUsage = new Usage var expectedUsage = new Usage
{ {
InputTokens = 1, InputTokens = 1,
OutputTokens = 1, OutputTokens = 1,
CacheCreationInputTokens = 1, CacheCreationInputTokens = 1,
CacheReadInputTokens = 1, CacheReadInputTokens = 1,
@@ -408,7 +408,7 @@ public class MessageRequestTests : SerializationTest
JsonAssert.Equal(expected, actual); JsonAssert.Equal(expected, actual);
} }
[Fact] [Fact]
public void JsonSerialization_WhenSerializedAndSystemMessageIsProvided_ItShouldUseSystemMessageForHaveSystemProperty() public void JsonSerialization_WhenSerializedAndSystemMessageIsProvided_ItShouldUseSystemMessageForHaveSystemProperty()
{ {
var messageRequest = new MessageRequest( var messageRequest = new MessageRequest(