Commit Graph

5127 Commits

Author SHA1 Message Date
Debanjum
b607a6187e Release Khoj version 2.0.0-beta.23 2025-12-29 01:42:25 -08:00
Boris Smus
f413ce7354 Enable excluding folders to sync from obsidian plugin settings (#1235)
- Add excludeFolders field to KhojSetting interface
- Rename 'Sync Folders' to 'Include Folders' for clarity
- Add 'Exclude Folders' UI section with folder picker
- Filter out excluded folders during content sync
- Show file counts when syncing (X of Y files)
- Prevent excluding root folder

This allows users to exclude specific directories (e.g., Inbox,
Highlights) from being indexed, while the existing Include Folders acts
as a whitelist.

---------

Co-authored-by: Debanjum <debanjum@gmail.com>
2025-12-29 15:09:19 +05:30
Debanjum
9b9cdc756f Capture more files generated by code execution in sandbox
This change had been removed in 9a8c707 to avoid overwrites. We now
use random filename for generated files to avoid overwrite from
subsequent runs.

Encourage model to write code that writes files in home folder to
capture with logical filenames.
2025-12-29 00:57:17 -08:00
Debanjum
c5650f166a Make Nano Banana Pro output 2K resolution images 2025-12-29 00:57:17 -08:00
Debanjum
1b7ccd141d Harden the user check of the Notion integration 2025-12-29 00:57:17 -08:00
Debanjum
b8eeefa0b1 Bump web app package dependencies 2025-12-29 00:57:17 -08:00
Debanjum
9801ffd2de Add Khoj app landing page. Show it when unauthenticated users open app
Add khoj app landing page to khoj monorepo. Show in a more natural
place, when non logged in users open the khoj app home page.

Authenticated users still see logged in home page experience.
2025-12-29 00:57:17 -08:00
Debanjum
5e65754a8b Unify login via popup on home. No need for separate login html page.
Delete old login html page. Login via popup on home is the single,
unified login experience.

Have docs mention khoj home url, no need to mention /login as login
popup shows on home page too
2025-12-29 00:57:17 -08:00
Debanjum
f65f6ae848 Fix streaming thoughts from multi-turn tools after parallel tool calling
Single turn tools are still executed in parallel. Multi turn tools
like operator are executed in serial.
2025-12-29 00:57:17 -08:00
Debanjum
446a23524c Remove trial subscriptions from Khoj cloud 2025-12-16 16:23:47 -08:00
Debanjum
cdcbdf8459 Execute tool calls in parallel to make research iterations faster 2025-12-13 22:55:54 -08:00
Debanjum
054ed79fdf Allow LLMs to make parallel tool call requests
Why
--
- The models are now smart enough to usually understand which tools to
  call in parallel and when.

- The LLM can request more work for each call to it, which is usually
  the slowest step. This speeds up work by reearch agent. Even though
  each tool is still executed in sequence (for now).
2025-12-13 21:37:49 -08:00
Debanjum
f4c519a9d0 Release Khoj version 2.0.0-beta.22 2025-12-07 20:32:28 -08:00
Debanjum
6480e99266 Upgrade server, documentation dependencies 2025-12-07 20:29:11 -08:00
Debanjum
181332dcb8 Improve Claude context caching to improve response cost, intelligence
Old thought messages are dropped by default by the Anthropic API. This
change ensures old thoughts are kept. This should improve cache
utilization to reduce costs. And keeping old thoughts may also improve
model intelligence.
2025-12-07 20:23:58 -08:00
Debanjum
9c03af2735 Disable parallel tool call by anthropic models as unsupported
Khoj doesn't handle parallel tool calling right now. Models were told
to call tools in serial but it wasn't enforced via the Anthropic API.
So if model did try make parallel tool call, next response would fail
as it expects a tool result for the other tool calls. But khoj just
returned the first tool calls results. This mostly affected haiku due
to its lower fine-grained instruction following capabilities.

This changes enforces serial tool calls at the API layer to avoid this
issue altogether for claude models.
2025-12-07 20:23:58 -08:00
Debanjum
4654ac4962 Enable reasoning for Claude Haiku 4.5. Track costs of Opus 4.5 2025-12-07 20:23:58 -08:00
Debanjum
f1337c3b07 Handle unset event in chat response stream
Testing unset event field is an edge case that would unnecessarily
prematurely terminate stream. Ignoring it stabilizes response stream
completion.
2025-12-07 20:23:58 -08:00
Debanjum
bdf9afa726 Set openai api output tokens high by default to not hit length limits
Explicitly set completion tokens high to avoid early termination
issues, especially when trying to generate structured responses.
2025-12-07 20:23:58 -08:00
Debanjum
5b6dab1627 Use consistent summarizer result for failed research iteration 2025-12-05 10:02:08 -08:00
Debanjum
3941159bd6 Release Khoj version 2.0.0-beta.21 2025-11-29 17:31:14 -08:00
Debanjum
e2340c709f Fix extracting image by URL in chat history when using Nano Banana Pro
Logical error due to else conditional being not correctly indented.
This would result in error in using gemini 3 pro image when images are
in S3 bucket.
2025-11-29 17:08:17 -08:00
Debanjum
856864147b Drop image generation support for Stability AI models
Reduces maintenance burden by dropping support for old ai model
providers
2025-11-29 17:08:11 -08:00
Debanjum
c41e37d734 Release Khoj version 2.0.0-beta.20 2025-11-29 16:12:38 -08:00
Debanjum
731700ac43 Support fallback deep, fast chat models via server chat settings
Overview
---
This change enables specifying fallback chat models for each task
type (fast, deep, default) and user type (free, paid).

Previously we did not fallback to other chat models if the chat model
assigned for a task failed.

Details
---
You can now specify multiple ServerChatSettings via the Admin Panel
with their usage priority. If the highest priority chat model for the
task, user type fails, the task is assigned to a lower priority chat
model configured for the current user and task type.

This change also reduces the retry attempts for openai chat actor
models from 3 to 2 as:
- multiple fallback server chat settings can now be created. So
  reducing retries with same model reduces latency.
- 2 attempts is inline with retry attempts with other model
  types (gemini, anthropic)
2025-11-29 15:57:35 -08:00
Debanjum
99f16df7e2 Use fast model in default mode and for most chat actors
What
--
- Default to using fast model for most chat actors. Specifically in this
  change we default to using fast model for doc, web search chat actors
- Only research chat director uses the deep chat model.
- Make using fast model by chat actors configurable via func argument

Code chat actor continues to use deep chat model and webpage reader
continues to use fast chat model.

Deep, fast chat models can be configured via ServerChatSettings on the
admin panel.

Why
--
Modern models are good enough at instruction following. So defaulting
most chat actor to use the fast model should improve chat speed with
acceptable response quality.

The option to fallback to research mode for higher quality
responses or deeper research always exists.
2025-11-29 15:57:35 -08:00
Debanjum
da493be417 Support image generation with Gemini Nano Banana 2025-11-29 15:57:35 -08:00
Debanjum
dd4381c25c Do not try render invalid image paths in message on web app
Avoids rendering flicker from attempt to render invalid image paths
referenced in message by khoj on web app.

The rendering flicker made it very annoying to interact with
conversations containing such messages on the web app.

The current change does lightweight validation of image url before
attempting to render it. If invalid image url detected, the image is
replaced with just its alt text.
2025-11-29 15:23:51 -08:00
Debanjum
51b893d51d Fix to ensure rectangular generated images are not cropped on web app
Previously non-square images would get cropped when being displayed on
web app
2025-11-29 15:23:51 -08:00
Debanjum
32966646e2 Avoid ai hover summaries in vscode dev env for now 2025-11-29 15:23:51 -08:00
Debanjum
043777c1bd Release Khoj version 2.0.0-beta.19 2025-11-18 15:30:50 -08:00
Debanjum
47a55c20a0 Associate folder icon with all doc tools use in thinking UX on web app
The newer grep_files and list_files should also be associated with
document search in train of thought visualization on the web app.
2025-11-18 15:17:38 -08:00
Debanjum
6459150870 Upgrade packages for documentation and desktop app 2025-11-18 15:17:38 -08:00
Debanjum
03dad1348a Support Minimax M2. Extract its thinking from response
- Use qwen style <think> tags to extract Minimax M2 model thoughts
- Use function to mark models that use in-stream thinking (including
  Kimi K2 thinking)
2025-11-18 14:13:28 -08:00
Debanjum
57d6ebb1b8 Support Google Gemini 3
- Use thinking level for gemini 3 models instead of thinking budget.
- Bump google gemini library
- Add default context, pricing
2025-11-18 14:13:24 -08:00
Debanjum
a30c5f245d Skip non-serializable, binary content parts when token counting 2025-11-18 12:42:18 -08:00
Debanjum
ec31df7154 Test khoj.el with more recent emacs versions 2025-11-18 10:29:02 -08:00
Debanjum
895af42039 Fix unbound response var exception in agent safety checker 2025-11-18 10:29:02 -08:00
Debanjum
748a4f9941 Release Khoj version 2.0.0-beta.18 2025-11-16 11:08:44 -08:00
Debanjum
3496189618 Support using MCP tools in research mode
- Server admin can add MCP servers via the admin panel
- Enabled MCP server tools are exposed to the research agent for use
- Use MCP library to standardize interactions with mcp servers
  - Support SSE or Stdio as transport to interact with mcp servers
  - Reuse session established to MCP servers across research iterations
2025-11-16 10:50:30 -08:00
Debanjum
2ac7359092 Simplify webpage read function names and drop unused return args 2025-11-16 10:50:30 -08:00
Debanjum
f1a34f0c2a Prefer Exa for web search over Google, Firecrawl
Google and Firecrawl do not provide good web search descriptions (within
given latency requirements). Exa does better than them.

So prioritize using Exa over Google or Firecrawl when multiple web
search providers available.
2025-11-16 10:50:30 -08:00
Debanjum
45f4253120 Move Olostep scraping config into its webpage reader for cleaner code 2025-11-16 10:50:30 -08:00
Debanjum
e6a5d3dc3d Deprecate support for using Firecrawl webpage summarizer
Better speed and control by using Khoj webpage summarizer. Reduce code
cruft by clearing unused features.
2025-11-16 10:50:30 -08:00
Debanjum
0415b31a23 Upgrade Firecrawl web provider to use their v2 api 2025-11-16 10:50:30 -08:00
Debanjum
61cb2d5b7e Enable webpage reading with Exa. Remove Jina web page reader
Support using Exa for webpage reading. It seems much faster than
currently available providers.

Remove Jina as a webpage reader and remaining references to Jina from
code, docs. It was anyway slow and API may shut down soon (as it was
bought by Elastic).

Update docs to mention Exa for web search and webpage reading.
2025-11-16 10:50:30 -08:00
Debanjum
d57c597245 Refactor count_tokens, get_encoder methods to utils/helper.py
Simplify get_encoder to not rely on global state. The caching
simplification is not necessary for now.
2025-11-16 10:50:30 -08:00
Debanjum
15482c54b5 Fix type of count total tokens system_message argument 2025-11-16 10:50:30 -08:00
Debanjum
761af5f98c Drop spurious results close xml tag in research shared with llm 2025-11-16 10:50:30 -08:00
Debanjum
1f3c1e1221 Remove spurious comments in desktop app chatutils.js 2025-11-16 10:50:30 -08:00