Skip to content

cadrianxyz/obsidian-auto-anki

Repository files navigation

Obsidian Auto Anki

Plugin for Obsidian.md that uses OpenAI's GPT LLM to automatically generate Flashcards for Anki.

The plugin only works for desktop.

The plugin introduces two new "commands" into obsidian:

  • Export Current File to Anki
  • Export Highlighted Text to Anki (only available in an active Editable window open - i.e. you need to have a document open, and it needs to be in edit mode)

The command palette can be accessed on Obsidian through the following hotkey (default): CMD + SHIFT + P

command-palette-hotkey.

If desired, you can set your own hotkeys for the new commands.

The two new commands look like the following:

command-palette-new-commands

Plugin Requirements

The following are required for the Plugin to work:

Plugin Setup

  1. Download and install the plugin (Options > Community Plugins)
  2. Ensure that you have all the requirements in the Plugin Requirements
  3. Go to the Plugin Settings (Settings > Community Plugins > Auto Anki) and make sure to set the following fields appropriately:
    • Anki Port (by default, this is 8765)
    • OpenAI API Key
  4. Enjoy!

Feature Details

Exporting an Entire File to Anki (Command: Export Current File to Anki)

This command allows you to use the contents of the currently-opened file to send to GPT and generate a list of questions and answers.

prompt-1

Alternatively, you can also specify the number of alternatives to generate for each question. This allows you more variety in the "questions and answers" generated by GPT and it allows you to choose among a larger number of alternative "questions and answers". Choosing a number of alternatives work best with smaller notes.

prompt-2

From the generated list of "questions and answers", you have the option to pick and choose the ones you want.

After picking and choosing, your selected "questions and answers" automatically imports the chosen questions to Anki, based on the details in your Plugin settings.

It may take a while if you are generating a large number of questions, or a large number of question alternatives. An indicator will show whether auto-anki is currently generating your flash cards. This is shown in the status bar at the bottom of the screen, like below:

status-bar-running

Exporting Highlighted Text to Anki (Command: Export Highlighted Text to Anki)

This command is similar to "Exporting an Entire File to Anki", but this allows you to use the currently-highlighted text (instead of the whole file) to send to GPT and generate a list of questions and questions. (Important Note: file needs to be in edit mode for the command to be available).

Motivation

With the kajillion things I read and watch on a daily basis, I've recently found myself struggling to retain knowledge of the things I've consumed. Hence, I've found myself trying to find new ways to enhance my self-education. I came upon Spaced Repetition, and wanted to try to use Anki to supplement my daily learnings. Being a long-time user and lover of Obsidian.md as my PKM (Personal Knowledge Management), I wanted to see if there was a way to automate my learning using spaced repetition with my current Obsidian vaults.

I looked at other similar plugins that attempt to connect Obsidian to Anki, but a lot of require you to change how you write your notes in Obsidian, or just don't seem automated enough. What this plugin does is automate the creation of "flashcard-style" questions and answers but without needing to format your notes for this purpose.

I consider myself a complete beginner when it comes to Spaced Repetition, Anki, or the general world of learning techniques, so I am always very open to suggestions, discussions, or any comments about the topic!

Issues, Discussion, etc

I keep track of all things related to this plugin mostly in issues. Feel free to report bugs and/or requests there!

About

Using AI to automate card creation for Spaced Repetion in Anki

Resources

License

Stars

Watchers

Forks

Packages

No packages published