Consolidated a bunch of reused code to agents
This commit is contained in:
@@ -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")
|
||||
}
|
Reference in New Issue
Block a user