Fix model mapping

This commit is contained in:
Charlie Gleason
2025-12-15 16:14:58 -08:00
parent 14c7777ca5
commit eb31887b3d
4 changed files with 38 additions and 22 deletions
@@ -18,6 +18,16 @@
set -eo pipefail
# =============================================================================
# Step 1: Fetch models from Cloudflare AI Gateway
# =============================================================================
echo "=== Step 1: Fetching models from Cloudflare AI Gateway ==="
# =============================================================================
# Main script
# =============================================================================
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DATA_DIR="${SCRIPT_DIR}/data"
API_RESPONSE_FILE="${DATA_DIR}/api_response.json"
@@ -38,11 +48,6 @@ if [[ -z "${CLOUDFLARE_GATEWAY_ID:-}" ]]; then
exit 1
fi
# =============================================================================
# Step 1: Fetch models from Cloudflare AI Gateway
# =============================================================================
echo "=== Step 1: Fetching models from Cloudflare AI Gateway ==="
API_URL="https://gateway.ai.cloudflare.com/v1/${CLOUDFLARE_ACCOUNT_ID}/${CLOUDFLARE_GATEWAY_ID}/compat/models"
mkdir -p "${DATA_DIR}"
@@ -64,20 +69,4 @@ fi
echo "Found ${MODEL_COUNT} models from API"
echo "${RESPONSE}" > "${API_RESPONSE_FILE}"
echo "Saved API response to ${API_RESPONSE_FILE}"
# =============================================================================
# Step 2: Update model names
# =============================================================================
echo ""
echo "=== Step 2: Generating / adding missing model names ==="
"${SCRIPT_DIR}/generate_model_names.sh"
# =============================================================================
# Step 3: Generate TOML files
# =============================================================================
echo ""
echo "=== Step 3: Generating model TOML files ==="
"${SCRIPT_DIR}/generate_model_toml.sh"
echo "Saved API response to ${API_RESPONSE_FILE}"
@@ -15,9 +15,18 @@ set -eo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/utils.sh"
# =============================================================================
# Step 2: Update model names
# =============================================================================
echo ""
echo "=== Step 2: Generating / adding missing model names ==="
"${SCRIPT_DIR}/generate_model_names.sh"
# =============================================================================
# Main script
# =============================================================================
DATA_DIR="${SCRIPT_DIR}/data"
MODEL_NAMES_FILE="${SCRIPT_DIR}/model_names.json"
API_RESPONSE_FILE="${DATA_DIR}/api_response.json"
@@ -14,6 +14,14 @@ set -eo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/utils.sh"
# =============================================================================
# Step 3: Generate TOML files
# =============================================================================
echo ""
echo "=== Step 3: Generating model TOML files ==="
"${SCRIPT_DIR}/generate_model_toml.sh"
# =============================================================================
# Main script
# =============================================================================
+10
View File
@@ -11,6 +11,9 @@ INCLUDE_ALL_PROVIDERS="workers-ai replicate"
# Namespaces to skip entirely (provider/namespace format)
SKIP_NAMESPACES="replicate/replicate-internal"
# Specific models to skip (exact model IDs)
SKIP_MODELS="aura-1 whisper"
# Providers to cross-reference from source provider files
CROSS_REFERENCE_PROVIDERS="openai anthropic"
@@ -82,6 +85,13 @@ should_include_model() {
# Extract provider from model ID (first path segment)
provider=$(echo "${model_id}" | cut -d'/' -f1)
# Check if model matches any skip pattern (partial match on model name)
for skip in ${SKIP_MODELS}; do
if [[ "${model_id}" == *"${skip}"* ]]; then
return 1 # Exclude
fi
done
# Check if model is in a skipped namespace
for ns in ${SKIP_NAMESPACES}; do
if [[ "${model_id}" == ${ns}/* ]]; then