chore: remove need for beta header when using prompt caching or PDF support

This commit is contained in:
Stevan Freeborn
2025-01-02 20:47:35 -06:00
parent a23938961f
commit 57f66d3619
2 changed files with 8 additions and 56 deletions
@@ -100,10 +100,7 @@ public class ClientTests(ConfigurationFixture configFixture) : EndToEndTest(conf
[Fact]
public async Task CreateMessageAsync_WhenSystemMessagesContainCacheControl_ItShouldUseCache()
{
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("anthropic-beta", "prompt-caching-2024-07-31");
var client = CreateClient(httpClient);
var client = CreateClient(new HttpClient());
var storyPath = GetTestFilePath("story.txt");
var storyText = await File.ReadAllTextAsync(storyPath);
@@ -121,7 +118,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.Value.Should().BeOfType<MessageResponse>();
@@ -142,10 +139,7 @@ public class ClientTests(ConfigurationFixture configFixture) : EndToEndTest(conf
[Fact]
public async Task CreateMessageAsync_WhenMessagesContainCacheControl_ItShouldUseCache()
{
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("anthropic-beta", "prompt-caching-2024-07-31");
var client = CreateClient(httpClient);
var client = CreateClient(new HttpClient());
var storyPath = GetTestFilePath("story.txt");
var storyText = await File.ReadAllTextAsync(storyPath);
@@ -181,10 +175,7 @@ public class ClientTests(ConfigurationFixture configFixture) : EndToEndTest(conf
[Fact]
public async Task CreateMessageAsync_WhenToolsContainCacheControl_ItShouldUseCache()
{
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("anthropic-beta", "prompt-caching-2024-07-31");
var client = CreateClient(httpClient);
var client = CreateClient(new HttpClient());
var func = (string ticker) => ticker;
@@ -238,9 +229,7 @@ public class ClientTests(ConfigurationFixture configFixture) : EndToEndTest(conf
]
);
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("anthropic-beta", "pdfs-2024-09-25");
var client = CreateClient(httpClient);
var client = CreateClient(new HttpClient());
var result = await client.CreateMessageAsync(request);
@@ -268,9 +257,7 @@ public class ClientTests(ConfigurationFixture configFixture) : EndToEndTest(conf
var bytes = await File.ReadAllBytesAsync(pdfPath);
var base64Data = Convert.ToBase64String(bytes);
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("anthropic-beta", "pdfs-2024-09-25, prompt-caching-2024-07-31");
var client = CreateClient(httpClient);
var client = CreateClient(new HttpClient());
var request = new MessageRequest(
model: AnthropicModels.Claude35Sonnet,