Maintain consistent parameter names and interface patterns across LLM implementations to improve maintainability and prevent integration issues. This includes:

  1. Use standard parameter names across all LLM integrations (e.g., ‘maxTokens’ instead of ‘maxTokensToSample’)
  2. Check for specific required capabilities rather than assuming implementation details
  3. Use consistent property access patterns for LLM responses

Example:

// INCORRECT
if (!llm.bindTools) {
  throw new LLMServiceError("LLM doesn't support binding tools");
}
const tokens = llmOutput?.tokenUsage?.completionTokens;

// CORRECT
if (typeof llm.withStructuredOutput !== 'function') {
  throw new LLMServiceError("LLM doesn't support structured output");
}
const tokens = llmResult?.llmOutput?.tokenUsage?.completionTokens;

This standardization: