Graphorin API reference v0.1.0
Graphorin API reference / @graphorin/provider / adapters/vercel
adapters/vercel
vercelAdapter — wraps a Vercel AI SDK LanguageModel-shaped value into a Graphorin Provider. The adapter is the default cloud path: it speaks the AI SDK's streamText / generateText API and maps the resulting events onto the canonical import('@graphorin/core').ProviderEvent discriminated union.
The AI SDK is an optional peer dependency of @graphorin/provider. Production callers leave runtimeOverrides unset and the adapter dynamically imports the package on first use; test fixtures pass a runtimeOverrides value to short-circuit the import and feed fixture chunks directly. The overrides shape is intentionally structural so users can supply hand-rolled stubs or any compatible library.
Interfaces
| Interface | Description |
|---|---|
| AISDKChunk | Loose chunk shape emitted by the AI SDK's streamText. The shape is intentionally permissive — we accept anything that carries the fields we use and ignore the rest. This keeps the adapter tolerant of additive AI SDK schema changes. |
| LanguageModelLike | Structural shape the adapter expects from the AI SDK language model value. The real LanguageModelV4 matches this shape. Re-declared here so we do not pin a hard dependency on @ai-sdk/provider. |
| VercelAdapterOptions | Options accepted by vercelAdapter. |
| VercelRuntimeOverrides | Subset of the AI SDK surface used by the adapter. |
Functions
| Function | Description |
|---|---|
| __resetVercelRuntimeCache | Test-only hook that resets the cached AI SDK runtime. Provider tests that mutate the cache (e.g. by injecting a mock then verifying the default loader runs) call this between scenarios. |
| vercelAdapter | Wrap a Vercel AI SDK language-model value in a Graphorin Provider. The adapter passes Graphorin Messages through directly — both formats use the same role + content discriminated shape — and translates the streaming chunks emitted by the AI SDK onto Graphorin ProviderEvents. |