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
3698b07f
Commit
3698b07f
authored
1 year ago
by
“Daniel Griffiths”
Browse files
Options
Downloads
Patches
Plain Diff
feat: added add route tfidf test
parent
138d540b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/unit/test_hybrid_layer.py
+13
-5
13 additions, 5 deletions
tests/unit/test_hybrid_layer.py
with
13 additions
and
5 deletions
tests/unit/test_hybrid_layer.py
+
13
−
5
View file @
3698b07f
...
...
@@ -30,11 +30,6 @@ def base_encoder(mocker):
return
mock_base_encoder
# @pytest.fixture
# def base_encoder():
# return BaseEncoder(name="test-encoder")
@pytest.fixture
def
cohere_encoder
(
mocker
):
mocker
.
patch
.
object
(
CohereEncoder
,
"
__call__
"
,
side_effect
=
mock_encoder_call
)
...
...
@@ -165,5 +160,18 @@ class TestHybridRouteLayer:
)
assert
route_layer
.
score_threshold
==
0.82
def
test_add_route_tfidf
(
self
,
cohere_encoder
,
tfidf_encoder
,
routes
):
hybrid_route_layer
=
HybridRouteLayer
(
dense_encoder
=
cohere_encoder
,
sparse_encoder
=
tfidf_encoder
,
routes
=
routes
[:
-
1
],
)
hybrid_route_layer
.
add
(
routes
[
-
1
])
all_utterances
=
[
utterance
for
route
in
routes
for
utterance
in
route
.
utterances
]
assert
hybrid_route_layer
.
sparse_index
is
not
None
assert
len
(
hybrid_route_layer
.
sparse_index
)
==
len
(
all_utterances
)
# Add more tests for edge cases and error handling as needed.
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