Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The NewExecutor parameter failed to be set #1007

Open
czc09 opened this issue Sep 11, 2024 · 0 comments
Open

The NewExecutor parameter failed to be set #1007

czc09 opened this issue Sep 11, 2024 · 0 comments

Comments

@czc09
Copy link

czc09 commented Sep 11, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant