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
c70d0861
Unverified
Commit
c70d0861
authored
1 year ago
by
James Briggs
Browse files
Options
Downloads
Patches
Plain Diff
update tests to use score_threshold
parent
e80eaa40
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
tests/unit/test_layer.py
+5
-5
5 additions, 5 deletions
tests/unit/test_layer.py
with
5 additions
and
5 deletions
tests/unit/test_layer.py
+
5
−
5
View file @
c70d0861
...
@@ -45,16 +45,16 @@ def decisions():
...
@@ -45,16 +45,16 @@ def decisions():
class
TestDecisionLayer
:
class
TestDecisionLayer
:
def
test_initialization
(
self
,
openai_encoder
,
decisions
):
def
test_initialization
(
self
,
openai_encoder
,
decisions
):
decision_layer
=
DecisionLayer
(
encoder
=
openai_encoder
,
decisions
=
decisions
)
decision_layer
=
DecisionLayer
(
encoder
=
openai_encoder
,
decisions
=
decisions
)
assert
decision_layer
.
s
imilarity
_threshold
==
0.82
assert
decision_layer
.
s
core
_threshold
==
0.82
assert
len
(
decision_layer
.
index
)
==
5
assert
len
(
decision_layer
.
index
)
==
5
assert
len
(
set
(
decision_layer
.
categories
))
==
2
assert
len
(
set
(
decision_layer
.
categories
))
==
2
def
test_initialization_different_encoders
(
self
,
cohere_encoder
,
openai_encoder
):
def
test_initialization_different_encoders
(
self
,
cohere_encoder
,
openai_encoder
):
decision_layer_cohere
=
DecisionLayer
(
encoder
=
cohere_encoder
)
decision_layer_cohere
=
DecisionLayer
(
encoder
=
cohere_encoder
)
assert
decision_layer_cohere
.
s
imilarity
_threshold
==
0.3
assert
decision_layer_cohere
.
s
core
_threshold
==
0.3
decision_layer_openai
=
DecisionLayer
(
encoder
=
openai_encoder
)
decision_layer_openai
=
DecisionLayer
(
encoder
=
openai_encoder
)
assert
decision_layer_openai
.
s
imilarity
_threshold
==
0.82
assert
decision_layer_openai
.
s
core
_threshold
==
0.82
def
test_add_decision
(
self
,
openai_encoder
):
def
test_add_decision
(
self
,
openai_encoder
):
decision_layer
=
DecisionLayer
(
encoder
=
openai_encoder
)
decision_layer
=
DecisionLayer
(
encoder
=
openai_encoder
)
...
@@ -107,9 +107,9 @@ class TestDecisionLayer:
...
@@ -107,9 +107,9 @@ class TestDecisionLayer:
assert
not
decision_layer
.
_pass_threshold
([],
0.5
)
assert
not
decision_layer
.
_pass_threshold
([],
0.5
)
assert
decision_layer
.
_pass_threshold
([
0.6
,
0.7
],
0.5
)
assert
decision_layer
.
_pass_threshold
([
0.6
,
0.7
],
0.5
)
def
test_failover_s
imilarity
_threshold
(
self
,
base_encoder
):
def
test_failover_s
core
_threshold
(
self
,
base_encoder
):
decision_layer
=
DecisionLayer
(
encoder
=
base_encoder
)
decision_layer
=
DecisionLayer
(
encoder
=
base_encoder
)
assert
decision_layer
.
s
imilarity
_threshold
==
0.82
assert
decision_layer
.
s
core
_threshold
==
0.82
# Add more tests for edge cases and error handling as needed.
# 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