Commit Graph

4443 Commits

Author SHA1 Message Date
Debanjum
50f71be03d Support Claude 3.7 and use its extended thinking in research mode
Claude 3.7 Sonnet is Anthropic's first reasoning model. It provides a
single model/api capable of standard and extended thinking. Utilize
the extended thinking in Khoj's research mode.

Increase default max output tokens to 8K for Anthropic models.
2025-03-11 21:27:59 +05:30
Debanjum
69048a859f Fix E2B tool description prompt to mention plotly package available 2025-03-11 02:20:06 +05:30
Debanjum
9751adb1a2 Improve Code Tool, Sandbox and Eval (#1120)
# Improve Code Tool, Sandbox
  - Improve code gen chat actor to output code in inline md code blocks
  - Stop code sandbox on request timeout to allow sandbox process restarts
  - Use tenacity retry decorator to retry executing code in sandbox
  - Add retry logic to code execution and add health check to sandbox container
  - Add E2B as an optional code sandbox provider

# Improve Gemini Chat Models
  - Default to non-zero temperature for all queries to Gemini models
  - Default to Gemini 2.0 flash instead of 1.5 flash on setup
  - Set default chat model to KHOJ_CHAT_MODEL env var if set
2025-03-09 18:49:59 +05:30
Debanjum
c133d11556 Improvements based on code feedback 2025-03-09 18:23:30 +05:30
Debanjum
94ca458639 Set default chat model to KHOJ_CHAT_MODEL env var if set
Simplify code log to set default_use_model during init for readability
2025-03-09 18:23:30 +05:30
Debanjum
7b2d0fdddc Improve code gen chat actor to output code in inline md code blocks
Simplify code gen chat actor to improve correct code gen success,
especially for smaller models & models with limited json mode support

Allow specify code blocks inline with reasoning to try improve
code quality

Infer input files based on user file paths referenced in code.
2025-03-09 18:23:30 +05:30
Debanjum
8305fddb14 Default to non-zero temperature for all queries to Gemini models.
It may mitigate the intermittent invalid json output issues. Model
maybe going into repetition loops, non-zero temp may avoid that.
2025-03-09 18:23:30 +05:30
Debanjum
45fb85f1df Add E2B as an optional code sandbox provider
- Specify E2B api key and template to use via env variables
- Try load, use e2b library when E2B api key set
- Fallback to try use terrarium sandbox otherwise
- Enable more python packages in e2b sandbox like rdkit via custom e2b template

- Use Async E2B Sandbox
- Parallelize file IO with sandbox
- Add documentation on how to enable E2B as code sandbox instead of Terrarium
2025-03-09 18:23:30 +05:30
Debanjum
b4183c7333 Default to gemini 2.0 flash instead of 1.5 flash on Gemini setup
Add price of gemini 2.0 flash for cost calculations
2025-03-07 13:48:15 +05:30
Debanjum
701a7be291 Stop code sandbox on request timeout to allow sandbox process restarts 2025-03-07 13:48:15 +05:30
Debanjum
ecc2f79571 Use tenacity retry decorator to retry executing code in sandbox 2025-03-07 13:48:15 +05:30
sabaimran
4a28714a08 Add retry logic to code execution and add health check to sandbox container 2025-03-07 13:48:15 +05:30
Debanjum
f13bdc5135 Log eval run progress percentage for orientation 2025-03-07 13:48:15 +05:30
Debanjum
bbe1b63361 Improve Obsidian Sync for Large Vaults (#1078)
- Batch sync files by size to try not exceed API request payload size limits
- Fix force sync of large vaults from Obsidian
- Add API endpoint to delete all indexed files by file type
- Fix to also delete file objects when call DELETE content source API
2025-03-07 13:47:21 +05:30
Debanjum
043de068ff Fix force sync of large vaults from Obsidian
Previously if you tried to force sync a vault with more than 1000
files it would only end up keeping the last batch because the PUT API
call would delete all previous entries.

This change calls DELETE for all previously indexed data first, followed by
a PATCH to index current vault on a force sync (regenerate) request.
This ensures that files from previous batches are not deleted.
2025-03-07 13:34:48 +05:30
Debanjum
86fa528a73 Add API endpoint to delete all indexed files by file type 2025-03-07 13:28:53 +05:30
Debanjum
b692e690b4 Rename and fix the delete content source API endpoint
- Delete file objects on deleting content by source via API
  Previously only entries were deleted, not the associated file objects
- Add new db adapter to delete multiple file objects (by name)
2025-03-07 13:28:53 +05:30
Debanjum
29403551b2 Batch sync files by size to not exceed API request payload size limits
This may help mitigate the issue #970
2025-03-04 09:31:48 +05:30
Debanjum
0ddb6a38b8 Update Khoj docs to mark LMStudio as not supported anymore
They seem to have deprecated json mode in their openai compatible API
which Khoj uses extensively.
2025-02-18 21:33:03 +05:30
sabaimran
de550e5ca7 re-enable markdown formatting when chatting with o3 2025-02-18 21:12:03 +05:30
sabaimran
0016fe06c9 Release Khoj version 1.36.6 2025-02-18 18:54:13 +05:30
sabaimran
7089ea1cf4 Remove experimental parenthesis from research mode ✁ 2025-02-18 08:59:12 +05:30
Debanjum
5a3c7b145a Decouple Django CSRF, ALLOWED_HOST settings for more complex setups
- Set KHOJ_ALLOWED_DOMAIN to the domain that Khoj is accessible on
  from the host machine. This can be the internal i.p or domain of the
  host machine.

  It can be used by your load balancer/reverse_proxy to access Khoj.
  For example, if the load balancer service is in the khoj docker
  network, KHOJ_DOMAIN will be `server' (i.e service name).

- Set KHOJ_DOMAIN to your externally accessible DOMAIN or I.P to avoid
  CSRF trusted origin or unset cookie issue when trying to access the
  khoj admin panel.

Resolves #1114
2025-02-17 15:47:35 +05:30
Debanjum
bb0828b887 Only show notes tool option to llm for selection when user has documents 2025-02-17 15:23:26 +05:30
Debanjum
5dfb59e1ee Show more references in teaser ref section of chat response on web app 2025-02-15 14:11:17 +05:30
sabaimran
b6e745336b Add s short description to explain what the create agent button does 2025-02-13 14:08:50 -08:00
sabaimran
848a91313d Move the create agent button to the bottom of the sidebar and fix experience when resetting settings 2025-02-12 19:24:02 -08:00
sabaimran
d0d30ace06 Add feature to create a custom agent directly from the side panel with currently configured settings
- Also, when in not subscribed state, fallback to the default model when chatting with an agent
- With conversion, create a brand new agent from inside the chat view that can be managed separately
2025-02-12 18:24:41 -08:00
sabaimran
5d6eca4c22 Fix automation retrieval validity check 2025-02-11 19:17:37 -08:00
sabaimran
51952364ab Release Khoj version 1.36.5 2025-02-11 13:23:30 -08:00
sabaimran
0211151570 Disable auto-setup of offline models if in non-interactive offline mode 2025-02-10 18:48:00 -08:00
sabaimran
589b047d90 Simplify agent picker selection in homepage mobile view 2025-02-10 15:05:30 -08:00
sabaimran
427ec061b4 Add auto redirect on delete of current conversation 2025-02-09 11:38:44 -08:00
sabaimran
bbb5fd667a update messaging in the welcome email 2025-02-07 15:10:59 -08:00
sabaimran
ff6cb80c84 Release Khoj version 1.36.4 2025-02-06 16:50:50 -08:00
sabaimran
031bccb628 Fix awkward padding in chat window 2025-02-06 16:31:25 -08:00
sabaimran
43e032e25a Improve handling of dark mode theme in order to avoid jitter when loading new page 2025-02-06 16:17:58 -08:00
sabaimran
2e01a95cf1 improve system prompt for generating mermaid.js diagrams 2025-02-06 15:05:30 -08:00
sabaimran
a2af6bea8e Release Khoj version 1.36.3 2025-02-04 13:23:41 -08:00
sabaimran
0d10c5fb02 Improve default selection of models to avoid infinite loops 2025-02-04 11:36:41 -08:00
sabaimran
24b1dd3bff Release Khoj version 1.36.2 2025-02-03 20:22:49 -08:00
sabaimran
4409a58794 set initial model of default state 2025-02-03 18:17:21 -08:00
sabaimran
51874c25d5 Prevent infinite loops in model selection logic by configuring an initial model state 2025-02-03 18:11:01 -08:00
sabaimran
489fa71143 Update the width for rending all conversation sessions 2025-02-03 15:49:43 -08:00
sabaimran
b354a37dcd Release Khoj version 1.36.1 2025-02-02 21:55:59 -08:00
sabaimran
61e48d686e Let file context buttons route to search page instead of settings for upload/manage 2025-02-02 12:26:13 -08:00
sabaimran
b4c467cd11 Remove shadows from reference panel trigger icons 2025-02-02 12:23:19 -08:00
sabaimran
a3d75e5241 When in mobile view, don't use the hover card in the model selector 2025-02-02 12:22:45 -08:00
sabaimran
4f79abb429 Release Khoj version 1.36.0 2025-02-02 08:39:21 -08:00
sabaimran
60e6913494 Merge pull request #1094 from khoj-ai/features/add-chat-controls
Make it easier to determine which model you're chatting with, and to effortlessly update said model from within a given chat. 

In this change, we introduce a side bar that allows users to quickly change their chat model, tools, custom instructions, and file filters, directly within the chat view. This removes the need for setting up custom agents for simple instructions and mitigates the requirement to go to the settings page to verify the chat model in action.

The settings page will still configure a per-user *default*, but the sidebar will allow for greater customization based on the needs of a conversation.

We also extend the chat model to include more attributes that help users make decisions about model selection, including `strengths` and `description`. This can help people quickly understand which model might work best for their use case.
2025-02-01 14:35:47 -08:00