Skip to content

Claude Sonnet 4 and Opus 4 Support for VertexAI Provider #317

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

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add comprehensive tests for VertexAI Claude models integration
Co-authored-by: king-11 <52061363+king-11@users.noreply.github.com>
  • Loading branch information
Copilot and king-11 committed Jul 14, 2025
commit d21788c339d80a5c33d716cdc425b40fc0c86d6f
95 changes: 95 additions & 0 deletions internal/llm/models/vertexai_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package models

import (
"testing"
)

func TestVertexAIClaudeModels(t *testing.T) {
// Test that Claude Sonnet 4 model is correctly defined
claude4Sonnet, exists := SupportedModels[VertexAIClaude4Sonnet]
if !exists {
t.Errorf("VertexAI Claude Sonnet 4 model not found in SupportedModels")
return
}

// Verify model properties
if claude4Sonnet.ID != VertexAIClaude4Sonnet {
t.Errorf("Expected ID %s, got %s", VertexAIClaude4Sonnet, claude4Sonnet.ID)
}
if claude4Sonnet.Name != "VertexAI: Claude Sonnet 4" {
t.Errorf("Expected name 'VertexAI: Claude Sonnet 4', got %s", claude4Sonnet.Name)
}
if claude4Sonnet.Provider != ProviderVertexAI {
t.Errorf("Expected provider %s, got %s", ProviderVertexAI, claude4Sonnet.Provider)
}
if claude4Sonnet.APIModel != "claude-sonnet-4" {
t.Errorf("Expected API model 'claude-sonnet-4', got %s", claude4Sonnet.APIModel)
}
if !claude4Sonnet.CanReason {
t.Errorf("Expected Claude Sonnet 4 to support reasoning")
}
if !claude4Sonnet.SupportsAttachments {
t.Errorf("Expected Claude Sonnet 4 to support attachments")
}

// Test that Claude Opus 4 model is correctly defined
claude4Opus, exists := SupportedModels[VertexAIClaude4Opus]
if !exists {
t.Errorf("VertexAI Claude Opus 4 model not found in SupportedModels")
return
}

// Verify model properties
if claude4Opus.ID != VertexAIClaude4Opus {
t.Errorf("Expected ID %s, got %s", VertexAIClaude4Opus, claude4Opus.ID)
}
if claude4Opus.Name != "VertexAI: Claude Opus 4" {
t.Errorf("Expected name 'VertexAI: Claude Opus 4', got %s", claude4Opus.Name)
}
if claude4Opus.Provider != ProviderVertexAI {
t.Errorf("Expected provider %s, got %s", ProviderVertexAI, claude4Opus.Provider)
}
if claude4Opus.APIModel != "claude-opus-4" {
t.Errorf("Expected API model 'claude-opus-4', got %s", claude4Opus.APIModel)
}
if !claude4Opus.SupportsAttachments {
t.Errorf("Expected Claude Opus 4 to support attachments")
}

// Check reasoning capability - should match the Anthropic model
anthropicOpusModel := AnthropicModels[Claude4Opus]
if claude4Opus.CanReason != anthropicOpusModel.CanReason {
t.Errorf("Expected CanReason to match Anthropic model: %v, got %v", anthropicOpusModel.CanReason, claude4Opus.CanReason)
}

// Test that pricing is inherited correctly from Anthropic models
anthropicSonnet := AnthropicModels[Claude4Sonnet]
if claude4Sonnet.CostPer1MIn != anthropicSonnet.CostPer1MIn {
t.Errorf("Expected inherited input cost %f, got %f", anthropicSonnet.CostPer1MIn, claude4Sonnet.CostPer1MIn)
}
if claude4Sonnet.ContextWindow != anthropicSonnet.ContextWindow {
t.Errorf("Expected inherited context window %d, got %d", anthropicSonnet.ContextWindow, claude4Sonnet.ContextWindow)
}

anthropicOpus := AnthropicModels[Claude4Opus]
if claude4Opus.CostPer1MIn != anthropicOpus.CostPer1MIn {
t.Errorf("Expected inherited input cost %f, got %f", anthropicOpus.CostPer1MIn, claude4Opus.CostPer1MIn)
}
if claude4Opus.ContextWindow != anthropicOpus.ContextWindow {
t.Errorf("Expected inherited context window %d, got %d", anthropicOpus.ContextWindow, claude4Opus.ContextWindow)
}
}

func TestVertexAIProviderPriority(t *testing.T) {
// Test that VertexAI provider is included in the popularity rankings
priority, exists := ProviderPopularity[ProviderVertexAI]
if !exists {
t.Errorf("VertexAI provider not found in ProviderPopularity")
return
}

// VertexAI should have a reasonable priority (not 0)
if priority <= 0 {
t.Errorf("Expected positive priority for VertexAI provider, got %d", priority)
}
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy