// Problem 1: options is invalid because Executor Call(ctx context. Context, inputValues map[string]any, _... chains.ChainCallOption) simply ignores the parameter
// Problem 2: error_code:336003, erro_msg:parameter check failed, temperature range is (0, 1.0) ERROR_Code :336003, erro_msg: Parameter check failed, temperature range is (0, 1.0)
package main
import ( "context" "github.com/davecgh/go-spew/spew" "github.com/tmc/langchaingo/agents" "github.com/tmc/langchaingo/chains" "github.com/tmc/langchaingo/llms/ernie" "github.com/tmc/langchaingo/prompts" "github.com/tmc/langchaingo/tools" "github.com/tmc/langchaingo/tools/serpapi" "os" )
func main() { llm, err := ernie.New( ) searchTool, := serpapi.New() calculator := tools.Calculator{} agentTools := []tools.Tool{searchTool, calculator} agent := agents.NewOpenAIFunctionsAgent(llm, agentTools, agents.NewOpenAIOption().WithSystemMessage("你是智能助手"), agents.NewOpenAIOption().WithExtraMessages([]prompts.MessageFormatter{ prompts.NewHumanMessagePromptTemplate("please be strict", nil), }), ) if err != nil { return } e := agents.NewExecutor( agent, agentTools, ) // 设置链调用选项 options := []chains.ChainCallOption{ chains.WithTemperature(0.8), } question := "目前市场上大蒜子的平均价格是多少?如果我在此基础上加价20%卖出,应该如何定价??" answer, err := chains.Run(context.Background(), e, question, options...) spew.Dump(err) println(answer, err) } //问题1 :options 设置了参数, 但是无效 ,原因是Executor Call(ctx context.Context, inputValues map[string]any, ...chains.ChainCallOption) 直接忽略了参数 //问题2 : 文心大模型 直接报错 error_code:336003, erro_msg:parameter check failed, temperature range is (0, 1.0]
// Problem 1: options is invalid because Executor Call(ctx context. Context, inputValues map[string]any, _... chains.ChainCallOption) simply ignores the parameter // Problem 2: error_code:336003, erro_msg:parameter check failed, temperature range is (0, 1.0) ERROR_Code :336003, erro_msg: Parameter check failed, temperature range is (0, 1.0)