feat(ai): Add xAI provider and Grok models

Integrates the xAI provider into the unified AI service layer, allowing the use of Grok models (e.g., grok-3, grok-3-mini).

    Changes include:
    - Added  dependency.
    - Created  with implementations for generateText, streamText, and generateObject (stubbed).
    - Updated  to include the xAI provider in the function map.
    - Updated  to recognize the 'xai' provider and the  environment variable.
    - Updated  to include known Grok models and their capabilities (object generation marked as likely unsupported).
This commit is contained in:
Eyal Toledano
2025-04-27 14:47:50 -04:00
parent 2517bc112c
commit ed79d4f473
13 changed files with 315 additions and 28 deletions

16
package-lock.json generated
View File

@@ -15,7 +15,7 @@
"@ai-sdk/mistral": "^1.2.7",
"@ai-sdk/openai": "^1.3.20",
"@ai-sdk/perplexity": "^1.1.7",
"@ai-sdk/xai": "^1.2.13",
"@ai-sdk/xai": "^1.2.15",
"@anthropic-ai/sdk": "^0.39.0",
"@openrouter/ai-sdk-provider": "^0.4.5",
"ai": "^4.3.10",
@@ -155,9 +155,9 @@
}
},
"node_modules/@ai-sdk/openai-compatible": {
"version": "0.2.11",
"resolved": "https://registry.npmjs.org/@ai-sdk/openai-compatible/-/openai-compatible-0.2.11.tgz",
"integrity": "sha512-56U0uNCcFTygA4h6R/uREv8r5sKA3/pGkpIAnMOpRzs5wiARlTYakWW3LZgxg6D4Gpeswo4gwNJczB7nM0K1Qg==",
"version": "0.2.13",
"resolved": "https://registry.npmjs.org/@ai-sdk/openai-compatible/-/openai-compatible-0.2.13.tgz",
"integrity": "sha512-tB+lL8Z3j0qDod/mvxwjrPhbLUHp/aQW+NvMoJaqeTtP+Vmv5qR800pncGczxn5WN0pllQm+7aIRDnm69XeSbg==",
"license": "Apache-2.0",
"dependencies": {
"@ai-sdk/provider": "1.1.3",
@@ -257,12 +257,12 @@
}
},
"node_modules/@ai-sdk/xai": {
"version": "1.2.13",
"resolved": "https://registry.npmjs.org/@ai-sdk/xai/-/xai-1.2.13.tgz",
"integrity": "sha512-vJnzpnRVIVuGgDHrHgfIc3ImjVp6YN+salVX99r+HWd2itiGQy+vAmQKen0Ml8BK/avnLyQneeYRfdlgDBkhgQ==",
"version": "1.2.15",
"resolved": "https://registry.npmjs.org/@ai-sdk/xai/-/xai-1.2.15.tgz",
"integrity": "sha512-18qEYyVHIqTiOMePE00bfx4kJrTHM4dV3D3Rpe+eBISlY80X1FnzZRnRTJo3Q6MOSmW5+ZKVaX9jtryhoFpn0A==",
"license": "Apache-2.0",
"dependencies": {
"@ai-sdk/openai-compatible": "0.2.11",
"@ai-sdk/openai-compatible": "0.2.13",
"@ai-sdk/provider": "1.1.3",
"@ai-sdk/provider-utils": "2.2.7"
},