Files
langchain-go/backend/handlers/agent.go
T
2026-03-29 10:10:32 +08:00

41 lines
1.1 KiB
Go

package handle
import (
"agent/agent"
"agent/response_struct"
"context"
"github.com/tmc/langchaingo/llms"
)
var files = []string{
".\\prompt\\card.txt",
".\\prompt\\guodegang.txt",
".\\prompt\\quiz.txt",
".\\prompt\\scenario.txt",
}
func GetCard(llm llms.Model, ctx context.Context, topic string) (response response_struct.Card) {
file := files[0]
response = agent.CallWithAgentDefined(llm, ctx, topic, file, response_struct.Card{})
return
}
func GetGuodegang(llm llms.Model, ctx context.Context, topic string) (response response_struct.Guodegang) {
file := files[1]
response = agent.CallWithAgentDefined(llm, ctx, topic, file, response_struct.Guodegang{})
return
}
func GetQuiz(llm llms.Model, ctx context.Context, topic string) (response response_struct.Quiz) {
file := files[2]
response = agent.CallWithAgentDefined(llm, ctx, topic, file, response_struct.Quiz{})
return
}
func GetScenario(llm llms.Model, ctx context.Context, topic string) (response response_struct.ScenarioResponse) {
file := files[3]
response = agent.CallWithAgentDefined(llm, ctx, topic, file, response_struct.ScenarioResponse{})
return
}