@tanstack/ai
Version:
Type-safe TypeScript AI SDK for streaming chat, tool calling, agents, structured outputs, and multimodal generation.
30 lines (29 loc) • 807 B
JavaScript
//#region src/activities/chat/adapter.ts
/**
* Abstract base class for text adapters.
* Extend this class to implement a text adapter for a specific provider.
*
* Generic parameters match TextAdapter - all pre-resolved by the provider function.
*/
var BaseTextAdapter = class {
kind = "text";
model;
requires = void 0;
supportsFileSources = false;
/**
* Provider subclasses override this from their model metadata, for example
* `override readonly inputModalities = INPUT_BY_MODEL[this.model]`.
*/
inputModalities = void 0;
config;
constructor(config = {}, model) {
this.config = config;
this.model = model;
}
generateId() {
return `${this.name}-${Date.now()}-${Math.random().toString(36).substring(7)}`;
}
};
//#endregion
export { BaseTextAdapter };
//# sourceMappingURL=adapter.js.map