from flask import Request, jsonify
import vertexai
from vertexai.preview import prompts
vertexai.init(project="vertex-cs", location="us-central1")
prompt_id = "8376007562385948672"
def hello_http(request: Request):
if request.method != "GET":
return "Method Not Allowed", 405
try:
prompt = prompts.get("8376007562385948672")
return f"Prompt fetched successfully:\n{str(prompt)}", 200
except Exception as e:
print("❌ Error:", e)
return jsonify({ "error": str(e) }), 500
Earlier I have checked also whether prompt id exists.
And received a list of prompts ids.
{
"prompts": [
{
"prompt_id": "8376007562385948672"
},
}
The error which Im receiving is:
{
"error": "value must not be empty"
}
it looks like prompt doesn't exist or its empty, but it exists and is not empty.
{
"error": {
"message": "Multi-turn prompts are not supported yet.",
"source": "get_prompt_by_id",
"traceback": [
" _populate_fields_from_metadata(prompt=prompt, metadata=metadata)",
" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^",
" File \"/layers/google.python.pip/pip/lib/python3.13/site-packages/vertexai/prompts/_prompt_management.py\", line 608, in _populate_fields_from_metadata",
" raise ValueError(\"Multi-turn prompts are not supported yet.\")",
"ValueError: Multi-turn prompts are not supported yet."
],
"type": "ValueError"
}
}
Is there any way to do prompt as singleturn?
Question answer thats all?