Skip to content

Commit cd213b7

Browse files
authored
Merge branch 'microsoft:main' into main
2 parents 1d3506a + f7205a0 commit cd213b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1388
-328
lines changed

.github/workflows/build_doc_ci.yml

+14-30
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ on:
1111
- 'docs/**'
1212
- 'scripts/docs/**'
1313
- '.github/workflows/build_doc_ci.yml'
14+
- 'src/promptflow/promptflow/**'
1415

1516
env:
1617
packageSetupType: promptflow_with_extra
1718
testWorkingDirectory: ${{ github.workspace }}/src/promptflow
18-
condaEnvName: release-env
1919

2020
jobs:
2121
build_doc_job:
@@ -27,10 +27,21 @@ jobs:
2727
with:
2828
submodules: true
2929

30-
- name: Build Doc
30+
- name: Python Setup
31+
uses: "./.github/actions/step_create_python_environment"
32+
33+
- name: Dev setup
34+
uses: "./.github/actions/step_sdk_setup"
35+
with:
36+
setupType: ${{ env.packageSetupType }}
37+
scriptPath: ${{ env.testWorkingDirectory }}
38+
39+
- name: Build doc with reference doc
3140
shell: powershell
3241
working-directory: scripts/docs/
33-
run: ./doc_generation.ps1 -WarningAsError:$true
42+
run: |-
43+
pip install langchain
44+
./doc_generation.ps1 -WithReferenceDoc:$true -WarningAsError:$true
3445
3546
# Note: We have this job separately because some error may missing when build link check exists.
3647
link_check_job:
@@ -46,30 +57,3 @@ jobs:
4657
shell: powershell
4758
working-directory: scripts/docs/
4859
run: ./doc_generation.ps1 -BuildLinkCheck -WarningAsError:$true
49-
50-
# TODO: Once we fixed all warnings in reference doc job, delete this whole job and make job "build_doc_job" to run with "-WithReferenceDoc:$true"
51-
build_doc_with_reference_doc_job:
52-
runs-on: windows-latest
53-
name: Build Doc with Reference Doc
54-
steps:
55-
- name: Checkout Repo
56-
uses: actions/checkout@v2
57-
with:
58-
submodules: true
59-
60-
- name: Conda Setup
61-
uses: "./.github/actions/step_create_conda_environment"
62-
63-
- name: Dev setup
64-
uses: "./.github/actions/step_sdk_setup"
65-
with:
66-
setupType: ${{ env.packageSetupType }}
67-
scriptPath: ${{ env.testWorkingDirectory }}
68-
69-
- name: Build doc with reference doc
70-
shell: powershell
71-
working-directory: scripts/docs/
72-
run: |-
73-
conda activate ${{ env.condaEnvName }}
74-
pip install langchain
75-
./doc_generation.ps1 -WithReferenceDoc:$true

.github/workflows/promptflow-executor-e2e-test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ jobs:
6565
az account show
6666
pip install langchain
6767
python scripts/building/run_coverage_tests.py `
68-
-p ${{ github.workspace }}/src/promptflow/promptflow `
69-
-t ${{ github.workspace }}/src/promptflow/tests/executor/e2etests `
68+
-p ${{ env.testWorkingDirectory }}/promptflow `
69+
-t ${{ env.testWorkingDirectory }}/tests/executor/e2etests `
7070
-l eastus `
7171
-m "all" `
7272
-n ${{ steps.cpu-cores.outputs.count }}`
73-
--coverage-config ${{ github.workspace }}/src/promptflow/tests/executor/.coveragerc
73+
--coverage-config ${{ env.testWorkingDirectory }}/tests/executor/.coveragerc
7474
- name: Upload Test Results
7575
if: always()
7676
uses: actions/upload-artifact@v3

