Start work on docker module
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
import unittest
|
||||
|
||||
from itertools import tee
|
||||
|
||||
from . import test_data
|
||||
from . import test_util
|
||||
|
||||
from sia.llm_engine import LlmEngine, InferenceResult
|
||||
from sia.llm_engine import LlmEngine
|
||||
|
||||
class LlmEngineTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.model_path = "/root/model"
|
||||
self.llm_engine = LlmEngine(self.model_path)
|
||||
|
||||
def test_initialization(self):
|
||||
llm_engine = LlmEngine(self.model_path)
|
||||
@@ -17,9 +18,9 @@ class LlmEngineTest(unittest.TestCase):
|
||||
def test_infer(self):
|
||||
main_context = "This is a test"
|
||||
llm_engine = LlmEngine(self.model_path)
|
||||
result = llm_engine.infer(test_data.echo_system_prompt, main_context, test_data.echo_action_schema)
|
||||
self.assertIsInstance(result, InferenceResult)
|
||||
self.assertIsInstance(result.reasoning, str)
|
||||
self.assertIsInstance(result.actions, str)
|
||||
self.assertEqual(result.reasoning, main_context)
|
||||
self.assertEqual(result.actions, f"<test_tag>{main_context}</test_tag>")
|
||||
tokens = llm_engine.infer(test_data.echo_system_prompt, main_context)
|
||||
print_tokens, result_tokens = tee(tokens)
|
||||
for token in print_tokens:
|
||||
print(token, end="", flush=True)
|
||||
result = ''.join(result_tokens)
|
||||
self.assertEqual(result, f"{main_context}<test_tag>{main_context}</test_tag>")
|
||||
Reference in New Issue
Block a user