Skip to content
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
6 changes: 3 additions & 3 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
".": "0.35.0",
"packages/vertex-sdk": "0.6.3",
"packages/bedrock-sdk": "0.12.2"
".": "0.36.0",
"packages/vertex-sdk": "0.6.4",
"packages/bedrock-sdk": "0.12.3"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 21
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-fd67aea6883f1ee9e46f31a42d3940f0acb1749e787055bd9b9f278b20fa53ec.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-7270ee0a79d885681ee507414608229f61c27f47c40f355dcd210b38aa7cddf1.yml
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## 0.36.0 (2025-01-23)

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

### Features

* **api:** add citations ([#668](https://github.com/anthropics/anthropic-sdk-typescript/issues/668)) ([1fef177](https://github.com/anthropics/anthropic-sdk-typescript/commit/1fef17749adbbeb243480b96c04941be29c0746c))
* **client:** support results endpoint ([#666](https://github.com/anthropics/anthropic-sdk-typescript/issues/666)) ([db5fffe](https://github.com/anthropics/anthropic-sdk-typescript/commit/db5fffeb38a99a3e9283ebf001fbf767d756162e))
* **stream:** expose `response` property as well ([b0235c7](https://github.com/anthropics/anthropic-sdk-typescript/commit/b0235c7b3ac174b3c8e670e381b4aa038e61c826))


### Chores

* **bedrock:** bump dependency on @anthropic-ai/sdk ([8745ca2](https://github.com/anthropics/anthropic-sdk-typescript/commit/8745ca2160f5af4d89e5732a44e560c5e2787aa8))
* **internal:** fix import ([628b55e](https://github.com/anthropics/anthropic-sdk-typescript/commit/628b55ef5ff8f0245287ecaea688480a0174e2e9))
* **internal:** minor restructuring ([#664](https://github.com/anthropics/anthropic-sdk-typescript/issues/664)) ([57aefa7](https://github.com/anthropics/anthropic-sdk-typescript/commit/57aefa73230d54da24d787a89adc277481986d02))
* **vertex:** bump dependency on @anthropic-ai/sdk ([a1c7fcd](https://github.com/anthropics/anthropic-sdk-typescript/commit/a1c7fcdce081f860cbb1148c3862e3303ddb8a62))

## 0.35.0 (2025-01-21)

Full Changelog: [sdk-v0.34.0...sdk-v0.35.0](https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.34.0...sdk-v0.35.0)
Expand Down
30 changes: 28 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,19 @@ Types:

- <code><a href="./src/resources/messages/messages.ts">Base64PDFSource</a></code>
- <code><a href="./src/resources/messages/messages.ts">CacheControlEphemeral</a></code>
- <code><a href="./src/resources/messages/messages.ts">CitationCharLocation</a></code>
- <code><a href="./src/resources/messages/messages.ts">CitationCharLocationParam</a></code>
- <code><a href="./src/resources/messages/messages.ts">CitationContentBlockLocation</a></code>
- <code><a href="./src/resources/messages/messages.ts">CitationContentBlockLocationParam</a></code>
- <code><a href="./src/resources/messages/messages.ts">CitationPageLocation</a></code>
- <code><a href="./src/resources/messages/messages.ts">CitationPageLocationParam</a></code>
- <code><a href="./src/resources/messages/messages.ts">CitationsConfigParam</a></code>
- <code><a href="./src/resources/messages/messages.ts">CitationsDelta</a></code>
- <code><a href="./src/resources/messages/messages.ts">ContentBlock</a></code>
- <code><a href="./src/resources/messages/messages.ts">ContentBlockDeltaEvent</a></code>
- <code><a href="./src/resources/messages/messages.ts">ContentBlockParam</a></code>
- <code><a href="./src/resources/messages/messages.ts">ContentBlockSource</a></code>
- <code><a href="./src/resources/messages/messages.ts">ContentBlockSourceContent</a></code>
- <code><a href="./src/resources/messages/messages.ts">ContentBlockStartEvent</a></code>
- <code><a href="./src/resources/messages/messages.ts">ContentBlockStopEvent</a></code>
- <code><a href="./src/resources/messages/messages.ts">DocumentBlockParam</a></code>
Expand All @@ -40,6 +50,7 @@ Types:
- <code><a href="./src/resources/messages/messages.ts">MessageTokensCount</a></code>
- <code><a href="./src/resources/messages/messages.ts">Metadata</a></code>
- <code><a href="./src/resources/messages/messages.ts">Model</a></code>
- <code><a href="./src/resources/messages/messages.ts">PlainTextSource</a></code>
- <code><a href="./src/resources/messages/messages.ts">RawContentBlockDeltaEvent</a></code>
- <code><a href="./src/resources/messages/messages.ts">RawContentBlockStartEvent</a></code>
- <code><a href="./src/resources/messages/messages.ts">RawContentBlockStopEvent</a></code>
Expand All @@ -49,6 +60,8 @@ Types:
- <code><a href="./src/resources/messages/messages.ts">RawMessageStreamEvent</a></code>
- <code><a href="./src/resources/messages/messages.ts">TextBlock</a></code>
- <code><a href="./src/resources/messages/messages.ts">TextBlockParam</a></code>
- <code><a href="./src/resources/messages/messages.ts">TextCitation</a></code>
- <code><a href="./src/resources/messages/messages.ts">TextCitationParam</a></code>
- <code><a href="./src/resources/messages/messages.ts">TextDelta</a></code>
- <code><a href="./src/resources/messages/messages.ts">Tool</a></code>
- <code><a href="./src/resources/messages/messages.ts">ToolChoice</a></code>
Expand Down Expand Up @@ -87,7 +100,7 @@ Methods:
- <code title="get /v1/messages/batches">client.messages.batches.<a href="./src/resources/messages/batches.ts">list</a>({ ...params }) -> MessageBatchesPage</code>
- <code title="delete /v1/messages/batches/{message_batch_id}">client.messages.batches.<a href="./src/resources/messages/batches.ts">delete</a>(messageBatchId) -> DeletedMessageBatch</code>
- <code title="post /v1/messages/batches/{message_batch_id}/cancel">client.messages.batches.<a href="./src/resources/messages/batches.ts">cancel</a>(messageBatchId) -> MessageBatch</code>
- <code title="get /v1/messages/batches/{message_batch_id}/results">client.messages.batches.<a href="./src/resources/messages/batches.ts">results</a>(messageBatchId) -> JSONLDecoder\<MessageBatchIndividualResponse\></code>
- <code title="get /v1/messages/batches/{message_batch_id}/results">client.messages.batches.<a href="./src/resources/messages/batches.ts">results</a>(messageBatchId) -> JSONLDecoder&lt;MessageBatchIndividualResponse&gt;</code>

# Models

Expand Down Expand Up @@ -135,15 +148,26 @@ Types:
- <code><a href="./src/resources/beta/messages/messages.ts">BetaBase64PDFBlock</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaBase64PDFSource</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaCacheControlEphemeral</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaCitationCharLocation</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaCitationCharLocationParam</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaCitationContentBlockLocation</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaCitationContentBlockLocationParam</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaCitationPageLocation</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaCitationPageLocationParam</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaCitationsConfigParam</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaCitationsDelta</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaContentBlock</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaContentBlockParam</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaContentBlockSource</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaContentBlockSourceContent</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaImageBlockParam</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaInputJSONDelta</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaMessage</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaMessageDeltaUsage</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaMessageParam</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaMessageTokensCount</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaMetadata</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaPlainTextSource</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaRawContentBlockDeltaEvent</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaRawContentBlockStartEvent</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaRawContentBlockStopEvent</a></code>
Expand All @@ -153,6 +177,8 @@ Types:
- <code><a href="./src/resources/beta/messages/messages.ts">BetaRawMessageStreamEvent</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaTextBlock</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaTextBlockParam</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaTextCitation</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaTextCitationParam</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaTextDelta</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaTool</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaToolBash20241022</a></code>
Expand Down Expand Up @@ -194,4 +220,4 @@ Methods:
- <code title="get /v1/messages/batches?beta=true">client.beta.messages.batches.<a href="./src/resources/beta/messages/batches.ts">list</a>({ ...params }) -> BetaMessageBatchesPage</code>
- <code title="delete /v1/messages/batches/{message_batch_id}?beta=true">client.beta.messages.batches.<a href="./src/resources/beta/messages/batches.ts">delete</a>(messageBatchId, { ...params }) -> BetaDeletedMessageBatch</code>
- <code title="post /v1/messages/batches/{message_batch_id}/cancel?beta=true">client.beta.messages.batches.<a href="./src/resources/beta/messages/batches.ts">cancel</a>(messageBatchId, { ...params }) -> BetaMessageBatch</code>
- <code title="get /v1/messages/batches/{message_batch_id}/results?beta=true">client.beta.messages.batches.<a href="./src/resources/beta/messages/batches.ts">results</a>(messageBatchId, { ...params }) -> JSONLDecoder\<MessageBatchIndividualResponse\></code>
- <code title="get /v1/messages/batches/{message_batch_id}/results?beta=true">client.beta.messages.batches.<a href="./src/resources/beta/messages/batches.ts">results</a>(messageBatchId, { ...params }) -> JSONLDecoder&lt;BetaMessageBatchIndividualResponse&gt;</code>
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.35.0",
"version": "0.36.0",
"description": "The official TypeScript library for the Anthropic API",
"author": "Anthropic <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
8 changes: 8 additions & 0 deletions packages/bedrock-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.12.3 (2025-01-23)

Full Changelog: [bedrock-sdk-v0.12.2...bedrock-sdk-v0.12.3](https://github.com/anthropics/anthropic-sdk-typescript/compare/bedrock-sdk-v0.12.2...bedrock-sdk-v0.12.3)

### Chores

* **bedrock:** bump dependency on @anthropic-ai/sdk ([8745ca2](https://github.com/anthropics/anthropic-sdk-typescript/commit/8745ca2160f5af4d89e5732a44e560c5e2787aa8))

## 0.12.2 (2025-01-21)

Full Changelog: [bedrock-sdk-v0.12.1...bedrock-sdk-v0.12.2](https://github.com/anthropics/anthropic-sdk-typescript/compare/bedrock-sdk-v0.12.1...bedrock-sdk-v0.12.2)
Expand Down
2 changes: 1 addition & 1 deletion packages/bedrock-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@anthropic-ai/bedrock-sdk",
"version": "0.12.2",
"version": "0.12.3",
"description": "The official TypeScript library for the Anthropic Bedrock API",
"author": "Anthropic <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const pkgJson = require('../dist/package.json');
for (const dep in pkgJson.dependencies) {
// ensure we point to NPM instead of a local directory
if (dep === '@anthropic-ai/sdk') {
pkgJson.dependencies[dep] = '^0';
pkgJson.dependencies[dep] = '>=0.35 <1';
}
}

fs.writeFileSync('dist/package.json', JSON.stringify(pkgJson, null, 2))
fs.writeFileSync('dist/package.json', JSON.stringify(pkgJson, null, 2));
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.35.0"
version "0.36.0"
# x-release-please-end-version
dependencies:
"@types/node" "^18.11.18"
Expand Down
8 changes: 8 additions & 0 deletions packages/vertex-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.6.4 (2025-01-23)

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

### Chores

* **vertex:** bump dependency on @anthropic-ai/sdk ([a1c7fcd](https://github.com/anthropics/anthropic-sdk-typescript/commit/a1c7fcdce081f860cbb1148c3862e3303ddb8a62))

## 0.6.3 (2025-01-21)

Full Changelog: [vertex-sdk-v0.6.2...vertex-sdk-v0.6.3](https://github.com/anthropics/anthropic-sdk-typescript/compare/vertex-sdk-v0.6.2...vertex-sdk-v0.6.3)
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.6.3",
"version": "0.6.4",
"description": "The official TypeScript library for the Anthropic Vertex API",
"author": "Anthropic <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const pkgJson = require('../dist/package.json');
for (const dep in pkgJson.dependencies) {
// ensure we point to NPM instead of a local directory
if (dep === '@anthropic-ai/sdk') {
pkgJson.dependencies[dep] = '>=0.14 <1';
pkgJson.dependencies[dep] = '>=0.35 <1';
}
}

fs.writeFileSync('dist/package.json', JSON.stringify(pkgJson, null, 2))
fs.writeFileSync('dist/package.json', JSON.stringify(pkgJson, null, 2));
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.35.0"
version "0.36.0"
# x-release-please-end-version
dependencies:
"@types/node" "^18.11.18"
Expand Down
26 changes: 26 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,19 @@ import {
import {
Base64PDFSource,
CacheControlEphemeral,
CitationCharLocation,
CitationCharLocationParam,
CitationContentBlockLocation,
CitationContentBlockLocationParam,
CitationPageLocation,
CitationPageLocationParam,
CitationsConfigParam,
CitationsDelta,
ContentBlock,
ContentBlockDeltaEvent,
ContentBlockParam,
ContentBlockSource,
ContentBlockSourceContent,
ContentBlockStartEvent,
ContentBlockStopEvent,
DocumentBlockParam,
Expand All @@ -57,6 +67,7 @@ import {
Messages,
Metadata,
Model,
PlainTextSource,
RawContentBlockDeltaEvent,
RawContentBlockStartEvent,
RawContentBlockStopEvent,
Expand All @@ -66,6 +77,8 @@ import {
RawMessageStreamEvent,
TextBlock,
TextBlockParam,
TextCitation,
TextCitationParam,
TextDelta,
Tool,
ToolChoice,
Expand Down Expand Up @@ -322,9 +335,19 @@ export declare namespace Anthropic {
Messages as Messages,
type Base64PDFSource as Base64PDFSource,
type CacheControlEphemeral as CacheControlEphemeral,
type CitationCharLocation as CitationCharLocation,
type CitationCharLocationParam as CitationCharLocationParam,
type CitationContentBlockLocation as CitationContentBlockLocation,
type CitationContentBlockLocationParam as CitationContentBlockLocationParam,
type CitationPageLocation as CitationPageLocation,
type CitationPageLocationParam as CitationPageLocationParam,
type CitationsConfigParam as CitationsConfigParam,
type CitationsDelta as CitationsDelta,
type ContentBlock as ContentBlock,
type ContentBlockDeltaEvent as ContentBlockDeltaEvent,
type ContentBlockParam as ContentBlockParam,
type ContentBlockSource as ContentBlockSource,
type ContentBlockSourceContent as ContentBlockSourceContent,
type ContentBlockStartEvent as ContentBlockStartEvent,
type ContentBlockStopEvent as ContentBlockStopEvent,
type DocumentBlockParam as DocumentBlockParam,
Expand All @@ -340,6 +363,7 @@ export declare namespace Anthropic {
type MessageTokensCount as MessageTokensCount,
type Metadata as Metadata,
type Model as Model,
type PlainTextSource as PlainTextSource,
type RawContentBlockDeltaEvent as RawContentBlockDeltaEvent,
type RawContentBlockStartEvent as RawContentBlockStartEvent,
type RawContentBlockStopEvent as RawContentBlockStopEvent,
Expand All @@ -349,6 +373,8 @@ export declare namespace Anthropic {
type RawMessageStreamEvent as RawMessageStreamEvent,
type TextBlock as TextBlock,
type TextBlockParam as TextBlockParam,
type TextCitation as TextCitation,
type TextCitationParam as TextCitationParam,
type TextDelta as TextDelta,
type Tool as Tool,
type ToolChoice as ToolChoice,
Expand Down
4 changes: 2 additions & 2 deletions src/internal/decoders/jsonl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AnthropicError } from '../../error';
import { readableStreamAsyncIterable } from '../../streaming';
import { ReadableStreamToAsyncIterable } from '../stream-utils';
import { type Response } from '../../_shims/index';
import { LineDecoder, type Bytes } from './line';

Expand Down Expand Up @@ -36,6 +36,6 @@ export class JSONLDecoder<T> {
throw new AnthropicError(`Attempted to iterate over a response with no body`);
}

return new JSONLDecoder(readableStreamAsyncIterable<Bytes>(response.body), controller);
return new JSONLDecoder(ReadableStreamToAsyncIterable<Bytes>(response.body), controller);
}
}
32 changes: 32 additions & 0 deletions src/internal/stream-utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Most browsers don't yet have async iterable support for ReadableStream,
* and Node has a very different way of reading bytes from its "ReadableStream".
*
* This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
*/
export function ReadableStreamToAsyncIterable<T>(stream: any): AsyncIterableIterator<T> {
if (stream[Symbol.asyncIterator]) return stream;

const reader = stream.getReader();
return {
async next() {
try {
const result = await reader.read();
if (result?.done) reader.releaseLock(); // release lock when stream becomes closed
return result;
} catch (e) {
reader.releaseLock(); // release lock when stream becomes errored
throw e;
}
},
async return() {
const cancelPromise = reader.cancel();
reader.releaseLock();
await cancelPromise;
return { done: true, value: undefined };
},
[Symbol.asyncIterator]() {
return this;
},
};
}
6 changes: 6 additions & 0 deletions src/lib/BetaMessageStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export class BetaMessageStream implements AsyncIterable<BetaMessageStreamEvent>
#errored = false;
#aborted = false;
#catchingPromiseCreated = false;
#response: Response | null | undefined;
#request_id: string | null | undefined;

constructor() {
Expand All @@ -76,6 +77,10 @@ export class BetaMessageStream implements AsyncIterable<BetaMessageStreamEvent>
this.#endPromise.catch(() => {});
}

get response(): Response | null | undefined {
return this.#response;
}

get request_id(): string | null | undefined {
return this.#request_id;
}
Expand Down Expand Up @@ -183,6 +188,7 @@ export class BetaMessageStream implements AsyncIterable<BetaMessageStreamEvent>

protected _connected(response: Response | null) {
if (this.ended) return;
this.#response = response;
this.#request_id = response?.headers.get('request-id');
this.#resolveConnectedPromise(response);
this._emit('connect');
Expand Down
6 changes: 6 additions & 0 deletions src/lib/MessageStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export class MessageStream implements AsyncIterable<MessageStreamEvent> {
#errored = false;
#aborted = false;
#catchingPromiseCreated = false;
#response: Response | null | undefined;
#request_id: string | null | undefined;

constructor() {
Expand All @@ -76,6 +77,10 @@ export class MessageStream implements AsyncIterable<MessageStreamEvent> {
this.#endPromise.catch(() => {});
}

get response(): Response | null | undefined {
return this.#response;
}

get request_id(): string | null | undefined {
return this.#request_id;
}
Expand Down Expand Up @@ -183,6 +188,7 @@ export class MessageStream implements AsyncIterable<MessageStreamEvent> {

protected _connected(response: Response | null) {
if (this.ended) return;
this.#response = response;
this.#request_id = response?.headers.get('request-id');
this.#resolveConnectedPromise(response);
this._emit('connect');
Expand Down
Loading
Loading