Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@anthropic-ai/sdk

Package Overview
Dependencies
Maintainers
8
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@anthropic-ai/sdk - npm Package Compare versions

Comparing version 0.19.0 to 0.19.1

23

CHANGELOG.md
# Changelog
## 0.19.1 (2024-03-29)
Full Changelog: [sdk-v0.19.0...sdk-v0.19.1](https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.19.0...sdk-v0.19.1)
### Bug Fixes
* **client:** correctly send deno version header ([#354](https://github.com/anthropics/anthropic-sdk-typescript/issues/354)) ([ad5162b](https://github.com/anthropics/anthropic-sdk-typescript/commit/ad5162be2ccb122eb355577f481732121b130b0b))
* handle process.env being undefined in debug func ([#351](https://github.com/anthropics/anthropic-sdk-typescript/issues/351)) ([3b0f38a](https://github.com/anthropics/anthropic-sdk-typescript/commit/3b0f38ab427ae7d31c800cd5c8be1653da9ae709))
* **streaming:** correct accumulation of output tokens ([#361](https://github.com/anthropics/anthropic-sdk-typescript/issues/361)) ([76af283](https://github.com/anthropics/anthropic-sdk-typescript/commit/76af283596530ccd3a77ed86788bc0ea1e93f3c1))
* **types:** correct typo claude-2.1' to claude-2.1 ([#352](https://github.com/anthropics/anthropic-sdk-typescript/issues/352)) ([0d5efb9](https://github.com/anthropics/anthropic-sdk-typescript/commit/0d5efb9a0b9eb3ebe1df5ed10164fadfd886eac6))
### Chores
* **internal:** add type ([#359](https://github.com/anthropics/anthropic-sdk-typescript/issues/359)) ([9456414](https://github.com/anthropics/anthropic-sdk-typescript/commit/945641467deffb674f762920955c98d10f287c8e))
### Documentation
* **bedrock:** fix dead link ([#356](https://github.com/anthropics/anthropic-sdk-typescript/issues/356)) ([a953e00](https://github.com/anthropics/anthropic-sdk-typescript/commit/a953e0070698f3238b728ffe06a056a9f2d6b7ff))
* **readme:** consistent use of sentence case in headings ([#347](https://github.com/anthropics/anthropic-sdk-typescript/issues/347)) ([30f45d1](https://github.com/anthropics/anthropic-sdk-typescript/commit/30f45d14a534d7392dfcc4fb503bf07ab8cf038d))
* **readme:** document how to make undocumented requests ([#349](https://github.com/anthropics/anthropic-sdk-typescript/issues/349)) ([f92c50a](https://github.com/anthropics/anthropic-sdk-typescript/commit/f92c50ac6d9d1b8bdb837e52414aafd3224553da))
## 0.19.0 (2024-03-19)

@@ -4,0 +27,0 @@

4

core.js

@@ -547,3 +547,3 @@ "use strict";

'X-Stainless-Runtime': 'deno',
'X-Stainless-Runtime-Version': Deno.version,
'X-Stainless-Runtime-Version': typeof Deno.version === 'string' ? Deno.version : Deno.version?.deno ?? 'unknown',
};

@@ -805,3 +805,3 @@ }

function debug(action, ...args) {
if (typeof process !== 'undefined' && process.env['DEBUG'] === 'true') {
if (typeof process !== 'undefined' && process?.env?.['DEBUG'] === 'true') {
console.log(`Anthropic:DEBUG:${action}`, ...args);

@@ -808,0 +808,0 @@ }

@@ -364,2 +364,3 @@ "use strict";

snapshot.stop_sequence = event.delta.stop_sequence;
snapshot.usage.output_tokens = event.usage.output_tokens;
return snapshot;

@@ -366,0 +367,0 @@ case 'content_block_start':

{
"name": "@anthropic-ai/sdk",
"version": "0.19.0",
"version": "0.19.1",
"description": "The official TypeScript library for the Anthropic API",

@@ -5,0 +5,0 @@ "author": "Anthropic <support@anthropic.com>",

@@ -40,3 +40,3 @@ # Anthropic TypeScript API Library

## Streaming Responses
## Streaming responses

@@ -280,4 +280,48 @@ We provide support for streaming responses using Server Sent Events (SSE).

## Customizing the fetch client
### Making custom/undocumented requests
This library is typed for convenient access to the documented API. If you need to access undocumented
endpoints, params, or response properties, the library can still be used.
#### Undocumented endpoints
To make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.
Options on the client, such as retries, will be respected when making these requests.
```ts
await client.post('/some/path', {
body: { some_prop: 'foo' },
query: { some_query_arg: 'bar' },
});
```
#### Undocumented params
To make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented
parameter. This library doesn't validate at runtime that the request matches the type, so any extra values you
send will be sent as-is.
```ts
client.foo.create({
foo: 'my_param',
bar: 12,
// @ts-expect-error baz is not yet public
baz: 'undocumented option',
});
```
For requests with the `GET` verb, any extra params will be in the query, all other requests will send the
extra param in the body.
If you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request
options.
#### Undocumented properties
To access undocumented response properties, you may access the response object with `// @ts-expect-error` on
the response object, or cast the response object to the requisite type. Like the request params, we do not
validate or strip extra properties from the response from the API.
### Customizing the fetch client
By default, this library uses `node-fetch` in Node, and expects a global `fetch` function in other environments.

@@ -299,2 +343,4 @@

### Logging and middleware
You may also provide a custom `fetch` function when instantiating the client,

@@ -320,3 +366,3 @@ which can be used to inspect or alter the `Request` or `Response` before/after each request:

## Configuring an HTTP(S) Agent (e.g., for proxies)
### Configuring an HTTP(S) Agent (e.g., for proxies)

@@ -350,3 +396,3 @@ By default, this library uses a stable agent for all http/https requests to reuse TCP connections, eliminating many TCP & TLS handshakes and shaving around 100ms off most requests.

## Semantic Versioning
## Semantic versioning

@@ -353,0 +399,0 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:

@@ -319,3 +319,3 @@ import * as Core from '@anthropic-ai/sdk/core';

*/
model: (string & {}) | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | "claude-2.1'" | 'claude-2.0' | 'claude-instant-1.2';
model: (string & {}) | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | 'claude-2.1' | 'claude-2.0' | 'claude-instant-1.2';
/**

@@ -526,3 +526,3 @@ * An object describing metadata about the request.

*/
model: (string & {}) | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | "claude-2.1'" | 'claude-2.0' | 'claude-instant-1.2';
model: (string & {}) | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | 'claude-2.1' | 'claude-2.0' | 'claude-instant-1.2';
/**

@@ -529,0 +529,0 @@ * An object describing metadata about the request.

@@ -821,3 +821,4 @@ import { VERSION } from './version';

'X-Stainless-Runtime': 'deno',
'X-Stainless-Runtime-Version': Deno.version,
'X-Stainless-Runtime-Version':
typeof Deno.version === 'string' ? Deno.version : Deno.version?.deno ?? 'unknown',
};

@@ -1079,3 +1080,3 @@ }

export function debug(action: string, ...args: any[]) {
if (typeof process !== 'undefined' && process.env['DEBUG'] === 'true') {
if (typeof process !== 'undefined' && process?.env?.['DEBUG'] === 'true') {
console.log(`Anthropic:DEBUG:${action}`, ...args);

@@ -1082,0 +1083,0 @@ }

@@ -453,2 +453,3 @@ import * as Core from "../core";

snapshot.stop_sequence = event.delta.stop_sequence;
snapshot.usage.output_tokens = event.usage.output_tokens;
return snapshot;

@@ -455,0 +456,0 @@ case 'content_block_start':

@@ -398,3 +398,3 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

| 'claude-3-haiku-20240307'
| "claude-2.1'"
| 'claude-2.1'
| 'claude-2.0'

@@ -626,3 +626,3 @@ | 'claude-instant-1.2';

| 'claude-3-haiku-20240307'
| "claude-2.1'"
| 'claude-2.1'
| 'claude-2.0'

@@ -629,0 +629,0 @@ | 'claude-instant-1.2';

@@ -205,3 +205,3 @@ import { ReadableStream, type Response } from './_shims/index';

},
async pull(ctrl) {
async pull(ctrl: any) {
try {

@@ -208,0 +208,0 @@ const { value, done } = await iter.next();

@@ -1,1 +0,1 @@

export const VERSION = '0.19.0'; // x-release-please-version
export const VERSION = '0.19.1'; // x-release-please-version

@@ -1,2 +0,2 @@

export declare const VERSION = "0.19.0";
export declare const VERSION = "0.19.1";
//# sourceMappingURL=version.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VERSION = void 0;
exports.VERSION = '0.19.0'; // x-release-please-version
exports.VERSION = '0.19.1'; // x-release-please-version
//# sourceMappingURL=version.js.map

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

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

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc