✨Feat: agent可传入提示词
This commit is contained in:
+19
-1
@@ -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
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user