From 157417dadacc1a199c24767ed2b1fc454ca785d1 Mon Sep 17 00:00:00 2001 From: Boundless Asura Date: Tue, 18 Jul 2023 17:13:15 +0530 Subject: [PATCH] added tests --- tests/unit_tests/llms/test_google_palm.py | 8 ++++++++ tests/unit_tests/llms/test_open_ai.py | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/tests/unit_tests/llms/test_google_palm.py b/tests/unit_tests/llms/test_google_palm.py index 6c0a9d964..e9848ac88 100644 --- a/tests/unit_tests/llms/test_google_palm.py +++ b/tests/unit_tests/llms/test_google_palm.py @@ -28,3 +28,11 @@ def test_chat_completion(mock_palm): top_p=palm_instance.top_p, max_output_tokens=int(max_tokens) ) + + +def test_verify_access_key(): + model = 'models/text-bison-001' + api_key = 'test_key' + palm_instance = GooglePalm(api_key, model=model) + result = palm_instance.verify_access_key() + assert result is False diff --git a/tests/unit_tests/llms/test_open_ai.py b/tests/unit_tests/llms/test_open_ai.py index 955581799..9882092f4 100644 --- a/tests/unit_tests/llms/test_open_ai.py +++ b/tests/unit_tests/llms/test_open_ai.py @@ -2,6 +2,7 @@ from unittest.mock import MagicMock, patch from superagi.llms.openai import OpenAi + @patch('superagi.llms.openai.openai') def test_chat_completion(mock_openai): # Arrange @@ -30,3 +31,11 @@ def test_chat_completion(mock_openai): frequency_penalty=openai_instance.frequency_penalty, presence_penalty=openai_instance.presence_penalty ) + + +def test_verify_access_key(): + model = 'gpt-4' + api_key = 'test_key' + openai_instance = OpenAi(api_key, model=model) + result = openai_instance.verify_access_key() + assert result is False