Consolidated a bunch of reused code to agents

This commit is contained in:
2025-03-26 00:21:19 -04:00
parent 5407c1a7cc
commit 5d2c350acf
33 changed files with 2866 additions and 803 deletions

View File

@@ -1,33 +0,0 @@
package shared
import (
"strings"
)
// TidBit is a small piece of information that the AI has learned.
type TidBit struct {
Info string
Source string
}
type Knowledge struct {
// OriginalQuestions are the questions that was asked first to the AI before any processing was done.
OriginalQuestions []string
// RemainingQuestions is the questions that are left to find answers for.
RemainingQuestions []string
// Knowledge are the tidbits of information that the AI has learned.
Knowledge []TidBit
}
// ToMessage converts the knowledge to a message that can be sent to the LLM.
func (k Knowledge) ToMessage() string {
var learned []string
for _, t := range k.Knowledge {
learned = append(learned, t.Info)
}
return "Original questions asked:\n" + strings.Join(k.OriginalQuestions, "\n") + "\n" +
"Learned information:\n" + strings.Join(learned, "\n") + "\n" +
"Remaining questions:\n" + strings.Join(k.RemainingQuestions, "\n")
}