Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10993 +/- ##
==========================================
- Coverage 89.73% 89.73% -0.01%
==========================================
Files 1051 1051
Lines 92781 92781
Branches 32855 32855
==========================================
- Hits 83261 83260 -1
- Misses 9520 9521 +1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
mldangelo
left a comment
There was a problem hiding this comment.
I cannot merge this as a working service integration yet. The default API hostname does not resolve in the current DNS check, and I could not find a published API contract for the /generate and /tasks endpoints on the linked service site. Please provide the documented endpoint/authentication/response contract, or make this an explicitly generic local simulation without claiming that these URLs represent generated media. I also reproduced the cancellation and reported-metadata defects below using the exact PR head and controlled responses. No credentials or paid generation requests were used.
|
|
||
| try { | ||
| // 1. Submit video generation job | ||
| const submitRes = await fetch(`${this.baseUrl}/generate`, { |
There was a problem hiding this comment.
[P2] Bound requests and propagate cancellation. maxPollAttempts only bounds the number of completed fetches; submission and each poll can wait indefinitely. A pre-aborted third-argument abortSignal still starts fetch, and the call remains pending when that fetch hangs. Accept the provider call options, combine caller cancellation with an overall deadline, and pass the resulting signal to both requests and polling waits.
There was a problem hiding this comment.
Resolved in 1c411f1. callApi now accepts options.abortSignal, immediately checks for pre-aborted signals without initiating requests, and combines caller cancellation with an overall deadline (timeoutMs, default 60s) via AbortSignal.any, propagating the signal to both submission/polling fetches and polling sleep intervals. Added unit tests covering pre-aborted cancellation, in-flight polling cancellation, and deadline timeouts.
| jobId, | ||
| status, | ||
| videoUrl: resultVideoUrl, | ||
| duration, |
There was a problem hiding this comment.
[P2] Report observed media properties instead of echoing the request. With a completed response reporting duration 1, fps 10 and resolution 320x240, a request for 5s/30fps/1920x1080 is returned as 5s/30fps/1920x1080. The example duration assertions therefore pass even when the generated media differs. Normalize actual response metadata from the documented API (or inspect the returned media) and keep requested settings in separately named fields.
There was a problem hiding this comment.
Resolved in 1c411f1. Observed media properties from the completed task response payload (duration, fps, resolution, motion) are now normalized and reported in output and metadata, while requested parameters are preserved in separately named fields (requestedDuration, requestedFps, requestedResolution, requestedMotion, requested). Added unit tests asserting that mismatched observed properties are reported accurately.
|
Thanks for the thorough review @mldangelo. I have updated the PR to address all points:
|
Summary
Adds an end-to-end custom provider example in
examples/provider-image-to-video-aidemonstrating how to evaluate asynchronous image-to-video generation workflows with Promptfoo, addressing feature request #10168.Motivation & Behavior
Image-to-video AI services (such as Image to Video AI, Runway, Kling, or Luma) follow an asynchronous pattern where jobs are submitted, polled until completion, and evaluated for output quality and media metadata.
This example provides:
provider.jsthat manages task submission, polling with configurable backoff and timeout, and structured result formatting.IMAGE_TO_VIDEO_AI_API_KEYis unset or in test environments, ensuring local evaluations and CI run reliably without requiring paid API credentials.promptfooconfig.yamlevaluating landscape camera motion, portrait subtle animation, and fluid macro dynamics.test/examples/imageToVideoProvider.test.tsverifying provider initialization, simulation fallback, live polling flows, timeout handling, and error branches.Closes #10168
Verification
npm test -- test/examples/imageToVideoProvider.test.ts(10/10 passed)npm test -- test/examples/yaml-aliases.test.ts(passed)npm test -- test/types/index.test.ts(390/390 passed, including new config)npm run local -- eval -c examples/provider-image-to-video-ai/promptfooconfig.yaml --no-cache(3/3 test cases passed in 0s)npm run tsc,npm run l,npm run f, andnpx knippassed cleanly with 0 errors.