chore: import upstream snapshot with attribution
tools_continuous_delivery / Private PyPI non-main branch release (push) Has been skipped
tools_continuous_delivery / Private PyPI main branch release (push) Failing after 2m42s
Publish Promptflow Doc / Build (push) Has been cancelled
Publish Promptflow Doc / Deploy (push) Has been cancelled
Flake8 Lint / flake8 (push) Has been cancelled
Spell check CI / Spell_Check (push) Has been cancelled
tools_continuous_delivery / Private PyPI non-main branch release (push) Has been skipped
tools_continuous_delivery / Private PyPI main branch release (push) Failing after 2m42s
Publish Promptflow Doc / Build (push) Has been cancelled
Publish Promptflow Doc / Deploy (push) Has been cancelled
Flake8 Lint / flake8 (push) Has been cancelled
Spell check CI / Spell_Check (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
# Deploy a flow using development server
|
||||
|
||||
Once you have created and thoroughly tested a flow, you can use it as an HTTP endpoint.
|
||||
|
||||
::::{tab-set}
|
||||
:::{tab-item} CLI
|
||||
:sync: CLI
|
||||
We are going to use the [web-classification](https://github.com/microsoft/promptflow/tree/main/examples/flows/standard/web-classification/) as
|
||||
an example to show how to deploy a flow.
|
||||
|
||||
Please ensure you have [create the connection](../manage-connections.md#create-a-connection) required by flow, if not, you could
|
||||
refer to [Setup connection for web-classification](https://github.com/microsoft/promptflow/tree/main/examples/flows/standard/web-classification).
|
||||
|
||||
Note: We will use relevant environment variable ({connection_name}_{key_name}) to override connection configurations in
|
||||
serving mode, white space in connection name will be removed directly from environment variable name. For instance,
|
||||
if there is a custom connection named 'custom_connection' with a configuration key called 'chat_deployment_name,' the
|
||||
function will attempt to retrieve 'chat_deployment_name' from the environment variable
|
||||
'CUSTOM_CONNECTION_CHAT_DEPLOYMENT_NAME' by default. If the environment variable is not set, it will use the original
|
||||
value as a fallback.
|
||||
|
||||
|
||||
The following CLI commands allows you serve a flow folder as an endpoint. By running this command, a [flask](https://flask.palletsprojects.com/en/) app will start in the environment where command is executed, please ensure all prerequisites required by flow have been installed.
|
||||
```bash
|
||||
# Serve the flow at localhost:8080
|
||||
pf flow serve --source <path-to-your-flow-folder> --port 8080 --host localhost
|
||||
```
|
||||
|
||||
The expected result is as follows if the flow served successfully, and the process will keep alive until it be killed manually.
|
||||
|
||||

|
||||
:::
|
||||
:::{tab-item} VS Code Extension
|
||||
:sync: VSC
|
||||
In visual editor, choose:
|
||||

|
||||
then choose format:
|
||||

|
||||
then in yaml editor:
|
||||

|
||||
:::
|
||||
::::
|
||||
|
||||
## Test endpoint
|
||||
::::{tab-set}
|
||||
:::{tab-item} Bash
|
||||
You could open another terminal to test the endpoint with the following command:
|
||||
```bash
|
||||
curl http://localhost:8080/score --data '{"url":"https://play.google.com/store/apps/details?id=com.twitter.android"}' -X POST -H "Content-Type: application/json"
|
||||
```
|
||||
:::
|
||||
:::{tab-item} PowerShell
|
||||
You could open another terminal to test the endpoint with the following command:
|
||||
```powershell
|
||||
Invoke-WebRequest -URI http://localhost:8080/score -Body '{"url":"https://play.google.com/store/apps/details?id=com.twitter.android"}' -Method POST -ContentType "application/json"
|
||||
```
|
||||
:::
|
||||
:::{tab-item} Test Page
|
||||
The development server has a built-in web page you can use to test the flow. Open 'http://localhost:8080' in your browser.
|
||||

|
||||
:::
|
||||
::::
|
||||
|
||||
## Next steps
|
||||
- Try the example [here](https://github.com/microsoft/promptflow/tree/main/examples/flows/standard/web-classification/).
|
||||
- See how to [deploy a flow using docker](deploy-using-docker.md).
|
||||
- See how to [deploy a flow using kubernetes](deploy-using-kubernetes.md).
|
||||
Reference in New Issue
Block a user