Skip to content
Snippets Groups Projects
Unverified Commit b1261407 authored by James Briggs's avatar James Briggs
Browse files

added llamacpp tests

parent ea5141e0
No related branches found
No related tags found
No related merge requests found
......@@ -37,3 +37,23 @@ class TestBaseLLM:
test_inputs = {"timezone": None}
assert base_llm._is_valid_inputs(test_inputs, test_schema) is False
def test_base_llm_is_valid_inputs_invalid_false(self, base_llm):
test_schema = {
"name": "get_time",
"description": 'Finds the current time in a specific timezone.\n\n:param timezone: The timezone to find the current time in, should\n be a valid timezone from the IANA Time Zone Database like\n "America/New_York" or "Europe/London". Do NOT put the place\n name itself like "rome", or "new york", you must provide\n the IANA format.\n:type timezone: str\n:return: The current time in the specified timezone.'
}
test_inputs = {"timezone": "America/New_York"}
assert base_llm._is_valid_inputs(test_inputs, test_schema) is False
def test_base_llm_extract_function_inputs(self, base_llm):
with pytest.raises(NotImplementedError):
test_schema = {
"name": "get_time",
"description": 'Finds the current time in a specific timezone.\n\n:param timezone: The timezone to find the current time in, should\n be a valid timezone from the IANA Time Zone Database like\n "America/New_York" or "Europe/London". Do NOT put the place\n name itself like "rome", or "new york", you must provide\n the IANA format.\n:type timezone: str\n:return: The current time in the specified timezone.',
"signature": "(timezone: str) -> str",
"output": "<class 'str'>",
}
test_query = "What time is it in America/New_York?"
base_llm.extract_function_inputs(test_schema, test_query)
......@@ -27,3 +27,6 @@ class TestLlamaCppLLM:
llm_input = [Message(role="user", content="test")]
output = llamacpp_llm(llm_input)
assert output == "test"
def test_llamacpp_llm_grammar(self, llamacpp_llm):
llamacpp_llm._grammar()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment