/
Alex_Ural
/
opencode
Обзор
Документация
Войти
/
Alex_Ural
/
opencode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
packages/core/src/plugin/provider/xai.ts
22 строки
661 B
Dax
feat(plugin): add namespaced hook API (#33416)
23 июн 2026, 02:06
Не верифицирован
23 июн 2026, 02:06
909a1a6
Код
Авторство
О чём код?
import { Effect } from "effect" import { define } from "../internal" import { ProviderV2 } from "../../provider" export const XAIPlugin = define({ id: "xai", effect: Effect.fn(function* (ctx) { yield* ctx.aisdk.sdk( Effect.fn(function* (evt) { if (evt.package !== "@ai-sdk/xai") return const mod = yield* Effect.promise(() => import("@ai-sdk/xai")) evt.sdk = mod.createXai(evt.options) }), ) yield* ctx.aisdk.language( Effect.fn(function* (evt) { if (evt.model.providerID !== ProviderV2.ID.make("xai")) return evt.language = evt.sdk.responses(evt.model.api.id) }), ) }), })