@@ -20,14 +20,14 @@ import ballerina/http;
2020const DEFAULT_ANTHROPIC_SERVICE_URL = " https://api.anthropic.com/v1" ;
2121const DEFAULT_MAX_TOKEN_COUNT = 512 ;
2222const DEFAULT_TEMPERATURE = 0.7 d ;
23+ const ANTHROPIC_API_VERSION = " 2023-06-01" ;
2324
2425# Provider is a client class that provides an interface for interacting with Anthropic Large Language Models.
2526public isolated client class Provider {
2627 * ai : ModelProvider ;
2728 private final http : Client AnthropicClient ;
2829 private final string apiKey;
2930 private final string modelType;
30- private final string apiVersion;
3131 private final int maxTokens;
3232
3333 # Initializes the Anthropic model with the given connection configuration and model configuration.
@@ -42,7 +42,6 @@ public isolated client class Provider {
4242 # + return - `nil` on successful initialization; otherwise, returns an `ai:Error`
4343 public isolated function init(@display {label: " API Key " } string apiKey ,
4444 @display {label: " Model Type " } ANTHROPIC_MODEL_NAMES modelType ,
45- @display {label: " API Version " } string apiVersion ,
4645 @display {label: " Service URL " } string serviceUrl = DEFAULT_ANTHROPIC_SERVICE_URL ,
4746 @display {label: " Maximum Tokens " } int maxTokens = DEFAULT_MAX_TOKEN_COUNT ,
4847 @display {label: " Temperature " } decimal temperature = DEFAULT_TEMPERATURE ,
@@ -75,7 +74,6 @@ public isolated client class Provider {
7574 self .AnthropicClient = httpClient ;
7675 self .apiKey = apiKey ;
7776 self .modelType = modelType ;
78- self .apiVersion = apiVersion ;
7977 self .maxTokens = maxTokens ;
8078 }
8179
@@ -168,7 +166,7 @@ public isolated client class Provider {
168166 // Send request to Anthropic API with proper headers
169167 map < string > headers = {
170168 " x-api-key" : self .apiKey ,
171- " anthropic-version" : self . apiVersion ,
169+ " anthropic-version" : ANTHROPIC_API_VERSION ,
172170 " content-type" : " application/json"
173171 };
174172
0 commit comments