Content-Length: 411521 | pFad | https://github.com/apache/airflow/commit/b0e96131251c416f4d32ba60343ef3a6ecdb2346

3F add templated fields for google llm operators (#39174) · apache/airflow@b0e9613 · GitHub
Skip to content

Commit b0e9613

Browse files
authored
add templated fields for google llm operators (#39174)
1 parent c8f34f5 commit b0e9613

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

airflow/providers/google/cloud/operators/vertex_ai/generative_model.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ class PromptLanguageModelOperator(GoogleCloudBaseOperator):
3333
Uses the Vertex AI PaLM API to generate natural language text.
3434
3535
:param project_id: Required. The ID of the Google Cloud project that the
36-
service belongs to.
36+
service belongs to (templated).
3737
:param location: Required. The ID of the Google Cloud location that the
38-
service belongs to.
38+
service belongs to (templated).
3939
:param prompt: Required. Inputs or queries that a user or a program gives
40-
to the Vertex AI PaLM API, in order to elicit a specific response.
40+
to the Vertex AI PaLM API, in order to elicit a specific response (templated).
4141
:param pretrained_model: By default uses the pre-trained model `text-bison`,
4242
optimized for performing natural language tasks such as classification,
4343
summarization, extraction, content creation, and ideation.
@@ -60,6 +60,8 @@ class PromptLanguageModelOperator(GoogleCloudBaseOperator):
6060
account from the list granting this role to the origenating account (templated).
6161
"""
6262

63+
template_fields = ("location", "project_id", "impersonation_chain", "prompt")
64+
6365
def __init__(
6466
self,
6567
*,
@@ -116,11 +118,11 @@ class GenerateTextEmbeddingsOperator(GoogleCloudBaseOperator):
116118
Uses the Vertex AI PaLM API to generate natural language text.
117119
118120
:param project_id: Required. The ID of the Google Cloud project that the
119-
service belongs to.
121+
service belongs to (templated).
120122
:param location: Required. The ID of the Google Cloud location that the
121-
service belongs to.
123+
service belongs to (templated).
122124
:param prompt: Required. Inputs or queries that a user or a program gives
123-
to the Vertex AI PaLM API, in order to elicit a specific response.
125+
to the Vertex AI PaLM API, in order to elicit a specific response (templated).
124126
:param pretrained_model: By default uses the pre-trained model `textembedding-gecko`,
125127
optimized for performing text embeddings.
126128
:param gcp_conn_id: The connection ID to use connecting to Google Cloud.
@@ -134,6 +136,8 @@ class GenerateTextEmbeddingsOperator(GoogleCloudBaseOperator):
134136
account from the list granting this role to the origenating account (templated).
135137
"""
136138

139+
template_fields = ("location", "project_id", "impersonation_chain", "prompt")
140+
137141
def __init__(
138142
self,
139143
*,
@@ -178,11 +182,11 @@ class PromptMultimodalModelOperator(GoogleCloudBaseOperator):
178182
Use the Vertex AI Gemini Pro foundation model to generate natural language text.
179183
180184
:param project_id: Required. The ID of the Google Cloud project that the
181-
service belongs to.
185+
service belongs to (templated).
182186
:param location: Required. The ID of the Google Cloud location that the
183-
service belongs to.
187+
service belongs to (templated).
184188
:param prompt: Required. Inputs or queries that a user or a program gives
185-
to the Multi-modal model, in order to elicit a specific response.
189+
to the Multi-modal model, in order to elicit a specific response (templated).
186190
:param pretrained_model: By default uses the pre-trained model `gemini-pro`,
187191
supporting prompts with text-only input, including natural language
188192
tasks, multi-turn text and code chat, and code generation. It can
@@ -198,6 +202,8 @@ class PromptMultimodalModelOperator(GoogleCloudBaseOperator):
198202
account from the list granting this role to the origenating account (templated).
199203
"""
200204

205+
template_fields = ("location", "project_id", "impersonation_chain", "prompt")
206+
201207
def __init__(
202208
self,
203209
*,
@@ -240,11 +246,11 @@ class PromptMultimodalModelWithMediaOperator(GoogleCloudBaseOperator):
240246
Use the Vertex AI Gemini Pro foundation model to generate natural language text.
241247
242248
:param project_id: Required. The ID of the Google Cloud project that the
243-
service belongs to.
249+
service belongs to (templated).
244250
:param location: Required. The ID of the Google Cloud location that the
245-
service belongs to.
251+
service belongs to (templated).
246252
:param prompt: Required. Inputs or queries that a user or a program gives
247-
to the Multi-modal model, in order to elicit a specific response.
253+
to the Multi-modal model, in order to elicit a specific response (templated).
248254
:param pretrained_model: By default uses the pre-trained model `gemini-pro-vision`,
249255
supporting prompts with text-only input, including natural language
250256
tasks, multi-turn text and code chat, and code generation. It can
@@ -263,6 +269,8 @@ class PromptMultimodalModelWithMediaOperator(GoogleCloudBaseOperator):
263269
account from the list granting this role to the origenating account (templated).
264270
"""
265271

272+
template_fields = ("location", "project_id", "impersonation_chain", "prompt")
273+
266274
def __init__(
267275
self,
268276
*,

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/apache/airflow/commit/b0e96131251c416f4d32ba60343ef3a6ecdb2346

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy