Skip to content

Commit

Permalink
fix cron create for thread return type
Browse files Browse the repository at this point in the history
  • Loading branch information
bracesproul committed Jan 10, 2025
1 parent c624ff6 commit c302724
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
14 changes: 9 additions & 5 deletions libs/sdk-js/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
Item,
ThreadStatus,
CronCreateResponse,
CronCreateForThreadResponse,
} from "./schema.js";
import { AsyncCaller, AsyncCallerParams } from "./utils/async_caller.js";
import {
Expand Down Expand Up @@ -185,7 +186,7 @@ export class CronsClient extends BaseClient {
threadId: string,
assistantId: string,
payload?: CronsCreatePayload,
): Promise<CronCreateResponse> {
): Promise<CronCreateForThreadResponse> {
const json: Record<string, any> = {
schedule: payload?.schedule,
input: payload?.input,
Expand All @@ -198,10 +199,13 @@ export class CronsClient extends BaseClient {
multitask_strategy: payload?.multitaskStrategy,
if_not_exists: payload?.ifNotExists,
};
return this.fetch<CronCreateResponse>(`/threads/${threadId}/runs/crons`, {
method: "POST",
json,
});
return this.fetch<CronCreateForThreadResponse>(
`/threads/${threadId}/runs/crons`,
{
method: "POST",
json,
},
);
}

/**
Expand Down
5 changes: 5 additions & 0 deletions libs/sdk-js/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,3 +292,8 @@ export interface CronCreateResponse {
updated_at: string;
metadata: Metadata;
}

export interface CronCreateForThreadResponse
extends Omit<CronCreateResponse, "thread_id"> {
thread_id: string;
}

0 comments on commit c302724

Please sign in to comment.