Skip to content

Tool Trace support + inference endpoint changed to v3/detect #16

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ export class Client extends Core.APIClient {
applicationName?: string;
modelName?: string;
mustCompute?: 'all_or_none' | 'ignore_failures';
toolTrace?: any[];
}): Promise<any>;

// Unified implementation for both call styles
Expand Down Expand Up @@ -249,6 +250,7 @@ export class Client extends Core.APIClient {
applicationName: arg1.applicationName,
modelName: arg1.modelName,
mustCompute: arg1.mustCompute ?? 'all_or_none',
toolTrace: arg1.toolTrace,
};
} else {
// Called using positional syntax (backward compatible)
Expand Down Expand Up @@ -279,7 +281,8 @@ export class Client extends Core.APIClient {
opts.publish,
opts.applicationName,
opts.modelName,
opts.mustCompute
opts.mustCompute,
opts.toolTrace
);
}

Expand Down
4 changes: 3 additions & 1 deletion src/resources/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export class Decorators extends APIResource {
publish?: boolean,
applicationName?: string,
modelName?: string,
mustCompute: 'all_or_none' | 'ignore_failures' = 'all_or_none'
mustCompute: 'all_or_none' | 'ignore_failures' = 'all_or_none',
toolTrace?: any[]
): Promise<any> {
try {
// Prepare the payload for detect API
Expand All @@ -35,6 +36,7 @@ export class Decorators extends APIResource {
...(publish ? { publish } : {}), // Only include publish if provided
...(applicationName ? { application_name: applicationName } : {}), // Only include application_name if provided
...(modelName ? { model_name: modelName } : {}), // Only include model_name if provided
...(toolTrace ? { tool_trace: toolTrace } : {}),
must_compute: mustCompute, // Always include must_compute with default value
};

Expand Down
7 changes: 6 additions & 1 deletion src/resources/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class Inference extends APIResource {
body: InferenceDetectParams,
options?: Core.RequestOptions,
): Core.APIPromise<InferenceDetectResponse> {
return this._client.post('/v2/detect', { body, ...options });
return this._client.post('/v3/detect', { body, ...options });
}
}

Expand Down Expand Up @@ -74,6 +74,11 @@ export namespace InferenceDetectParams {
* Indicates the computation strategy. Must be either 'all_or_none' or 'ignore_failures'.
*/
must_compute?: 'all_or_none' | 'ignore_failures';

/**
* Optional tool trace for analysis
*/
tool_trace?: any[];
}

export namespace Body {
Expand Down