add tool calling
This commit is contained in:
+10
-10
@@ -143,7 +143,7 @@ def test_speak_with_custom_bot(
|
||||
|
||||
asyncio.run(main_module.speak(mock_ctx, message="alfred what time is it"))
|
||||
|
||||
mock_llama_wrapper.chat_completion_with_history.assert_called_once()
|
||||
mock_llama_wrapper.chat_completion_with_tools.assert_called_once()
|
||||
mock_tts_engine.generate_audio.assert_called_once()
|
||||
assert mock_ctx.send.call_count >= 3
|
||||
text_response = mock_ctx.send.call_args_list[1][0][0]
|
||||
@@ -387,7 +387,7 @@ def test_handle_chat_success(
|
||||
|
||||
import vibe_bot.main as main_module
|
||||
|
||||
mock_llama_wrapper.chat_completion_with_history.return_value = (
|
||||
mock_llama_wrapper.chat_completion_with_tools.return_value = (
|
||||
"This is a bot response"
|
||||
)
|
||||
|
||||
@@ -401,7 +401,7 @@ def test_handle_chat_success(
|
||||
),
|
||||
)
|
||||
|
||||
mock_llama_wrapper.chat_completion_with_history.assert_called_once()
|
||||
mock_llama_wrapper.chat_completion_with_tools.assert_called_once()
|
||||
mock_database.add_message.assert_called()
|
||||
assert mock_ctx.send.call_count >= 2
|
||||
|
||||
@@ -416,7 +416,7 @@ def test_handle_chat_error(
|
||||
|
||||
import vibe_bot.main as main_module
|
||||
|
||||
mock_llama_wrapper.chat_completion_with_history.side_effect = Exception("API error")
|
||||
mock_llama_wrapper.chat_completion_with_tools.side_effect = Exception("API error")
|
||||
|
||||
asyncio.run(
|
||||
main_module.handle_chat(
|
||||
@@ -443,7 +443,7 @@ def test_handle_chat_long_response_chunked(
|
||||
import vibe_bot.main as main_module
|
||||
|
||||
long_response = "x" * 2500
|
||||
mock_llama_wrapper.chat_completion_with_history.return_value = long_response
|
||||
mock_llama_wrapper.chat_completion_with_tools.return_value = long_response
|
||||
|
||||
asyncio.run(
|
||||
main_module.handle_chat(
|
||||
@@ -722,7 +722,7 @@ def test_handle_chat_includes_user_info(
|
||||
|
||||
import vibe_bot.main as main_module
|
||||
|
||||
mock_llama_wrapper.chat_completion_with_history.return_value = (
|
||||
mock_llama_wrapper.chat_completion_with_tools.return_value = (
|
||||
"This is a bot response"
|
||||
)
|
||||
|
||||
@@ -736,8 +736,8 @@ def test_handle_chat_includes_user_info(
|
||||
),
|
||||
)
|
||||
|
||||
mock_llama_wrapper.chat_completion_with_history.assert_called_once()
|
||||
call_kwargs = mock_llama_wrapper.chat_completion_with_history.call_args
|
||||
mock_llama_wrapper.chat_completion_with_tools.assert_called_once()
|
||||
call_kwargs = mock_llama_wrapper.chat_completion_with_tools.call_args
|
||||
system_prompt = call_kwargs.kwargs["system_prompt"]
|
||||
assert "you are a butler" in system_prompt
|
||||
assert "User Information:" in system_prompt
|
||||
@@ -769,8 +769,8 @@ def test_speak_with_bot_includes_user_info(
|
||||
|
||||
asyncio.run(main_module.speak(mock_ctx, message="alfred what time is it"))
|
||||
|
||||
mock_llama_wrapper.chat_completion_with_history.assert_called_once()
|
||||
call_kwargs = mock_llama_wrapper.chat_completion_with_history.call_args
|
||||
mock_llama_wrapper.chat_completion_with_tools.assert_called_once()
|
||||
call_kwargs = mock_llama_wrapper.chat_completion_with_tools.call_args
|
||||
system_prompt = call_kwargs.kwargs["system_prompt"]
|
||||
assert "british butler" in system_prompt
|
||||
assert "User Information:" in system_prompt
|
||||
|
||||
Reference in New Issue
Block a user