Skip to content

Commit e04c6ca

Browse files
mpstatonclaude
andcommitted
docs(readme): document the Gemini provider + partials/preambles paradigm for 0.2.0
README sections added/updated: - Lede + Key Features list — Gemini in the provider list - Network use table — new Gemini row + a note on the grounding-redirect resolution requests - Initial Setup — new step 2 "Configure Google Gemini" between Perplexity and Perplexica; LM Studio renumbered to step 4 - New "Using Google Gemini" section between Using Perplexity and Using Perplexica, including why Gemini's per-segment citations beat Claude's - Command Reference — new "Google Gemini Commands" subsection - Directory Templates — new "Partials and preambles" subsection documenting the {{include: name}} directive + auto-attached preambles paradigm - Table of Contents — Gemini link added Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 76dc1b4 commit e04c6ca

1 file changed

Lines changed: 111 additions & 4 deletions

File tree

README.md

Lines changed: 111 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
![Perplexed: An Obsidian Plugin for Perplexity and Perplexica / Vane](https://i.imgur.com/MVOK3rk.png)
22
# Perplexed: AI Content Generation for Obsidian
33

4-
**Perplexed** is an Obsidian plugin that enables AI-powered content generation with source citations using [Perplexity](https://www.perplexity.ai/), [Anthropic Claude](https://www.anthropic.com/), and [Perplexica / Vane](https://github.com/ItzCrazyKns/Vane) (self-hosted). This plugin brings research-grade AI capabilities directly into your Obsidian workspace, allowing you to generate well-cited content for your notes.
4+
**Perplexed** is an Obsidian plugin that enables AI-powered content generation with source citations using [Perplexity](https://www.perplexity.ai/), [Anthropic Claude](https://www.anthropic.com/), [Google Gemini](https://ai.google.dev/) (with Google Search grounding), and [Perplexica / Vane](https://github.com/ItzCrazyKns/Vane) (self-hosted). This plugin brings research-grade AI capabilities directly into your Obsidian workspace, allowing you to generate well-cited content for your notes.
55

66
## 🎯 Key Features
77
![Perplexed UI Modal interface](https://i.imgur.com/jaZ4UfS.png)
@@ -15,7 +15,7 @@
1515
[2]: 2025, Jun 16. [Governance, risk and compliance (GRC): Definitions and resources](https://www.diligent.com/resources/guides/grc). Published: 2025-05-27 | Updated: 2025-06-16
1616
> ```
1717
18-
- **Multiple AI Providers**: Support for Perplexity, Anthropic Claude, Perplexica / Vane (self-hosted), and LM Studio (local)
18+
- **Multiple AI Providers**: Support for Perplexity, Anthropic Claude, Google Gemini (with Google Search grounding), Perplexica / Vane (self-hosted), and LM Studio (local)
1919
- **Streaming Responses**: Real-time streaming of AI responses for better UX
2020
- **Flexible Configuration**: Customizable endpoints, models, and parameters
2121
- **Deep Research Mode**: Comprehensive research across hundreds of sources
@@ -32,9 +32,18 @@ explicitly selected when invoking selection-based commands.
3232
|---|---|---|---|
3333
| Perplexity | `https://api.perplexity.ai/chat/completions` | Required | Required (paid) |
3434
| Anthropic Claude | `https://api.anthropic.com/v1/messages` | Required | Required (paid) |
35+
| Google Gemini | `https://generativelanguage.googleapis.com/v1beta/models/{model}:streamGenerateContent` | Required ([AI Studio](https://aistudio.google.com/)) | Required (free tier available, no credit card) |
3536
| Perplexica / Vane ([install required](https://github.com/ItzCrazyKns/Vane)) | `http://localhost:3030/api/search` (default; user-configurable) | Not required | Not required (self-hosted, runs locally) |
3637
| LM Studio | `http://localhost:1234/v1/chat/completions` (default; user-configurable) | Not required | Not required (runs locally) |
3738
39+
When Gemini's `google_search` grounding is enabled, the plugin also issues
40+
follow-up `GET` requests to `vertexaisearch.cloud.google.com/grounding-api-redirect/…`
41+
URLs to resolve them to the real source page (so your `### Citations` footer
42+
contains durable source URLs rather than short-lived Google redirects). The
43+
follow-up requests go through Obsidian's `requestUrl` (Node-side), not the
44+
browser fetch — no cross-origin permissions involved, and the request is
45+
strictly URL-resolution, no auth header.
46+
3847
The plugin does not collect telemetry, ship vault content anywhere else,
3948
or update itself — Obsidian handles plugin updates through the community
4049
plugin directory.
@@ -45,6 +54,7 @@ plugin directory.
4554
- [Installation](#installation)
4655
- [Initial Setup](#initial-setup)
4756
- [Using Perplexity](#using-perplexity)
57+
- [Using Google Gemini](#using-google-gemini)
4858
- [Using Perplexica / Vane](#using-perplexica--vane)
4959
- [Using LM Studio](#using-lm-studio)
5060
- [Command Reference](#command-reference)
@@ -88,7 +98,24 @@ Perplexity is a commercial AI service that provides high-quality, source-cited r
8898
- Enter your Perplexity API key
8999
- The default endpoint should work: `https://api.perplexity.ai/chat/completions`
90100
91-
### 2. Configure Perplexica / Vane (self-hosted — requires local install)
101+
### 2. Configure Google Gemini (Free tier available)
102+
103+
Google Gemini is Google's commercial AI service. The `google_search` grounding tool returns per-segment citation attribution — meaning each cited sentence is mapped back to the specific URL it came from, which becomes the verbatim quote in your `### Citations` footer. AI Studio's free tier requires **no credit card** to get started.
104+
105+
1. **Get API key**:
106+
- Visit [Google AI Studio](https://aistudio.google.com/apikey)
107+
- Sign in with a Google account
108+
- Click "Create API key" → copy the `AIza…` string
109+
110+
2. **Configure in plugin**:
111+
- Open Obsidian Settings → Community Plugins → Perplexed
112+
- Scroll to **Gemini (Google)**
113+
- Paste your API key into "Gemini API key"
114+
- Default model: `gemini-flash-latest` (always-current Flash, free-tier friendly) — `gemini-pro-latest` and pinned `gemini-2.5-pro` / `gemini-2.5-flash` also available
115+
- Leave **Enable Google search grounding by default** on for source-cited research
116+
- Leave **Resolve citation urls** on — this is what turns the grounding-redirect URLs into the real source URLs in your citations footer
117+
118+
### 3. Configure Perplexica / Vane (self-hosted — requires local install)
92119
93120
Perplexica / Vane is a free, open-source AI search engine that you run
94121
**locally on your own machine**. This plugin does not bundle the server
@@ -122,7 +149,7 @@ before the "Ask Perplexica / Vane" command will work.
122149
- Pick a focus mode, optimization mode, and the local model you've
123150
configured the server to use
124151
125-
### 3. Configure LM Studio (Optional)
152+
### 4. Configure LM Studio (Optional)
126153
127154
For local AI processing without internet dependency:
128155
@@ -217,6 +244,58 @@ AI is changing how we work.
217244
Artificial Intelligence (AI) is fundamentally transforming how we work across various industries and sectors. From automating routine tasks to enabling more sophisticated decision-making processes, AI technologies are reshaping traditional workflows and creating new opportunities for productivity and innovation.
218245
```
219246

247+
## Using Google Gemini
248+
249+
### Quick start
250+
251+
1. **Open Command Palette**: `Ctrl/Cmd + Shift + P`
252+
2. **Run Command**: Type "Ask Gemini" and select it
253+
3. **Enter your question** in the textarea
254+
4. **Configure options** in the modal:
255+
- **Model**: `gemini-flash-latest` (recommended, free-tier friendly), `gemini-pro-latest`, or pinned 2.5 versions
256+
- **Enable Google search grounding**: server-side `google_search` tool; emits per-segment citations
257+
- **Append Google searches list**: appends a Markdown bullet list of the queries Gemini ran, each linked to `google.com/search` (Markdown-native substitute for Google's required Search Suggestions chip)
258+
- **Resolve citation urls**: resolves the `vertexaisearch.cloud.google.com` grounding-redirect URLs to durable source URLs + real page titles before writing the citations footer
259+
- **Stream response**: incremental writing to the note as the response arrives
260+
261+
### Available models
262+
263+
- **gemini-flash-latest**: Google's always-current Flash alias, free-tier friendly (recommended default)
264+
- **gemini-pro-latest**: Always-current Pro alias for deepest reasoning
265+
- **gemini-2.5-pro**: Pinned Pro version (free-tier quota typically exhausted; paid tier required)
266+
- **gemini-2.5-flash**: Pinned Flash version for reproducibility
267+
268+
### Why Gemini's citations are different
269+
270+
Gemini's `groundingSupports[]` carries per-segment attribution that survives the full response round-trip — meaning the `### Citations` footer contains the verbatim quote per source, attached to the prose above it. Compare to Claude's `web_search_20260209`, where the dynamic-filter sandbox post-processes search results and per-claim attachment doesn't survive: text blocks come back with `citations: null`.
271+
272+
The plugin walks two layers of provenance:
273+
274+
| Layer | Field | What it gives you |
275+
|---|---|---|
276+
| Page-level | `groundingChunks[]` | URL + title per page Gemini consulted |
277+
| Segment-level | `groundingSupports[]` | Text span (`segment.text`) → indices into `groundingChunks[]` |
278+
279+
Page-level chunks become URL-and-title fallbacks; segment-level supports enrich them with the verbatim quote Gemini grounded against. Citation footer mirrors Claude's exactly (`[N]: [Title](url). > cited_text`) so [cite-wide](https://github.com/lossless-group/cite-wide)'s hex-substitution pass works on Gemini output too.
280+
281+
### Example usage
282+
283+
#### Basic research with grounding
284+
```
285+
Question: "Who won the 2024 Nobel Prize in Physics and what was the citation?"
286+
Model: gemini-flash-latest
287+
Grounding: Enabled
288+
Resolve URLs: Enabled
289+
```
290+
291+
Lands in the note with prose like:
292+
293+
> The 2024 Nobel Prize in Physics was jointly awarded to John J. Hopfield and Geoffrey Hinton.
294+
>
295+
> The Nobel Prize Committee cited them "for foundational discoveries and inventions that enable machine learning with artificial neural networks".
296+
297+
…followed by a `### Google Searches` section listing the queries Gemini issued, and a `### Citations` footer where each entry is `[N]: [Real Page Title](https://nobelprize.org/…)` with the verbatim segment as a blockquote.
298+
220299
## Using Perplexica / Vane
221300

222301
### Quick Start
@@ -302,6 +381,13 @@ System Prompt: "You are a technical expert who explains complex concepts clearly
302381
| `Update Perplexity URL` | Change Perplexity API endpoint | Settings command |
303382
| `Show Perplexity Settings` | Display current Perplexity configuration | Debug command |
304383

384+
### Google Gemini Commands
385+
386+
| Command | Description | Usage |
387+
|---------|-------------|-------|
388+
| `Ask Gemini` | Query Google Gemini with Google Search grounding | Editor command with modal interface |
389+
| `Check Gemini service status` | Report whether the service initialized and the API key is configured | Debug command |
390+
305391
### Perplexica / Vane Commands
306392

307393
| Command | Description | Usage |
@@ -343,6 +429,27 @@ A working Obsidian vault collects categories of files that share a shape — con
343429
2. **Commands**`Apply directory template to current file` auto-matches via the glob; `Apply directory template to folder` runs a batch with a confirmation modal; `Stop directory template batch` halts a running batch.
344430
3. **Cleanup pipeline** — after the SSE stream completes, the runtime wraps `<think>` blocks, swaps `[IMAGE N: <description>]` markers for real embeds (with a fallback `# Images` section when the model didn't emit markers but Perplexity returned images), strips unreplaced placeholders, appends a `# Sources` footer in the format [cite-wide](https://github.com/lossless-group/cite-wide) can convert to hex citations, and stamps `cf_last_run` + `cf_last_run_model` into the target's frontmatter.
345431

432+
### Partials and preambles — shared guidance across templates
433+
434+
Two peer folders alongside `templates/` keep editorial rules vault-visible and DRY:
435+
436+
```
437+
Content-Dev/
438+
├── templates/ (your four profile templates)
439+
├── partials/ (reusable snippets: mermaid-discipline, etc.)
440+
│ └── mermaid-discipline.md
441+
└── preambles/ (auto-attached to every request as system / user messages)
442+
├── inline-citation.md
443+
├── image-placement.md
444+
└── research-framing.md
445+
```
446+
447+
- **`{{include: name}}`** in a template body splices in `partials/name.md` recursively (depth-limited, cycle-detected). Missing files show as inline `[[include: name — file not found]]` markers so typos stay visible.
448+
- **Preambles auto-attach** to every Perplexity request with bundled defaults as fallback. Settings tab exposes Partials root, Preambles root, System preambles (default: `inline-citation`), User preambles (default: `image-placement` when return-images is on).
449+
- **Per-template overrides** in the `cft` fence: `preambles: { system: [...], skip-user: [...], skip-all: true }`.
450+
451+
Fix the mermaid quoting rule once in `partials/mermaid-discipline.md` and every future template generation picks it up — no template editing required.
452+
346453
### Shipped templates
347454

348455
Four templates ship inlined into the plugin and seed into your vault on first plugin load:

0 commit comments

Comments
 (0)