Skip to content

Commit f922de1

Browse files
authored
fix: pass Usage, ChatResponseCached, and ToolResults to SDKs (#860)
Signed-off-by: Donnie Adams <[email protected]>
1 parent ec0c019 commit f922de1

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

pkg/sdkserver/types.go

+15-8
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ func (r *runInfo) process(e event) map[string]any {
173173
if e.Content != "" {
174174
call.Input = e.Content
175175
}
176+
if e.ToolResults > 0 {
177+
call.ToolResults = e.ToolResults
178+
}
176179

177180
case runner.EventTypeCallSubCalls:
178181
call.setSubCalls(e.ToolSubCalls)
@@ -185,6 +188,8 @@ func (r *runInfo) process(e event) map[string]any {
185188
call.setOutput(e.Content)
186189

187190
case runner.EventTypeChat:
191+
call.Usage = e.Usage
192+
call.ChatResponseCached = e.ChatResponseCached
188193
if e.ChatRequest != nil {
189194
call.LLMRequest = e.ChatRequest
190195
}
@@ -210,14 +215,16 @@ func (r *runInfo) processStdout(cs runner.ChatResponse) {
210215
type call struct {
211216
engine.CallContext `json:",inline"`
212217

213-
Type runner.EventType `json:"type"`
214-
Start time.Time `json:"start"`
215-
End time.Time `json:"end"`
216-
Input string `json:"input"`
217-
Output []output `json:"output"`
218-
Usage types.Usage `json:"usage"`
219-
LLMRequest any `json:"llmRequest"`
220-
LLMResponse any `json:"llmResponse"`
218+
Type runner.EventType `json:"type"`
219+
Start time.Time `json:"start"`
220+
End time.Time `json:"end"`
221+
Input string `json:"input"`
222+
Output []output `json:"output"`
223+
Usage types.Usage `json:"usage"`
224+
ChatResponseCached bool `json:"chatResponseCached"`
225+
ToolResults int `json:"toolResults"`
226+
LLMRequest any `json:"llmRequest"`
227+
LLMResponse any `json:"llmResponse"`
221228
}
222229

223230
func (c *call) setSubCalls(subCalls map[string]engine.Call) {

0 commit comments

Comments
 (0)