Skip to content

Commit 4fe033e

Browse files
stainless-botrattrayalex
authored andcommitted
fix(client): eliminate circular imports, which cause runtime errors in webpack dev bundles (#170)
Also updates the README.
1 parent cada6ef commit 4fe033e

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
This library provides convenient access to the Anthropic REST API from server-side TypeScript or JavaScript.
66

7+
For the AWS Bedrock API, see [`@anthropic-ai/bedrock-sdk`](github.com/anthropics/anthropic-bedrock-typescript).
8+
79
## Migration from v0.4.x and below
810

911
In `v0.5.0`, we introduced a fully rewritten SDK. The new version offers better error handling, a more robust and intuitive streaming implementation, and more.

src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// File generated from our OpenAPI spec by Stainless.
22

33
import * as Core from './core';
4-
import * as API from './resources/index';
54
import * as Errors from './error';
65
import { type Agent } from './_shims/index';
76
import * as Uploads from './uploads';
7+
import * as API from '@anthropic-ai/sdk/resources/index';
88

99
export interface ClientOptions {
1010
/**
@@ -222,10 +222,10 @@ export namespace Anthropic {
222222
export import RequestOptions = Core.RequestOptions;
223223

224224
export import Completions = API.Completions;
225-
export import Completion = API.Completion;
226-
export import CompletionCreateParams = API.CompletionCreateParams;
227-
export import CompletionCreateParamsNonStreaming = API.CompletionCreateParamsNonStreaming;
228-
export import CompletionCreateParamsStreaming = API.CompletionCreateParamsStreaming;
225+
export type Completion = API.Completion;
226+
export type CompletionCreateParams = API.CompletionCreateParams;
227+
export type CompletionCreateParamsNonStreaming = API.CompletionCreateParamsNonStreaming;
228+
export type CompletionCreateParamsStreaming = API.CompletionCreateParamsStreaming;
229229
}
230230

231231
export default Anthropic;

src/resources/completions.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import * as Core from '@anthropic-ai/sdk/core';
44
import { APIPromise } from '@anthropic-ai/sdk/core';
55
import { APIResource } from '@anthropic-ai/sdk/resource';
6-
import * as API from './index';
6+
import * as CompletionsAPI from '@anthropic-ai/sdk/resources/completions';
77
import { Stream } from '@anthropic-ai/sdk/streaming';
88

99
export class Completions extends APIResource {
@@ -156,8 +156,8 @@ export namespace CompletionCreateParams {
156156
user_id?: string;
157157
}
158158

159-
export type CompletionCreateParamsNonStreaming = API.CompletionCreateParamsNonStreaming;
160-
export type CompletionCreateParamsStreaming = API.CompletionCreateParamsStreaming;
159+
export type CompletionCreateParamsNonStreaming = CompletionsAPI.CompletionCreateParamsNonStreaming;
160+
export type CompletionCreateParamsStreaming = CompletionsAPI.CompletionCreateParamsStreaming;
161161
}
162162

163163
export interface CompletionCreateParamsNonStreaming extends CompletionCreateParamsBase {
@@ -183,8 +183,8 @@ export interface CompletionCreateParamsStreaming extends CompletionCreateParamsB
183183
}
184184

185185
export namespace Completions {
186-
export import Completion = API.Completion;
187-
export import CompletionCreateParams = API.CompletionCreateParams;
188-
export import CompletionCreateParamsNonStreaming = API.CompletionCreateParamsNonStreaming;
189-
export import CompletionCreateParamsStreaming = API.CompletionCreateParamsStreaming;
186+
export type Completion = CompletionsAPI.Completion;
187+
export type CompletionCreateParams = CompletionsAPI.CompletionCreateParams;
188+
export type CompletionCreateParamsNonStreaming = CompletionsAPI.CompletionCreateParamsNonStreaming;
189+
export type CompletionCreateParamsStreaming = CompletionsAPI.CompletionCreateParamsStreaming;
190190
}

0 commit comments

Comments
 (0)