executorPluginReady reports whether the named plugin can actually execute a request right now: it must declare an executor capability AND resolve a non-empty provider identifier (the same requirement enforced by executorAdapterForPlugin at execution time), allow static execution without selected aut
(pluginID string, routeReq pluginapi.ModelRouteRequest)
| 20 | // treated as unhandled and fall through to lower-priority routers instead of |
| 21 | // returning handled then 500ing. |
| 22 | func (h *Host) executorPluginReady(pluginID string, routeReq pluginapi.ModelRouteRequest) bool { |
| 23 | if h == nil { |
| 24 | return false |
| 25 | } |
| 26 | pluginID = strings.TrimSpace(pluginID) |
| 27 | if pluginID == "" { |
| 28 | return false |
| 29 | } |
| 30 | for _, record := range h.activeRecords() { |
| 31 | if record.id != pluginID || h.isPluginFused(record.id) { |
| 32 | continue |
| 33 | } |
| 34 | executor := record.plugin.Capabilities.Executor |
| 35 | if executor == nil { |
| 36 | return false |
| 37 | } |
| 38 | if !executorScopeAllowsStaticModels(record.plugin.Capabilities) { |
| 39 | return false |
| 40 | } |
| 41 | provider, okProvider := h.executorProvider(record, executor) |
| 42 | if !okProvider { |
| 43 | return false |
| 44 | } |
| 45 | adapter := newExecutorAdapterRegistration(h, record, provider, executor).adapter |
| 46 | return adapter.supportsExecutorFormats( |
| 47 | coreexecutor.Request{Model: routeReq.RequestedModel, Payload: routeReq.Body}, |
| 48 | coreexecutor.Options{ |
| 49 | Stream: routeReq.Stream, |
| 50 | OriginalRequest: routeReq.Body, |
| 51 | SourceFormat: sdktranslator.FromString(routeReq.SourceFormat), |
| 52 | ResponseFormat: sdktranslator.FromString(routeReq.SourceFormat), |
| 53 | Headers: cloneHeader(routeReq.Headers), |
| 54 | Query: cloneValues(routeReq.Query), |
| 55 | Metadata: cloneInterceptorMetadata(routeReq.Metadata), |
| 56 | }, |
| 57 | ) |
| 58 | } |
| 59 | return false |
| 60 | } |
| 61 | |
| 62 | func (a *executorAdapter) supportsExecutorFormats(req coreexecutor.Request, opts coreexecutor.Options) bool { |
| 63 | if a == nil { |
no test coverage detected