From e7bb67893c87a6c5b598e72a851d244ecac90be8 Mon Sep 17 00:00:00 2001 From: Matthieu Olenga Date: Mon, 16 Dec 2024 15:41:48 +0100 Subject: [PATCH 1/2] feat: add warning logging when getting info linked to deleted prompt lineage --- src/api.ts | 26 +++++++++++++++++++++++++- src/prompt-engineering/prompt.ts | 1 + 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/api.ts b/src/api.ts index 23bba68..aae4239 100644 --- a/src/api.ts +++ b/src/api.ts @@ -2027,6 +2027,7 @@ export class API { name: $name ) { id + deletedAt } }`; @@ -2038,6 +2039,12 @@ export class API { return null; } + if (result.data.promptLineage.deletedAt) { + console.warn( + `Prompt lineage "${name}" was deleted - please update any references to use an active prompt in production` + ); + } + return result.data.promptLineage; } @@ -2139,6 +2146,7 @@ export class API { version lineage { name + deletedAt } } } @@ -2165,6 +2173,12 @@ export class API { } const promptData = result.data.promptVersion; + if (promptData.lineage?.deletedAt) { + console.warn( + `Prompt lineage "${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; @@ -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 lineage "${prompt.lineage?.name}" was deleted - please update any references to use an active prompt in production` + ); + } + + return prompt; } /** diff --git a/src/prompt-engineering/prompt.ts b/src/prompt-engineering/prompt.ts index e21da43..8f8e77e 100644 --- a/src/prompt-engineering/prompt.ts +++ b/src/prompt-engineering/prompt.ts @@ -32,6 +32,7 @@ class PromptFields extends Utils { id!: string; type!: GenerationType; createdAt!: string; + deletedAt?: Maybe; name!: string; version!: number; url?: Maybe; From ad5b1e219df2ed6f51ed1382c5396fcae807bbbc Mon Sep 17 00:00:00 2001 From: Matthieu Olenga Date: Mon, 16 Dec 2024 16:19:43 +0100 Subject: [PATCH 2/2] feat: improve wording --- src/api.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api.ts b/src/api.ts index aae4239..40cfadb 100644 --- a/src/api.ts +++ b/src/api.ts @@ -2041,7 +2041,7 @@ export class API { if (result.data.promptLineage.deletedAt) { console.warn( - `Prompt lineage "${name}" was deleted - please update any references to use an active prompt in production` + `Prompt "${name}" was deleted - please update any references to use an active prompt in production` ); } @@ -2175,7 +2175,7 @@ export class API { const promptData = result.data.promptVersion; if (promptData.lineage?.deletedAt) { console.warn( - `Prompt lineage "${promptData.lineage?.name}" was deleted - please update any references to use an active prompt in production` + `Prompt "${promptData.lineage?.name}" was deleted - please update any references to use an active prompt in production` ); } @@ -2232,7 +2232,7 @@ export class API { if (prompt?.lineage?.deletedAt) { console.warn( - `Prompt lineage "${prompt.lineage?.name}" was deleted - please update any references to use an active prompt in production` + `Prompt "${prompt.lineage?.name}" was deleted - please update any references to use an active prompt in production` ); }