docs, cli[patch]: document loaders doc template (#22862)

From: https://github.com/langchain-ai/langchain/pull/22290

---------

Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
This commit is contained in:
Isaac Francisco
2024-06-13 19:28:57 -07:00
committed by GitHub
parent d1cdde267a
commit 75e966a2fa
4 changed files with 295 additions and 31 deletions

View File

@@ -153,7 +153,7 @@ def create_doc(
component_type: Annotated[
str,
typer.Option(
help=("The type of component. Currently only 'ChatModel' supported."),
help=("The type of component. Currently only 'ChatModel', 'DocumentLoader' supported."),
),
] = "ChatModel",
destination_dir: Annotated[
@@ -196,7 +196,10 @@ def create_doc(
)
# copy over template from ../integration_template
docs_template = Path(__file__).parents[1] / "integration_template/docs/chat.ipynb"
if component_type == "ChatModel":
docs_template = Path(__file__).parents[1] / "integration_template/docs/chat.ipynb"
elif component_type == "DocumentLoader":
docs_template = Path(__file__).parents[1] / "integration_template/docs/document_loaders.ipynb"
shutil.copy(docs_template, destination_path)
# replacements in file