feat(vision): gate recognition on a configured provider
Expose ImageRecognitionRuntime.available() and gate the image-task pre-step injection on it, so the capability is dormant until an endpoint is configured instead of guiding the model to a call that can only fail. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -98,3 +98,22 @@ describe('ImageRecognitionRuntime selection', () => {
|
||||
.rejects.toThrow(expect.objectContaining({ code: 'IMAGE_RECOGNITION_PROVIDER_AMBIGUOUS' }))
|
||||
})
|
||||
})
|
||||
|
||||
describe('ImageRecognitionRuntime.available', () => {
|
||||
it('is false with no registered provider', async () => {
|
||||
const { runtime } = await mountRuntime()
|
||||
expect(runtime.available()).toBe(false)
|
||||
})
|
||||
|
||||
it('is false when the configured provider is unavailable (not configured)', async () => {
|
||||
const { runtime } = await mountRuntime({ provider: 'http' })
|
||||
runtime.registerProvider(makeProvider('http', unavailable, () => Promise.resolve(recognizeResult('a'))))
|
||||
expect(runtime.available()).toBe(false)
|
||||
})
|
||||
|
||||
it('is true when a configured provider is available', async () => {
|
||||
const { runtime } = await mountRuntime({ provider: 'http' })
|
||||
runtime.registerProvider(makeProvider('http', available, () => Promise.resolve(recognizeResult('a'))))
|
||||
expect(runtime.available()).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user