Skip to content

Commit

Permalink
fix: VertexAI KeyError 'location' (langflow-ai#2983)
Browse files Browse the repository at this point in the history
(cherry picked from commit bce072b)
  • Loading branch information
nicoloboschi committed Jul 30, 2024
1 parent 4ef9ee4 commit 4e14665
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class VertexAIEmbeddingsComponent(LCModelComponent):
value="",
file_types=["json"],
),
MessageTextInput(name="location", display_name="Location", advanced=True),
MessageTextInput(name="location", display_name="Location", value="us-central1", advanced=True),
MessageTextInput(name="project", display_name="Project", info="The project ID.", advanced=True),
IntInput(name="max_output_tokens", display_name="Max Output Tokens", advanced=True),
IntInput(name="max_retries", display_name="Max Retries", value=1, advanced=True),
Expand Down Expand Up @@ -53,7 +53,7 @@ def build_embeddings(self) -> Embeddings:
return VertexAIEmbeddings(
credentials=gcloud_credentials,
location=self.location,
max_output_tokens=self.max_output_tokens,
max_output_tokens=self.max_output_tokens or None,
max_retries=self.max_retries,
model_name=self.model_name,
n=self.n,
Expand All @@ -62,6 +62,6 @@ def build_embeddings(self) -> Embeddings:
stop=self.stop_sequences or None,
streaming=self.streaming,
temperature=self.temperature,
top_k=self.top_k,
top_k=self.top_k or None,
top_p=self.top_p,
)
6 changes: 3 additions & 3 deletions src/backend/base/langflow/components/models/VertexAiModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ChatVertexAIComponent(LCModelComponent):
),
MessageTextInput(name="model_name", display_name="Model Name", value="gemini-1.5-pro"),
StrInput(name="project", display_name="Project", info="The project ID.", advanced=True),
StrInput(name="location", display_name="Location", advanced=True),
StrInput(name="location", display_name="Location", value="us-central1", advanced=True),
IntInput(name="max_output_tokens", display_name="Max Output Tokens", advanced=True),
IntInput(name="max_retries", display_name="Max Retries", value=1, advanced=True),
FloatInput(name="temperature", value=0.0, display_name="Temperature"),
Expand Down Expand Up @@ -60,11 +60,11 @@ def build_model(self) -> LanguageModel:
credentials=credentials,
location=location,
project=project,
max_output_tokens=self.max_output_tokens,
max_output_tokens=self.max_output_tokens or None,
max_retries=self.max_retries,
model_name=self.model_name,
temperature=self.temperature,
top_k=self.top_k,
top_k=self.top_k or None,
top_p=self.top_p,
verbose=self.verbose,
),
Expand Down

0 comments on commit 4e14665

Please sign in to comment.