langchainjs icon indicating copy to clipboard operation
langchainjs copied to clipboard

Human as a tool

Open achammah opened this issue 1 year ago • 1 comments

I see that the python repo had a new tool that is super useful, Human as a tool (https://github.com/hwchase17/langchain/tree/master/langchain/tools/human)

I'm trying to implement it myself but am wondering if this is something anyone can help with

this is what I have so far

`import { Tool } from "./base.js";

type PromptFunc = (text: string) => void;
type InputFunc = () => Promise<string>;

class HumanInput extends Tool {
  name = "Human";
  description =
    "You can ask a human for guidance when you think you got stuck or you are not sure what to do next. The input should be a question for the human.";
  promptFunc: PromptFunc;
  inputFunc: InputFunc;

  constructor(promptFunc: PromptFunc, inputFunc: InputFunc) {
    super();
    this.promptFunc = promptFunc;
    this.inputFunc = inputFunc;
  }

  async _call(query: string): Promise<string> {
    this.promptFunc(query);
    return await this.inputFunc();
  }
}

export { HumanInput };`

achammah avatar Mar 31 '23 14:03 achammah

Came here to ask this question!

max-clouatre avatar Apr 01 '23 22:04 max-clouatre

figure it out?

aehlke avatar Jun 28 '23 19:06 aehlke

Hi, @achammah! I'm Dosu, and I'm here to help the langchainjs team manage their backlog. I wanted to let you know that we are marking this issue as stale.

From what I understand, you created this issue to seek assistance with implementing the "Human as a tool" feature from the Python repository in your personal project. You provided some details about your progress so far. There have been a couple of comments on the issue, with max-clouatre expressing a similar question and aehlke asking if you have figured it out.

Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the langchainjs repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.

Thank you for your understanding, and please don't hesitate to reach out if you have any further questions or concerns.

dosubot[bot] avatar Sep 27 '23 16:09 dosubot[bot]