mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-24 04:31:02 +02:00
Tests are passing
This commit is contained in:
parent
7e7b9beba7
commit
8614efc79c
2 changed files with 12 additions and 4 deletions
|
|
@ -99,7 +99,15 @@ class TestLlamaFileProcessorSimple(IsolatedAsyncioTestCase):
|
||||||
messages=[{
|
messages=[{
|
||||||
"role": "user",
|
"role": "user",
|
||||||
"content": "System prompt\n\nUser prompt"
|
"content": "System prompt\n\nUser prompt"
|
||||||
}]
|
}],
|
||||||
|
temperature=0.0,
|
||||||
|
max_tokens=4096,
|
||||||
|
top_p=1,
|
||||||
|
frequency_penalty=0,
|
||||||
|
presence_penalty=0,
|
||||||
|
response_format={
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@patch('trustgraph.model.text_completion.llamafile.llm.OpenAI')
|
@patch('trustgraph.model.text_completion.llamafile.llm.OpenAI')
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ class TestOllamaProcessorSimple(IsolatedAsyncioTestCase):
|
||||||
assert result.in_token == 15
|
assert result.in_token == 15
|
||||||
assert result.out_token == 8
|
assert result.out_token == 8
|
||||||
assert result.model == 'llama2'
|
assert result.model == 'llama2'
|
||||||
mock_client.generate.assert_called_once_with('llama2', "System prompt\n\nUser prompt")
|
mock_client.generate.assert_called_once_with('llama2', "System prompt\n\nUser prompt", options={'temperature': 0.0})
|
||||||
|
|
||||||
@patch('trustgraph.model.text_completion.ollama.llm.Client')
|
@patch('trustgraph.model.text_completion.ollama.llm.Client')
|
||||||
@patch('trustgraph.base.async_processor.AsyncProcessor.__init__')
|
@patch('trustgraph.base.async_processor.AsyncProcessor.__init__')
|
||||||
|
|
@ -203,7 +203,7 @@ class TestOllamaProcessorSimple(IsolatedAsyncioTestCase):
|
||||||
assert result.model == 'llama2'
|
assert result.model == 'llama2'
|
||||||
|
|
||||||
# The prompt should be "" + "\n\n" + "" = "\n\n"
|
# The prompt should be "" + "\n\n" + "" = "\n\n"
|
||||||
mock_client.generate.assert_called_once_with('llama2', "\n\n")
|
mock_client.generate.assert_called_once_with('llama2', "\n\n", options={'temperature': 0.0})
|
||||||
|
|
||||||
@patch('trustgraph.model.text_completion.ollama.llm.Client')
|
@patch('trustgraph.model.text_completion.ollama.llm.Client')
|
||||||
@patch('trustgraph.base.async_processor.AsyncProcessor.__init__')
|
@patch('trustgraph.base.async_processor.AsyncProcessor.__init__')
|
||||||
|
|
@ -310,7 +310,7 @@ class TestOllamaProcessorSimple(IsolatedAsyncioTestCase):
|
||||||
assert result.out_token == 15
|
assert result.out_token == 15
|
||||||
|
|
||||||
# Verify the combined prompt
|
# Verify the combined prompt
|
||||||
mock_client.generate.assert_called_once_with('llama2', "You are a helpful assistant\n\nWhat is AI?")
|
mock_client.generate.assert_called_once_with('llama2', "You are a helpful assistant\n\nWhat is AI?", options={'temperature': 0.0})
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue