Skip to content

switch to claude-sonnet-4-6#1

Open
DanRoscigno wants to merge 1 commit into
mainfrom
anthropic
Open

switch to claude-sonnet-4-6#1
DanRoscigno wants to merge 1 commit into
mainfrom
anthropic

Conversation

@DanRoscigno
Copy link
Copy Markdown
Collaborator

No description provided.

Signed-off-by: DanRoscigno <dan@roscigno.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR switches the markdown translation backend from Google Gemini to Anthropic Claude (model set to claude-sonnet-4-6), updating the SDK integration, CLI/API key wiring, and documentation accordingly.

Changes:

  • Replace @google/generative-ai usage with @anthropic-ai/sdk and add a shared callModel() wrapper for Anthropic Messages API calls.
  • Update the AST translation pipeline to build separate { system, user } prompts and parse Anthropic response payloads.
  • Update CLI/README/package metadata to reference Anthropic/Claude and ANTHROPIC_API_KEY.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/translator.js Swaps Gemini client/model setup for Anthropic client and adds callModel() + Anthropic metadata extraction.
src/translator_ast_mvp.js Updates prompt construction and request/repair flow to use callModel() and Anthropic response parsing.
bin/cli.js Switches env var/help text/error hints from Gemini to Anthropic.
README.md Updates user-facing docs from Gemini to Claude/Anthropic (including ANTHROPIC_API_KEY).
package.json Replaces Gemini dependency/keywords with Anthropic equivalents.
package-lock.json Removes Gemini SDK and adds Anthropic SDK + transitive deps.
Comments suppressed due to low confidence (1)

src/translator_ast_mvp.js:563

  • Same issue as the initial request: repairResponse.content[0].text assumes a single text block. If the repair response contains multiple blocks, only the first is used and JSON parsing may fail. Extract/concatenate all text blocks from repairResponse.content before parsing.
            const repairResponse = await this.callModel(repairUser, repairSystem);
            const repairMetadata = this.extractChunkMetadata(repairResponse);
            const repairText = repairResponse.content[0].text;


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/translator_ast_mvp.js
Comment on lines +541 to 545
const { system, user } = this.createAstTranslationPrompt(items, targetLanguage, sourceLanguage);
const response = await this.callModel(user, system);
const metadata = this.extractChunkMetadata(response);
const text = response.content[0].text;

Comment thread package.json
"@google/generative-ai": "^0.24.1",
"@playcanvas/eslint-config": "2.1.0",
"@anthropic-ai/sdk": "^0.95.2",
"@playcanvas/eslint-config": "2.1.0",
Comment thread README.md
The translator now uses the AST pipeline by default.

When `--trace` is enabled, the tool logs one JSON trace record per ID and includes the full `sourceText` and `translatedText` values. The only masking applied is replacing any accidental `GEMINI_API_KEY` occurrences with `***`.
When `--trace` is enabled, the tool logs one JSON trace record per ID and includes the full `sourceText` and `translatedText` values. The only masking applied is replacing any accidental `ANTHROPIC_API_KEY` occurrences with `***`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants