Skip to content
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

feat: add warning when getting deleted prompt lineage #90

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
26 changes: 25 additions & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2027,6 +2027,7 @@ export class API {
name: $name
) {
id
deletedAt
}
}`;

Expand All @@ -2038,6 +2039,12 @@ export class API {
return null;
}

if (result.data.promptLineage.deletedAt) {
console.warn(
`Prompt "${name}" was deleted - please update any references to use an active prompt in production`
);
}

return result.data.promptLineage;
}

Expand Down Expand Up @@ -2139,6 +2146,7 @@ export class API {
version
lineage {
name
deletedAt
}
}
}
Expand All @@ -2165,6 +2173,12 @@ export class API {
}

const promptData = result.data.promptVersion;
if (promptData.lineage?.deletedAt) {
console.warn(
`Prompt "${promptData.lineage?.name}" was deleted - please update any references to use an active prompt in production`
);
}

promptData.provider = promptData.settings?.provider;
promptData.name = promptData.lineage?.name;
delete promptData.lineage;
Expand Down Expand Up @@ -2208,11 +2222,21 @@ export class API {
url
lineage {
name
deletedAt
}
}
}
`;
return await this.getPromptWithQuery(query, { name, version });

const prompt = await this.getPromptWithQuery(query, { name, version });

if (prompt?.lineage?.deletedAt) {
console.warn(
`Prompt "${prompt.lineage?.name}" was deleted - please update any references to use an active prompt in production`
);
}

return prompt;
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/prompt-engineering/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class PromptFields extends Utils {
id!: string;
type!: GenerationType;
createdAt!: string;
deletedAt?: Maybe<string>;
name!: string;
version!: number;
url?: Maybe<string>;
Expand Down
Loading