khoj/tests
Debanjum 3e17ab438a
Separate notes, online context from user message sent to chat models (#950)
Overview
---
- Put context into separate user message before sending to chat model.
  This should improve model response quality and truncation logic in code
- Pass online context from chat history to chat model for response.
  This should improve response speed when previous online context can be reused
- Improve format of notes, online context passed to chat models in prompt.
  This should improve model response quality

Details
---
The document, online search context are now passed as separate user
messages to chat model, instead of being added to the final user message.

This will improve
- Models ability to differentiate data from user query.
  That should improve response quality and reduce prompt injection
  probability
- Make truncation logic simpler and more robust
  When context window hit, can simply pop messages to auto truncate
  context in order of context, user, assistant message for each
  conversation turn in history until reach current user query

  The complex, brittle logic to extract user query from context in
  last user message isn't required.
2024-10-28 02:03:18 -07:00
..
data Support Indexing Images via OCR (#823) 2024-07-01 06:00:00 -07:00
__init__.py Move tests out to project root. Use absolute import in project 2021-09-30 04:12:14 -07:00
conftest.py Add unit tests for agents 2024-10-20 20:04:50 -07:00
helpers.py Create explicit flow to enable the free trial (#944) 2024-10-23 15:29:23 -07:00
test_agents.py Add unit tests for agents 2024-10-20 20:04:50 -07:00
test_cli.py Add isort to the pre-commit configuration and apply it to the whole project (#595) 2023-12-28 18:04:02 +05:30
test_client.py Update chat director, client tests to call chat API using new POST method 2024-09-11 17:28:06 -07:00
test_conversation_utils.py Default to gpt-4o-mini instead of gpt-3.5-turbo in tests, func args 2024-08-22 19:04:49 -07:00
test_date_filter.py Improve date filter regexes to extract structured, natural, partial dates 2024-03-30 00:07:19 +05:30
test_db_lock.py Update test_db_lock with new function name 2024-08-08 13:03:01 +05:30
test_docx_to_entries.py Upgrade RapidOCR and enable for Python 3.12. Fix PDF OCR test 2024-06-22 16:01:55 +05:30
test_file_filter.py Support exclusion file filters (#826) 2024-08-12 05:41:54 -07:00
test_helpers.py Part 2: Add web UI updates for basic agent interactions (#675) 2024-03-26 18:13:24 +05:30
test_image_to_entries.py Support Indexing Images via OCR (#823) 2024-07-01 06:00:00 -07:00
test_markdown_to_entries.py Add Ability to Summarize Documents (#800) 2024-06-18 19:31:07 +05:30
test_multiple_users.py Split /api/v1/index/update into /api/content PUT, PATCH API endpoints 2024-07-19 01:45:53 +05:30
test_offline_chat_actors.py Intelligently initialize a decent default set of chat model options 2024-09-19 20:32:08 -07:00
test_offline_chat_director.py Update chat director, client tests to call chat API using new POST method 2024-09-11 17:28:06 -07:00
test_openai_chat_actors.py Fix up openai chat actor tests 2024-10-22 03:09:36 -07:00
test_openai_chat_director.py Fix up openai chat actor tests 2024-10-22 03:09:36 -07:00
test_org_to_entries.py Split current section once by heading to resolve org-mode indexing bug 2024-07-06 19:35:59 +05:30
test_orgnode.py Add isort to the pre-commit configuration and apply it to the whole project (#595) 2023-12-28 18:04:02 +05:30
test_pdf_to_entries.py Fix PDFs unit test, skip OCR 2024-10-20 22:25:41 -07:00
test_plaintext_to_entries.py Add Ability to Summarize Documents (#800) 2024-06-18 19:31:07 +05:30
test_text_search.py Accept file deletion requests by clients during sync 2024-07-19 04:53:01 +05:30
test_word_filter.py Fix test word filter 2023-11-19 13:14:58 -08:00