mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-26 23:28:43 +00:00
feat(core): add a Gemini prompt section on batching tool calls
This commit is contained in:
parent
355d1e79d9
commit
6cc067b99d
4 changed files with 15 additions and 3 deletions
|
|
@ -12,6 +12,7 @@ import PROMPT_ASTRA from "./system-prompt/gpt-astra.txt"
|
|||
import PROMPT_META from "./system-prompt/meta.txt"
|
||||
import PROMPT_TRINITY from "./system-prompt/trinity.txt"
|
||||
import PROMPT_ANTHROPIC from "./system-prompt/anthropic.txt"
|
||||
import PROMPT_GEMINI from "./system-prompt/gemini.txt"
|
||||
|
||||
const GPT_6_2 = [
|
||||
"gpt-6.2",
|
||||
|
|
@ -41,6 +42,12 @@ export const AnthropicPlugin = make(
|
|||
"append",
|
||||
)
|
||||
|
||||
export const GeminiPlugin = make(
|
||||
"opencode.prompt.gemini",
|
||||
(model) => (model.id.toLowerCase().includes("gemini") ? PROMPT_GEMINI : undefined),
|
||||
"append",
|
||||
)
|
||||
|
||||
export const ArceePlugin = make("opencode.prompt.arcee", (model) =>
|
||||
model.id.toLowerCase().includes("trinity") ? PROMPT_TRINITY : undefined,
|
||||
)
|
||||
|
|
@ -49,7 +56,7 @@ export const MetaPlugin = make("opencode.prompt.meta", (model) => {
|
|||
return PROMPT_META.replaceAll("{{MODEL_NAME}}", model.name)
|
||||
})
|
||||
|
||||
export const Plugins = [OpenAIPlugin, AnthropicPlugin, ArceePlugin, MetaPlugin] as const
|
||||
export const Plugins = [OpenAIPlugin, AnthropicPlugin, GeminiPlugin, ArceePlugin, MetaPlugin] as const
|
||||
|
||||
const models = new WeakMap<SessionHooks["context"], Model.Info>()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# System Prompts
|
||||
|
||||
Most prompts in this directory override the baseline prompt at `packages/core/src/session/runner/prompt/system.txt` (see `packages/core/src/plugin/optimize.ts`; currently only `anthropic.txt` appends to it).
|
||||
Most prompts in this directory override the baseline prompt at `packages/core/src/session/runner/prompt/system.txt` (see `packages/core/src/plugin/optimize.ts`; currently only `anthropic.txt` and `gemini.txt` append to it).
|
||||
|
||||
When updating high-level harness instructions in `system.txt` or any override prompt here — such as `# Harness` rules, `<system-update>`, `<background-result>`, `${OPENCODE_TOOL_GUIDANCE}`, or `# Working in codebases` — update the other override prompts in this directory too so they stay consistent.
|
||||
|
|
|
|||
3
packages/core/src/plugin/system-prompt/gemini.txt
Normal file
3
packages/core/src/plugin/system-prompt/gemini.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Tool calls
|
||||
- Every response is a separate model request over the whole conversation, so tool calls that don't depend on each other belong together in one response.
|
||||
- Commands that depend on each other can run as one shell command, and file contents already in the conversation don't need to be read again unless they have changed.
|
||||
|
|
@ -20,10 +20,12 @@ import PROMPT_GPT_6_2 from "../../src/plugin/system-prompt/gpt-6.2.txt"
|
|||
import PROMPT_ASTRA from "../../src/plugin/system-prompt/gpt-astra.txt"
|
||||
import PROMPT_TRINITY from "../../src/plugin/system-prompt/trinity.txt"
|
||||
import PROMPT_ANTHROPIC from "../../src/plugin/system-prompt/anthropic.txt"
|
||||
import PROMPT_GEMINI from "../../src/plugin/system-prompt/gemini.txt"
|
||||
|
||||
const it = testEffect(PluginTestLayer)
|
||||
const fallback = SessionSystemPrompt.make([])
|
||||
const appended = `${fallback}\n\n${SessionSystemPrompt.render(PROMPT_ANTHROPIC, [])}`
|
||||
const gemini = `${fallback}\n\n${SessionSystemPrompt.render(PROMPT_GEMINI, [])}`
|
||||
const makeHost = Effect.gen(function* () {
|
||||
const agents = yield* Agent.Service
|
||||
const plugins = yield* Plugin.Service
|
||||
|
|
@ -105,7 +107,7 @@ describe("OptimizePlugin", () => {
|
|||
["gpt-latest", PROMPT_GPT_6_2],
|
||||
["gpt-6.3-sol", PROMPT_GPT],
|
||||
["gpt-7", PROMPT_GPT],
|
||||
["gemini-2.5-pro", fallback],
|
||||
["gemini-2.5-pro", gemini],
|
||||
["claude-sonnet-4", appended],
|
||||
["kimi-k2", fallback],
|
||||
["trinity", PROMPT_TRINITY],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue