-
Notifications
You must be signed in to change notification settings - Fork 36
feat: use auto-generated docs in the system prompt (#45) #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 6 commits
782e715
dec6b9d
0176828
2e1adde
2bf336d
f8b3dc1
e063baf
66678c2
88aaca7
bf7bd8f
85c9baa
6f6aa54
bb6210a
7896fea
142d525
b9c83ff
28d961c
2d695ce
6a6e1a8
957f1ac
8c628f6
8aca7e8
bd915ac
4c24823
f466f97
cedd104
fb07165
0720729
74204b9
65f9010
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { getSystemPromptWithDocs } from "../lib/get-system-prompt-with-docs" | ||
|
|
||
| /** | ||
| * Re-exports the system prompt with auto-generated docs for use in evals. | ||
| * Import `systemPrompt` from this module wherever you need the full prompt. | ||
| * | ||
| * Example usage in an eval file: | ||
| * | ||
| * ```ts | ||
| * import { systemPrompt } from "../evals/eval-with-docs.eval" | ||
| * | ||
| * const result = await aiModel.complete({ | ||
| * system: systemPrompt, | ||
| * prompt: "Create a simple LED circuit with a current-limiting resistor", | ||
| * }) | ||
| * ``` | ||
| */ | ||
| export const systemPrompt = getSystemPromptWithDocs() | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,58 @@ | ||||||||||
| import * as fs from "fs" | ||||||||||
| import * as path from "path" | ||||||||||
|
||||||||||
| import * as fs from "fs" | |
| import * as path from "path" | |
| import fs from "node:fs" | |
| import path from "node:path" |
Copilot
AI
Mar 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are now multiple hard-coded base prompt variants across lib/system-prompt.ts, lib/get-system-prompt.ts, and this getBaseSystemPrompt() (different rules/examples and different docs wrapper formats). This duplication is likely to drift over time; consider extracting a single shared base prompt builder and having each variant only customize the docs-loading/wrapping strategy.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,112 @@ | ||||||||||||||||||||||||||||
| import * as fs from "fs" | ||||||||||||||||||||||||||||
| import * as path from "path" | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
| import * as fs from "fs" | |
| import * as path from "path" | |
| import fs from "node:fs" | |
| import path from "node:path" |
Copilot
AI
Mar 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file exports an async getSystemPrompt(), but lib/system-prompt.ts also exports a sync getSystemPrompt() with different formatting/wrapping. Having two similarly-named public APIs for the same concept is confusing and can lead to importing the wrong one; consider consolidating to one implementation or renaming to reflect behavior (sync vs async / cached vs fetch) and standardizing the docs wrapper format.
| * Builds the system prompt used for AI-based circuit generation benchmarks. | |
| * Incorporates auto-generated tscircuit component documentation so the model | |
| * has accurate, up-to-date API references. | |
| */ | |
| export async function getSystemPrompt(): Promise<string> { | |
| * Builds the system prompt used for AI-based circuit generation benchmarks, | |
| * including auto-generated tscircuit component documentation so the model | |
| * has accurate, up-to-date API references. | |
| * | |
| * This async variant fetches the latest docs (from local cache or remote) | |
| * and should be used when you need a prompt with embedded documentation. | |
| */ | |
| export async function getSystemPromptWithDocs(): Promise<string> { |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,64 @@ | ||||||||||
| import * as fs from "fs" | ||||||||||
| import * as path from "path" | ||||||||||
|
||||||||||
| import * as fs from "fs" | |
| import * as path from "path" | |
| import fs from "node:fs" | |
| import path from "node:path" |
Copilot
AI
Mar 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring states this is "the main system prompt used in all tscircuit prompt benchmarks", but the benchmarks currently build the system prompt via createLocalCircuitPrompt() (see benchmarks/benchmark-local-circuit*.eval.ts) and nothing imports lib/system-prompt.ts. Please either wire this prompt builder into the benchmark flow or reword the comment to avoid misleading future readers.
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,63 @@ | ||||||||||
| /** | ||||||||||
| * Script to fetch and cache the auto-generated tscircuit documentation. | ||||||||||
| * Run this periodically to keep the docs up-to-date. | ||||||||||
| * | ||||||||||
| * Usage: npx tsx scripts/update-docs.ts | ||||||||||
| */ | ||||||||||
|
|
||||||||||
| import * as fs from "fs" | ||||||||||
| import * as path from "path" | ||||||||||
|
||||||||||
| import * as fs from "fs" | |
| import * as path from "path" | |
| import fs from "node:fs" | |
| import path from "node:path" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR description mentions appending cached docs inside a clearly delimited
<tscircuit_docs>block, but this eval re-export usesgetSystemPromptWithDocs()which appends docs under a markdown heading and does not include the<tscircuit_docs>delimiter. Please align the eval prompt output with the intended wrapper (either change the builder to wrap in<tscircuit_docs>or import the builder that already does so).