MCPcopy
hub / github.com/mudler/LocalAI / classifyRequestShape

Function classifyRequestShape

core/services/cloudproxy/mitm/handler.go:215–224  ·  view source on GitHub ↗
(host, path string)

Source from the content-addressed store, hash-verified

213)
214
215func classifyRequestShape(host, path string) requestShape {
216 host = strings.ToLower(host)
217 switch {
218 case host == "api.openai.com" && strings.HasSuffix(path, "/v1/chat/completions"):
219 return shapeOpenAIChat
220 case host == "api.anthropic.com" && strings.HasSuffix(path, "/v1/messages"):
221 return shapeAnthropicMessages
222 }
223 return shapeUnknown
224}
225
226func (d *piiDispatcher) redactRequest(ctx context.Context, body []byte, shape requestShape, cfgs []pii.NERConfig, correlationID string) ([]byte, bool, error) {
227 var parsed any

Callers 2

serveMethod · 0.85
handler_test.goFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected