logancyang / obsidian-copilot

THE Copilot in Obsidian
https://www.obsidiancopilot.com/
GNU Affero General Public License v3.0
3.08k stars 217 forks source link
aiagent chatgpt copilot obsidian-plugin openai-api rag

πŸ” Copilot for Obsidian

GitHub release (latest SemVer) Obsidian Downloads

Copilot for Obsidian is an open-source LLM interface right inside Obsidian. It has a minimalistic design and is straightforward to use.

My goal is to make it the ultimate AI assistant that truly understands your personal knowledge base while being privacy-focused.

It has a local index that powers the question-answering. Your notes are always stored on your own device and nowhere else! More features are under construction. Stay tuned!

UI

If you enjoy Copilot for Obsidian, please consider sponsoring this project, or donate by clicking the button below. It will help me keep this project going to build toward a privacy-focused AI experience. Thank you!

Buy Me A Coffee

SPECIAL THANKS TO OUR TOP SPONSORS: @pedramamini, @Arlorean, @dashinja, @azagore, @MTGMAD, @gpythomas, @emaynard, @scmarinelli, @borthwick, @adamhill, @gluecode, @rusi, @timgrote, @JiaruiYu-Consilium, @ddocta, @AMOz1, @chchwy, @pborenstein, @GitTom, @kazukgw, @mjluser1, @joesfer, @rwaal

Changelog

πŸ€– v2.7.0 Copilot Plus (alpha) demo video - AI Agent for Obsidian! πŸš€

Copilot Plus is a brand new mode that brings powerful agentic capabilities to Obsidian. Think of it as Cursor inside Obsidian but optimized for PKM use cases instead of coding. It is still in limited alpha and only available to alpha testers. If you are interested in joining the alpha, please consider sponsoring the project on Github (please have your email info in your github profile or I won't be able to reach you) or buy me coffees!

Check out the demo video below for the first sneak peak of what Copilot Plus can do. It is under active development so expect more features to come very soon!

πŸ› οΈ Features

Chat and Vault QA modes are completely free to use. Copilot Plus is currently in limited alpha and free to use for alpha testers.

Model Providers

OpenAI, Anthropic, Azure OpenAI, Google Gemini, Cohere, OpenRouter, GROQ, and any 3rd Party Models with OpenAI-Compatible API are supported. You can easily add them via Custom Model in Copilot settings.

LM Studio and Ollama are supported for local models. Please check out the super simple setup guide here. Don't forget to flex your creativity in custom prompts using local models!

πŸ€— New to Copilot? Quick Guide for Beginners

The simplest way to get started is to get an OpenAI API key (with payment method set up with OpenAI) and set it in the Copilot settings. Then simply pick gpt-4o or gpt-4o-mini in the model dropdown to start chatting. Please check out the documentation for more details.

Try going through all the Copilot commands in the command palette, and see what they do. You can also checkout my youtube channel for previous demos.

πŸ”§ Copilot Settings

Explore the "General Settings" to select your default chat model and customize parameters such as temperature, max tokens, and conversation context to fit your needs.

Settings

Enter your API keys in "API settings" for existing providers.

API Settings

Add model using the "Custom Model" form.

You can also use your own system prompt, choose between different embedding providers for Vault QA and more.

πŸ’¬ User Custom Prompt: Create as Many Copilot Commands as You Like!

You can add, apply, edit and delete your own custom Copilot commands, all persisted in your local Obsidian environment! Check out this demo video below!

🧠 Advanced Custom Prompt! Unleash your creativity and fully leverage the long context window!

This video shows how Advanced Custom Prompt works. This form of templating enables a lot more possibilities with long context window models. If you have your own creative cool use cases, don't hesitate to share them in the discussion or in the youtube comment section!

βš™οΈ Installation (recommended)

Now you can see the chat icon in your leftside ribbon, clicking on it will open the chat panel on the right! Don't forget to provide your API keys in settings before using the plugin!

⛓️ Manual Installation

πŸ”” Note

πŸ“£ Again, please always be mindful of the API cost if you use expensive models with a long context!

πŸ€” FAQ (please read before submitting an issue)

"You do not have access to this model" - You need to **have access to the model APIs** to use them. Usually they require an API key and a payment method. - A common misunderstanding I see is that some think they have access to GPT-4 API when they get ChatGPT Plus subscription. It's not always true (depending on when you signed up). _You need to have access to GPT-4 API to use the model in this plugin_. Please check if you have payment available on your OpenAI account. Then check OpenAI playground if you can use that particular model https://platform.openai.com/playground?mode=chat. Again, API access and ChatGPT Plus are two different things! You can use the API without the ChatGPT Plus subscription. - Reference issue: https://github.com/logancyang/obsidian-copilot/issues/3#issuecomment-1544583676
It's not using my note as context - Please don't forget to switch to "**Vault QA**" in the Mode Selection dropdown in order to start the QA. Copilot does not have your note as context in "Chat" mode without an explicit `[[notetitle]]` in the message. Settings
"insufficient_quota" - Most likely because **you haven't set up payment in your OpenAI account**, or you exceeded your max monthly limit. OpenAI has a cap on how much you can use their API, usually $120 for individual users. - Reference issue: https://github.com/logancyang/obsidian-copilot/issues/11
"context_length_exceeded" - Please refer to the model provider's documentation for the context window size. **Note: if you set a big max token limit in your Copilot setting, you could get this error**. Max token refers to completion tokens, not input tokens. So a bigger max output token limit means a smaller input token limit! - The prompts behind the scenes for Copilot commands can also take up tokens, so please limit your message length and max tokens to avoid this error. (For QA with Unlimited Context, use the "QA" mode in the dropdown! Requires Copilot v2.1.0.) - Reference issue: https://github.com/logancyang/obsidian-copilot/issues/1#issuecomment-1542934569
Azure issue - It's a bit tricky to get all Azure credentials right in the first try. My suggestion is to use `curl` to test in your terminal first, make sure it gets response back, and then set the correct params in Copilot settings. Example: ``` curl https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/completions?api-version=VERSION\ -H "Content-Type: application/json" \ -H "api-key: YOUR_API_KEY" \ -d "{ \"prompt\": \"Once upon a time\", \"max_tokens\": 5 }" ``` - Reference issue: https://github.com/logancyang/obsidian-copilot/issues/98

When opening an issue, please follow the issue template and include relevant console logs. You can go to Copilot's settings and turn on "Debug mode" at the bottom for more console messages. On Mac, you can open the console by pressing Cmd+Opt+I. On Windows, you can open the console by pressing Ctrl+Shift+I.

πŸ™ Thank You

If you share my vision, please consider sponsoring this project or buying me some coffees!

Buy Me A Coffee

Please also help spread the word by sharing about the Copilot for Obsidian Plugin on Twitter/X, Reddit, or any other social media platform you use.

You can find me on Twitter/X @logancyang.