You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/how-to-guides/develop-a-tool/create-custom-llm-tool.md
+47-48
Original file line number
Diff line number
Diff line change
@@ -4,60 +4,59 @@ In this document, we will guide you through the process of developing a tool wit
4
4
Custom LLM is a large language model fine-tuned by yourself. If you find it has good performance and is useful, then you can follow this guidance to make it a tool so that it can be shared with other people to have more impact.
5
5
6
6
## Prerequisites
7
-
- Please ensure that your `Prompt flow` for VS Code is updated to version 1.2.0 or later.
7
+
- Please ensure that your [Prompt flow for VS Code](https://marketplace.visualstudio.com/items?itemName=prompt-flow.prompt-flow) is updated to version 1.2.0 or later.
8
8
9
9
## How to create a custom LLM tool
10
10
Here we use [an existing tool package](../../../examples/tools/tool-package-quickstart/my_tool_package) as an example. If you want to create your own tool, please refer to [create and use tool package](create-and-use-tool-package.md).
11
11
12
-
### Add a `PromptTemplate` input to your tool, like in [this example](../../../examples/tools/tool-package-quickstart/my_tool_package/tools/tool_with_custom_llm_type.py)
13
-
14
-
```python
15
-
from jinja2 import Template
16
-
from promptflow import tool
17
-
from promptflow.connections import CustomConnection
18
-
# 1. Import the PromptTemplate type.
19
-
from promptflow.contracts.types import PromptTemplate
20
-
21
-
22
-
# 2. Add a PromptTemplate input for your tool method.
Run the command below in your tool project directory to automatically generate your tool YAML, use _-t "custom_llm"_ or _--tool-type "custom_llm"_ to indicate this is a custom LLM tool:
Here we use [an existing tool](../../../examples/tools/tool-package-quickstart/my_tool_package/yamls/tool_with_custom_llm_type.yaml) as an example.
37
-
```
38
-
cd D:\proj\github\promptflow\examples\tools\tool-package-quickstart
39
-
40
-
python D:\proj\github\promptflow\scripts\tool\generate_package_tool_meta.py -m my_tool_package.tools.tool_with_custom_llm_type -o my_tool_package\yamls\tool_with_custom_llm_type.yaml -n "My Custom LLM Tool" -d "This is a tool to demonstrate the custom_llm tool type" -t "custom_llm"
41
-
```
42
-
This command will generate a YAML file as follows:
Run the command below in your tool project directory to automatically generate your tool YAML, use _-t "custom_llm"_ or _--tool-type"custom_llm"_ to indicate this is a custom LLM tool:
Here we use [an existing tool](../../../examples/tools/tool-package-quickstart/my_tool_package/yamls/tool_with_custom_llm_type.yaml) as an example.
36
+
```
37
+
cd D:\proj\github\promptflow\examples\tools\tool-package-quickstart
38
+
39
+
python D:\proj\github\promptflow\scripts\tool\generate_package_tool_meta.py -m my_tool_package.tools.tool_with_custom_llm_type -o my_tool_package\yamls\tool_with_custom_llm_type.yaml -n "My Custom LLM Tool" -d "This is a tool to demonstrate the custom_llm tool type" -t "custom_llm"
Follow the steps to [build and install your tool package](create-and-use-tool-package.md#build-and-share-the-tool-package) and [use your tool from VS Code extension](create-and-use-tool-package.md#use-your-tool-from-vscode-extension).
60
59
61
60
Here we use an existing flow to demonstrate the experience, open [this flow](../../../examples/flows/standard/custom_llm_tool_showcase/flow.dag.yaml) inVS Code extension.
62
-
- There is a node named "custom_llm_tool" with a prompt template file. You can either use an existing file or create a new one as the prompt template file.
- There is a node named "my_custom_llm_tool"with a prompt template file. You can either use an existing fileor create a new one as the prompt template file.
0 commit comments