MCPcopy Create free account
hub / github.com/diillson/chatcli / appendKnowledgeRound

Function appendKnowledgeRound

cli/chat_knowledge.go:119–130  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
119func 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

Callers 3

TestAppendKnowledgeRoundFunction · 0.85
executeChatAskNativeMethod · 0.85
executeChatAskXMLMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestAppendKnowledgeRoundFunction · 0.68