Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/st3v3nmw/obsidian-synapse
Generate flashcard answers with LLMs based on your Obsidian notes and sync them to Anki
https://github.com/st3v3nmw/obsidian-synapse
anki flashcards llm obsidian obsidian-plugin spaced-repetition
Last synced: 15 days ago
JSON representation
Generate flashcard answers with LLMs based on your Obsidian notes and sync them to Anki
- Host: GitHub
- URL: https://github.com/st3v3nmw/obsidian-synapse
- Owner: st3v3nmw
- License: mit
- Created: 2024-05-16T11:47:56.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-10-21T08:21:33.000Z (16 days ago)
- Last Synced: 2024-10-21T11:29:19.079Z (16 days ago)
- Topics: anki, flashcards, llm, obsidian, obsidian-plugin, spaced-repetition
- Language: TypeScript
- Homepage:
- Size: 81.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Obsidian Synapse
Generate flashcard answers with LLMs based on your Obsidian notes and sync them to Anki.
## Context
I tried generating flashcards from my notes where the LLM generates both the questions
and the answers. One issue with this approach is that the LLM would add questions that I didn't
care about, for instance the dates of historical events. Or I didn't like how it phrased the questions.Of course this can easily be fixed by reviewing the list of generated flashcards to weed out what you don't want. Or you can update your prompt to do exactly what you want. But why do that when we can create a new plugin? :)
This plugin acts as a middle ground between creating all your flashcards manually and having an LLM generate them for you. You provide the questions and the LLM generates the answers based on your notes.
Please note that this plugin is a proof of concept. I don't use it in my day-to-day. If you use the [Spaced Repetition](https://github.com/st3v3nmw/obsidian-spaced-repetition) plugin, you can try the [Obsidian Flashcards LLM](https://github.com/crybot/obsidian-flashcards-llm) plugin instead.
## Setup
### Anki
- Install [Anki](https://apps.ankiweb.net/)
- Install [AnkiConnect](https://ankiweb.net/shared/info/2055492159)
- Add `app://obsidian.md` to the `webCorsOriginList` entry in the add-on's config (`Tools -> Add-ons -> AnkiConnect -> Config`). It should look like this afterwards:```json
{
"apiKey": null,
"apiLogPath": null,
"ignoreOriginList": [],
"webBindAddress": "127.0.0.1",
"webBindPort": 8765,
"webCorsOriginList": ["http://localhost", "app://obsidian.md"]
}
```- Next, create a note type called `Synapse` (`Tools -> Manage Notes Type -> Add`). It should have 3 fields: `Front`, `Back`, & `Topic`. It's basically, a `Basic` note with a `Topic` field to add context on which file the card was generated from.
You can use this as the template:
Front:
```
{{Topic}}
{{Front}}
```Back:
```
{{FrontSide}}
{{Back}}
```### Plugin
Install the plugin using [BRAT](https://github.com/TfTHacker/obsidian42-brat).
In the plugin's settings, add your [OpenRouter API Key](https://openrouter.ai/docs/api-keys).
If you wish, you can update the LLM prompt. This is the default:
```
In one short sentence, give a concise answer to the question "${question}".
For math equations, use the format: equation.
Wrap code in italics code.
DO NOT repeat the instructions or question in your answer.
Base your answer on the following context:
${context}
```## Usage
Add your question as a one-line [call-out](https://help.obsidian.md/Editing+and+formatting/Callouts):
```markdown
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.> [!question] What is X?
```Click the plugin's icon on the ribbon bar to generate and sync the flashcards to Anki. Make sure that Anki is running.
Done!
If you want to regenerate the flashcards, use the `Regenerate flashcards & sync` command.