bbawj / obsidian-semantic-search

Semantic search for Obsidian.md

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Semantic Search for Obsidian

Find what you are looking for based on what you mean. A new file switcher powered by OpenAI's embedding API and built using WASM and Rust.

Quickstart

  1. Setup OpenAI API key in plugin settings
  2. Run Generate Input command
  3. Run Generate Embedding command
  4. Run Open Query Modal command and start semantic searching!

Demo

mp4.mp4

Commands

Command Description
Generate Input Generate input csv based on sections of your notes. Currently, sections are defined as text blocks between headings. Prepared input is saved as input.csv in your root folder.
Generate Embedding Obtain embeddings via OpenAI's text-embedding-ada-002 embedding model (this requires that the generate input command was successfully executed). Generated embeddings is saved as embedding.csv in your root folder.
Open Query Modal Semantic search through your notes using generated embeddings.
Recommend links using current selection Uses current editor selection as query input, automatically creating a markdown link with your choice. Can also be triggered in the context menu using the mouse right-click.

Configuration

Setting Description
API Key Your OpenAI API key which can be found here. This gets stored into data.json as per all obsidian plugin settings data so make sure you do not commit this file to a repository.
Section Delimeters Regex used to determine if the current line is the start of a new section. Sections are used to group related content together. Defaults to ., meaning every line starts a new section. E.g. matching every heading: ^#{1,6}
Folders to ignore Folders to ignore when generating input. Enter folder paths separated by newlines.
Number of batches Number of batches used to call OpenAI's endpoint. If you have lots of data, and are facing invalid request errors, try increasing this number.
Enable link recommendation using {{}} Use {{}} as a way to trigger semantic search suggestions for file linking.

Installing

From Obsidian v1.0.0, this plugin can be activated from within Obsidian:

  1. Open Settings > Third-party plugin
  2. Make sure Safe mode is off
  3. Click Browse community plugins
  4. Search for "Semantic Search"
  5. Click the "Install" button
  6. Once installed, close the community plugins window
  7. Under the "Installed plugins" section, enable Semantic Search

From Github

  1. Download the latest release distribution
  2. Extract the the contents of the distribution zip file to your vault's plugins folder: /.obsidian/plugins/ Note: On MacOs the .obsidian folder may be hidden by default.
  3. Reload Obsidian
  4. Open Settings, third-party plugins, make sure safe mode is off and enable "Semantic Search" from there.

Contributing

Contributions are welcome!

Dependencies

  1. Rust and cargo
  2. wasm-pack

Getting Started

  1. Clone the repo
  2. cd into the newly created folder and run yarn install
  3. Run yarn run dev

Note

This plugin is very much experimental at the moment, use it at your own risk. Testing is done on Windows.

Thanks to Robert's blog post for the idea and inspiration!

About

Semantic search for Obsidian.md

License:GNU General Public License v3.0


Languages

Language:Rust 57.2%Language:TypeScript 35.8%Language:JavaScript 4.1%Language:Shell 2.3%Language:CSS 0.7%