- Previously Khoj could only support Python upto 3.10 due to pytorch. But lots of folks had python 3.11 installed by default on their machines. This required installing python 3.10 and dealing with virtual envs. With Torch >= 2.0.1 now able to support python 3.11, at least one class of installation troubles for Khoj should drop. See https://github.com/pytorch/pytorch/issues/86566 for reference - Preliminary testing indicates using the new torch 2.x may reduce search time by 25% (from 80ms to 60ms on Mac M1) - Update Docs to not require mentioning python <=3.10 required - Update Github test workflow to run khoj tests with python 3.11 too
7.9 KiB
https://github.com/khoj-ai/khoj/actions/workflows/build_khoj_el.yml/badge.svg? https://github.com/khoj-ai/khoj/actions/workflows/test_khoj_el.yml/badge.svg?
An AI personal assistant for your digital brain
Table of Contents
Features
-
Search
- Natural: Advanced natural language understanding using Transformer based ML Models
- Local: Your personal data stays local. All search, indexing is done on your machine*
- Incremental: Incremental search for a fast, search-as-you-type experience
-
Chat
- Faster answers: Find answers faster than search
- Iterative discovery: Iteratively explore and (re-)discover your notes
- Assisted creativity: Smoothly weave across answer retrieval and content generation
Setup
- Make sure python and pip are installed on your machine
- khoj.el attempts to automatically install, start and configure the khoj server. If this fails, follow these instructions to manually setup the khoj server.
Direct Install
M-x package-install khoj
Minimal Install
Add below snippet to your Emacs config file. Indexes your org-agenda files, by default.
;; Install Khoj Package from MELPA Stable
(use-package khoj
:ensure t
:pin melpa-stable
:bind ("C-c s" . 'khoj)
-
Note: Install
khoj.elfrom MELPA (instead of MELPA Stable) if you installed the pre-release version of khoj- That is, use
:pin melpato install khoj.el in above snippet if khoj server was installed with--preflag, i.epip install --pre khoj-assistant - Else use
:pin melpa-stableto install khoj.el in above snippet if khoj was installed withpip install khoj-assistant - This ensures both khoj.el and khoj app are from the same version (git tagged or latest)
- That is, use
Standard Install
Add below snippet to your Emacs config file. Indexes the specified org files, directories. Sets up OpenAI API key for Khoj Chat
;; Install Khoj Package from MELPA Stable
(use-package khoj
:ensure t
:pin melpa-stable
:bind ("C-c s" . 'khoj)
:config (setq khoj-org-directories '("~/docs/org-roam" "~/docs/notes")
khoj-org-files '("~/docs/todo.org" "~/docs/work.org")
khoj-openai-api-key "YOUR_OPENAI_API_KEY")) ; required to enable chat
With Straight.el
Add below snippet to your Emacs config file. Indexes the specified org files, directories. Sets up OpenAI API key for Khoj Chat
;; Install Khoj Package using Straight.el
(use-package khoj
:after org
:straight (khoj :type git :host github :repo "khoj-ai/khoj" :files (:defaults "src/interface/emacs/khoj.el"))
:bind ("C-c s" . 'khoj)
:config (setq khoj-org-directories '("~/docs/org-roam" "~/docs/notes")
khoj-org-files '("~/docs/todo.org" "~/docs/work.org")
khoj-openai-api-key "YOUR_OPENAI_API_KEY" ; required to enable chat)
Use
Search
- Hit
C-c s s(orM-x khoj RET s) to open khoj search - Enter your query in natural language e.g "What is the meaning of life?", "My life goals for 2023"
Chat
- Hit
C-c s c(orM-x khoj RET c) to open khoj chat - Ask questions in a natural, conversational style E.g "When did I file my taxes last year?"
See Khoj Chat for more details
Find Similar Entries
This feature finds entries similar to the one you are currently on.
- Move cursor to the org-mode entry, markdown section or text paragraph you want to find similar entries for
- Hit
C-c s f(orM-x khoj RET f) to find similar entries
Advanced Usage
- Add query filters during search to narrow down results further e.g `What is the meaning of life? -"god" +"none" dt>"last week"`
-
Use
C-c C-o 2to open the current result at cursor in its source org file- This calls
M-x org-open-at-pointon the current entry and opens the second link in the entry. - The second link is the entries org-id, if set, or the heading text. The first link is the line number of the entry in the source file. This link is less robust to file changes.
- Note: If you have speed keys enabled,
o 2will also work
- This calls
Khoj Menu
Hit C-c s (or M-x khoj) to open the khoj menu above. Then:
- Hit
tuntil you preferred content type is selected in the khoj menuContent Typespecifies the content to performSearch,UpdateorFind Similaractions on - Hit
ntwice and then enter number of results you want to seeResults Countis used by theSearchandFind Similaractions - Hit
-f utoforceupdate the khoj content index TheForce Updateswitch is only used by theUpdateaction
Upgrade
Upgrade Khoj Backend
pip install --upgrade khoj-assistant
Upgrade Khoj.el
Use your Emacs package manager to upgrade khoj.el
-
For
khoj.elfrom MELPA-
Method 1
- Run
M-x package-list-packagesto list all packages - Press
Uonkhojto mark it for upgrade - Press
xto execute the marked actions
- Run
-
Method 2
- Run
M-x package-refresh-content - Run
M-x package-reinstall khoj
- Run
-
-
For
khoj.elfrom Straight- Run
M-x straight-pull-package khoj
- Run

