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

Standardize KV-Store Docs #24888

Closed
jacoblee93 opened this issue Jul 31, 2024 · 1 comment
Closed

Standardize KV-Store Docs #24888

jacoblee93 opened this issue Jul 31, 2024 · 1 comment
Labels
🤖:docs Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder help wanted Good issue for contributors

Comments

@jacoblee93
Copy link
Contributor

jacoblee93 commented Jul 31, 2024

To make our KV-store integrations as easy to use as possible we need to make sure the docs for them are thorough and standardized. There are two parts to this: updating the KV-store docstrings and updating the actual integration docs.

This needs to be done for each KV-store integration, ideally with one PR per KV-store.

Related to broader issues #21983 and #22005.

Docstrings

Each KV-store class docstring should have the sections shown in the Appendix below. The sections should have input and output code blocks when relevant.

To build a preview of the API docs for the package you're working on run (from root of repo):

make api_docs_clean; make api_docs_quick_preview API_PKG=openai

where API_PKG= should be the parent directory that houses the edited package (e.g. community, openai, anthropic, huggingface, together, mistralai, groq, fireworks, etc.). This should be quite fast for all the partner packages.

Doc pages

Each KV-store docs page should follow this template.

Here is an example: https://python.langchain.com/v0.2/docs/integrations/stores/in_memory/

You can use the langchain-cli to quickly get started with a new chat model integration docs page (run from root of repo):

poetry run pip install -e libs/cli
poetry run langchain-cli integration create-doc --name "foo-bar" --name-class FooBar --component-type kv_store --destination-dir ./docs/docs/integrations/stores/

where --name is the integration package name without the "langchain-" prefix and --name-class is the class name without the "ByteStore" suffix. This will create a template doc with some autopopulated fields at docs/docs/integrations/stores/foo_bar.ipynb.

To build a preview of the docs you can run (from root):

make docs_clean
make docs_build
cd docs/build/output-new
yarn
yarn start

Appendix

Expected sections for the KV-store class docstring.

    """__ModuleName__ completion KV-store integration.

    # TODO: Replace with relevant packages, env vars.
    Setup:
        Install ``__package_name__`` and set environment variable ``__MODULE_NAME___API_KEY``.

        .. code-block:: bash

            pip install -U __package_name__
            export __MODULE_NAME___API_KEY="your-api-key"

    # TODO: Populate with relevant params.
    Key init args — client params:
        api_key: Optional[str]
            __ModuleName__ API key. If not passed in will be read from env var __MODULE_NAME___API_KEY.

    See full list of supported init args and their descriptions in the params section.

    # TODO: Replace with relevant init params.
    Instantiate:
        .. code-block:: python

            from __module_name__ import __ModuleName__ByteStore

            kv_store = __ModuleName__ByteStore(
                # api_key="...",
                # other params...
            )

    Set keys:
        .. code-block:: python

            kv_pairs = [
                ["key1", "value1"],
                ["key2", "value2"],
            ]

            kv_store.mset(kv_pairs)

        .. code-block:: python

    Get keys:
        .. code-block:: python

            kv_store.mget(["key1", "key2"])

        .. code-block:: python

            # TODO: Example output.

    Delete keys:
        ..code-block:: python

            kv_store.mdelete(["key1", "key2"])

        ..code-block:: python
    """  # noqa: E501
@dosubot dosubot bot added the 🤖:docs Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder label Jul 31, 2024
@baskaryan baskaryan added the help wanted Good issue for contributors label Jul 31, 2024
Copy link

dosubot bot commented Oct 30, 2024

Hi, @jacoblee93,

I'm helping the LangChain team manage their backlog and am marking this issue as stale. Your proposal to standardize documentation for KV-store integrations is important for improving usability, and it highlights the need for consistent docstrings and structured templates. However, there haven't been any comments or developments in the discussion yet.

Could you please let us know if this issue is still relevant to the latest version of the LangChain repository? If it is, feel free to comment here to keep the conversation going. Otherwise, you can close the issue yourself, or it will be automatically closed in 7 days.

Thank you!

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Oct 30, 2024
@dosubot dosubot bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 6, 2024
@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:docs Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder help wanted Good issue for contributors
Projects
None yet
Development

No branches or pull requests

2 participants