MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / ParseLLMEvent

Function ParseLLMEvent

internal/toolinjection/observe.go:16–36  ·  view source on GitHub ↗

ParseLLMEvent parses raw LLM request/response JSON into a structured LLMEvent. eventType is "request" or "response"; format is "openai", "claude", or "openai-responses".

(rawJSON []byte, eventType, format string)

Source from the content-addressed store, hash-verified

14// ParseLLMEvent parses raw LLM request/response JSON into a structured LLMEvent.
15// eventType is "request" or "response"; format is "openai", "claude", or "openai-responses".
16func ParseLLMEvent(rawJSON []byte, eventType, format string) *implantpb.LLMEvent {
17 ev := &implantpb.LLMEvent{
18 Type: eventType,
19 Format: format,
20 }
21
22 f := GetFormat(format)
23 if f == nil {
24 return ev
25 }
26 switch eventType {
27 case "request":
28 ev.Model = gjson.GetBytes(rawJSON, "model").String()
29 f.ParseRequest(rawJSON, ev)
30 case "response":
31 ev.Model = gjson.GetBytes(rawJSON, "model").String()
32 f.ParseResponse(rawJSON, ev)
33 }
34
35 return ev
36}
37
38// parseRequest extracts model, message count, last N messages, and tool results from a request.
39// Deprecated: use Format.ParseRequest instead. Kept for any external callers.

Calls 4

GetFormatFunction · 0.85
ParseRequestMethod · 0.65
ParseResponseMethod · 0.65
StringMethod · 0.45