diff --git a/agent/chatAgent.go b/agent/chatAgent.go index b27aa25..9f9d4fb 100644 --- a/agent/chatAgent.go +++ b/agent/chatAgent.go @@ -8,7 +8,7 @@ import ( "github.com/tmc/langchaingo/llms" ) -func Call(llm llms.Model, ctx context.Context) { +func Call(llm llms.Model, ctx context.Context) (response string) { response, err := llms.GenerateFromSinglePrompt( ctx, @@ -21,4 +21,22 @@ func Call(llm llms.Model, ctx context.Context) { fmt.Println("AI:", response) + return response + +} +func CallWithMessage(llm llms.Model, ctx context.Context, prompt string) (response string) { + + response, err := llms.GenerateFromSinglePrompt( + ctx, + llm, + prompt, + ) + if err != nil { + log.Fatal(err) + } + + fmt.Println("AI:", response) + + return response + } diff --git a/main.go b/main.go index a8e8a79..963a1a5 100644 --- a/main.go +++ b/main.go @@ -46,4 +46,6 @@ func init() { func main() { agent.Call(llm, ctx) + + agent.CallWithMessage(llm, ctx, "System Prompt: please say \"happy\" no matter i say what.\nUser: Hi im wonder") }