fix: VertexAI KeyError 'location' (#2983)

This commit is contained in:
Nicolò Boschi 2024-07-26 23:02:56 +02:00 committed by GitHub
commit bce072bb76
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View file

@ -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),
@ -53,7 +53,7 @@ class VertexAIEmbeddingsComponent(LCModelComponent):
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,
@ -62,6 +62,6 @@ class VertexAIEmbeddingsComponent(LCModelComponent):
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,
)

View file

@ -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"),
@ -60,11 +60,11 @@ class ChatVertexAIComponent(LCModelComponent):
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,
),