Skip to content

Commit

Permalink
Update AICore Library docs, release 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
justyns committed Jul 21, 2024
1 parent 4afab67 commit 4f6326d
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ For in-development code from the main branch:
For the latest "release" code, mostly also still in development for now:

```yaml
- ghr:justyns/silverbullet-ai/0.1.0
- ghr:justyns/silverbullet-ai/0.2.0
```

You can also use the `Plugs: Add` command and enter the above url to install.
Expand Down
28 changes: 24 additions & 4 deletions docs/AI Core Library.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,25 @@ tags: sidebar
navOrder: 10
---

> **warning** This doesn’t quite work yet, sorry!
# AI Core Library

Silverbullet offers the ability to share templates, snippets, etc as [Libraries](https://silverbullet.md/Libraries) that can be imported. The AICore library is meant to provide helpful utilities around using the silverbullet-ai plug.

# Installation
To import this library, run the {[Library: Import]} command in your SilverBullet space and enter:
To import this library, edit your `SETTINGS` page to include this library under the `libraries:` key like the example below.

```yaml
libraries:
# You'll most likely already have the normal Silverbullet core library
- import: "[[!silverbullet.md/Library/Core/*]]"
# Add the AICore library as well
- import: "[[!ai.silverbullet.md/Library/AICore/*]]"
```
Once added, run the {[Libraries: Update]} command to download the libraries. **Note**: This needs to run from a client that is not in sync-mode due to CORs issues.
!ai.silverbullet.md/Library/AICore/
The included templates, prompts, and space scripts are briefly described below. Please consider [contributing](https://github.com/justyns/silverbullet-ai) any templates or prompts you find useful.
# Included templates and prompts
Expand All @@ -18,4 +31,11 @@ where name =~ /^Library\/AICore/
render [[Library/Core/Query/Template]]
```

Please consider contributing any templates or prompts you find useful.
# Included Space Script

```query
page
where name =~ /^Library\/AICore\/Space Script/
render [[Library/Core/Query/Template]]
```

75 changes: 75 additions & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
For the full changelog, please refer to the individual release notes on https://github.com/justyns/silverbullet-ai/releases or the commits themselves.

This page is a brief overview of each version.

---
## Unreleased
- TBD
---
## 0.1.0
- **BREAKING**: Removed deprecated parameters: summarizePrompt, tagPrompt, imagePrompt, temperature, maxTokens, defaultTextModel, backwardsCompat. Except for defaultTextModel, these were no longer used.
- New [[Commands/AI: Suggest Page Name]] command
- Bake queries and templates in chat by [@justyns](https://github.com/justyns) in [#30](https://github.com/justyns/silverbullet-ai/pull/30)
* Allow completely overriding page rename system prompt, improve ux by [@justyns](https://github.com/justyns) in [#31](https://github.com/justyns/silverbullet-ai/pull/31)
* Always select a model if it's the only one in the list by [@justyns](https://github.com/justyns) in [#33](https://github.com/justyns/silverbullet-ai/pull/33)
* Pass all existing tags to generate tag command, allow user to add their own instructions too
---
## 0.0.11
- Support for custom chat message enrichment functions, see [[Configuration/Custom Enrichment Functions]]
---
## 0.0.10
- Add WIP docs and docs workflow by [@justyns](https://github.com/justyns) in [#20](https://github.com/justyns/silverbullet-ai/pull/20)
- Enable slash completion for ai prompts
- Don't die if clientStore.get doesn't work, like in cli mode
---
## 0.0.9
- Add github action for deno build-release by [@justyns](https://github.com/justyns) in [#18](https://github.com/justyns/silverbullet-ai/pull/18)
- Add ability to configure multiple text and image models, and switch between them by [@justyns](https://github.com/justyns) in [#17](https://github.com/justyns/silverbullet-ai/pull/17)
- Fix error when imageModels is undefined in SETTINGS by [@justyns](https://github.com/justyns) in [#22](https://github.com/justyns/silverbullet-ai/pull/22)
- Re-add summarizeNote and insertSummary commands, fixes [#19](https://github.com/justyns/silverbullet-ai/issues/19). Also add non-streaming support to gemini by [@justyns](https://github.com/justyns) in [#24](https://github.com/justyns/silverbullet-ai/pull/24)
---
## 0.0.8
- Add wikilink enrichment to chat messages for [#9](https://github.com/justyns/silverbullet-ai/issues/9) by [@justyns](https://github.com/justyns) in [#12](https://github.com/justyns/silverbullet-ai/pull/12)
- Add a newline when the first message from the LLM is either a code fence or markdown block by [@justyns](https://github.com/justyns) in [#13](https://github.com/justyns/silverbullet-ai/pull/13)
---
## 0.0.7
- Added Perplexity AI API info by [@zefhemel](https://github.com/zefhemel) in [#6](https://github.com/justyns/silverbullet-ai/pull/6)
- Add Custom Instructions for chat by [@justyns](https://github.com/justyns) in [#8](https://github.com/justyns/silverbullet-ai/pull/8)
- Interfaces refactor by [@justyns](https://github.com/justyns) in [#10](https://github.com/justyns/silverbullet-ai/pull/10)
- Add experimental Google Gemini support for [#3](https://github.com/justyns/silverbullet-ai/issues/3) by [@justyns](https://github.com/justyns) in [#11](https://github.com/justyns/silverbullet-ai/pull/11)
---
## 0.0.6
- Add a new command to prompt for a template to execute and render as a prompt
- Add insertAt option for prompt templates (page-start, page-end, cursor)
- Make the cursor behave nicer in interactive chats, fixes [#1](https://github.com/justyns/silverbullet-ai/issues/1)
- Remove 'Contacting LLM' notification and replace it with a loading placeholder for now [#1](https://github.com/justyns/silverbullet-ai/issues/1)
- Move some of the flashNotifications to console.log instead
- Dall-e: Use finalFileName instead of the prompt to prevent long prompts form breaking the markdown
- Add queryOpenAI function to use in templates later
- Update Readme for templated prompts, build potential release version
---
## 0.0.5
- Rename test stream command
- Add better error handling and notifications
- Misc refactoring to make the codebase easier to work on
- Automatically reload config from SETTINGS and SECRETS page
- Update readme for ollama/mistral.ai examples
- Use editor.insertAtPos instead of insertAtCursor to make streaming text more sane
- Add requireAuth variable to fix cors issue on chrome w/ ollama
- Remove redundant commands, use streaming for others
- Let chat on page work on any page. Add keyboard shortcut for it
- Move cursor to follow streaming response
---
## 0.0.4
- Add command for 'Chat on current page' to have an interactive chat on a note page
- Use relative image path name for dall-e generated images
- First attempt at supporting streaming responses from openai directly into the editor
---
## 0.0.3
- Add a new command to call openai using a user note or selection as the prompt, ignoring built-in prompts
- Add support for changing the openai-compatible api url and using a local LLM like Ollama
- Update jsdoc descriptions for each command and add to readme
- Save dall-e generated image locally
- Add script to update readme automatically
- Save and display the revised prompt from dall-e-3
---
2 changes: 1 addition & 1 deletion docs/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ For in-development code from the main branch:
For the latest "release" code, mostly also still in development for now:
```yaml
- ghr:justyns/silverbullet-ai/0.1.0
- ghr:justyns/silverbullet-ai/0.2.0
```
You can also use the `Plugs: Add` command and enter the above url to install.
Expand Down
5 changes: 2 additions & 3 deletions docs/Library/AICore/AIPrompt/AI Create Space Script.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ aiprompt:

SilverBullet space script documentation:

{{readPage([[!silverbullet.md/Space%20Script]])}}
[[!silverbullet.md/Space%20Script]]


Using the above documentation, please create a space-script following the users description in the note below. Output only valid markdown with a code block using space-script. No explanations, code in a markdown space-script block only. Must contain silverbullet.registerFunction or silverbullet.registerCommand.
Using the above documentation, please create a space-script following the users description in the note below. Output only valid markdown with a code block using space-script. No explanations, code in a markdown space-script block only. Must contain **silverbullet.registerFunction** or **silverbullet.registerCommand**. Use syscalls where available, but only if you know for sure they exist.

title: {{@page.name}}
Everything below is the content of the note:
Expand Down
File renamed without changes.
16 changes: 16 additions & 0 deletions docs/Library/AICore/Space Script/AI Query LLM.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
tags:
- spacescript

description: >
This space script allows you to use `{{queryAI(userPrompt, systemPrompt)}}` inside of a template.
Note that these responses are not cached, so it’s recommended to either immediately bake the rendered template or only use it in a snippet that will be rendered into a note.
---


```space-script
silverbullet.registerFunction({name: "queryAI"}, async (userPrompt, systemPrompt) => {
const pageContent = await syscall("system.invokeFunction", "silverbullet-ai.queryAI", userPrompt, systemPrompt);
return pageContent;
})
```
3 changes: 3 additions & 0 deletions docs/SETTINGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ A list of built-in settings [[!silverbullet.md/SETTINGS|can be found here]].

```yaml
indexPage: index
libraries:
- import: "[[!silverbullet.md/Library/Core/*]]"
- import: "[[!ai.silverbullet.md/Library/AICore/*]]"
publish:
# indexPage specific to the published site
indexPage: index
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ silverbullet-ai is very new and is still in early development. It may not work

If you are new here, start with [[Quick Start]], and then [[AI Core Library]]!

> **warning** **Warning**: Please backup your notes before using this plug. It inserts and replaces text at certain points and isn't well-tested yet, so back up your data!
> **warning** **Warning**: Please backup your notes before using this plug. It inserts and replaces text at certain points. It is recommended to use the git plug to keep your notes versioned automatically in a git repo.
## Features

Expand Down

0 comments on commit 4f6326d

Please sign in to comment.