Closed jsbryaniv closed 9 months ago
🤖
Hello,
Thank you for your interest in contributing to the LangChain project. Your idea of adding decision tree prompts functionality sounds like a great addition to the project.
Based on the current structure of the LangChain codebase, you would need to create a new module for your feature. This would involve creating a new directory with an index file for your feature, and adding an entry point for your feature in the entrypoints
object. You can use the create-entrypoints.js
script to generate the necessary files and update the configuration files for your new module.
Here's a simplified example of how you might structure your new feature:
// Adding a new feature
const entrypoints = {
...,
prompt_tree: "prompt_tree/index",
...
};
Once you've created your new module and added it to the entrypoints
object, you can start implementing your feature. Make sure to follow the coding standards and practices of the LangChain project, and use the provided tooling for dependency management, linting, formatting, testing, and documentation.
When you're ready to contribute your feature, you should follow the "fork and pull request" workflow. This involves creating a fork of the LangChain repository, making your changes in your fork, and then submitting a pull request to the LangChain repository. Make sure to provide a detailed description of your changes in your pull request.
Here's a simplified example of how you might contribute your feature:
# Fork the LangChain repository on GitHub
# Clone your fork to your local machine
git clone https://github.com/yourusername/langchainjs.git
# Create a new branch for your feature
git checkout -b my-feature
# Make your changes in your branch
# ...
# Push your changes to your fork
git push origin my-feature
# Submit a pull request to the LangChain repository on GitHub
Please make sure to read and follow the contribution guidelines for the LangChain project. These guidelines provide detailed instructions on how to contribute to the project, including how to use the provided tooling and how to submit a pull request.
If you have any questions or need further assistance, feel free to ask. We're here to help!
Best, Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
@dosu-bot
How can I talk to a human admin or contributor to discus where in the library this would be most appropriate?
🤖
Hello,
Thank you for your interest in contributing to the LangChain project. Your feature of adding decision tree prompts functionality sounds like a great addition to the project. However, as LangChain is a Javascript/Typescript framework, we would need to have this feature implemented in Javascript or Typescript to be integrated into the existing codebase.
Given the current structure of the LangChain codebase, it seems like your feature would fit best under the "Prompts" component, as it deals with creating new types of prompts for the language models. However, the exact placement and integration would depend on the specifics of your implementation.
To discuss this further with a human admin or contributor, you can follow these steps:
Open a new issue in the LangChain repository describing your feature and your questions about integrating it into the codebase. Be sure to provide as much detail as possible about your implementation and how you believe it could fit into the existing structure.
Once the issue is open, you can request a review from a specific contributor or admin by mentioning them in the issue using the "@" symbol followed by their GitHub username. If you're not sure who to ask for a review, you can leave it open and someone should get back to you.
You can also use the "assignees" option on the right side of the issue page to assign the issue to a specific contributor or admin. This will notify them of the issue and request their review.
Be sure to follow the contribution guidelines as outlined in the CONTRIBUTING.md file in the repository. This includes following the "fork and pull request" workflow, discussing new abstractions in an issue before implementing them, and using the provided tooling for dependency management, linting, and testing.
I hope this helps guide you in the right direction. If you have any other questions or need further clarification, feel free to ask.
Best, Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
I can't be of much help, but I was also looking at a similar feature using LangchainJS since it's the most 'mature' AI framework in the JS ecosystem currently. However, after much searching I could not find anything.
Within the python framework, LLMFlows seems to implement the use of 'prompt flow/trees' very well and could be something that LangChain JS picks up too.
@khanguslee I would really like to contribute to incorporate this as a feature. Do you know who I should talk to about this? Or do I just build a prototype and then submit it as a fork and push, with an explanation?
Hi, @jsbryaniv! I'm Dosu, and I'm here to help the langchainjs team manage our backlog. I wanted to let you know that we are marking this issue as stale.
From what I understand, you are requesting functionality for decision tree prompts in LangChain. You provided a mini example using two additional classes, PromptTree and PromptBranch, to demonstrate how this could be implemented. You were unsure of how to contribute to open source projects, and I provided guidance on creating a new module and following the "fork and pull request" workflow. You also asked how to discuss the placement of the feature with a human admin or contributor, and I provided steps for initiating that discussion. Additionally, khanguslee mentioned a similar feature in the Python framework LLMFlows that could be a reference for LangChain JS. You expressed interest in contributing and asked for guidance on how to proceed.
Before we close this issue, I 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 this issue. Otherwise, feel free to close the issue yourself or it will be automatically closed in 7 days.
Thank you for your contribution and interest in LangChain JS! Let us know if you have any further questions or need any assistance.
I am not sure if this is most appropriately an issue, a discussion, or something that belongs on the discord channel, but on the Contributing guidelines it says to open an issue for feature requests so I will start here.
I want to request functionality for decision tree prompts. I know I am not the first one to request this, but so far I havent been able to find any functionality in LangChain that supports this sort of thing. So I made a mini example to show that it wouldnt be tremendously difficult.
I created a simple example about how this could be done using 2 additional classes: PromptTree and PromptBranch. Basically it works by giving the LLM a tool which allows it to switch branches in the conversation. The user must then only supply which branches the AI has access to and a short description of that branch. I also give it an option to record specific "insights", which could in principle function as the keys for future prompts down the prompttree.
Here is my example:
I know its a lot of code to unpack, so maybe the best way to see how it works would just be to try it. The AI starts talking about icecream, but if you change the topic to the beach or "something fancy" you will see how the AI is able to switch to a new conversation branch where they could, in principle, have access to different information in their prompts. I know this is a silly example, but I hope you take it more as a proof-of-principle.
I would love to see something like this implemented in the core of LangChain. I have no experience contributing to open source projects so Im not sure where to start with this.
Please let me know what you think!