.github/workflows/promptflow-executor-unit-test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ jobs:
6464
gci env:* | sort-object name
6565
az account show
6666
python scripts/building/run_coverage_tests.py `
67-
-p ${{ github.workspace }}/src/promptflow/promptflow `
68-
-t ${{ github.workspace }}/src/promptflow/tests/executor/unittests `
67+
-p ${{ env.testWorkingDirectory }}/promptflow `
68+
-t ${{ env.testWorkingDirectory }}/tests/executor/unittests `
6969
-l eastus `
7070
-m "all" `
7171
-n ${{ steps.cpu-cores.outputs.count }} `
72-
--coverage-config ${{ github.workspace }}/src/promptflow/tests/executor/.coveragerc
72+
--coverage-config ${{ env.testWorkingDirectory }}/tests/executor/.coveragerc
7373
- name: Upload Test Results
7474
if: always()
7575
uses: actions/upload-artifact@v3

.github/workflows/publish_doc.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ jobs:
3636
with:
3737
submodules: true
3838

39-
- name: Conda Setup
40-
uses: "./.github/actions/step_create_conda_environment"
39+
- name: Python Setup
40+
uses: "./.github/actions/step_create_python_environment"
4141

4242
- name: Dev setup
4343
uses: "./.github/actions/step_sdk_setup"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ htmlcov/
4545
.cache
4646
nosetests.xml
4747
coverage.xml
48+
cov.xml
4849
*.cover
4950
*.py,cover
5051
.hypothesis/

README.md

