(ctx context.Context, record capabilityRecord, from, to sdktranslator.Format, model string, body []byte, stream bool)
| 1944 | } |
| 1945 | |
| 1946 | func (h *Host) callRequestNormalizer(ctx context.Context, record capabilityRecord, from, to sdktranslator.Format, model string, body []byte, stream bool) (out []byte, ok bool) { |
| 1947 | if h == nil || h.isPluginFused(record.id) || !h.recordCurrent(record) || record.plugin.Capabilities.RequestNormalizer == nil { |
| 1948 | return nil, false |
| 1949 | } |
| 1950 | defer func() { |
| 1951 | if recovered := recover(); recovered != nil { |
| 1952 | h.fusePlugin(record.id, "RequestNormalizer.NormalizeRequest", recovered) |
| 1953 | out = nil |
| 1954 | ok = false |
| 1955 | } |
| 1956 | }() |
| 1957 | resp, errNormalizeRequest := record.plugin.Capabilities.RequestNormalizer.NormalizeRequest(ctx, pluginapi.RequestTransformRequest{ |
| 1958 | FromFormat: from.String(), |
| 1959 | ToFormat: to.String(), |
| 1960 | Model: model, |
| 1961 | Stream: stream, |
| 1962 | Body: bytes.Clone(body), |
| 1963 | }) |
| 1964 | if errNormalizeRequest != nil || len(resp.Body) == 0 { |
| 1965 | return nil, false |
| 1966 | } |
| 1967 | return bytes.Clone(resp.Body), true |
| 1968 | } |
| 1969 | |
| 1970 | func (h *Host) callRequestTranslator(ctx context.Context, record capabilityRecord, from, to sdktranslator.Format, model string, body []byte, stream bool) (out []byte, ok bool) { |
| 1971 | if h == nil || h.isPluginFused(record.id) || !h.recordCurrent(record) || record.plugin.Capabilities.RequestTranslator == nil { |
no test coverage detected