{"id":13654774,"url":"https://github.com/j0rd1smit/obsidian-copilot-auto-completion","last_synced_at":"2025-04-23T10:31:32.479Z","repository":{"id":182041769,"uuid":"667852848","full_name":"j0rd1smit/obsidian-copilot-auto-completion","owner":"j0rd1smit","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-25T10:55:26.000Z","size":7112,"stargazers_count":126,"open_issues_count":9,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-10T06:34:12.707Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/j0rd1smit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-07-18T12:55:50.000Z","updated_at":"2024-11-08T14:54:15.000Z","dependencies_parsed_at":"2023-07-27T15:53:29.438Z","dependency_job_id":"aa2041a3-4a66-463b-90b5-a3aa59c3c9f7","html_url":"https://github.com/j0rd1smit/obsidian-copilot-auto-completion","commit_stats":null,"previous_names":["j0rd1smit/obsidian-copilot","j0rd1smit/obsidian-copilot-auto-completion"],"tags_count":12,"template":false,"template_full_name":"obsidianmd/obsidian-sample-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j0rd1smit%2Fobsidian-copilot-auto-completion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j0rd1smit%2Fobsidian-copilot-auto-completion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j0rd1smit%2Fobsidian-copilot-auto-completion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j0rd1smit%2Fobsidian-copilot-auto-completion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/j0rd1smit","download_url":"https://codeload.github.com/j0rd1smit/obsidian-copilot-auto-completion/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250416380,"owners_count":21426982,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T03:00:46.372Z","updated_at":"2025-04-23T10:31:31.588Z","avatar_url":"https://github.com/j0rd1smit.png","language":"TypeScript","funding_links":["https://buymeacoffee.com/jordismit","https://img.buymeacoffee.com/button-api/?text=Buy"],"categories":["Tools/Products","AI code completion tools","Copilot auto completion"],"sub_categories":["AI code completion tools"],"readme":"# Copilot like auto-completion for Obsidian\nThis plugin adds a Copilot-like auto-completion to Obsidian.\nIt uses large language models (LLMs) to generate text based on the `n` characters before and after your cursor.\nIt will show the suggested completion in transparent text next to your cursor. \nYou can then press Tab to insert the entire suggestion, or the right arrow key to insert part of the suggestion. \nAdditionally, you can press Escape or move the cursor to ignore the suggestion.\nThe plugin supports multiple API providers, such as OpenAI, Azure OpenAI and Ollama.\n\n![demo](assets/demo-static.gif)\n\n\n\n## Features\nThe plugin offers the following features:\n\n- **Fill-in-the-Middle Auto-Completion**: The plugin provides suggestions based on the `n` characters before and after your cursor, displaying the proposed text as transparent overlay near your cursor, tailored to fit the current context. Want to know how it works? See the [how does the model work in detail?](docs/how%20does%20the%20model%20work%20in%20details.md) documentation.\n- **Context-Aware Suggestions**: The suggestions adapt to the current writing context. For instance, the plugin will offer text suggestions in paragraphs, code in code blocks, and LaTeX formulas in math blocks, among others. Want to know how it does this? See the [context aware few shot examples](docs/how%20does%20the%20model%20work%20in%20details.md#context-aware-few-shot-examples) documentation.\n- **Language-Aware Suggestions**: The automaticly tries to detect the language around the cursor and nudges the model to generate text in that language. See the [language detection documentation](docs/how%20does%20the%20model%20work%20in%20details.md#language-detection) for more information.\n- **Multiple API Providers**: Support is available for various API providers, including [OpenAI](docs/how-to/OpenAI%20API%20setup%20guide.md), [Azure OpenAI](docs/how-to/Azure%20API%20setup%20guide.md), and [Ollama](docs/how-to/Ollama%20setup%20guide.md). Additionally, you can configure the OpenAI API provider to use any API that implements the OpenAI standard, allowing you to use any local models or other API providers that implement this standard. \n- **Highly Customizable**: Configure elements like [triggers](docs/personalization%20and%20settings.md#triggers), [trigger delay](docs/personalization%20and%20settings.md#trigger-delay), [prefix/suffix size](docs/personalization%20and%20settings.md#preprocessing), [text generation settings](docs/personalization%20and%20settings.md#model-options), [custom few-shot examples](docs/personalization%20and%20settings.md#customize-the-few-shot-examples), and the [custom system prompt](docs/personalization%20and%20settings.md#customize-the-system-prompts) to your liking.\n- **Git-Ignore-Like Functionality**: The plugin features functionality similar to `.gitignore`, automatically disabling itself when opening files that match certain patterns. This helps prevent unintended triggers in sensitive documents. For more information, [click here](docs/how-to/ignore%20files.md).\n- **Partial Suggestions Insertion**: Insert portions of a suggestion incrementally using the right arrow key, enabling word-by-word insertion.\n- **Smart Caching**: Suggestions are cached to minimize API calls. If the typed text matches a cached suggestion, that suggestion is displayed, avoiding an additional API call.\n- **Optimized to Reduce API Calls**: The plugin employs an intelligent queuing and trigger detection system to minimize API call frequency. For more information, [click here](docs/plugin%20design.md).\n- **Easy to disable**: The plugin can be disabled at any time using the `Obsidian Copilot: Disable` command. This allows you to disable the plugin when working on sensitive documents or when you are currently not in need of suggestions. \n\n\n## Getting Started\nTo install the plugin, please follow these steps:\n\n1. Open Obsidian.\n2. Navigate to the 'Settings' menu.\n3. Select the 'Community Plugins' tab.\n4. Disable 'Restricted Mode' by turning it off.\n5. Access the Community Plugins Store by clicking the 'Browse' button.\n6. Search for 'Copilot Auto Completion.'\n7. Click the 'Install' button to proceed with the installation.\n8. Once installed, activate the plugin by enabling it in the 'Community Plugins' settings.\n9. Proceed to the 'Copilot Auto Completion' settings section.\n10. Choose your API provider and refer to the corresponding guide for specific instructions: \n    - [OpenAI API setup guide](docs/how-to/OpenAI%20API%20setup%20guide.md)\n    - [Azure OpenAI API setup guide](docs/how-to/Azure%20API%20setup%20guide.md)\n    - [Ollama setup guide](docs/how-to/Ollama%20setup%20guide.md)\n11. Depending on your chosen API provider, you may be required to enter additional details, such as an API key or endpoint URLs.\n12. Once you have entered all necessary information, use the 'Test Connection' button to ensure that the plugin can successfully connect to the API provider.\n13. If the test is successful, the plugin is ready for use.\n\nThe following GIF demonstrates what a successful connection test should look like:\n![settings](assets/settings_demo.gif)\n\nThe plugin is now ready for use.  \nIt monitors the text you type for specific triggers, such as end-of-sentence punctuation, a new line, or a list item.\nUpon detecting a trigger, it presents context-specific suggestions.  \nFor instance, try typing the following:  \n   \n```text  \n# A Tale of Two Cities  \n   \nThe most famous quote from this book is:  \n```\n   \nOnce you type a space after the `:`, the plugin should display a suggestion like this.\n\n![](assets/a-tale-of-two-cities-example.jpg)\n\nNote: To minimize API calls and costs, this plugin is not as sensitive to triggers as the original Copilot.\nIt only activates after specific triggers, such as end-of-sentence punctuation, a new line, or a list item.\nFor more information, see the [triggers documentation](docs/personalization%20and%20settings.md#triggers).\n\n## How It Works\n\nThis plugin utilizes large language models (LLMs) to perform fill-in-the-middle auto-completion. \nBy default, most LLMs are not trained for this specific task. \nHowever, through prompt engineering, we can adapt LLMs to facilitate fill-in-the-middle auto-completion.\nThe system prompt we use looks roughly like this:\n\n```text\nYour job is to predict the most logical text that should be written at the location of the \u003cmask/\u003e.\nYour answer can be either code, a single word, or multiple sentences.\nYour answer must be in the same language as the existing text.\n...\n```\n\nWe then supply the model with the truncated text before and after the cursor, formatted as `\u003ctruncated_text_before_cursor\u003e \u003cmask/\u003e \u003ctruncated_text_after_cursor\u003e`. \nThe model responds with the text it predicts should fill the `\u003cmask/\u003e`. \nAfter some post-processing, we present this prediction to the user as a suggestion.\n\n\nIn addition to the system prompt, we provide the model with context-specific examples to enhance its performance and make it more context-aware.\nFor instance, if the cursor is within a code block, we supply code-related examples to the model. \nConversely, if the cursor is in a title, we offer title-related examples. \nThis approach informs the model of our expectations for the response in the given context. \nThe plugin accommodates a wide array of contexts, including code blocks, math blocks, lists, headings, paragraphs, and more.\nThese few-shot examples are customizable, allowing you to tailor them to your writing style or language preferences (see [Custom Few-Shot Examples](docs/personalization%20and%20settings.md#customize-the-few-shot-examples) for more information).\n\n![context aware few shot examples](assets/few-shot-example-visual.gif)\n\n\nThis overview gives you a high-level understanding of how the plugin functions. Interested in more details?\nExplore the following pages:\n- [How Does the Model Work in Detail?](docs/how%20does%20the%20model%20work%20in%20details.md)\n- [How is the plugin designed?](docs/plugin%20design.md)\n- [What are the different states of the plugin?](docs/plugin%20design.md#plugin-design)\n\n\n## Personalization and Settings\n\nThe plugin is designed to be highly customizable, allowing you to tailor the following aspects:\n\n- **API Provider**: Choose your preferred API provider. Options include [OpenAI](docs/how-to/OpenAI%20API%20setup%20guide.md), [Azure OpenAI](docs/how-to/Azure%20API%20setup%20guide.md), or [Ollama](docs/how-to/Ollama%20setup%20guide.md).\n- **[Triggers](docs/personalization%20and%20settings.md#triggers)**: Define the text after which the plugin should suggest a completion.\n- **[Trigger Delay](docs/personalization%20and%20settings.md#trigger-delay)**: Set the duration the plugin should wait before offering a suggestion to minimize costs.\n- **[Prefix/Suffix Size](docs/personalization%20and%20settings.md#preprocessing)**: Determine the amount of text to include in the prediction request.\n- **[Text Generation Settings](docs/personalization%20and%20settings.md#model-options)**: Adjust common text generation parameters like temperature, top-k, max tokens, frequency penalty, and more.\n- **[Custom Few-Shot Examples](docs/personalization%20and%20settings.md#customize-the-few-shot-examples)**: Add your own few-shot examples to enhance the model's accuracy or to match your writing style.\n- **[Custom System Prompt](docs/personalization%20and%20settings.md#customize-the-system-prompts)**: Personalize the system prompt to refine model performance or to suit your style and language preferences.\n\nFor detailed guidance on customizing these settings, please visit the [Personalization and Settings](docs/personalization%20and%20settings.md) page.\n\n## Keyboard shortcuts\nThe plugin supports the following keyboard shortcuts:\n  \n| Key           | State      | Action                                                                                                          |\n| ------------- | ---------- | --------------------------------------------------------------------------------------------------------------- |\n| `Tab`         | Suggesting | Accept the entire suggestion                                                                                    |\n| `Right Arrow` | Suggesting | Accept the next word of the suggestion                                                                          |\n| `Escape`      | Suggesting | Reject the suggestion and clear the suggestion cache                                                            |\n| `Escape`      | Predicting | Cancel the prediction request. This prevents the suggestion from showing up, but the cost has already incurred. |\n| `Escape`      | Queued     | Cancel the prediction request. This prevents the API call, thus no additional costs are incurred.               |\n\nNote that the keyboard shortcuts have different effects depending on the state of the plugin.\nIf the plugin is in a state not listed in the table above, the keys will function normally.\nThe current state of the plugin is always displayed in the plugin's status bar at the bottom of the screen.\nClick here for more information about the [plugin's states](docs/plugin%20design.md).\n\n## Privacy Considerations\n\nWhen dealing with privacy-sensitive documents, you may prefer not to share their contents with API providers such as OpenAI or Azure OpenAI.\nThese providers could potentially store your data and utilize it to enhance their models, based on their current terms and conditions.\nSo always make sure to read the terms and conditions of your chosen API provider before using it with this plugin.\n\nTo safeguard your privacy, you can take the following measures:\n\n1. Opt for a local API provider like [Ollama](https://ollama.ai/), which ensures your data remains on your computer. To set up a local provider, [click here](docs/how-to/Ollama%20setup%20guide.md) for a guide. However, it's important to note that these local models may not be as accurate or fast as their cloud-based counterparts.\n2. Utilize the `ignore` functionality within the plugin. Within the settings, you can define a list of patterns similar to .gitignore glob patterns. If you open a file matching one of these patterns, the plugin will automatically deactivate for that file and reactivate when you switch to a non-matching file. By default, the settings are configured to ignore all files within any parent folder named secret. For instructions on setting this up, [click here](docs/how-to/ignore files.md).\n3. Manually disable the plugin while working on sensitive documents by using the `Obsidian Copilot: Disable` command.\n\n## Triggers\nAs you write, the plugin monitors the text preceding your cursor to see if it matches any predefined triggers.\nUnlike Copilot, this plugin does not activate after each character you type; it only activates with specific triggers, such as end-of-sentence punctuation, a new line, a list item, math block, code block, etc. \nThis method is intended to minimize the number of API calls and, as a result, the associated costs. \nThe gif below demonstrates how the plugin gets automatically triggered after adding an new line inside a math block.\n\n![demo](assets/demo.gif)\n\nYou can tailor these triggers in the plugin's settings according to your preferences. \nHowever, please note that more sensitive triggers might increase API calls and, thus, incur higher expenses.\nSee the [Personalization and Settings](docs/personalization%20and%20settings.md#triggers) to learn how to customize these triggers to your liking.\n\nIn addition to automatic triggers, you can force the plugin to make a prediction by using the command palette (with `CMD + P` on Mac or `CTRL + P` on Windows) and typing `Obsidian Copilot: Predict`.\nThis command enables you to request a prediction from the plugin at any time, independent of automatic triggers.\nObsidian allows you to assign this command to any hotkey of your choice. \nTo do so, search for `Copilot` in the hotkey settings and assign a hotkey to the `Obsidian Copilot: Predict` command.\n\n![demo](assets/type_hint_prediction.gif)\n\n## Development\n\nWant to contribute? Great! \nPlease read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests.\n\n## Disclaimer\n\nThis plugin serves as a connection to the API provider.\nWe do not access or retain your data, but it is possible that the API provider does.\nTherefore, it is important to review and understand their terms and conditions and privacy policy.\nPlease note that we are not liable for any information you provide to the API provider. \nYou have the discretion to enable or disable the plugin based on the content of your documents. \nHowever, when you do this is your own responsibility.\nPlease exercise caution when sharing sensitive information such as secrets or personal data with your API provider.\n\n\n## Support\nIf you find this plugin useful and would like to support its development, you can buy me a coffee.\n\n\u003ca href=\"https://buymeacoffee.com/jordismit\"\u003e\u003cimg src=\"https://img.buymeacoffee.com/button-api/?text=Buy me a coffee\u0026emoji=\u0026slug=jordismit\u0026button_colour=5F7FFF\u0026font_colour=ffffff\u0026font_family=Lato\u0026outline_colour=000000\u0026coffee_colour=FFDD00\"\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj0rd1smit%2Fobsidian-copilot-auto-completion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj0rd1smit%2Fobsidian-copilot-auto-completion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj0rd1smit%2Fobsidian-copilot-auto-completion/lists"}