LanguageModel interface, never to a vendor client. You supply a concrete implementation through an adapter. This keeps the core free of vendor SDKs, keeps browser bundles small, and lets you switch providers in one line.
The LanguageModel contract
generateText
Produces free-form text. The input accepts aprompt, an optional system string, an optional AbortSignal, and an optional logprobs flag.
logprobs, pass a number to request that many top alternatives per token, or true for the chosen tokens with no alternatives. When the provider returns them, logprobs is an array of TokenLogprob (token, logprob, optional topLogprobs). The logprob evaluator builds on this.
generateObject
Produces a structured value validated against a Zod schema. The resultobject is typed as z.infer of the schema you pass.
Model adapters
An adapter is anything that satisfiesLanguageModel. Adapters live in their own subpaths so the core never imports a vendor SDK — you pay for an adapter only when you import it.
Built-in: the Vercel AI SDK adapter
@gaussia/sdk/adapters/ai-sdk is the only built-in adapter today. createAiSdkAdapter wraps any Vercel AI SDK model so it satisfies LanguageModel. It delegates generateObject to the AI SDK’s structured output and maps provider log probabilities into the vendor-neutral TokenLogprob[] shape, so downstream code never depends on a provider’s metadata format.
ai peer and a provider package to use it:
ai@^5 pairs with @ai-sdk/openai@^2. Because the AI SDK supports many providers, switching is a one-line change at the adapter call site — anything ai can construct (OpenAI, Anthropic, and others) works, and the rest of your code is untouched.Bring your own adapter
Any object satisfyingLanguageModel works — no special registration. This is how you connect an internal proxy, a self-hosted model, Bedrock, or a provider without an AI SDK package: implement the two methods and pass it anywhere a model is expected.
generateText provides them, the logprob evaluator uses them; if not, it falls back to a structured judge.
Why adapters
The core depends on theLanguageModel interface, and vendor SDKs live only inside adapter subpaths (see Architecture). That boundary is what lets the same evaluation or optimization code run in the browser, swap providers without churn, and avoid shipping a Node-shaped vendor SDK to clients that import only the core.
Related concepts
Prompt optimizer
GEPA drives optimization through a
LanguageModel.Logprob evaluator
Score from Yes/No token log probabilities.