khoj/tests
Debanjum b351cfb8a0
Add Search Actor to Improve Querying Notes for Khoj Chat
Merge pull request #189 from debanjum/add-search-actor-to-improve-notes-lookup-for-chat

### Introduce Search Actor
Search actor infers Search Queries from user's message
- Capabilities
  - Use previous messages to add context to current search queries[^1]
    This improves quality of responses in multi-turn conversations. 
  - Deconstruct users message into multiple search queries to lookup notes[^2]
  - Use relative date awareness to add date filters to search queries[^3]

- Chat Director now does the following:
  1. [*NEW*] Use Search Actor to generate search queries from user's message
  2. Retrieve relevant notes from Knowledge Base using the Search queries
  3. Pass retrieved relevant notes to Chat Actor to respond to user

### Add Chat Quality Tests 
- Test Search Actor capabilities
- Mark Chat Director Tests for Relative Date, Multiple Search Queries as Expected Pass

### Give More Search Results as Context to Chat Actor
- Loosen search results score threshold to work better for searches with date filters
- Pass more search results (up to 5 from 2) as context to Chat Actor to improve inference

[^1]: Multi-Turn Example
Q: "When did I go to Mars?"
Search: "When did I go to Mars?"
A: "You went to Mars in the future"
Q: "How was that experience?"
Search: "How my Mars experience?"
*This gives better context for the Chat actor to respond* 
[^2]: Deconstruct Example: 
Is Alpha older than Beta? => What is Alpha's age? & When was Beta born?

[^3]: Date Example: 
Convert user messages containing relative dates like last month, yesterday to date filters on specific dates like dt>="2023-03-01"
2023-03-18 18:02:12 -06:00
..
data Create test notes dataset for chat testing 2023-03-16 09:30:37 -06:00
__init__.py Move tests out to project root. Use absolute import in project 2021-09-30 04:12:14 -07:00
conftest.py Setup Pytest fixture for conversation processor to test chat API 2023-03-16 09:30:37 -06:00
test_beancount_to_jsonl.py Use Black to format Khoj server code and tests 2023-02-17 11:55:17 -06:00
test_chat_actors.py Add answers to context for Search Actor to generate relevant queries 2023-03-18 16:30:55 -06:00
test_chat_director.py Expect Chat Director can extract relative dates using new Search Actor 2023-03-18 16:30:55 -06:00
test_cli.py Read content plugin configs from Khoj config YAML 2023-02-23 23:57:32 -06:00
test_client.py Fix configuring search types & /config/types API when no plugin configured 2023-03-01 01:23:37 -06:00
test_date_filter.py Test usage of = in date filter queries 2023-03-16 14:52:59 -06:00
test_file_filter.py Use Black to format Khoj server code and tests 2023-02-17 11:55:17 -06:00
test_helpers.py Use Black to format Khoj server code and tests 2023-02-17 11:55:17 -06:00
test_image_search.py Use Black to format Khoj server code and tests 2023-02-17 11:55:17 -06:00
test_jsonl_to_jsonl.py Add processor to index entries from jsonl files for plugins 2023-02-24 02:54:12 -06:00
test_markdown_to_jsonl.py Use Black to format Khoj server code and tests 2023-02-17 11:55:17 -06:00
test_org_to_jsonl.py Index intro text before headings in org files 2023-03-01 12:11:33 -06:00
test_orgnode.py Index intro text before headings in org files 2023-03-01 12:11:33 -06:00
test_rawconfig.py Test error on missing fields in ContentConfig pulled from Khoj.yml 2023-03-02 15:35:39 -06:00
test_text_search.py Output date filter from cache log at debug level. Remove unused imports 2023-03-02 15:41:32 -06:00
test_word_filter.py Use Black to format Khoj server code and tests 2023-02-17 11:55:17 -06:00