Update test framework: fix run_tests.py to support all test files, add auto-import-check for test files

This commit is contained in:
qiaoxinjiu
2026-05-09 15:11:30 +08:00
parent eb053a347f
commit eaba8328da
21739 changed files with 2236758 additions and 719 deletions

View File

@@ -0,0 +1,156 @@
import * as Core from '@anthropic-ai/sdk/core';
import { APIPromise } from '@anthropic-ai/sdk/core';
import { APIResource } from '@anthropic-ai/sdk/resource';
import * as CompletionsAPI from '@anthropic-ai/sdk/resources/completions';
import { Stream } from '@anthropic-ai/sdk/streaming';
export declare class Completions extends APIResource {
/**
* Create a completion
*/
create(body: CompletionCreateParamsNonStreaming, options?: Core.RequestOptions): APIPromise<Completion>;
create(body: CompletionCreateParamsStreaming, options?: Core.RequestOptions): APIPromise<Stream<Completion>>;
create(body: CompletionCreateParamsBase, options?: Core.RequestOptions): APIPromise<Stream<Completion> | Completion>;
}
export interface Completion {
/**
* The resulting completion up to and excluding the stop sequences.
*/
completion: string;
/**
* The model that performed the completion.
*/
model: string;
/**
* The reason that we stopped sampling.
*
* This may be one the following values:
*
* - `"stop_sequence"`: we reached a stop sequence — either provided by you via the
* `stop_sequences` parameter, or a stop sequence built into the model
* - `"max_tokens"`: we exceeded `max_tokens_to_sample` or the model's maximum
*/
stop_reason: string;
}
export type CompletionCreateParams = CompletionCreateParamsNonStreaming | CompletionCreateParamsStreaming;
export interface CompletionCreateParamsBase {
/**
* The maximum number of tokens to generate before stopping.
*
* Note that our models may stop _before_ reaching this maximum. This parameter
* only specifies the absolute maximum number of tokens to generate.
*/
max_tokens_to_sample: number;
/**
* The model that will complete your prompt.
*
* As we improve Claude, we develop new versions of it that you can query. This
* parameter controls which version of Claude answers your request. Right now we
* are offering two model families: Claude, and Claude Instant. You can use them by
* setting `model` to `"claude-2"` or `"claude-instant-1"`, respectively. See
* [models](https://docs.anthropic.com/claude/reference/selecting-a-model) for
* additional details.
*/
model: (string & {}) | 'claude-2' | 'claude-instant-1';
/**
* The prompt that you want Claude to complete.
*
* For proper response generation you will need to format your prompt as follows:
*
* ```javascript
* const userQuestion = r"Why is the sky blue?";
* const prompt = `\n\nHuman: ${userQuestion}\n\nAssistant:`;
* ```
*
* See our
* [comments on prompts](https://docs.anthropic.com/claude/docs/introduction-to-prompt-design)
* for more context.
*/
prompt: string;
/**
* An object describing metadata about the request.
*/
metadata?: CompletionCreateParams.Metadata;
/**
* Sequences that will cause the model to stop generating completion text.
*
* Our models stop on `"\n\nHuman:"`, and may include additional built-in stop
* sequences in the future. By providing the stop_sequences parameter, you may
* include additional strings that will cause the model to stop generating.
*/
stop_sequences?: Array<string>;
/**
* Whether to incrementally stream the response using server-sent events.
*
* See
* [this guide to SSE events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
* for details.
*/
stream?: boolean;
/**
* Amount of randomness injected into the response.
*
* Defaults to 1. Ranges from 0 to 1. Use temp closer to 0 for analytical /
* multiple choice, and closer to 1 for creative and generative tasks.
*/
temperature?: number;
/**
* Only sample from the top K options for each subsequent token.
*
* Used to remove "long tail" low probability responses.
* [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
*/
top_k?: number;
/**
* Use nucleus sampling.
*
* In nucleus sampling, we compute the cumulative distribution over all the options
* for each subsequent token in decreasing probability order and cut it off once it
* reaches a particular probability specified by `top_p`. You should either alter
* `temperature` or `top_p`, but not both.
*/
top_p?: number;
}
export declare namespace CompletionCreateParams {
/**
* An object describing metadata about the request.
*/
interface Metadata {
/**
* An external identifier for the user who is associated with the request.
*
* This should be a uuid, hash value, or other opaque identifier. Anthropic may use
* this id to help detect abuse. Do not include any identifying information such as
* name, email address, or phone number.
*/
user_id?: string;
}
type CompletionCreateParamsNonStreaming = CompletionsAPI.CompletionCreateParamsNonStreaming;
type CompletionCreateParamsStreaming = CompletionsAPI.CompletionCreateParamsStreaming;
}
export interface CompletionCreateParamsNonStreaming extends CompletionCreateParamsBase {
/**
* Whether to incrementally stream the response using server-sent events.
*
* See
* [this guide to SSE events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
* for details.
*/
stream?: false;
}
export interface CompletionCreateParamsStreaming extends CompletionCreateParamsBase {
/**
* Whether to incrementally stream the response using server-sent events.
*
* See
* [this guide to SSE events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
* for details.
*/
stream: true;
}
export declare namespace Completions {
export import Completion = CompletionsAPI.Completion;
export import CompletionCreateParams = CompletionsAPI.CompletionCreateParams;
export import CompletionCreateParamsNonStreaming = CompletionsAPI.CompletionCreateParamsNonStreaming;
export import CompletionCreateParamsStreaming = CompletionsAPI.CompletionCreateParamsStreaming;
}
//# sourceMappingURL=completions.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"completions.d.ts","sourceRoot":"","sources":["../src/resources/completions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,cAAc,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAErD,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,kCAAkC,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC;IACvG,MAAM,CACJ,IAAI,EAAE,+BAA+B,EACrC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACjC,MAAM,CACJ,IAAI,EAAE,0BAA0B,EAChC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;CAS/C;AAED,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,UA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QAAQ,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC;IACrD,MAAM,QAAQ,sBAAsB,GAAG,cAAc,CAAC,sBAAsB,CAAC;IAC7E,MAAM,QAAQ,kCAAkC,GAAG,cAAc,CAAC,kCAAkC,CAAC;IACrG,MAAM,QAAQ,+BAA+B,GAAG,cAAc,CAAC,+BAA+B,CAAC;CAChG"}

