@ai-sdk/anthropic
Advanced tools
Comparing version 1.0.3 to 1.0.4
# @ai-sdk/anthropic | ||
## 1.0.4 | ||
### Patch Changes | ||
- bcd892e: feat (provider/google-vertex): Add support for Anthropic models. | ||
## 1.0.3 | ||
@@ -4,0 +10,0 @@ |
@@ -518,3 +518,3 @@ "use strict"; | ||
} | ||
getHeaders({ | ||
async getHeaders({ | ||
betas, | ||
@@ -527,3 +527,3 @@ headers | ||
return (0, import_provider_utils3.combineHeaders)( | ||
this.config.headers(), | ||
await (0, import_provider_utils3.resolve)(this.config.headers), | ||
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}, | ||
@@ -533,2 +533,10 @@ headers | ||
} | ||
buildRequestUrl(isStreaming) { | ||
var _a, _b, _c; | ||
return (_c = (_b = (_a = this.config).buildRequestUrl) == null ? void 0 : _b.call(_a, this.config.baseURL, isStreaming)) != null ? _c : `${this.config.baseURL}/messages`; | ||
} | ||
transformRequestBody(args) { | ||
var _a, _b, _c; | ||
return (_c = (_b = (_a = this.config).transformRequestBody) == null ? void 0 : _b.call(_a, args)) != null ? _c : args; | ||
} | ||
async doGenerate(options) { | ||
@@ -538,5 +546,5 @@ var _a, _b, _c, _d; | ||
const { responseHeaders, value: response } = await (0, import_provider_utils3.postJsonToApi)({ | ||
url: `${this.config.baseURL}/messages`, | ||
headers: this.getHeaders({ betas, headers: options.headers }), | ||
body: args, | ||
url: this.buildRequestUrl(false), | ||
headers: await this.getHeaders({ betas, headers: options.headers }), | ||
body: this.transformRequestBody(args), | ||
failedResponseHandler: anthropicFailedResponseHandler, | ||
@@ -598,5 +606,5 @@ successfulResponseHandler: (0, import_provider_utils3.createJsonResponseHandler)( | ||
const { responseHeaders, value: response } = await (0, import_provider_utils3.postJsonToApi)({ | ||
url: `${this.config.baseURL}/messages`, | ||
headers: this.getHeaders({ betas, headers: options.headers }), | ||
body, | ||
url: this.buildRequestUrl(true), | ||
headers: await this.getHeaders({ betas, headers: options.headers }), | ||
body: this.transformRequestBody(body), | ||
failedResponseHandler: anthropicFailedResponseHandler, | ||
@@ -603,0 +611,0 @@ successfulResponseHandler: (0, import_provider_utils3.createEventSourceResponseHandler)( |
{ | ||
"name": "@ai-sdk/anthropic", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"license": "Apache-2.0", | ||
@@ -11,2 +11,3 @@ "sideEffects": false, | ||
"dist/**/*", | ||
"internal/dist/**/*", | ||
"CHANGELOG.md" | ||
@@ -20,2 +21,8 @@ ], | ||
"require": "./dist/index.js" | ||
}, | ||
"./internal": { | ||
"types": "./internal/dist/index.d.ts", | ||
"import": "./internal/dist/index.mjs", | ||
"module": "./internal/dist/index.mjs", | ||
"require": "./internal/dist/index.js" | ||
} | ||
@@ -57,3 +64,3 @@ }, | ||
"build:watch": "tsup --watch", | ||
"clean": "rm -rf dist", | ||
"clean": "rm -rf dist && rm -rf internal/dist", | ||
"lint": "eslint \"./**/*.ts*\"", | ||
@@ -60,0 +67,0 @@ "type-check": "tsc --noEmit", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
427465
16
4163