test_nvidia_model.ps1 681 B

1234567891011
  1. param(
  2. [string]$Model = "meta/llama-3.3-70b-instruct",
  3. [string]$ApiKey = "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",
  4. [int]$TimeoutSec = 25
  5. )
  6. $body = "{`"model`":`"$Model`",`"messages`":[{`"role`":`"user`",`"content`":`"ping`"}],`"max_tokens`":5}"
  7. $tempPath = "$env:TEMP\nv_test_$($Model -replace '[^a-zA-Z0-9]','_').json"
  8. Set-Content -Path $tempPath -Value $body -Encoding UTF8
  9. $result = & curl.exe -s --max-time $TimeoutSec -H "Authorization: Bearer $ApiKey" -H "Content-Type: application/json" -d "@$tempPath" "https://integrate.api.nvidia.com/v1/chat/completions" 2>&1
  10. Remove-Item $tempPath -ErrorAction SilentlyContinue
  11. return $result