Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Semantic Router
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
aurelio-labs
Semantic Router
Commits
6cd8f468
Commit
6cd8f468
authored
1 year ago
by
Stephen Witkowski
Browse files
Options
Downloads
Patches
Plain Diff
Refactor GoogleEncoder constructor parameter name
parent
043c0458
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
semantic_router/encoders/google.py
+5
-5
5 additions, 5 deletions
semantic_router/encoders/google.py
with
5 additions
and
5 deletions
semantic_router/encoders/google.py
+
5
−
5
View file @
6cd8f468
...
...
@@ -38,7 +38,7 @@ class GoogleEncoder(BaseEncoder):
def
__init__
(
self
,
model_
name
:
Optional
[
str
]
=
None
,
name
:
Optional
[
str
]
=
None
,
score_threshold
:
float
=
0.3
,
project_id
:
Optional
[
str
]
=
None
,
location
:
Optional
[
str
]
=
None
,
...
...
@@ -61,10 +61,10 @@ class GoogleEncoder(BaseEncoder):
Raises:
ValueError: If the Google Project ID is not provided or if the AI Platform client fails to initialize.
"""
if
model_
name
is
None
:
model_
name
=
EncoderDefault
.
GOOGLE
.
value
[
"
embedding_model
"
]
if
name
is
None
:
name
=
EncoderDefault
.
GOOGLE
.
value
[
"
embedding_model
"
]
super
().
__init__
(
model_name
=
model_
name
,
score_threshold
=
score_threshold
)
super
().
__init__
(
name
=
name
,
score_threshold
=
score_threshold
)
project_id
=
project_id
or
os
.
getenv
(
"
GOOGLE_PROJECT_ID
"
)
location
=
location
or
os
.
getenv
(
"
GOOGLE_LOCATION
"
,
"
us-central1
"
)
...
...
@@ -76,7 +76,7 @@ class GoogleEncoder(BaseEncoder):
aiplatform
.
init
(
project
=
project_id
,
location
=
location
,
api_endpoint
=
api_endpoint
)
self
.
client
=
TextEmbeddingModel
.
from_pretrained
(
self
.
model_
name
)
self
.
client
=
TextEmbeddingModel
.
from_pretrained
(
self
.
name
)
except
Exception
as
e
:
raise
ValueError
(
f
"
Google AI Platform client failed to initialize. Error:
{
e
}
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment