Unable to update an existing prompt in the vertex ai prompt library using python SDK. #6409
Unanswered
subbu4github
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using the following command to fetch the existing prompt from the library
existing_prompt = client.prompts.get(prompt_id="12356644445433333")
I am using the below command to update its content
existing_prompt.prompt_data = types.PromptData(
contents=[
genai_types.Content(
parts=[genai_types.Part(text=content)]
)
],
model=MODEL
)
After the above modification I verified that prompt id is intact by using the following command
print(f"After modification {existing_prompt.prompt_id}")
I used the following command to create the version for the prompt.
version = client.prompts.create_version(prompt=existing_prompt) #since prompt id is deprecated, I am not passing it.
Instead of updating the existing prompt, its creating a newer prompt with the updated content. How to fix this.
The following packages are utilized
import vertexai
from google.genai import types as genai_types
from vertexai import types
from vertexai.preview.prompts import Prompt
-- Subbu S.
Beta Was this translation helpful? Give feedback.
All reactions