Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

532 B
Raw Blame
import { type ModelParams } from "@langfuse/shared";

export function useValidateCustomModel(
  availableProviders: string[],
  customModelParams?: {
    provider: string;
    model: string;
    modelParams: ModelParams & {
      maxTemperature: number;
    };
  },
): { isCustomModelValid: boolean } {
  if (!customModelParams) {
    return { isCustomModelValid: false };
  }

  if (!availableProviders.includes(customModelParams.provider)) {
    return { isCustomModelValid: false };
  }

  return { isCustomModelValid: true };
}