Skip to content

Add Support for Claude Opus 4.1 Model #1673

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

Merged

Conversation

ksylvan
Copy link
Collaborator

@ksylvan ksylvan commented Aug 7, 2025

Add Support for Claude Opus 4.1 Model

Summary

This PR refactors the GitHub Actions release workflow to improve build reliability and adds support for the Claude Opus 4.1 model. The main changes include separating the version retrieval into its own job, simplifying OS detection logic, fixing parameter conflicts for Anthropic models, and updating the anthropic-sdk-go dependency.

Files Changed

  • .github/workflows/release.yml: Restructured the release workflow to separate concerns and improve maintainability
  • cmd/generate_changelog/incoming/1673.txt: Added changelog entry documenting these changes
  • go.mod / go.sum: Updated anthropic-sdk-go dependency from v1.4.0 to v1.7.0
  • internal/plugins/ai/anthropic/anthropic.go: Added Claude Opus 4.1 model support and fixed parameter handling

Code Changes

Release Workflow Refactoring

The workflow now has a dedicated get_version job that runs before the build:

get_version:
  name: Get version
  runs-on: ubuntu-latest
  outputs:
    latest_tag: ${{ steps.get_version.outputs.latest_tag }}

OS detection has been simplified from a multi-step process to inline ternary operators:

GOOS: ${{ matrix.os == 'ubuntu-latest' && 'linux' || 'darwin' }}

Changelog generation has been moved to a separate update_release_notes job that runs after all builds complete:

update_release_notes:
  needs: [build, get_version]
  runs-on: ubuntu-latest

Anthropic Client Updates

Added support for the new Claude Opus 4.1 model:

string(anthropic.ModelClaudeOpus4_1_20250805),

Fixed temperature/topP parameter conflict issue:

// Only set one of Temperature or TopP as some models don't allow both
if opts.Temperature != 0 {
    params.Temperature = anthropic.Opt(opts.Temperature)
} else if opts.TopP != 0 {
    params.TopP = anthropic.Opt(opts.TopP)
}

Reason for Changes

  1. Workflow Reliability: The previous workflow had version retrieval duplicated across matrix jobs, which could lead to race conditions and inefficiencies. Separating this into its own job ensures it runs once and provides consistent output.

  2. Claude Opus 4.1 Support: Adding support for the latest Claude model provides users with access to improved AI capabilities.

  3. Parameter Conflict Fix: Some Anthropic models don't allow both temperature and topP parameters to be set simultaneously, which was causing API errors.

  4. Simplified OS Detection: The previous multi-step OS detection was unnecessarily complex and could be replaced with inline conditionals.

Impact of Changes

  • Improved CI/CD Performance: Version retrieval now happens once instead of multiple times across matrix jobs
  • Better Error Handling: The temperature/topP fix prevents API errors when using certain Anthropic models
  • Enhanced Model Support: Users can now leverage the latest Claude Opus 4.1 model
  • Cleaner Workflow: Separation of concerns makes the workflow easier to maintain and debug

Test Plan

  1. Verify the workflow runs successfully on push to main branch
  2. Confirm version is correctly extracted from nix/pkgs/fabric/version.nix
  3. Test that binaries are built for all OS/architecture combinations
  4. Verify release notes are properly generated after all builds complete
  5. Test Claude Opus 4.1 model integration with various temperature/topP combinations

Additional Notes

  • The workflow now has explicit job dependencies (needs: [test, get_version]) ensuring proper execution order
  • The changelog generation runs as a final step to avoid conflicts with concurrent build jobs
  • The anthropic-sdk-go upgrade from v1.4.0 to v1.7.0 may include additional improvements beyond the Opus 4.1 model support

Potential Issues to Monitor:

  • The ternary operator approach for OS detection should be tested across all matrix combinations
  • The temperature/topP logic prioritizes temperature when both are set - this behavior should be documented
  • The separate update_release_notes job requires all builds to complete successfully before running

ksylvan added 2 commits August 6, 2025 19:50
…otes generation

## CHANGES

- Upgrade anthropic-sdk-go from v1.4.0 to v1.7.0
- Move changelog generation to separate workflow job
- Add Claude Opus 4.1 model support
- Fix temperature/topP parameter conflict for models
- Separate release artifact upload from changelog update
- Add dedicated update_release_notes job configuration
@ksylvan ksylvan requested a review from Copilot August 7, 2025 03:03
Copilot

This comment was marked as resolved.

@ksylvan ksylvan requested a review from Copilot August 7, 2025 03:30
Copilot

This comment was marked as outdated.

ksylvan added 4 commits August 6, 2025 20:56
## CHANGES

- Add domain constants for default chat parameter values
- Update Anthropic client to check explicitly set parameters
- Add documentation linking CLI flags to domain defaults
- Improve temperature and TopP parameter selection logic
- Ensure consistent default values across CLI and domain
- Replace zero-value checks with explicit default comparisons
- Centralize chat option defaults in domain package
…default

## CHANGES

- Always set temperature parameter for consistent behavior
- Prioritize TopP over temperature when explicitly set
- Override Anthropic's default 1.0 with Fabric's 0.7
- Add comprehensive tests for parameter precedence logic
- Update VSCode dictionary with Keploy entry
- Simplify conditional logic for temperature/TopP selection
@ksylvan ksylvan requested a review from Copilot August 7, 2025 04:34
Copy link

@Copilot 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 adds support for Claude Opus 4.1 model and refactors the GitHub Actions release workflow to improve build reliability. The main changes include separating version retrieval into a dedicated job, simplifying OS detection logic, and fixing parameter conflicts in the Anthropic client.

  • Add Claude Opus 4.1 model support to the Anthropic client
  • Fix temperature/topP parameter conflict that was causing API errors
  • Refactor GitHub Actions workflow to improve reliability with separated version job

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/plugins/ai/anthropic/anthropic.go Added Claude Opus 4.1 model and fixed temperature/topP parameter handling
internal/plugins/ai/anthropic/anthropic_test.go Added comprehensive tests for parameter handling logic
internal/domain/domain.go Added default constants for chat parameters
internal/cli/flags.go Added comment about parameter defaults consistency
go.mod Updated anthropic-sdk-go from v1.4.0 to v1.7.0
.github/workflows/release.yml Refactored workflow with dedicated version job and simplified OS detection
cmd/generate_changelog/incoming/1673.txt Added changelog entry for the changes
.vscode/settings.json Added "Keploy" to spell check dictionary

@ksylvan ksylvan merged commit bc64290 into danielmiessler:main Aug 7, 2025
1 check passed
@ksylvan ksylvan deleted the 0806-update-anthropic-to-support-opus-4-1 branch August 7, 2025 04:53
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.

1 participant