mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 21:29:13 +00:00
Improve data source, output mode selection
- Set output mode to single string. Specify output schema in prompt
- Both thesee should encourage model to select only 1 output mode
instead of encouraging it in prompt too many times
- Output schema should also improve schema following in general
- Standardize variable, func name of io selector for readability
- Fix chat actors to test the io selector chat actor
- Make chat actor return sources, output separately for better
disambiguation, at least during tests, for now
This commit is contained in:
@@ -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_tools_to_execute
|
||||
from khoj.routers.helpers import aget_data_sources_and_output_format
|
||||
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_tools_to_execute(user_query, {}, False, False)
|
||||
tools = await aget_data_sources_and_output_format(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_tools_to_execute(user_query, {}, False, False)
|
||||
tools = await aget_data_sources_and_output_format(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_tools_to_execute(user_query, {}, False, False)
|
||||
tools = await aget_data_sources_and_output_format(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_tools_to_execute(user_query, {}, False, False)
|
||||
tools = await aget_data_sources_and_output_format(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_tools_to_execute(user_query, chat_history, False, False)
|
||||
tools = await aget_data_sources_and_output_format(user_query, chat_history, False, False)
|
||||
|
||||
# Assert
|
||||
tools = [tool.value for tool in tools]
|
||||
|
||||
Reference in New Issue
Block a user