appendKnowledgeRound folds one pull into the conversation being built for the next decision call: the pending prompt becomes a user turn, the model's call is acknowledged, and the tool result becomes the new pending prompt.
(history []models.Message, prompt, callJSON, result string)
| 117 | // the next decision call: the pending prompt becomes a user turn, the model's |
| 118 | // call is acknowledged, and the tool result becomes the new pending prompt. |
| 119 | func appendKnowledgeRound(history []models.Message, prompt, callJSON, result string) ([]models.Message, string) { |
| 120 | next := make([]models.Message, 0, len(history)+2) |
| 121 | next = append(next, history...) |
| 122 | next = append(next, |
| 123 | models.Message{Role: "user", Content: prompt}, |
| 124 | models.Message{Role: "assistant", Content: "[knowledge call] " + callJSON}, |
| 125 | ) |
| 126 | followup := "knowledge result:\n" + result + |
| 127 | "\n\nUse this material to answer the user's question (cite source paths). " + |
| 128 | "Call knowledge again only if something essential is still missing." |
| 129 | return next, followup |
| 130 | } |
| 131 | |
| 132 | // chatKnowledgeXMLInstruction is appended to the decision-turn prompt for |
| 133 | // providers WITHOUT native tools. It overrides the tool-less framing for this |
no outgoing calls