We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
// 获取工具信息, 用于绑定到 ChatModel toolInfos := make([]*schema.ToolInfo, 0, len(todoTools)) for _, todoTool := range todoTools { info, err := todoTool.Info(context.Background()) if err != nil { log.Fatal(err) } toolInfos = append(toolInfos, info) } // 将 tools 绑定到 ChatModel err = chatModel.BindTools(toolInfos) if err != nil { log.Fatal(err) } // 创建 tools 节点 todoToolsNode, err := compose.NewToolNode(context.Background(), &compose.ToolsNodeConfig{ Tools: todoTools, }) if err != nil { log.Fatal(err) } // 构建完整的处理链 chain := compose.NewChain[*schema.Message, []*schema.Message]() chain. AppendChatModel(chatModel, compose.WithNodeName("chat_model")). AppendToolsNode(todoToolsNode, compose.WithNodeName("tools")) // 编译并运行 chain agent, err := chain.Compile(context.Background()) if err != nil { log.Fatal(err) } // 运行示例 resp, err := agent.Invoke(context.Background(), &schema.Message{ Content: "使用add_todo工具帮我创建一个明天下午3点截止的待办事项:准备Eino项目演示文稿", }) if err != nil { log.Fatal(err) } // 输出结果 for _, msg := range resp { fmt.Println(msg.Content) }
func (t *Todo) CreateToDoList(ctx context.Context, input *AddTodoInput) (*AddTodoOutput, error) { haveTable := HaveTable(DB()) if !haveTable { err := Migrate(DB()) if err != nil { return nil, err } } output := &AddTodoOutput{ Content: input.Content, StartAt: input.StartAt, Detailed: input.Detailed, } if err := DB().Create(&Todo{ Content: input.Content, StartAt: int64(input.StartAt), Detailed: int64(input.Detailed), }).Error; err != nil { return output, err } return output, nil } func (t *Todo) MarshalOutput(_ context.Context, req any) (string, error) { out, ok := req.(*AddTodoOutput) if !ok { return "", fmt.Errorf("invalid input type") } return fmt.Sprintf("Todo item added: %v", out), nil }
2025/01/17 13:27:52 graph edge[start]-[Chain[0]_chat_model]: start node's output type[*schema.Message] and end node's input type[[]*schema.Message] mismatch exit status 1
The text was updated successfully, but these errors were encountered:
Is this code from eino-examples? If so, try pulling the newest main branch. It contains the fix for this.
Sorry, something went wrong.
No branches or pull requests
工具使用
输出
The text was updated successfully, but these errors were encountered: