khoj/src/interface/obsidian
2023-07-02 16:20:43 -07:00
..
docs Add screenshot of Khoj chat on Obsidian to Readme. Fix links 2023-03-30 02:49:05 +07:00
src Use built-in app.vault to determine whether there are any PDF files within 2023-07-02 16:20:43 -07:00
.editorconfig Create Obsidian plugin for Khoj 2023-01-04 18:28:16 -03:00
.eslintignore Add, configure and run pre-commit locally and in test workflow 2023-02-17 13:31:36 -06:00
.eslintrc Add, configure and run pre-commit locally and in test workflow 2023-02-17 13:31:36 -06:00
.gitignore Create Obsidian plugin for Khoj 2023-01-04 18:28:16 -03:00
.npmrc Add, configure and run pre-commit locally and in test workflow 2023-02-17 13:31:36 -06:00
esbuild.config.mjs Create Obsidian plugin for Khoj 2023-01-04 18:28:16 -03:00
LICENSE Add, configure and run pre-commit locally and in test workflow 2023-02-17 13:31:36 -06:00
manifest.json Release Khoj version 0.7.0 2023-07-01 05:44:22 -07:00
package.json Release Khoj version 0.7.0 2023-07-01 05:44:22 -07:00
README.md Make --no-gui the default behavior of Khoj and update corresponding documentation 2023-07-01 19:07:59 -07:00
styles.css Update color of Khoj chat in Obsidinan plugin to Lantern theme 2023-07-01 02:18:47 -07:00
tsconfig.json Create Obsidian plugin for Khoj 2023-01-04 18:28:16 -03:00
version-bump.mjs Create Obsidian plugin for Khoj 2023-01-04 18:28:16 -03:00
versions.json Release Khoj version 0.7.0 2023-07-01 05:44:22 -07:00
yarn.lock Add Yarn lockfile for Khoj Obsidian 2023-04-18 00:57:11 +07:00

Khoj LogoObsidian

Natural language search for your Obsidian notes using Khoj

Table of Contents

Features

  • Search
    • Natural: Advanced natural language understanding using Transformer based ML Models
    • Local: Your personal data stays local. All search and indexing is done on your machine. Unlike chat which requires access to GPT.
    • Incremental: Incremental search for a fast, search-as-you-type experience
  • Chat
    • Faster answers: Find answers faster and with less effort than search
    • Iterative discovery: Iteratively explore and (re-)discover your notes
    • Assisted creativity: Smoothly weave across answers retrieval and content generation

Demo

Search Demo

https://github.com/khoj-ai/khoj/assets/6413477/3e33d8ea-25bb-46c8-a3bf-c92f78d0f56b

Description
  1. Install Khoj via pip and start Khoj backend
    python -m pip install khoj-assistant && khoj
    
  2. Install Khoj plugin via Community Plugins settings pane on Obsidian app
    • Check the new Khoj plugin settings
    • Wait for Khoj backend to index markdown, PDF files in the current Vault
    • Open Khoj plugin on Obsidian via Search button on Left Pane
    • Search "Announce plugin to folks" in the Obsidian Plugin docs
    • Jump to the search result

Interfaces

Search Modal

Chat Modal

Setup

  • Make sure python and pip are installed on your machine
  • Ensure you follow the ordering of the setup steps. Install the plugin after starting the khoj backend. This allows the plugin to configure the khoj backend

1. Setup Backend

Open terminal/cmd and run below command to install and start the khoj backend

  • On Linux/MacOS

    python -m pip install khoj-assistant && khoj
    
  • On Windows

    py -m pip install khoj-assistant && khoj
    

2. Setup Plugin

  1. Open Khoj from the Community plugins tab in Obsidian settings panel
  2. Click Install, then Enable on the Khoj plugin page in Obsidian
  3. [Optional] To enable Khoj Chat, set your OpenAI API key in the Khoj plugin settings

See official Obsidian plugin docs for details

Use

Chat

Run Khoj: Chat from the Command Palette and ask questions in a natural, conversational style.
E.g "When did I file my taxes last year?"

Notes:

  • Using Khoj Chat will result in query relevant notes being shared with OpenAI for ChatGPT to respond.
  • To use Khoj Chat, ensure you've set your OpenAI API key in the Khoj plugin settings.

See Khoj Chat for more details

Click the Khoj search icon 🔎 on the Ribbon or run Khoj: Search from the Command Palette

Note: Ensure the khoj server is running in the background before searching. Execute khoj in your terminal if it is not already running

https://user-images.githubusercontent.com/6413477/218801155-cd67e8b4-a770-404a-8179-d6b61caa0f93.mp4

Query Filters

Use structured query syntax to filter the natural language search results

  • Word Filter: Get entries that include/exclude a specified term
    • Entries that contain term_to_include: +"term_to_include"
    • Entries that contain term_to_exclude: -"term_to_exclude"
  • Date Filter: Get entries containing dates in YYYY-MM-DD format from specified date (range)
    • Entries from April 1st 1984: dt:"1984-04-01"
    • Entries after March 31st 1984: dt>="1984-04-01"
    • Entries before April 2nd 1984 : dt<="1984-04-01"
  • File Filter: Get entries from a specified file
    • Entries from incoming.org file: file:"incoming.org"
  • Combined Example
    • what is the meaning of life? file:"1984.org" dt>="1984-01-01" dt<="1985-01-01" -"big" -"brother"
    • Adds all filters to the natural language query. It should return entries
      • from the file 1984.org
      • containing dates from the year 1984
      • excluding words "big" and "brother"
      • that best match the natural language query "what is the meaning of life?"

Find Similar Notes

To see other notes similar to the current one, run Khoj: Find Similar Notes from the Command Palette

Upgrade

1. Upgrade Backend

pip install --upgrade khoj-assistant

2. Upgrade Plugin

  1. Open Community plugins tab in Obsidian settings
  2. Click the Check for updates button
  3. Click the Update button next to Khoj, if available

Troubleshooting

  • Open the Khoj plugin settings pane, to configure Khoj
  • Toggle Enable/Disable Khoj, if setting changes have not applied
  • Click Update button to force index to refresh, if results are failing or stale

Current Limitations

  • The plugin loads the index of only one vault at a time.
    So notes across multiple vaults cannot be searched at the same time

Visualize Codebase

Implementation

The plugin implements the following functionality to search your notes with Khoj:

  • Open the Khoj search modal via left ribbon icon or the Khoj: Search command
  • Render results as Markdown preview to improve readability
  • Configure Khoj via the plugin setting tab on the settings page
    • Set Obsidian Vault to Index with Khoj. Defaults to all markdown, PDF files in current Vault
    • Set URL of Khoj backend
    • Set Number of Search Results to show in Search Modal
  • Allow reranking of result to improve search quality
  • Allow Finding notes similar to current note being viewed