MCPcopy Create free account
hub / github.com/coder/coder / PatchThoughtSignatures

Function PatchThoughtSignatures

internal/googleopenai/thought_signature.go:77–90  ·  view source on GitHub ↗

PatchThoughtSignatures adds fallback thought signatures to Gemini tool-call history in body. It returns changed=false when no patch is needed.

(body []byte)

Source from the content-addressed store, hash-verified

75// PatchThoughtSignatures adds fallback thought signatures to Gemini tool-call
76// history in body. It returns changed=false when no patch is needed.
77func PatchThoughtSignatures(body []byte) ([]byte, bool, error) {
78 var payload map[string]any
79 if err := json.Unmarshal(body, &payload); err != nil {
80 return nil, false, err
81 }
82 if !AddThoughtSignaturesToLatestTurn(payload) {
83 return body, false, nil
84 }
85 patched, err := json.Marshal(payload)
86 if err != nil {
87 return nil, false, err
88 }
89 return patched, true, nil
90}
91
92// AddThoughtSignaturesToLatestTurn patches only the current turn because
93// completed tool-call/result pairs from earlier turns are not validated by

Callers 1

Calls 3

UnmarshalMethod · 0.45
MarshalMethod · 0.45

Tested by

no test coverage detected