From e89eb0664e128406c74aeae2bfa09b8d86b4d853 Mon Sep 17 00:00:00 2001 From: moritzlaurer Date: Thu, 12 Dec 2024 13:05:48 +0100 Subject: [PATCH] docs: small updates --- docs/agents.md | 5 ++++- docs/reference/tools.md | 4 ++-- docs/standard_prompt_format.md | 4 ++-- docs/standard_tool_format.md | 2 ++ mkdocs.yml | 4 +++- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/docs/agents.md b/docs/agents.md index 277e351..8bbf45a 100644 --- a/docs/agents.md +++ b/docs/agents.md @@ -1,5 +1,8 @@ # Agents +!!! note + Standardizing the sharing of tools and agents is in an early experimental stage. + How could the sharing of agents be standardized on the HF Hub? A good standard for sharing agents should be: modular, open, and interoperable. @@ -9,7 +12,7 @@ Agents have four main components: 1. An orchestration library such as [autogen](https://github.com/microsoft/autogen), [CrewAI](https://github.com/crewAIInc/crewAI), [langchain](https://github.com/langchain-ai/langchain), or [transformers.agents](https://huggingface.co/docs/transformers/en/agents), which implements prompt formatting, tool parsing, API calls, agent interaction etc. 2. A set of prompt templates that define different tasks and agent personas. -3. A set of tools, provided as JSON strings, Python dictionaries, or functions. +3. A set of tools, which are essentially a prompt template + code. 4. A compute environment to run the agent code, invoking the prompts and tools. **Modularity** is a fundamental principle in software engineering. It enables maintainability, reusability, scalability, and testability. In practice, however, the code for LLM systems and agents often combines prompt strings, tool functions and the agent orchestration code in the same files. This means that changes in prompts are hard to test and version and it is harder for others to reuse prompt templates or tools for their own systems. diff --git a/docs/reference/tools.md b/docs/reference/tools.md index 0806b26..eee6f3a 100644 --- a/docs/reference/tools.md +++ b/docs/reference/tools.md @@ -1,9 +1,9 @@ # Tools -This section documents the Tool class. - !!! note This class is still in an early experimental stage. + +This section documents the Tool class. ::: prompt_templates.tools options: diff --git a/docs/standard_prompt_format.md b/docs/standard_prompt_format.md index 3fd91ca..10c024a 100644 --- a/docs/standard_prompt_format.md +++ b/docs/standard_prompt_format.md @@ -1,6 +1,6 @@ # Standardizing prompt templates -The library expects prompt templates to be stored as modular YAML or JSON files. They can be part of any HF repository, see for example the `Files` tab in these repos for [open-weight model prompts](https://huggingface.co/MoritzLaurer/open_models_special_prompts), [closed-model prompts](https://huggingface.co/MoritzLaurer/closed_system_prompts), or [dataset prompts](https://huggingface.co/datasets/MoritzLaurer/dataset_prompts). +The library expects prompt templates to be stored as modular YAML or JSON files. They can be stored locally or in an HF repository, see for example the `Files` tab in these repos for [open-weight model prompts](https://huggingface.co/MoritzLaurer/open_models_special_prompts), [closed-model prompts](https://huggingface.co/MoritzLaurer/closed_system_prompts), or [dataset prompts](https://huggingface.co/datasets/MoritzLaurer/dataset_prompts). A prompt template YAML or JSON file must follow the following standardized structure: @@ -113,7 +113,7 @@ prompt_template_langchain = prompt_template.to_langchain_template() - The [simplest use](https://huggingface.co/docs/transformers/en/conversations) is via the text-generation pipeline - See also details on [chat_templates](https://huggingface.co/docs/transformers/main/en/chat_templating). - Limitations: - - The original purpose of these chat_templates is to easily add special tokens that a specific open-source model requires under the hood. The `hub_hub_prompts` library is designed for prompt templates for any LLM, not just open-source LLMs. + - The original purpose of these chat_templates is to easily add special tokens that a specific open-source model requires under the hood. The `prompt_templates` library is designed for prompt templates for any LLM, not just open-source LLMs. - VLMs require special pre-processors that are not directly compatible with the standardized messages format (?). And new VLMs like [InternVL](https://huggingface.co/OpenGVLab/InternVL2-1B/blob/main/tokenizer_config.json) or [Molmo](https://huggingface.co/allenai/Molmo-7B-D-0924) often require non-standardized remote code for image preprocessing. - LLMs like [command-r](https://huggingface.co/CohereForAI/c4ai-command-r-plus-08-2024) have cool special prompts e.g. for grounded generation, but they provide their own custom remote code for preparing prompts/functionalities properly for these special prompts. diff --git a/docs/standard_tool_format.md b/docs/standard_tool_format.md index da2d51a..c3737ea 100644 --- a/docs/standard_tool_format.md +++ b/docs/standard_tool_format.md @@ -1,5 +1,7 @@ # Standardizing and Sharing Tools +!!! note + Standardizing the sharing of tools and agents is in an early experimental stage. ## What are LLM tools? diff --git a/mkdocs.yml b/mkdocs.yml index fc46216..473df0b 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -7,8 +7,8 @@ repo_name: moritzlaurer/prompt_templates nav: - Home: - Overview: index.md - - HF Hub Repo Types: repo_types_examples.md - Standard Prompt Format: standard_prompt_format.md + - HF Hub Repo Types: repo_types_examples.md - Tools: standard_tool_format.md - Agents: agents.md - API Reference: @@ -75,6 +75,8 @@ markdown_extensions: anchor_linenums: true - pymdownx.superfences - pymdownx.inlinehilite + - admonition + - pymdownx.details plugins: - search