From ea8e6a1106be58f6e246b17c5603aaeb6aa01598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Mata?= Date: Sat, 20 Dec 2025 00:08:10 +0000 Subject: [PATCH] Improve Langfuse setup check via rake --- lib/tasks/evals.rake | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/tasks/evals.rake b/lib/tasks/evals.rake index 1987124f8..f34afdce0 100644 --- a/lib/tasks/evals.rake +++ b/lib/tasks/evals.rake @@ -427,12 +427,34 @@ namespace :evals do task check: :environment do begin client = Eval::Langfuse::Client.new + + # Obfuscate keys for display + public_key = ENV["LANGFUSE_PUBLIC_KEY"] + secret_key = ENV["LANGFUSE_SECRET_KEY"] + + obfuscate_key = lambda do |key| + return "null" if key.blank? + return "#{key[3..8]}***" if key.length <= 8 + "#{key[0..7]}...#{key[-4..-1]}" + end + + # Determine region + region = if ENV["LANGFUSE_HOST"].present? + "custom (#{ENV['LANGFUSE_HOST']})" + elsif ENV["LANGFUSE_REGION"].present? + ENV["LANGFUSE_REGION"] + else + "eu (default)" + end + puts "✓ Langfuse credentials configured" + puts " 🔑 Public Key: #{obfuscate_key.call(public_key)}" + puts " 🔐 Secret Key: #{obfuscate_key.call(secret_key)}" + puts " 🌍 Region: #{region}" # Try to list datasets to verify connection response = client.list_datasets(limit: 1) puts "✓ Successfully connected to Langfuse" - puts " Region: #{ENV['LANGFUSE_REGION'] || 'us (default)'}" rescue Eval::Langfuse::Client::ConfigurationError => e puts "✗ #{e.message}" exit 1