17
17
from vertexai .preview import reasoning_engines
18
18
19
19
20
- def create_reasoning_engine_basic (project_id : str ) -> reasoning_engines .ReasoningEngine :
20
+ def create_reasoning_engine_basic (
21
+ project_id : str , staging_bucket : str
22
+ ) -> reasoning_engines .ReasoningEngine :
21
23
22
24
# [START generativeaionvertexai_create_reasoning_engine_basic]
23
25
import vertexai
24
26
from vertexai .preview import reasoning_engines
25
27
26
28
# TODO(developer): Update and un-comment below lines
27
29
# project_id = "PROJECT_ID"
30
+ # staging_bucket = "gs://YOUR_BUCKET_NAME"
28
31
29
- vertexai .init (project = project_id , location = "us-central1" )
32
+ vertexai .init (
33
+ project = project_id , location = "us-central1" , staging_bucket = staging_bucket
34
+ )
30
35
31
36
class SimpleAdditionApp :
32
37
def query (self , a : int , b : int ):
@@ -60,7 +65,7 @@ def query(self, a: int, b: int):
60
65
61
66
62
67
def create_reasoning_engine_advanced (
63
- project_id : str , location : str
68
+ project_id : str , location : str , staging_bucket : str
64
69
) -> reasoning_engines .ReasoningEngine :
65
70
66
71
# [START generativeaionvertexai_create_reasoning_engine_advanced]
@@ -71,6 +76,9 @@ def create_reasoning_engine_advanced(
71
76
# TODO(developer): Update and un-comment below lines
72
77
# project_id = "PROJECT_ID"
73
78
# location = "us-central1"
79
+ # staging_bucket = "gs://YOUR_BUCKET_NAME"
80
+
81
+ vertexai .init (project = project_id , location = location , staging_bucket = staging_bucket )
74
82
75
83
class LangchainApp :
76
84
def __init__ (self , project : str , location : str ):
@@ -108,8 +116,6 @@ def query(self, question: str):
108
116
app .set_up ()
109
117
print (app .query ("What is Vertex AI?" ))
110
118
111
- vertexai .init (project = project_id , location = location )
112
-
113
119
# Create a remote app with reasoning engine
114
120
# This may take 1-2 minutes to finish because it builds a container and turn up HTTP servers.
115
121
reasoning_engine = reasoning_engines .ReasoningEngine .create (
0 commit comments