+91-11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
[![Python package](https://img.shields.io/pypi/v/promptflow)](https://pypi.org/project/promptflow/)
44
[![Python](https://img.shields.io/pypi/pyversions/promptflow.svg?maxAge=2592000)](https://pypi.python.org/pypi/promptflow/)
55
[![PyPI - Downloads](https://img.shields.io/pypi/dm/promptflow)](https://pypi.org/project/promptflow/)
6+
[![CLI](https://img.shields.io/badge/CLI-reference-blue)](https://microsoft.github.io/promptflow/reference/pf-command-reference.html)
7+
[![vsc extension](https://img.shields.io/visual-studio-marketplace/i/prompt-flow.prompt-flow?logo=Visual%20Studio&label=Extension%20)](https://marketplace.visualstudio.com/items?itemName=prompt-flow.prompt-flow)
8+
9+
[![Doc](https://img.shields.io/badge/Doc-online-green)](https://microsoft.github.io/promptflow/index.html)
10+
[![Issue](https://img.shields.io/github/issues/microsoft/promptflow)](https://github.com/microsoft/promptflow/issues/new/choose)
11+
[![Discussions](https://img.shields.io/github/discussions/microsoft/promptflow)](https://github.com/microsoft/promptflow/issues/new/choose)
12+
[![CONTRIBUTING](https://img.shields.io/badge/Contributing-8A2BE2)](https://github.com/microsoft/promptflow/blob/main/CONTRIBUTING.md)
613
[![License: MIT](https://img.shields.io/github/license/microsoft/promptflow)](https://github.com/microsoft/promptflow/blob/main/LICENSE)
714

815
> Welcome to join us to make Prompt flow better by
@@ -14,20 +21,93 @@
1421

1522
With prompt flow, you will be able to:
1623

17-
- Create executable workflows that link LLMs, prompts, Python code and other tools together.
18-
- Debug and iterate your flows, especially the interaction with LLMs with ease.
19-
- Evaluate your flow's quality and performance with larger datasets.
20-
- Integrate the testing and evaluation into your CI/CD system to ensure quality of your flow.
21-
- Deploy your flow to the serving platform you choose or integrate into your app's code base easily.
22-
- (Optional but highly recommended) Collaborate with your team by leveraging the cloud version of [Prompt flow in Azure AI](https://learn.microsoft.com/en-us/azure/machine-learning/prompt-flow/overview-what-is-prompt-flow?view=azureml-api-2).
24+
- **Create and iteratively develop flow**
25+
- Create executable [flows](https://microsoft.github.io/promptflow/concepts/concept-flows.html) that link LLMs, prompts, Python code and other [tools](https://microsoft.github.io/promptflow/concepts/concept-tools.html) together.
26+
- Debug and iterate your flows, especially the [interaction with LLMs](https://microsoft.github.io/promptflow/concepts/concept-connections.html) with ease.
27+
- **Evaluate flow quality and performance**
28+
- Evaluate your flow's quality and performance with larger datasets.
29+
- Integrate the testing and evaluation into your CI/CD system to ensure quality of your flow.
30+
- **Streamlined development cycle for production**
31+
- Deploy your flow to the serving platform you choose or integrate into your app's code base easily.
32+
- (Optional but highly recommended) Collaborate with your team by leveraging the cloud version of [Prompt flow in Azure AI](https://learn.microsoft.com/en-us/azure/machine-learning/prompt-flow/overview-what-is-prompt-flow?view=azureml-api-2).
33+
34+
------
35+
36+
## Installation
37+
38+
Ensure you have a python environment, `python=3.9` is recommended.
39+
40+
```sh
41+
pip install promptflow promptflow-tools
42+
```
43+
44+
## Quick Start ⚡
45+
46+
**Create a chatbot with prompt flow**
47+
48+
Run the command to initiate a prompt flow from a chat template, it creates folder named `my_chatbot` and generates required files within it:
49+
50+
```sh
51+
pf flow init --flow ./my_chatbot --type chat
52+
```
53+
54+
**Setup a connection for your API key**
55+
56+
For OpenAI key, establish a connection by running the command, using the `openai.yaml` file in the `my_chatbot` folder, which stores your OpenAI key:
57+
58+
```sh
59+
# Override keys with --set to avoid yaml file changes
60+
pf connection create --file ./my_chatbot/openai.yaml --set api_key=<your_api_key> --name open_ai_connection
61+
```
62+
63+
For Azure OpenAI key, establish the connection by running the command, using the `azure_openai.yaml` file:
64+
65+
```sh
66+
pf connection create --file ./my_chatbot/azure_openai.yaml --set api_key=<your_api_key> api_base=<your_api_base> --name open_ai_connection
67+
```
68+
69+
**Chat with your flow**
70+
71+
In the `my_chatbot` folder, there's a `flow.dag.yaml` file that outlines the flow, including inputs/outputs, nodes, connection, and the LLM model, etc
72+
73+
> Note that in the `chat` node, we're using a connection named `open_ai_connection` (specified in `connection` field) and the `gpt-35-turbo` model (specified in `deployment_name` field). The deployment_name filed is to specify the OpenAI model, or the Azure OpenAI deployment resource.
74+
75+
Interact with your chatbot by running: (press `Ctrl + C` to end the session)
76+
77+
```sh
78+
pf flow test --flow ./my_chatbot --interactive
79+
```
80+
81+
Next Step! Continue with the **Tutorial** 👇 section to delve deeper into Prompt flow.
82+
83+
## Tutorial 🏃‍♂️
84+
85+
Prompt Flow is a tool designed to **build high quality LLM apps**, the development process in prompt flow follows these steps: develop a flow, improve the flow quality, deploy the flow to production.
86+
87+
### Develop your own LLM apps
88+
89+
#### VS Code Extension<img src="examples/tutorials/quick-start/media/logo_pf.png" alt="logo" width="25"/>
90+
91+
We also offer a VS Code extension (a flow designer) for an interactive flow development experience with UI.
92+
93+
<img src="examples/tutorials/quick-start/media/vsc.png" alt="vsc" width="1000"/>
94+
95+
You can install it from the <a href="https://marketplace.visualstudio.com/items?itemName=prompt-flow.prompt-flow">visualstudio marketplace</a>.
96+
97+
#### Deep dive into flow development
98+
99+
[Getting Started with Prompt Flow](https://microsoft.github.io/promptflow/how-to-guides/quick-start.html): A step by step guidance to invoke your first flow run.
100+
101+
### Learn from use cases
102+
103+
[Tutorial: Chat with PDF](https://github.com/microsoft/promptflow/blob/main/examples/tutorials/e2e-development/chat-with-pdf.md): An end-to-end tutorial on how to build a high quality chat application with prompt flow, including flow development and evaluation with metrics.
104+
> More examples can be found [here](https://microsoft.github.io/promptflow/tutorials/index.html#samples). We welcome contributions of new use cases!
23105
24-
## Get Started with Prompt flow ⚡
106+
### Setup for contributors
25107

26-
Develop your LLM apps with Prompt flow: please start with our [docs](https://microsoft.github.io/promptflow/) & [examples](./examples/README.md):
27-
- [Getting Started with Prompt Flow](https://microsoft.github.io/promptflow/how-to-guides/quick-start.html): A step by step guidance to invoke your first flow run.
28-
- [Tutorial: Chat with PDF](https://github.com/microsoft/promptflow/blob/main/examples/tutorials/e2e-development/chat-with-pdf.md): An end-to-end tutorial on how to build a high quality chat application with prompt flow, including flow development and evaluation with metrics.
108+
If you're interested in contributing, please start with our dev setup guide: [dev_setup.md](./docs/dev/dev_setup.md).
29109

30-
Contribute to Prompt flow: please start with our dev setup guide: [dev_setup.md](./docs/dev/dev_setup.md).
110+
Next Step! Continue with the **Contributing** 👇 section to to contribute to Prompt flow.
31111

32112
## Contributing
33113

docs/cloud/azureai/deploy-to-azure-appservice.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This example demos how to deploy [web-classification](https://github.com/microso
1010
Use the command below to build a flow as docker format app:
1111

1212
```bash
13-
pf flow build --source ../../flows/standard/web-classification --output build --format docker
13+
pf flow build --source ../../flows/standard/web-classification --output dist --format docker
1414
```
1515

1616
Note that all dependent connections must be created before building as docker.
@@ -27,7 +27,7 @@ The two scripts will do the following things:
2727
:::{tab-item} Bash
2828
Example command to use bash script:
2929
```shell
30-
bash deploy.sh --path build -i <image_tag> --name my_app_23d8m -r <docker registery> -g <resource_group>
30+
bash deploy.sh --path dist -i <image_tag> --name my_app_23d8m -r <docker registery> -g <resource_group>
3131
```
3232
See the full parameters by `bash deploy.sh -h`.
3333
:::

docs/how-to-guides/deploy-a-flow/deploy-using-docker.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ refer to [Setup connection for web-classifiction](https://github.com/microsoft/p
5353
Use the command below to build a flow as docker format app:
5454

5555
```bash
56-
pf flow build --source ../../flows/standard/web-classification --output build --format docker
56+
pf flow build --source ../../flows/standard/web-classification --output dist --format docker
5757
```
5858

5959
Note that all dependent connections must be created before exporting as docker.
@@ -65,7 +65,7 @@ Like other Dockerfile, you need to build the image first. You can tag the image
6565
Run the command below to build image:
6666

6767
```bash
68-
docker build build -t web-classification-serve
68+
docker build dist -t web-classification-serve
6969
```
7070

7171
### Run Docker image

examples/tutorials/e2e-development/chat-with-pdf.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ the other choices, please refer to [flow deploy docs](https://microsoft.github.i
325325
Use the command below to build a flow as docker format app:
326326

327327
```bash
328-
pf flow build --source . --output build --format docker
328+
pf flow build --source . --output dist --format docker
329329
```
330330

331331
### Deploy with Docker
@@ -336,7 +336,7 @@ Like other Dockerfile, you need to build the image first. You can tag the image
336336
Run the command below to build image:
337337

338338
```shell
339-
docker build build -t chat-with-pdf-serve
339+
docker build dist -t chat-with-pdf-serve
340340
```
341341

342342
#### Run Docker image

examples/tutorials/flow-deploy/azure-app-service/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pf connection create --file ../../../connections/azure_openai.yml --set api_key=
1818
Use the command below to build a flow as docker format app:
1919

2020
```bash
21-
pf flow build --source ../../../flows/standard/web-classification --output build --format docker
21+
pf flow build --source ../../../flows/standard/web-classification --output dist --format docker
2222
```
2323

2424

@@ -32,7 +32,7 @@ The two scripts will do the following things:
3232

3333
Example command to use bash script:
3434
```shell
35-
bash deploy.sh --path build -i <image_tag> --name my_app_23d8m -r <docker registery> -g <resource_group>
35+
bash deploy.sh --path dist -i <image_tag> --name my_app_23d8m -r <docker registery> -g <resource_group>
3636
```
3737

3838
Example command to use powershell script:

examples/tutorials/flow-deploy/docker/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pf connection create --file ../../../connections/azure_openai.yml --set api_key=
1414
Use the command below to build a flow as docker format app:
1515

1616
```bash
17-
pf flow build --source ../../../flows/standard/web-classification --output build --format docker
17+
pf flow build --source ../../../flows/standard/web-classification --output dist --format docker
1818
```
1919

2020
## Deploy with Docker
@@ -25,7 +25,7 @@ Like other Dockerfile, you need to build the image first. You can tag the image
2525
Run the command below to build image:
2626

2727
```shell
28-
docker build build -t web-classification-serve
28+
docker build dist -t web-classification-serve
2929
```
3030

3131
### Run Docker image

examples/tutorials/flow-deploy/kubernetes/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pf connection create --file ../../../connections/azure_openai.yml --set api_key=
1515
Use the command below to build a flow as docker format app:
1616

1717
```bash
18-
pf flow build --source ../../../flows/standard/web-classification --output build --format docker
18+
pf flow build --source ../../../flows/standard/web-classification --output dist --format docker
1919
```
2020

2121
## Deploy with Kubernetes
@@ -26,7 +26,7 @@ Like other Dockerfile, you need to build the image first. You can tag the image
2626
Then run the command below:
2727

2828
```shell
29-
cd build
29+
cd dist
3030
docker build . -t web-classification-serve
3131
```
3232

Loading
159 KB
Loading

scripts/docs/conf.py

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"sphinx_design",
2222
"sphinx_copybutton",
2323
"matplotlib.sphinxext.plot_directive",
24-
"numpydoc",
2524
"sphinx_togglebutton",
2625
'myst_parser',
2726
"sphinx.builders.linkcheck",

scripts/docs/doc_generation.ps1

+8-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ param(
2323
[string] $OutPath = [System.IO.Path]::Combine($ScriptPath, "_build")
2424
[string] $SphinxApiDoc = [System.IO.Path]::Combine($DocPath, "sphinx_apidoc.log")
2525
[string] $SphinxBuildDoc = [System.IO.Path]::Combine($DocPath, "sphinx_build.log")
26-
[string] $WarningErrorPattern = "WARNING:|ERROR:"
26+
[string] $WarningErrorPattern = "WARNING:|ERROR:|CRITICAL:"
2727
$apidocWarningsAndErrors = $null
2828
$buildWarningsAndErrors = $null
2929

@@ -72,6 +72,13 @@ if($WithReferenceDoc){
7272
Write-Host "===============Build Promptflow Reference Doc==============="
7373
sphinx-apidoc --module-first --no-headings --no-toc --implicit-namespaces "$PkgSrcPath" -o "$RefDocPath" | Tee-Object -FilePath $SphinxApiDoc
7474
$apidocWarningsAndErrors = Select-String -Path $SphinxApiDoc -Pattern $WarningErrorPattern
75+
76+
Write-Host "=============== Overwrite promptflow.connections.rst ==============="
77+
# We are doing this overwrite because the connection entities are also defined in the promptflow.entities module
78+
# and it will raise duplicate object description error if we don't do so when we run sphinx-build later.
79+
$ConnectionRst = [System.IO.Path]::Combine($RepoRootPath, "scripts\docs\promptflow.connections.rst")
80+
$AutoGenConnectionRst = [System.IO.Path]::Combine($RefDocPath, "promptflow.connections.rst")
81+
Copy-Item -Path $ConnectionRst -Destination $AutoGenConnectionRst -Force
7582
}
7683

7784

0 commit comments

Comments
 (0)