Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/plugins/plugin-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ Fragment loader plugins differ from template loader plugins in that you can stac

A fragment loader can return one or more string fragments or attachments, or a mixture of the two. The fragments will be concatenated together into the prompt string, while any attachments will be added to the list of attachments to be sent to the model.

The `prefix` specifies the loader. The `argument` will be passed to that registered callback..
The `prefix` specifies the loader. The `argument` will be passed to that registered callback.

The callback works in a very similar way to template loaders, but returns either a single `llm.Fragment`, a list of `llm.Fragment` objects, a single `llm.Attachment`, or a list that can mix `llm.Attachment` and `llm.Fragment` objects.

Expand Down Expand Up @@ -278,8 +278,8 @@ def my_fragment_loader(argument: str) -> llm.Fragment:
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}"),
llm.Fragment("Fragment 1 content", f"my-fragments:{argument}"),
llm.Fragment("Fragment 2 content", f"my-fragments:{argument}"),
llm.Attachment(path="/path/to/image.png"),
]
```
Expand Down