MCPcopy Index your code
hub / github.com/github/copilot-sdk / responses_events

Function responses_events

python/e2e/_copilot_request_helpers.py:86–138  ·  view source on GitHub ↗

The ordered ``/responses`` event objects the runtime's reducer expects.

(text: str, resp_id: str = "resp_stub_1")

Source from the content-addressed store, hash-verified

84
85
86def responses_events(text: str, resp_id: str = "resp_stub_1") -> list[dict]:
87 """The ordered ``/responses`` event objects the runtime's reducer expects."""
88 return [
89 {
90 "type": "response.created",
91 "response": {
92 "id": resp_id,
93 "object": "response",
94 "status": "in_progress",
95 "output": [],
96 },
97 },
98 {
99 "type": "response.output_item.added",
100 "output_index": 0,
101 "item": {"id": "msg_1", "type": "message", "role": "assistant", "content": []},
102 },
103 {
104 "type": "response.content_part.added",
105 "output_index": 0,
106 "content_index": 0,
107 "part": {"type": "output_text", "text": ""},
108 },
109 {
110 "type": "response.output_text.delta",
111 "output_index": 0,
112 "content_index": 0,
113 "delta": text,
114 },
115 {
116 "type": "response.output_text.done",
117 "output_index": 0,
118 "content_index": 0,
119 "text": text,
120 },
121 {
122 "type": "response.completed",
123 "response": {
124 "id": resp_id,
125 "object": "response",
126 "status": "completed",
127 "output": [
128 {
129 "id": "msg_1",
130 "type": "message",
131 "role": "assistant",
132 "content": [{"type": "output_text", "text": text}],
133 }
134 ],
135 "usage": {"input_tokens": 5, "output_tokens": 7, "total_tokens": 12},
136 },
137 },
138 ]
139
140
141def build_non_inference_response(

Callers 3

_sse_bodyFunction · 0.85
ws_handlerFunction · 0.85
build_inference_responseFunction · 0.85

Calls

no outgoing calls

Tested by 2

_sse_bodyFunction · 0.68
ws_handlerFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…