Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,250 changes: 0 additions & 1,250 deletions benchmarks/prompt-logs/prompt-2025-02-18T12-45-42-158Z.txt

This file was deleted.

1,250 changes: 0 additions & 1,250 deletions benchmarks/prompt-logs/prompt-2025-02-18T12-48-05-585Z.txt

This file was deleted.

1,250 changes: 0 additions & 1,250 deletions benchmarks/prompt-logs/prompt-2025-02-18T12-48-05-645Z.txt

This file was deleted.

1,250 changes: 0 additions & 1,250 deletions benchmarks/prompt-logs/prompt-2025-02-18T12-49-18-664Z.txt

This file was deleted.

2,683 changes: 2,683 additions & 0 deletions benchmarks/prompt-logs/prompt-2025-09-28T16-28-18-507Z.txt

Large diffs are not rendered by default.

2,683 changes: 2,683 additions & 0 deletions benchmarks/prompt-logs/prompt-2025-09-28T16-28-18-742Z.txt

Large diffs are not rendered by default.

2,683 changes: 2,683 additions & 0 deletions benchmarks/prompt-logs/prompt-2025-09-28T16-30-20-378Z.txt

Large diffs are not rendered by default.

2,683 changes: 2,683 additions & 0 deletions benchmarks/prompt-logs/prompt-2025-09-28T16-30-20-422Z.txt

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion lib/prompt-templates/create-local-circuit-prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
getFootprintSizes,
fp,
} from "@tscircuit/footprinter"
import { fetchTSCircuitAIDocs } from "../utils/fetch-tscircuit-context"

async function fetchFileContent(url: string): Promise<string> {
try {
Expand Down Expand Up @@ -44,12 +45,17 @@ export const createLocalCircuitPrompt = async () => {
.join("\n")
.replace(/\n\n+/g, "\n\n")

// Fetch comprehensive TSCircuit AI documentation
const tscircuitAIDocs = await fetchTSCircuitAIDocs()

return `
You are an expert in electronic circuit design and tscircuit, and your job is to create a circuit board in tscircuit with the user-provided description.

YOU MUST ABIDE BY THE RULES IN THE RULES SECTION

## tscircuit API overview
## TSCircuit Comprehensive Documentation

${tscircuitAIDocs ? `${tscircuitAIDocs}\n\n` : ''}## tscircuit API overview

Here's an overview of the tscircuit API:

Expand Down
28 changes: 28 additions & 0 deletions lib/utils/fetch-tscircuit-context.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Utility to fetch TSCircuit AI documentation
*/

export async function fetchTSCircuitAIDocs(): Promise<string> {
try {
console.log("Fetching TSCircuit AI documentation from docs.tscircuit.com/ai.txt")

const response = await fetch("https://docs.tscircuit.com/ai.txt", {
headers: {
'User-Agent': 'tscircuit-prompt-benchmarks'
}
})

if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`)
}

const docs = await response.text()
console.log(`Successfully fetched TSCircuit AI docs (${docs.length} characters)`)
return docs

} catch (error) {
console.warn("Failed to fetch TSCircuit AI docs:", error)
console.log("Continuing without TSCircuit AI context")
return ""
}
}
Loading