From 2b09caa237f302065fbc0d6ff14638cfc5638f2d Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Sun, 3 Dec 2023 19:13:28 -0500 Subject: [PATCH] Make online results an optional argument to the gpt converse method --- src/khoj/processor/conversation/openai/gpt.py | 2 +- src/khoj/routers/helpers.py | 4 ++-- tests/test_openai_chat_director.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/khoj/processor/conversation/openai/gpt.py b/src/khoj/processor/conversation/openai/gpt.py index fed110f7..dc708ab7 100644 --- a/src/khoj/processor/conversation/openai/gpt.py +++ b/src/khoj/processor/conversation/openai/gpt.py @@ -123,8 +123,8 @@ def send_message_to_model( def converse( references, - online_results, user_query, + online_results=[], conversation_log={}, model: str = "gpt-3.5-turbo", api_key: Optional[str] = None, diff --git a/src/khoj/routers/helpers.py b/src/khoj/routers/helpers.py index 22b0d037..618f89ef 100644 --- a/src/khoj/routers/helpers.py +++ b/src/khoj/routers/helpers.py @@ -251,9 +251,9 @@ def generate_chat_response( chat_model = conversation_config.chat_model chat_response = converse( compiled_references, - online_results, q, - meta_log, + online_results=online_results, + conversation_log=meta_log, model=chat_model, api_key=api_key, completion_func=partial_completion, diff --git a/tests/test_openai_chat_director.py b/tests/test_openai_chat_director.py index 7b98d4da..50ad60af 100644 --- a/tests/test_openai_chat_director.py +++ b/tests/test_openai_chat_director.py @@ -68,10 +68,10 @@ def test_chat_with_online_content(chat_client): response_message = response_message.split("### compiled references")[0] # Assert - expected_responses = ["http://www.paulgraham.com/greatwork.html"] + expected_responses = ["http://www.paulgraham.com/greatwork.html", "Please set your SERPER_DEV_API_KEY"] assert response.status_code == 200 assert any([expected_response in response_message for expected_response in expected_responses]), ( - "Expected assistants name, [K|k]hoj, in response but got: " + response_message + "Expected links or serper not setup in response but got: " + response_message )