[chore] add runid test

laurel/helm
Laurel 2 years ago
parent c5f00b9f73
commit 073f8117c8

@ -160,7 +160,7 @@ setup(
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Topic :: Foundation Models :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
],
# $ setup.py publish support.
cmdclass={

@ -91,6 +91,31 @@ def test_run(sqlite_cache, session_cache, n, return_response):
else:
assert res == ["hello", "hello"]
prompt = Prompt("This is a prompt")
result = manifest.run(prompt, run_id="34", return_response=return_response)
if return_response:
assert isinstance(result, Response)
res = result.get_response(manifest.stop_token)
else:
res = result
assert (
manifest.cache.get_key(
request_to_key(
{
"prompt": "This is a prompt",
"client_name": "dummy",
"num_results": n,
"run_id": "34",
}
)
)
is not None
)
if n == 1:
assert res == "hello"
else:
assert res == ["hello", "hello"]
prompt = Prompt(lambda x: f"{x} is a prompt")
result = manifest.run(prompt, "Hello", return_response=return_response)
if return_response:

Loading…
Cancel
Save