Skip to content

Commit bf79260

Browse files
committed
stronger typing for contract
1 parent de291cc commit bf79260

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

packages/web/src/features/chat/types.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,18 @@ type _AssertAllProviders = LanguageModelProvider extends typeof languageModelPro
209209
const _assertAllProviders: _AssertAllProviders = true;
210210
void _assertAllProviders;
211211

212-
export type InputModality = 'text' | 'image' | 'audio' | 'video';
213-
export type DocumentType = 'pdf';
212+
export const inputModalities = ['text', 'image', 'audio', 'video'] as const;
213+
export type InputModality = typeof inputModalities[number];
214+
215+
export const documentTypes = ['pdf'] as const;
216+
export type DocumentType = typeof documentTypes[number];
214217

215218
export const languageModelInfoSchema = z.object({
216219
provider: z.enum(languageModelProviders).describe("The model provider (e.g., 'anthropic', 'openai')"),
217220
model: z.string().describe("The model ID"),
218221
displayName: z.string().optional().describe("Optional display name for the model"),
219-
inputModalities: z.array(z.enum(['text', 'image', 'audio', 'video'])).default(['text']).describe("The input modalities the model can accept (images, audio, video, text). Single-medium attachments are gated by these. Defaults to text-only."),
220-
supportedDocumentTypes: z.array(z.enum(['pdf'])).default([]).describe("Rich compound document formats (e.g. PDF) the model can ingest natively, distinct from single-medium attachments gated by inputModalities. Defaults to none."),
222+
inputModalities: z.array(z.enum(inputModalities)).default(['text']).describe("The input modalities the model can accept (images, audio, video, text). Single-medium attachments are gated by these. Defaults to text-only."),
223+
supportedDocumentTypes: z.array(z.enum(documentTypes)).default([]).describe("Rich compound document formats (e.g. PDF) the model can ingest natively, distinct from single-medium attachments gated by inputModalities. Defaults to none."),
221224
});
222225

223226
/**

0 commit comments

Comments
 (0)