Skip to content

Commit 4b7550f

Browse files
committed
add standard flow
1 parent 892ae10 commit 4b7550f

File tree

8 files changed

+102
-0
lines changed

8 files changed

+102
-0
lines changed

apps/11_promptflow/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,31 @@ $ pf run create \
152152
$ pf run show-details --name $RUN_NAME
153153
```
154154

155+
### playground_standard
156+
157+
```shell
158+
cd apps/11_promptflow
159+
160+
# Initialize a new flow
161+
$ pf flow init \
162+
--flow playground_standard \
163+
--type standard
164+
165+
$ cd playground_standard
166+
167+
# Create run with multiple lines data
168+
$ RUN_NAME=playground_standard-$(date +%s)
169+
$ pf run create \
170+
--name $RUN_NAME \
171+
--flow . \
172+
--data ./data.jsonl \
173+
--column-mapping text='${data.text}' \
174+
--stream
175+
176+
# Show run details
177+
$ pf run show-details --name $RUN_NAME
178+
```
179+
155180
## References
156181

157182
- [Prompt flow > repos](https://github.com/microsoft/promptflow)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.env
2+
__pycache__/
3+
.promptflow/*
4+
!.promptflow/flow.tools.json
5+
.runs/
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"package": {},
3+
"code": {
4+
"hello.jinja2": {
5+
"type": "prompt",
6+
"inputs": {
7+
"text": {
8+
"type": [
9+
"string"
10+
]
11+
}
12+
},
13+
"description": "Please replace the template with your own prompt.",
14+
"source": "hello.jinja2"
15+
},
16+
"hello.py": {
17+
"type": "python",
18+
"inputs": {
19+
"input1": {
20+
"type": [
21+
"string"
22+
]
23+
}
24+
},
25+
"source": "hello.py",
26+
"function": "my_python_tool"
27+
}
28+
}
29+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"text": "Hello World!"}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json
2+
inputs:
3+
text:
4+
type: string
5+
outputs:
6+
output_prompt:
7+
type: string
8+
reference: ${echo_my_prompt.output}
9+
nodes:
10+
- name: hello_prompt
11+
type: prompt
12+
source:
13+
type: code
14+
path: hello.jinja2
15+
inputs:
16+
text: ${inputs.text}
17+
- name: echo_my_prompt
18+
type: python
19+
source:
20+
type: code
21+
path: hello.py
22+
inputs:
23+
input1: ${hello_prompt.output}
24+
environment:
25+
python_requirements_txt: requirements.txt
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{# Please replace the template with your own prompt. #}
2+
Write a simple {{text}} program that displays the greeting message.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# ---------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# ---------------------------------------------------------
4+
5+
from promptflow.core import tool
6+
7+
# The inputs section will change based on the arguments of the tool function, after you save the code
8+
# Adding type to arguments and return value will help the system show the types properly
9+
# Please update the function name/signature per need
10+
11+
12+
@tool
13+
def my_python_tool(input1: str) -> str:
14+
return "Prompt: " + input1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
promptflow

0 commit comments

Comments
 (0)