langflow icon indicating copy to clipboard operation
langflow copied to clipboard

display or link to node documentation

Open clstaudt opened this issue 2 years ago • 6 comments

As a langflow user, I do not see a quick and easy way to look up the documentation for a node in my workflow.

Screenshot 2023-05-04 at 10 51 24

For example, the node could show a tooltip on hover or have a link to open the corresponding langchain class documentation.

Furthermore, it would be great if more documentation was attached to the inputs and outputs of a node. Not just the type, but a description text of the parameters.

In short, where are the docstrings?

I realize this also depends on documentation quality in langchain, which is evolving and was not in the greatest shape last time I checked. Then again, if your project is about LLMs, it would look good on it to have great docstrings, because they can mostly be auto-generated from the code nowadays...

clstaudt avatar May 04 '23 08:05 clstaudt

Hey, @clstaudt.

I agree with you. A link to LangChain would be interesting but would require a lot of manual labor which is what we are trying to avoid so that API changes to break everything all the time.

Maybe we can think of better ways to explain things in the node. The hover data on the inputs and outputs are really the types that are checked for when connecting nodes, but I'm sure we can think of something better.

ogabrielluiz avatar May 04 '23 18:05 ogabrielluiz

Assuming langchain classes have good docstrings, shouldn't it be possible to just extract and display them in the UI?

import inspect

class MyClass:
    """
    This is the MyClass docstring.
    """

    def method1(self):
        """
        This is the method1 docstring.
        """
        pass

    def method2(self):
        """
        This is the method2 docstring.
        """
        pass

def extract_docstrings(cls):
    docstrings = {}
    docstrings['class'] = inspect.getdoc(cls)
    
    for name, obj in inspect.getmembers(cls, predicate=inspect.isfunction):
        docstrings[name] = inspect.getdoc(obj)
    
    return docstrings

docstrings = extract_docstrings(MyClass)

for key, value in docstrings.items():
    print(f"{key}:\n{value}\n")

clstaudt avatar May 04 '23 18:05 clstaudt

Hey, @clstaudt.

I agree with you. A link to LangChain would be interesting but would require a lot of manual labor which is what we are trying to avoid so that API changes to break everything all the time.

Maybe we can think of better ways to explain things in the node. The hover data on the inputs and outputs are really the types that are checked for when connecting nodes, but I'm sure we can think of something better.

Easy way to fix this:

  1. work on a node requires working user documentation
  2. user documentation can come in the form of module comments
  3. node documentation is generated from comments and published when you do a prod release
  4. node documentation is published to a static website in separate pages that match the node name
  5. node documentation should have a version selector next to it.
  6. within the langflow ui, the ( ? ) icon should link to to something like: https://langflow.docs/node/chat-openai?version=0.7.5

edit: what i mean to say is that the methedology for solving this challenge is known

that API changes to break everything all the time.

and it is to ensure that the user documentation is versioned with the code it reflects and is made available all the time:

  • https://langflow.docs/v1.0.0/the-node which would suit statically generated sites
  • https://langflow.docs/node/chat-openai?version=0.7.5 which would suit a separately server side render-to-response website that sources documentation from uploaded json/yaml/md files.

airtonix avatar May 15 '23 03:05 airtonix

@clstaudt This is what we do. The problem is that documentation is not just a docstring.

ogabrielluiz avatar May 16 '23 01:05 ogabrielluiz

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 30 '23 09:06 stale[bot]

Stale bot - what is it good for?

clstaudt avatar Jun 30 '23 15:06 clstaudt

Function already implemented on latest version.

lucaseduoli avatar Jul 25 '23 14:07 lucaseduoli