mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
When diagram generation fails, save to conversation log
- Update tool name when choosing tools to execute
This commit is contained in:
@@ -7,7 +7,7 @@ from freezegun import freeze_time
|
||||
from khoj.database.models import Agent, Entry, KhojUser
|
||||
from khoj.processor.conversation import prompts
|
||||
from khoj.processor.conversation.utils import message_to_log
|
||||
from khoj.routers.helpers import aget_relevant_information_sources
|
||||
from khoj.routers.helpers import aget_relevant_tools_to_execute
|
||||
from tests.helpers import ConversationFactory
|
||||
|
||||
SKIP_TESTS = True
|
||||
@@ -735,7 +735,7 @@ async def test_get_correct_tools_online(client_offline_chat):
|
||||
user_query = "What's the weather in Patagonia this week?"
|
||||
|
||||
# Act
|
||||
tools = await aget_relevant_information_sources(user_query, {}, is_task=False)
|
||||
tools = await aget_relevant_tools_to_execute(user_query, {}, is_task=False)
|
||||
|
||||
# Assert
|
||||
tools = [tool.value for tool in tools]
|
||||
@@ -750,7 +750,7 @@ async def test_get_correct_tools_notes(client_offline_chat):
|
||||
user_query = "Where did I go for my first battleship training?"
|
||||
|
||||
# Act
|
||||
tools = await aget_relevant_information_sources(user_query, {}, is_task=False)
|
||||
tools = await aget_relevant_tools_to_execute(user_query, {}, is_task=False)
|
||||
|
||||
# Assert
|
||||
tools = [tool.value for tool in tools]
|
||||
@@ -765,7 +765,7 @@ async def test_get_correct_tools_online_or_general_and_notes(client_offline_chat
|
||||
user_query = "What's the highest point in Patagonia and have I been there?"
|
||||
|
||||
# Act
|
||||
tools = await aget_relevant_information_sources(user_query, {}, is_task=False)
|
||||
tools = await aget_relevant_tools_to_execute(user_query, {}, is_task=False)
|
||||
|
||||
# Assert
|
||||
tools = [tool.value for tool in tools]
|
||||
@@ -782,7 +782,7 @@ async def test_get_correct_tools_general(client_offline_chat):
|
||||
user_query = "How many noble gases are there?"
|
||||
|
||||
# Act
|
||||
tools = await aget_relevant_information_sources(user_query, {}, is_task=False)
|
||||
tools = await aget_relevant_tools_to_execute(user_query, {}, is_task=False)
|
||||
|
||||
# Assert
|
||||
tools = [tool.value for tool in tools]
|
||||
@@ -806,7 +806,7 @@ async def test_get_correct_tools_with_chat_history(client_offline_chat, default_
|
||||
chat_history = create_conversation(chat_log, default_user2)
|
||||
|
||||
# Act
|
||||
tools = await aget_relevant_information_sources(user_query, chat_history, is_task=False)
|
||||
tools = await aget_relevant_tools_to_execute(user_query, chat_history, is_task=False)
|
||||
|
||||
# Assert
|
||||
tools = [tool.value for tool in tools]
|
||||
|
||||
@@ -8,7 +8,7 @@ from freezegun import freeze_time
|
||||
from khoj.processor.conversation.openai.gpt import converse, extract_questions
|
||||
from khoj.processor.conversation.utils import message_to_log
|
||||
from khoj.routers.helpers import (
|
||||
aget_relevant_information_sources,
|
||||
aget_relevant_tools_to_execute,
|
||||
generate_online_subqueries,
|
||||
infer_webpage_urls,
|
||||
schedule_query,
|
||||
@@ -538,7 +538,7 @@ async def test_select_data_sources_actor_chooses_to_search_notes(
|
||||
chat_client, user_query, expected_conversation_commands
|
||||
):
|
||||
# Act
|
||||
conversation_commands = await aget_relevant_information_sources(user_query, {}, False, False)
|
||||
conversation_commands = await aget_relevant_tools_to_execute(user_query, {}, False, False)
|
||||
|
||||
# Assert
|
||||
assert set(expected_conversation_commands) == set(conversation_commands)
|
||||
|
||||
@@ -8,7 +8,7 @@ from freezegun import freeze_time
|
||||
from khoj.database.models import Agent, Entry, KhojUser, LocalPdfConfig
|
||||
from khoj.processor.conversation import prompts
|
||||
from khoj.processor.conversation.utils import message_to_log
|
||||
from khoj.routers.helpers import aget_relevant_information_sources
|
||||
from khoj.routers.helpers import aget_relevant_tools_to_execute
|
||||
from tests.helpers import ConversationFactory
|
||||
|
||||
# Initialize variables for tests
|
||||
@@ -719,7 +719,7 @@ async def test_get_correct_tools_online(chat_client):
|
||||
user_query = "What's the weather in Patagonia this week?"
|
||||
|
||||
# Act
|
||||
tools = await aget_relevant_information_sources(user_query, {}, False, False)
|
||||
tools = await aget_relevant_tools_to_execute(user_query, {}, False, False)
|
||||
|
||||
# Assert
|
||||
tools = [tool.value for tool in tools]
|
||||
@@ -734,7 +734,7 @@ async def test_get_correct_tools_notes(chat_client):
|
||||
user_query = "Where did I go for my first battleship training?"
|
||||
|
||||
# Act
|
||||
tools = await aget_relevant_information_sources(user_query, {}, False, False)
|
||||
tools = await aget_relevant_tools_to_execute(user_query, {}, False, False)
|
||||
|
||||
# Assert
|
||||
tools = [tool.value for tool in tools]
|
||||
@@ -749,7 +749,7 @@ async def test_get_correct_tools_online_or_general_and_notes(chat_client):
|
||||
user_query = "What's the highest point in Patagonia and have I been there?"
|
||||
|
||||
# Act
|
||||
tools = await aget_relevant_information_sources(user_query, {}, False, False)
|
||||
tools = await aget_relevant_tools_to_execute(user_query, {}, False, False)
|
||||
|
||||
# Assert
|
||||
tools = [tool.value for tool in tools]
|
||||
@@ -766,7 +766,7 @@ async def test_get_correct_tools_general(chat_client):
|
||||
user_query = "How many noble gases are there?"
|
||||
|
||||
# Act
|
||||
tools = await aget_relevant_information_sources(user_query, {}, False, False)
|
||||
tools = await aget_relevant_tools_to_execute(user_query, {}, False, False)
|
||||
|
||||
# Assert
|
||||
tools = [tool.value for tool in tools]
|
||||
@@ -790,7 +790,7 @@ async def test_get_correct_tools_with_chat_history(chat_client):
|
||||
chat_history = generate_history(chat_log)
|
||||
|
||||
# Act
|
||||
tools = await aget_relevant_information_sources(user_query, chat_history, False, False)
|
||||
tools = await aget_relevant_tools_to_execute(user_query, chat_history, False, False)
|
||||
|
||||
# Assert
|
||||
tools = [tool.value for tool in tools]
|
||||
|
||||
Reference in New Issue
Block a user