diff --git a/js/src/client.ts b/js/src/client.ts index 36ded0d6..aabcccb0 100644 --- a/js/src/client.ts +++ b/js/src/client.ts @@ -3417,12 +3417,14 @@ export class Client { ): Promise { // Create or update prompt metadata if (await this.promptExists(promptIdentifier)) { - await this.updatePrompt(promptIdentifier, { - description: options?.description, - readme: options?.readme, - tags: options?.tags, - isPublic: options?.isPublic, - }); + if (options && Object.keys(options).some((key) => key !== "object")) { + await this.updatePrompt(promptIdentifier, { + description: options?.description, + readme: options?.readme, + tags: options?.tags, + isPublic: options?.isPublic, + }); + } } else { await this.createPrompt(promptIdentifier, { description: options?.description, diff --git a/js/src/tests/client.int.test.ts b/js/src/tests/client.int.test.ts index b7c0e531..9fabd681 100644 --- a/js/src/tests/client.int.test.ts +++ b/js/src/tests/client.int.test.ts @@ -997,6 +997,13 @@ test("Test push and pull prompt", async () => { ], { templateFormat: "mustache" } ); + const template2 = ChatPromptTemplate.fromMessages( + [ + new SystemMessage({ content: "System message" }), + new HumanMessage({ content: "My question is: {{question}}" }), + ], + { templateFormat: "mustache" } + ); await client.pushPrompt(promptName, { object: template, @@ -1005,6 +1012,11 @@ test("Test push and pull prompt", async () => { tags: ["test", "tag"], }); + // test you can push an updated manifest + await client.pushPrompt(promptName, { + object: template2, + }); + const pulledPrompt = await client._pullPrompt(promptName); expect(pulledPrompt).toBeDefined();