File tree Expand file tree Collapse file tree
src/tests/Anthropic.IntegrationTests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,27 +10,19 @@ public partial class Tests
1010 private static AnthropicClient GetAuthenticatedClient ( )
1111 {
1212 var apiKey =
13- Environment . GetEnvironmentVariable ( "API_KEY" ) ??
14- Environment . GetEnvironmentVariable ( "ANTHROPIC_API_KEY" ) ??
13+ Environment . GetEnvironmentVariable ( "API_KEY" ) is { Length : > 0 } apiKeyValue ? apiKeyValue :
14+ Environment . GetEnvironmentVariable ( "ANTHROPIC_API_KEY" ) is { Length : > 0 } anthropicKeyValue ? anthropicKeyValue :
1515 throw new AssertInconclusiveException ( "ANTHROPIC_API_KEY environment variable is not found." ) ;
16- if ( string . IsNullOrWhiteSpace ( apiKey ) )
17- {
18- throw new AssertInconclusiveException ( "ANTHROPIC_API_KEY environment variable is empty." ) ;
19- }
2016
2117 return new AnthropicClient ( apiKey ) { ReadResponseAsString = true } ;
2218 }
2319
2420 private static IChatClient GetAuthenticatedChatClient ( )
2521 {
2622 var apiKey =
27- Environment . GetEnvironmentVariable ( "API_KEY" ) ??
28- Environment . GetEnvironmentVariable ( "ANTHROPIC_API_KEY" ) ??
23+ Environment . GetEnvironmentVariable ( "API_KEY" ) is { Length : > 0 } apiKeyValue ? apiKeyValue :
24+ Environment . GetEnvironmentVariable ( "ANTHROPIC_API_KEY" ) is { Length : > 0 } anthropicKeyValue ? anthropicKeyValue :
2925 throw new AssertInconclusiveException ( "ANTHROPIC_API_KEY environment variable is not found." ) ;
30- if ( string . IsNullOrWhiteSpace ( apiKey ) )
31- {
32- throw new AssertInconclusiveException ( "ANTHROPIC_API_KEY environment variable is empty." ) ;
33- }
3426
3527 return new AnthropicClient ( apiKey ) { ReadResponseAsString = true } ;
3628 }
You can’t perform that action at this time.
0 commit comments