From cb1ea231dc47e3094be9f61a548d54ccdaa1a2a1 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 8 May 2025 19:05:50 -0700 Subject: [PATCH] Example docstrings for fragment loaders !stable-docs --- docs/plugins/plugin-hooks.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/plugins/plugin-hooks.md b/docs/plugins/plugin-hooks.md index c77c49a..c2c8fe2 100644 --- a/docs/plugins/plugin-hooks.md +++ b/docs/plugins/plugin-hooks.md @@ -136,6 +136,10 @@ def register_fragment_loaders(register): def my_fragment_loader(argument: str) -> llm.Fragment: + """ + Documentation for the fragment loader goes here. It will be displayed + when users run the 'llm fragments loaders' command. + """ try: fragment = "Fragment content for {}".format(argument) source = "my-fragments:{}".format(argument) @@ -148,6 +152,7 @@ def my_fragment_loader(argument: str) -> llm.Fragment: # Or for the case where you want to return multiple fragments and attachments: def my_fragment_loader(argument: str) -> list[llm.Fragment]: + "Docs go here." return [ llm.Fragment("Fragment 1 content", "my-fragments:{argument}"), llm.Fragment("Fragment 2 content", "my-fragments:{argument}"),