Skip to content

Cache generated docs in local circuit prompt#61

Open
694410194 wants to merge 2 commits into
tscircuit:mainfrom
694410194:codex/cache-generated-docs-prompt-45
Open

Cache generated docs in local circuit prompt#61
694410194 wants to merge 2 commits into
tscircuit:mainfrom
694410194:codex/cache-generated-docs-prompt-45

Conversation

@694410194
Copy link
Copy Markdown

Summary

  • include the generated tscircuit docs from https://docs.tscircuit.com/ai.txt in the local circuit prompt
  • load the required props docs and optional generated docs in parallel
  • cache generated docs during the process so benchmark runs do not refetch them for every prompt build
  • make OpenAI-backed tests opt-in via RUN_OPENAI_TESTS to keep default test runs deterministic

Tests

  • bun test tests/prompt-templates/create-local-circuit-prompt.test.ts --timeout 50000
  • bun test --timeout 50000
  • bun x tsc --noEmit
  • bun run build

/claim #45

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 04261fab37

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

async function getGeneratedTscircuitDocs(): Promise<string> {
generatedDocsCache ??= await fetchOptionalFileContent(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid caching empty docs after transient fetch failures

The new cache assignment generatedDocsCache ??= await fetchOptionalFileContent(...) permanently stores "" when https://docs.tscircuit.com/ai.txt is temporarily unavailable (network error/503). Because "" is not nullish, all later prompt builds skip refetching and never recover generated docs until process restart, so long-running sessions can miss the “most up-to-date tscircuit API reference” even after the endpoint recovers.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant