Skip to content

Commit 5d966a8

Browse files
committed
clean: comment out un-used samples
1 parent 086f373 commit 5d966a8

File tree

2 files changed

+59
-59
lines changed

2 files changed

+59
-59
lines changed
Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
# Copyright 2024 Google LLC
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# https://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
import os
15-
16-
from vertexai.preview.prompts import Prompt
17-
18-
PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")
19-
20-
21-
def restore_prompt_version() -> Prompt:
22-
"""Restores specified version for specified prompt."""
23-
24-
# [START generativeaionvertexai_prompt_restore_version]
25-
import vertexai
26-
from vertexai.preview import prompts
27-
28-
# Initialize vertexai
29-
vertexai.init(project=PROJECT_ID, location="us-central1")
30-
31-
# Create local Prompt
32-
prompt = Prompt(
33-
prompt_name="zoologist",
34-
prompt_data="Which animal is the fastest on earth?",
35-
model_name="gemini-2.0-flash-001",
36-
system_instruction="You are a zoologist. Answer in a short sentence.",
37-
)
38-
# Save Prompt to online resource.
39-
prompt1 = prompts.create_version(prompt=prompt)
40-
prompt_id = prompt1.prompt_id
41-
42-
# Restore to prompt version id 1 (original)
43-
prompt_version_metadata = prompts.restore_version(prompt_id=prompt_id, version_id="1")
44-
45-
# Fetch the newly restored latest version of the prompt
46-
prompt1 = prompts.get(prompt_id=prompt_version_metadata.prompt_id)
47-
48-
# Example response:
49-
# Restored prompt version 1 under prompt id 12345678910 as version number 2
50-
# [END generativeaionvertexai_prompt_restore_version]
51-
return prompt1
52-
53-
54-
if __name__ == "__main__":
55-
restore_prompt_version()
1+
# # Copyright 2024 Google LLC
2+
# #
3+
# # Licensed under the Apache License, Version 2.0 (the "License");
4+
# # you may not use this file except in compliance with the License.
5+
# # You may obtain a copy of the License at
6+
# #
7+
# # https://www.apache.org/licenses/LICENSE-2.0
8+
# #
9+
# # Unless required by applicable law or agreed to in writing, software
10+
# # distributed under the License is distributed on an "AS IS" BASIS,
11+
# # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# # See the License for the specific language governing permissions and
13+
# # limitations under the License.
14+
# import os
15+
#
16+
# from vertexai.preview.prompts import Prompt
17+
#
18+
# PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")
19+
#
20+
#
21+
# def restore_prompt_version() -> Prompt:
22+
# """Restores specified version for specified prompt."""
23+
#
24+
# # [START generativeaionvertexai_prompt_restore_version]
25+
# import vertexai
26+
# from vertexai.preview import prompts
27+
#
28+
# # Initialize vertexai
29+
# vertexai.init(project=PROJECT_ID, location="us-central1")
30+
#
31+
# # Create local Prompt
32+
# prompt = Prompt(
33+
# prompt_name="zoologist",
34+
# prompt_data="Which animal is the fastest on earth?",
35+
# model_name="gemini-2.0-flash-001",
36+
# system_instruction="You are a zoologist. Answer in a short sentence.",
37+
# )
38+
# # Save Prompt to online resource.
39+
# prompt1 = prompts.create_version(prompt=prompt)
40+
# prompt_id = prompt1.prompt_id
41+
#
42+
# # Restore to prompt version id 1 (original)
43+
# prompt_version_metadata = prompts.restore_version(prompt_id=prompt_id, version_id="1")
44+
#
45+
# # Fetch the newly restored latest version of the prompt
46+
# prompt1 = prompts.get(prompt_id=prompt_version_metadata.prompt_id)
47+
#
48+
# # Example response:
49+
# # Restored prompt version 1 under prompt id 12345678910 as version number 2
50+
# # [END generativeaionvertexai_prompt_restore_version]
51+
# return prompt1
52+
#
53+
#
54+
# if __name__ == "__main__":
55+
# restore_prompt_version()

generative_ai/prompts/test_prompt_template.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import prompt_get
1818
import prompt_list_prompts
1919
import prompt_list_version
20-
import prompt_restore_version
20+
# import prompt_restore_version
2121
import prompt_template
2222

2323

@@ -51,6 +51,6 @@ def test_prompt_delete() -> None:
5151
assert delete_prompt is None
5252

5353

54-
def test_prompt_restore_version() -> None:
55-
prompt1 = prompt_restore_version.restore_prompt_version()
56-
assert prompt1
54+
# def test_prompt_restore_version() -> None:
55+
# prompt1 = prompt_restore_version.restore_prompt_version()
56+
# assert prompt1

0 commit comments

Comments
 (0)