Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release main #339

Merged
merged 6 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
".": "0.18.0",
"packages/vertex-sdk": "0.2.2",
".": "0.19.0",
"packages/vertex-sdk": "0.3.0",
"packages/bedrock-sdk": "0.9.1"
}
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## 0.19.0 (2024-03-19)

Full Changelog: [sdk-v0.18.0...sdk-v0.19.0](https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.18.0...sdk-v0.19.0)

### Features

* **vertex:** add support for overriding google auth ([#338](https://github.com/anthropics/anthropic-sdk-typescript/issues/338)) ([28d98c4](https://github.com/anthropics/anthropic-sdk-typescript/commit/28d98c487257a3c6b3c6d84597768d484fadb86d))
* **vertex:** api is no longer in private beta ([#344](https://github.com/anthropics/anthropic-sdk-typescript/issues/344)) ([892127c](https://github.com/anthropics/anthropic-sdk-typescript/commit/892127cdac059eee11c1a322a5512f9250868023))


### Bug Fixes

* **internal:** make toFile use input file's options ([#343](https://github.com/anthropics/anthropic-sdk-typescript/issues/343)) ([2dc2174](https://github.com/anthropics/anthropic-sdk-typescript/commit/2dc217441d6da8f2192b3e81b03c985383b6816e))


### Chores

* **internal:** update generated pragma comment ([#341](https://github.com/anthropics/anthropic-sdk-typescript/issues/341)) ([fd60f63](https://github.com/anthropics/anthropic-sdk-typescript/commit/fd60f63d5e5cd978b287d66fd95deabe2ff089d2))


### Documentation

* fix typo in CONTRIBUTING.md ([#340](https://github.com/anthropics/anthropic-sdk-typescript/issues/340)) ([ba9f3fa](https://github.com/anthropics/anthropic-sdk-typescript/commit/ba9f3faa5e3d116fce232d81f554b2f95f573ec8))

## 0.18.0 (2024-03-13)

Full Changelog: [sdk-v0.17.2...sdk-v0.18.0](https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.17.2...sdk-v0.18.0)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pnpm link -—global @anthropic-ai/sdk
Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.

```bash
npx prism path/to/your/openapi.yml
npx prism mock path/to/your/openapi.yml
```

```bash
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@anthropic-ai/sdk",
"version": "0.18.0",
"version": "0.19.0",
"description": "The official TypeScript library for the Anthropic API",
"author": "Anthropic <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/bedrock-sdk/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

"@anthropic-ai/sdk@file:../../dist":
# x-release-please-start-version
version "0.18.0"
version "0.19.0"
# x-release-please-end-version
dependencies:
"@types/node" "^18.11.18"
Expand Down
9 changes: 9 additions & 0 deletions packages/vertex-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 0.3.0 (2024-03-19)

Full Changelog: [vertex-sdk-v0.2.2...vertex-sdk-v0.3.0](https://github.com/anthropics/anthropic-sdk-typescript/compare/vertex-sdk-v0.2.2...vertex-sdk-v0.3.0)

### Features

* **vertex:** add support for overriding google auth ([#338](https://github.com/anthropics/anthropic-sdk-typescript/issues/338)) ([28d98c4](https://github.com/anthropics/anthropic-sdk-typescript/commit/28d98c487257a3c6b3c6d84597768d484fadb86d))
* **vertex:** api is no longer in private beta ([#344](https://github.com/anthropics/anthropic-sdk-typescript/issues/344)) ([892127c](https://github.com/anthropics/anthropic-sdk-typescript/commit/892127cdac059eee11c1a322a5512f9250868023))

## 0.2.2 (2024-03-13)

Full Changelog: [vertex-sdk-v0.2.1...vertex-sdk-v0.2.2](https://github.com/anthropics/anthropic-sdk-typescript/compare/vertex-sdk-v0.2.1...vertex-sdk-v0.2.2)
Expand Down
5 changes: 1 addition & 4 deletions packages/vertex-sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# Anthropic Vertex TypeScript API Library

> [!IMPORTANT]
> This API is in private preview.

[![NPM version](https://img.shields.io/npm/v/@anthropic-ai/vertex-sdk.svg)](https://npmjs.org/package/@anthropic-ai/vertex-sdk)

This library provides convenient access to the private preview of the Anthropic Vertex API.
This library provides convenient access to the Anthropic Vertex API.

For the non-Vertex Anthropic API at api.anthropic.com, see [`@anthropic-ai/sdk`](https://github.com/anthropics/anthropic-sdk-typescript).

Expand Down
2 changes: 1 addition & 1 deletion packages/vertex-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@anthropic-ai/vertex-sdk",
"version": "0.2.2",
"version": "0.3.0",
"description": "The official TypeScript library for the Anthropic Vertex API",
"author": "Anthropic <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
19 changes: 14 additions & 5 deletions packages/vertex-sdk/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,22 @@ import { type RequestInit } from '@anthropic-ai/sdk/_shims/index';
import { GoogleAuth } from 'google-auth-library';

const DEFAULT_VERSION = 'vertex-2023-10-16';
const DEFAULT_BETA_TYPES = ['private-messages-testing'];

export type ClientOptions = Omit<API.ClientOptions, 'apiKey' | 'authToken'> & {
region?: string | null | undefined;
projectId?: string | null | undefined;
accessToken?: string | null | undefined;

/**
* Override the default google auth config using the
* [google-auth-library](https://www.npmjs.com/package/google-auth-library) package.
*
* Note that you'll likely have to set `scopes`, e.g.
* ```ts
* new GoogleAuth({ scopes: 'https://www.googleapis.com/auth/cloud-platform' })
* ```
*/
googleAuth?: GoogleAuth | null | undefined;
};

export class AnthropicVertex extends Core.APIClient {
Expand All @@ -27,6 +37,7 @@ export class AnthropicVertex extends Core.APIClient {
*
* @param {string | null} opts.accessToken
* @param {string | null} opts.projectId
* @param {GoogleAuth} opts.googleAuth - Override the default google auth config
* @param {string | null} [opts.region=process.env['CLOUD_ML_REGION']]
* @param {string} [opts.baseURL=process.env['ANTHROPIC_VERTEX__BASE_URL'] ?? https://${region}-aiplatform.googleapis.com/v1] - Override the default base URL for the API.
* @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
Expand Down Expand Up @@ -66,7 +77,8 @@ export class AnthropicVertex extends Core.APIClient {
this.projectId = projectId;
this.accessToken = options.accessToken ?? null;

this._auth = new GoogleAuth({ scopes: 'https://www.googleapis.com/auth/cloud-platform' });
this._auth =
options.googleAuth ?? new GoogleAuth({ scopes: 'https://www.googleapis.com/auth/cloud-platform' });
this._authClientPromise = this._auth.getClient();
}

Expand Down Expand Up @@ -104,9 +116,6 @@ export class AnthropicVertex extends Core.APIClient {
if (!options.body['anthropic_version']) {
options.body['anthropic_version'] = DEFAULT_VERSION;
}
if (!options.body['anthropic_beta']) {
options.body['anthropic_beta'] = DEFAULT_BETA_TYPES;
}
}

if (options.path === '/v1/messages' && options.method === 'post') {
Expand Down
2 changes: 1 addition & 1 deletion packages/vertex-sdk/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

"@anthropic-ai/sdk@file:../../dist":
# x-release-please-start-version
version "0.18.0"
version "0.19.0"
# x-release-please-end-version
dependencies:
"@types/node" "^18.11.18"
Expand Down
2 changes: 1 addition & 1 deletion src/error.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless.
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { castToError, Headers } from './core';

Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless.
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from './core';
import * as Errors from './error';
Expand Down
2 changes: 1 addition & 1 deletion src/resource.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless.
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from '@anthropic-ai/sdk/core';

Expand Down
2 changes: 1 addition & 1 deletion src/resources/completions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless.
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from '@anthropic-ai/sdk/core';
import { APIPromise } from '@anthropic-ai/sdk/core';
Expand Down
2 changes: 1 addition & 1 deletion src/resources/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless.
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export {
Completion,
Expand Down
2 changes: 1 addition & 1 deletion src/resources/messages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless.
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from '@anthropic-ai/sdk/core';
import { APIPromise } from '@anthropic-ai/sdk/core';
Expand Down
2 changes: 1 addition & 1 deletion src/resources/top-level.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// File generated from our OpenAPI spec by Stainless.
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export {};
5 changes: 4 additions & 1 deletion src/uploads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,14 @@ export type ToFileInput = Uploadable | Exclude<BlobLikePart, string> | AsyncIter
export async function toFile(
value: ToFileInput | PromiseLike<ToFileInput>,
name?: string | null | undefined,
options: FilePropertyBag | undefined = {},
options?: FilePropertyBag | undefined,
): Promise<FileLike> {
// If it's a promise, resolve it.
value = await value;

// Use the file's options if there isn't one provided
options ??= isFileLike(value) ? { lastModified: value.lastModified, type: value.type } : {};

if (isResponseLike(value)) {
const blob = await value.blob();
name ||= new URL(value.url).pathname.split(/[\\/]/).pop() ?? 'unknown_file';
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '0.18.0'; // x-release-please-version
export const VERSION = '0.19.0'; // x-release-please-version
2 changes: 1 addition & 1 deletion tests/api-resources/completions.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless.
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import Anthropic from '@anthropic-ai/sdk';
import { Response } from 'node-fetch';
Expand Down
2 changes: 1 addition & 1 deletion tests/api-resources/messages.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless.
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import Anthropic from '@anthropic-ai/sdk';
import { Response } from 'node-fetch';
Expand Down
2 changes: 1 addition & 1 deletion tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless.
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import Anthropic from '@anthropic-ai/sdk';
import { APIUserAbortError } from '@anthropic-ai/sdk';
Expand Down
Loading