Skip to content

Commit 61e2601

Browse files
committed
run playground flow
1 parent 2ea0153 commit 61e2601

File tree

5 files changed

+64
-5
lines changed

5 files changed

+64
-5
lines changed

apps/11_promptflow/README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,65 @@ $ pf run create \
6666
--stream
6767
```
6868

69+
### playground
70+
71+
```shell
72+
cd apps/11_promptflow
73+
74+
# Initialize a new flow
75+
$ pf flow init \
76+
--flow playground \
77+
--type chat
78+
79+
$ cd playground
80+
81+
# Set parameters
82+
$ CONNECTION_NAME=open_ai_connection
83+
$ AZURE_OPENAI_KEY=<your_api_key>
84+
$ AZURE_OPENAI_ENDPOINT=<your_api_endpoint>
85+
86+
# List connections
87+
$ pf connection list
88+
89+
90+
# Delete connection (if needed)
91+
$ pf connection delete \
92+
--name $CONNECTION_NAME
93+
94+
# Create connection
95+
$ pf connection create \
96+
--file azure_openai.yaml \
97+
--set api_key=$AZURE_OPENAI_KEY \
98+
--set api_base=$AZURE_OPENAI_ENDPOINT \
99+
--name $CONNECTION_NAME
100+
101+
# Show connection
102+
$ pf connection show \
103+
--name $CONNECTION_NAME
104+
105+
# Interact with chat flow
106+
$ pf flow test \
107+
--flow . \
108+
--interactive
109+
110+
# Test flow
111+
$ pf flow test \
112+
--flow . \
113+
--inputs question="What's the capital of France?"
114+
115+
# Create run with multiple lines data
116+
$ RUN_NAME=playground-$(date +%s)
117+
$ pf run create \
118+
--name $RUN_NAME \
119+
--flow . \
120+
--data ./data.jsonl \
121+
--column-mapping question='${data.question}' \
122+
--stream
123+
124+
# Show run details
125+
$ pf run show-details --name $RUN_NAME
126+
```
127+
69128
## References
70129

71130
- [Prompt flow > repos](https://github.com/microsoft/promptflow)

apps/11_promptflow/playground/azure_openai.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ type: azure_open_ai
44
api_key: "<user-input>"
55
api_base: "<user-input>"
66
api_type: "azure"
7+
api_version: "2024-07-01-preview"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{"question": "What's the capital of France?"}
2+
{"question": "What's the capital of Japan?"}
3+
{"question": "What's the capital of China?"}

apps/11_promptflow/playground/flow.dag.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ nodes:
1919
type: code
2020
path: chat.jinja2
2121
inputs:
22-
deployment_name: gpt-35-turbo
22+
deployment_name: gpt-4o
2323
max_tokens: '256'
2424
temperature: '0.7'
2525
chat_history: ${inputs.chat_history}

apps/11_promptflow/playground/openai.yaml

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)