MCPcopy Index your code
hub / github.com/simstudioai/sim / validateTokenizationInput

Function validateTokenizationInput

apps/sim/lib/tokenization/utils.ts:115–134  ·  view source on GitHub ↗
(
  model: string,
  inputText: string,
  outputText: string
)

Source from the content-addressed store, hash-verified

113 * Validates tokenization input
114 */
115export function validateTokenizationInput(
116 model: string,
117 inputText: string,
118 outputText: string
119): void {
120 if (!model?.trim()) {
121 throw createTokenizationError('INVALID_MODEL', 'Model is required for tokenization', { model })
122 }
123
124 if (!inputText?.trim() && !outputText?.trim()) {
125 throw createTokenizationError(
126 'MISSING_TEXT',
127 'Either input text or output text must be provided',
128 {
129 inputLength: inputText?.length || 0,
130 outputLength: outputText?.length || 0,
131 }
132 )
133 }
134}
135
136/**
137 * Formats token count for display

Callers 1

calculateStreamingCostFunction · 0.90

Calls 1

createTokenizationErrorFunction · 0.90

Tested by

no test coverage detected