mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-03-27 13:28:32 +07:00
Add tools for comparing translation quality between different models (e.g., Sonnet vs Opus) or prompt variations. Useful for evaluating translation improvements before deploying changes. - run_test.py: Test runner with Dify API streaming - compare.py: Generate similarity reports between variants - Example spec and documentation included 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
53 lines
1.3 KiB
Bash
Executable File
53 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# Translation Test Framework Setup Script
|
|
# Creates Python virtual environment and installs dependencies
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$SCRIPT_DIR"
|
|
|
|
echo "==================================="
|
|
echo "Translation Test Framework Setup"
|
|
echo "==================================="
|
|
echo ""
|
|
|
|
# Check Python version
|
|
if ! command -v python3 &> /dev/null; then
|
|
echo "Error: Python 3 is required but not found"
|
|
exit 1
|
|
fi
|
|
|
|
PYTHON_VERSION=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
|
|
echo "Python version: $PYTHON_VERSION"
|
|
|
|
# Create virtual environment
|
|
if [ -d "venv" ]; then
|
|
echo "Virtual environment already exists"
|
|
else
|
|
echo "Creating virtual environment..."
|
|
python3 -m venv venv
|
|
echo "Virtual environment created"
|
|
fi
|
|
|
|
# Activate and install dependencies
|
|
echo "Installing dependencies..."
|
|
source venv/bin/activate
|
|
pip install --upgrade pip -q
|
|
pip install -r requirements.txt -q
|
|
|
|
echo ""
|
|
echo "==================================="
|
|
echo "Setup Complete!"
|
|
echo "==================================="
|
|
echo ""
|
|
echo "To activate the environment:"
|
|
echo " source venv/bin/activate"
|
|
echo ""
|
|
echo "To run a test:"
|
|
echo " python run_test.py <test-spec.md>"
|
|
echo ""
|
|
echo "Example:"
|
|
echo " python run_test.py base-20251127.md"
|
|
echo ""
|