feat(core): add google vertex ai (#12423)

Close [AI-125](https://linear.app/affine-design/issue/AI-125)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Added new provider configurations `geminiVertex` and `anthropicVertex` for Google Vertex AI in backend schema, provider classes, and admin config.
  - Introduced `GeminiVertexProvider` and `AnthropicVertexProvider` classes supporting Vertex AI models with specific capabilities.
  - Expanded model options for transcription prompts with newer Gemini models.
  - Re-exported provider modules to include Vertex AI variants.

- **Improvements**
  - Extended provider architecture to support separate Vertex AI configurations and models.
  - Updated test setup to replace deprecated provider references with new Vertex variants.
  - Consolidated environment variables for server testing with a single `SERVER_CONFIG`.

- **Bug Fixes**
  - Updated mock models and import references in tests to align with new provider classes.

- **Chores**
  - Added `@ai-sdk/google-vertex` dependency for Vertex AI support.
  - Updated dependency list to include `@ai-sdk/google-vertex`.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
akumatus
2025-05-26 13:09:28 +00:00
parent eb26e99ecd
commit 5fcdad46eb
21 changed files with 487 additions and 191 deletions
+19 -3
View File
@@ -909,6 +909,7 @@ __metadata:
"@affine/server-native": "workspace:*"
"@ai-sdk/anthropic": "npm:^1.2.10"
"@ai-sdk/google": "npm:^1.2.18"
"@ai-sdk/google-vertex": "npm:^2.2.22"
"@ai-sdk/openai": "npm:^1.3.21"
"@ai-sdk/perplexity": "npm:^1.1.6"
"@apollo/server": "npm:^4.11.3"
@@ -1073,7 +1074,7 @@ __metadata:
languageName: unknown
linkType: soft
"@ai-sdk/anthropic@npm:^1.2.10":
"@ai-sdk/anthropic@npm:1.2.11, @ai-sdk/anthropic@npm:^1.2.10":
version: 1.2.11
resolution: "@ai-sdk/anthropic@npm:1.2.11"
dependencies:
@@ -1085,7 +1086,22 @@ __metadata:
languageName: node
linkType: hard
"@ai-sdk/google@npm:^1.2.18":
"@ai-sdk/google-vertex@npm:^2.2.22":
version: 2.2.22
resolution: "@ai-sdk/google-vertex@npm:2.2.22"
dependencies:
"@ai-sdk/anthropic": "npm:1.2.11"
"@ai-sdk/google": "npm:1.2.18"
"@ai-sdk/provider": "npm:1.1.3"
"@ai-sdk/provider-utils": "npm:2.2.8"
google-auth-library: "npm:^9.15.0"
peerDependencies:
zod: ^3.0.0
checksum: 10/852928d35797cc14802d8c4a7dba2794197f019507a24124e7f87e456ba19f2b4e50438af626dd30e3a2a0f9f10819d6534a31e23c08f7f3d148d56b68167d0a
languageName: node
linkType: hard
"@ai-sdk/google@npm:1.2.18, @ai-sdk/google@npm:^1.2.18":
version: 1.2.18
resolution: "@ai-sdk/google@npm:1.2.18"
dependencies:
@@ -22796,7 +22812,7 @@ __metadata:
languageName: node
linkType: hard
"google-auth-library@npm:^9.0.0, google-auth-library@npm:^9.7.0":
"google-auth-library@npm:^9.0.0, google-auth-library@npm:^9.15.0, google-auth-library@npm:^9.7.0":
version: 9.15.1
resolution: "google-auth-library@npm:9.15.1"
dependencies: