From ab1434d671c5ede5d04d818e4f0d663869ba3744 Mon Sep 17 00:00:00 2001 From: Steve Dudenhoeffer Date: Sat, 12 Apr 2025 03:42:16 -0400 Subject: [PATCH] Update go-llm module version and modify system prompt handling in knowledge integration --- go.mod | 2 +- go.sum | 2 ++ pkg/agents/knowledge_integrate.go | 5 +++-- pkg/agents/knowledge_processor.go | 4 +--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index f79c77d..f150c73 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ replace github.com/rocketlaunchr/google-search => github.com/chrisjoyce911/googl require ( gitea.stevedudenhoeffer.com/steve/go-extractor v0.0.0-20250318064250-39453288ce2a - gitea.stevedudenhoeffer.com/steve/go-llm v0.0.0-20250412062040-3093b988f80a + gitea.stevedudenhoeffer.com/steve/go-llm v0.0.0-20250412074148-916f07be1840 github.com/Edw590/go-wolfram v0.0.0-20241010091529-fb9031908c5d github.com/advancedlogic/GoOse v0.0.0-20231203033844-ae6b36caf275 github.com/asticode/go-astisub v0.34.0 diff --git a/go.sum b/go.sum index 0f336a7..db81f92 100644 --- a/go.sum +++ b/go.sum @@ -19,6 +19,8 @@ gitea.stevedudenhoeffer.com/steve/go-llm v0.0.0-20250408003321-2ae583e9f360 h1:e gitea.stevedudenhoeffer.com/steve/go-llm v0.0.0-20250408003321-2ae583e9f360/go.mod h1:Puz2eDyIwyQLKFt20BU9eRrfkUpBFo+ZX+PtTI64XSo= gitea.stevedudenhoeffer.com/steve/go-llm v0.0.0-20250412062040-3093b988f80a h1:SH2fWzDtv2KeWiwW+wtPr4NLI3CwdCSoYKn3FCRDdZc= gitea.stevedudenhoeffer.com/steve/go-llm v0.0.0-20250412062040-3093b988f80a/go.mod h1:RPbuI2VSwQJArwr4tdqmu+fEKlhpro5Cqtq6aC4Cp1w= +gitea.stevedudenhoeffer.com/steve/go-llm v0.0.0-20250412074148-916f07be1840 h1:Yf33CXaCYwBG6AQxQAiK5MrdCQrRrf+Y0tzSfuXPb30= +gitea.stevedudenhoeffer.com/steve/go-llm v0.0.0-20250412074148-916f07be1840/go.mod h1:RPbuI2VSwQJArwr4tdqmu+fEKlhpro5Cqtq6aC4Cp1w= github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c h1:udKWzYgxTojEKWjV8V+WSxDXJ4NFATAsZjh8iIbsQIg= github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= diff --git a/pkg/agents/knowledge_integrate.go b/pkg/agents/knowledge_integrate.go index 23c6e05..0108032 100644 --- a/pkg/agents/knowledge_integrate.go +++ b/pkg/agents/knowledge_integrate.go @@ -2,6 +2,7 @@ package agents import ( "context" + gollm "gitea.stevedudenhoeffer.com/steve/go-llm" ) @@ -76,10 +77,10 @@ func (a Agent) KnowledgeIntegrate(ctx context.Context, base Knowledge, in ...Kno }), ) - _, err := a.WithSystemPrompt(`You are combining knowledge that has been observed in two states, the original knowledge is what was known before an action was taken, and the new knowledge is what was learned after an action was taken. If the new knowledge answers or opens any new questions, notes, or objectives you should add, edit, or remove them now. The original knowledge is as follows: ` + baseMsg.Text + ` The new knowledge is as follows: ` + incomingMsg.Text). + _, err := a.WithSystemPrompt(`You are combining knowledge that has been observed in two states, the original knowledge is what was known before an action was taken, and the new knowledge is what was learned after an action was taken. If the new knowledge answers or opens any new questions, notes, or objectives you should add, edit, or remove them now.`). WithSystemPromptSuffix(``). WithToolbox(tools). - CallAndExecute(ctx) + CallAndExecute(ctx, `The original knowledge is as follows: `+baseMsg.Text+` The new knowledge is as follows: `+incomingMsg.Text) return result, err diff --git a/pkg/agents/knowledge_processor.go b/pkg/agents/knowledge_processor.go index c74aa88..a101ea5 100644 --- a/pkg/agents/knowledge_processor.go +++ b/pkg/agents/knowledge_processor.go @@ -51,11 +51,9 @@ Here is the knowledge I have gathered from ` + fmt.Sprint(len(sources)) + ` sour systemPrompt += "\n\nI still have some questions that I could not find an answer to:\n" + strings.Join(knowledge.RemainingQuestions, "\n") } - systemPrompt += "\n\nUsing the sources, write an answer to the original question. Note any information that wasn't able to be answered." - res, err := a.WithSystemPrompt(systemPrompt). WithSystemPromptSuffix(``). - CallAndExecute(ctx) + CallAndExecute(ctx, "Using the sources, write an answer to the original question. Note any information that wasn't able to be answered.") if err != nil { return "", err }