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
5c60f73b
Unverified
Commit
5c60f73b
authored
11 months ago
by
Siraj R Aizlewood
Browse files
Options
Downloads
Patches
Plain Diff
More PyTests.
parent
d756c869
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/llms/test_llm_base.py
+24
-1
24 additions, 1 deletion
tests/unit/llms/test_llm_base.py
with
24 additions
and
1 deletion
tests/unit/llms/test_llm_base.py
+
24
−
1
View file @
5c60f73b
...
@@ -4,7 +4,7 @@ from semantic_router.llms import BaseLLM
...
@@ -4,7 +4,7 @@ from semantic_router.llms import BaseLLM
class
TestBaseLLM
:
class
TestBaseLLM
:
@pytest.fixture
@pytest.fixture
def
base_llm
(
self
):
def
base_llm
(
self
):
return
BaseLLM
(
name
=
"
TestLLM
"
)
return
BaseLLM
(
name
=
"
TestLLM
"
)
...
@@ -16,6 +16,14 @@ class TestBaseLLM:
...
@@ -16,6 +16,14 @@ class TestBaseLLM:
"
description
"
:
"
A test function with mixed mandatory and optional parameters.
"
,
"
description
"
:
"
A test function with mixed mandatory and optional parameters.
"
,
"
signature
"
:
"
(mandatory1, mandatory2: int, optional1=None, optional2: str =
'
default
'
)
"
"
signature
"
:
"
(mandatory1, mandatory2: int, optional1=None, optional2: str =
'
default
'
)
"
}
}
@pytest.fixture
def
mandatory_params
(
self
):
return
[
"
param1
"
,
"
param2
"
]
@pytest.fixture
def
all_params
(
self
):
return
[
"
param1
"
,
"
param2
"
,
"
optional1
"
]
def
test_base_llm_initialization
(
self
,
base_llm
):
def
test_base_llm_initialization
(
self
,
base_llm
):
assert
base_llm
.
name
==
"
TestLLM
"
,
"
Initialization of name failed
"
assert
base_llm
.
name
==
"
TestLLM
"
,
"
Initialization of name failed
"
...
@@ -96,3 +104,18 @@ class TestBaseLLM:
...
@@ -96,3 +104,18 @@ class TestBaseLLM:
inputs
=
{
"
mandatory1
"
:
"
value1
"
,
"
mandatory2
"
:
42
,
"
optional1
"
:
"
opt1
"
,
"
optional2
"
:
"
opt2
"
,
"
extra
"
:
"
value
"
}
inputs
=
{
"
mandatory1
"
:
"
value1
"
,
"
mandatory2
"
:
42
,
"
optional1
"
:
"
opt1
"
,
"
optional2
"
:
"
opt2
"
,
"
extra
"
:
"
value
"
}
assert
base_llm
.
_is_valid_inputs
(
inputs
,
mixed_function_schema
)
==
False
assert
base_llm
.
_is_valid_inputs
(
inputs
,
mixed_function_schema
)
==
False
def
test_check_for_mandatory_inputs_all_present
(
self
,
base_llm
,
mandatory_params
):
inputs
=
{
"
param1
"
:
"
value1
"
,
"
param2
"
:
"
value2
"
}
assert
base_llm
.
_check_for_mandatory_inputs
(
inputs
,
mandatory_params
)
==
True
def
test_check_for_mandatory_inputs_missing_one
(
self
,
base_llm
,
mandatory_params
):
inputs
=
{
"
param1
"
:
"
value1
"
}
assert
base_llm
.
_check_for_mandatory_inputs
(
inputs
,
mandatory_params
)
==
False
def
test_check_for_extra_inputs_no_extras
(
self
,
base_llm
,
all_params
):
inputs
=
{
"
param1
"
:
"
value1
"
,
"
param2
"
:
"
value2
"
}
assert
base_llm
.
_check_for_extra_inputs
(
inputs
,
all_params
)
==
True
def
test_check_for_extra_inputs_with_extras
(
self
,
base_llm
,
all_params
):
inputs
=
{
"
param1
"
:
"
value1
"
,
"
param2
"
:
"
value2
"
,
"
extra_param
"
:
"
extra
"
}
assert
base_llm
.
_check_for_extra_inputs
(
inputs
,
all_params
)
==
False
\ No newline at end of file
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