logancyang_obsidian-copilot/docs/models-and-parameters.md
Logan Yang d3ee3f999b
fix: agent loop improvements, clickable citations, and UI fixes (#2287)
* fix: prevent agent ReAct loop from getting stuck with small local models

Small local models (e.g. qwen3.5-4b-mlx) get stuck calling localSearch
repeatedly with near-identical queries and never synthesizing an answer.

- Remove QueryExpander from agent loop to avoid model contention on
  single-connection local models (retriever still expands internally)
- Add query deduplication that pre-filters tool call batches using
  Jaccard word-overlap similarity before execution
- Force synthesis via raw model (without tools) after 2 consecutive
  iterations where all tool calls are duplicates
- Add agent-specific system prompt guidance for search limits
- Strip leaked chat template role tokens from intermediate content
- Add intermediate model output logging for debugging

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: make inline citation numbers clickable and restore Max Sources setting

Inline citation numbers like [1], [2] in chat responses are now clickable
links that open the corresponding source note. Also restores the Max Sources
slider in QA settings, reverting the hardcoded DEFAULT_MAX_SOURCE_CHUNKS.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: remove excessive 32px bottom padding from chat view on desktop

The padding-bottom on .view-content used max(safe-area + 4px, 32px),
forcing a 32px minimum even on desktop where safe-area-inset-bottom is 0.
Simplified to safe-area + 4px so desktop gets minimal padding while
devices with safe areas still get proper spacing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(agent): track dedup queries post-execution to keep failed searches retryable

Move previousSearchQueries tracking from before to after each localSearch tool
call executes. Previously, queries were marked as seen before any tool ran, so
if a call was aborted or the loop threw early, those queries were still blocked
from retrying on the next iteration. Now each query is added to
previousSearchQueries immediately after its tool call returns, keeping the dedup
effective for completed calls while leaving transient failures retryable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(citations): preserve Obsidian internal-link attributes on inline citation anchors

When building clickable inline citation links (e.g. [1], [2]), the previous code
only copied the href from the source section anchor. Obsidian vault-note links have
additional attributes such as data-href and class="internal-link" that are required
for in-app note navigation. Without them, clicking an inline citation resolves the
link as a plain relative URL instead of opening the corresponding note.

Fix: store the source anchor element rather than just the href, then copy all
attributes onto the generated citation anchor before setting the citation-specific
class and aria-label overrides.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(agent): only mark localSearch queries as seen after successful execution

Change the dedup tracking condition from always tracking queries post-execution
to only tracking when the tool call succeeds (result.success is true). This
ensures transient failures (e.g. temporary index unavailability) leave the
query retryable: if a localSearch fails, the model can issue the same query
again on the next iteration. Previously, even a failed execution would mark
the query as seen, blocking recovery.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: deduplicate inline citations after source consolidation

When multiple chunks come from the same note, the LLM cites them
separately. After consolidation maps them to the same source number,
adjacent duplicates like [1][1] or [1] and [1] now collapse to [1].

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore: update GPT-5.2 to GPT-5.4 in builtin models

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: add dynamic status bar clearance for desktop chat view

The chat input was hidden behind Obsidian's status bar on desktop.
Adds ChatViewLayout which measures the geometric overlap between
the view-content and the status bar, setting a CSS variable to
provide the exact padding needed. Adapts to any theme: no clearance
for auto-hide themes (opacity: 0) or themes that already account
for the status bar in their layout; correct clearance for themes
where the bar is visible and overlapping. Re-checks on theme
switches via debounced css-change listener.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: suppress thinking tokens during streaming when reasoning is disabled

When a local model (e.g. Qwen 3.5 via LM Studio) emits text-level
<think> tags but the user has not enabled the reasoning capability,
the thinking content was visibly rendered during streaming and only
stripped once the </think> tag arrived. Now tracks the position of
excluded think blocks across chunks and truncates fullResponse to
the safe prefix on each chunk, so thinking content never appears.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 16:17:37 -07:00

5.9 KiB
Raw Blame History

Models and Parameters

This guide explains how to manage chat models, embedding models, and the parameters that control how the AI behaves.


Chat Models

Built-In Models

Copilot comes with a set of built-in models across many providers. Some are always included ("core" models); others can be enabled or disabled.

Model Provider Capabilities
copilot-plus-flash Copilot Plus Vision (Plus exclusive)
google/gemini-2.5-flash OpenRouter Vision
google/gemini-2.5-pro OpenRouter Vision
google/gemini-3-flash-preview OpenRouter Vision, Reasoning
google/gemini-3.1-pro-preview OpenRouter Vision, Reasoning
openai/gpt-5.4 OpenRouter Vision
openai/gpt-5-mini OpenRouter Vision
gpt-5.4 OpenAI Vision
gpt-5-mini OpenAI Vision
gpt-4.1 OpenAI Vision
gpt-4.1-mini OpenAI Vision
claude-opus-4-6 Anthropic Vision, Reasoning
claude-sonnet-4-5-20250929 Anthropic Vision, Reasoning
gemini-2.5-pro Google Vision
gemini-2.5-flash Google Vision
gemini-3-flash-preview Google Vision, Reasoning
grok-4-1-fast XAI Vision
deepseek-chat DeepSeek
deepseek-reasoner DeepSeek Reasoning

Model Capability Badges

Models may show capability badges:

  • Reasoning — Extended internal thinking before responding; better for complex tasks
  • Vision — Can process images (e.g., screenshots, diagrams embedded in notes)
  • Web Search — Can access the internet directly (model-native feature)

Managing Models

Go to Settings → Copilot → Model to see the full model list.

  • Enable/disable — Toggle individual models on or off to control what appears in the model selector
  • Reorder — Drag models to change their order in the dropdown
  • Delete — Remove custom models you've added

Adding Custom Models

If your provider offers a model that isn't in the built-in list, you can add it manually:

  1. Go to Settings → Copilot → Model
  2. Click Add Model
  3. Enter the model name exactly as the provider expects it (e.g., gpt-4-turbo-preview)
  4. Select the provider
  5. Optionally set a custom base URL (useful for proxies or alternate endpoints)
  6. Save

Importing Models from Provider

You can automatically import the full list of available models from a provider:

  1. Go to Settings → Copilot → Model
  2. Find the Import models button for your provider
  3. Copilot will fetch the provider's model list and add new ones

Embedding Models

Embedding models convert text into numerical vectors, which powers semantic (meaning-based) search in Vault QA and the "Relevant Notes" feature.

Built-In Embedding Models

Model Provider
copilot-plus-small Copilot Plus (Plus exclusive)
copilot-plus-large Copilot Plus (Believer exclusive)
copilot-plus-multilingual Copilot Plus (Plus exclusive)
openai/text-embedding-3-small OpenRouter
text-embedding-3-small OpenAI
text-embedding-3-large OpenAI
embed-multilingual-light-v3.0 Cohere
text-embedding-004 Google
gemini-embedding-001 Google
Qwen3-Embedding-0.6B SiliconFlow

Selecting an Embedding Model

Go to Settings → Copilot → QAEmbedding Model.

If you change embedding models, you must rebuild the vault index because the old vectors are incompatible with the new model. Copilot will prompt you to confirm before rebuilding.

What Embeddings Affect

  • Vault QA mode — Uses embeddings to find relevant notes by meaning
  • Semantic Search — The "Enable Semantic Search" toggle in QA settings
  • Relevant Notes — Shows semantically similar notes in the sidebar

Model Parameters

These settings control how the AI responds. Global defaults live in Settings → Copilot → Model. You can override them per-session using the gear icon in the chat panel.

Temperature

Controls how random or creative the responses are.

  • Range: 0.01.0
  • Default: 0.1
  • Low (0.00.2): Precise, factual, deterministic
  • Medium (0.40.6): Balanced
  • High (0.81.0): Creative, varied, less predictable

Max Tokens

Maximum number of tokens in the AI's response. A token is roughly ¾ of a word (so 1,000 tokens ≈ 750 words).

  • Default: 6,000
  • Higher values allow longer responses but cost more

Conversation Turns in Context

How many past conversation turns to include in each request. More turns = more context but larger requests.

  • Default: 15 turns
  • Reduce this if you hit context limits or want to lower costs

Auto-Compact Threshold

When the conversation reaches this many tokens, older messages are automatically summarized.

  • Default: 128,000 tokens
  • Range: 64,0001,000,000 tokens
  • See Chat Interface for details

Reasoning Effort

For reasoning-capable models (like deepseek-reasoner, claude-opus-4-6), controls how much internal reasoning the model does before responding.

  • Options: minimal, low, medium, high, xhigh
  • Default: low
  • Higher effort = better results on complex tasks, slower responses

Verbosity

For models that support it, controls response length and detail.

  • Options: low, medium, high
  • Default: medium

Top P

An alternative to temperature for controlling randomness. Leave at default unless you have a specific reason to change it.

Frequency Penalty

Reduces the likelihood of the model repeating itself.


Default Model Selection

Your default model is the one Copilot uses when you open a new chat. Set it in: Settings → Copilot → Basic → Default Chat Model

The default is OpenRouter Gemini 2.5 Flash (requires OpenRouter API key).