View File

@@ -0,0 +1,14 @@
"use strict";
// File generated from our OpenAPI spec by Stainless.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Completions = void 0;
const resource_1 = require("@anthropic-ai/sdk/resource");
class Completions extends resource_1.APIResource {
create(body, options) {
return this.post('/v1/complete', { body, timeout: 600000, ...options, stream: body.stream ?? false });
}
}
exports.Completions = Completions;
(function (Completions) {
})(Completions = exports.Completions || (exports.Completions = {}));
//# sourceMappingURL=completions.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"completions.js","sourceRoot":"","sources":["../src/resources/completions.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAIrD,yDAAyD;AAIzD,MAAa,WAAY,SAAQ,sBAAW;IAa1C,MAAM,CACJ,IAA4B,EAC5B,OAA6B;QAE7B,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,KAAK,EAAE,CAElE,CAAC;IACrC,CAAC;CACF;AArBD,kCAqBC;AA2JD,WAAiB,WAAW;AAK5B,CAAC,EALgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAK3B"}

View File

@@ -0,0 +1,10 @@
// File generated from our OpenAPI spec by Stainless.
import { APIResource } from '@anthropic-ai/sdk/resource';
export class Completions extends APIResource {
create(body, options) {
return this.post('/v1/complete', { body, timeout: 600000, ...options, stream: body.stream ?? false });
}
}
(function (Completions) {
})(Completions || (Completions = {}));
//# sourceMappingURL=completions.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"completions.mjs","sourceRoot":"","sources":["../src/resources/completions.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAI9C,EAAE,WAAW,EAAE,MAAM,4BAA4B;AAIxD,MAAM,OAAO,WAAY,SAAQ,WAAW;IAa1C,MAAM,CACJ,IAA4B,EAC5B,OAA6B;QAE7B,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,KAAK,EAAE,CAElE,CAAC;IACrC,CAAC;CACF;AA2JD,WAAiB,WAAW;AAK5B,CAAC,EALgB,WAAW,KAAX,WAAW,QAK3B"}

2
node_modules/@anthropic-ai/sdk/resources/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export { Completion, CompletionCreateParams, CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming, Completions, } from "./completions.js";
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EACV,sBAAsB,EACtB,kCAAkC,EAClC,+BAA+B,EAC/B,WAAW,GACZ,MAAM,eAAe,CAAC"}

7
node_modules/@anthropic-ai/sdk/resources/index.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
"use strict";
// File generated from our OpenAPI spec by Stainless.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Completions = void 0;
var completions_1 = require("./completions.js");
Object.defineProperty(exports, "Completions", { enumerable: true, get: function () { return completions_1.Completions; } });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAErD,gDAMuB;AADrB,0GAAA,WAAW,OAAA"}

3
node_modules/@anthropic-ai/sdk/resources/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,3 @@
// File generated from our OpenAPI spec by Stainless.
export { Completions, } from "./completions.mjs";
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAE9C,EAKL,WAAW,GACZ"}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=top-level.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"top-level.d.ts","sourceRoot":"","sources":["../src/resources/top-level.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC"}

View File

@@ -0,0 +1,4 @@
"use strict";
// File generated from our OpenAPI spec by Stainless.
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=top-level.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"top-level.js","sourceRoot":"","sources":["../src/resources/top-level.ts"],"names":[],"mappings":";AAAA,qDAAqD"}

View File

@@ -0,0 +1,3 @@
// File generated from our OpenAPI spec by Stainless.
export {};
//# sourceMappingURL=top-level.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"top-level.mjs","sourceRoot":"","sources":["../src/resources/top-level.ts"],"names":[],"mappings":"AAAA,qDAAqD"}