-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
28 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,59 @@ | ||
# Run a flow | ||
# Run a workflow | ||
|
||
Run a flow you created on Prompt Studio from within your application given some input values. Returns the results of the flow. You can retrieve the `flow_id` from the flow editor. | ||
Run a workflow you created in Prompt Studio from within your application given some input values. This endpoint returns the results of the flow. You can retrieve the `version_id` of the workflow from the workflow editor. | ||
|
||
## `POST` `/v1/flows/:flow_id/run` | ||
## `POST` `/v1/workflows/:version_id/run` | ||
|
||
<Badge type="warning" text="unstable" /> | ||
|
||
Run the flow starting from the input node. | ||
Run a workflow starting from the input node. Values passed in the input field of the request body will be used as the input for the workflow. | ||
|
||
### Parameters | ||
|
||
| name | type | description | | ||
| --------- | ------ | ---------------------------------- | | ||
| `flow_id` | string | the id of the flow you want to run | | ||
| name | type | description | | ||
| ---- | ------ | -------------------------------------- | | ||
| `id` | string | the id of the workflow you want to run | | ||
|
||
### Request Body | ||
|
||
| name | type | description | | ||
| ---- | ---- | ----------------------------- | | ||
| `` | | the flow was run successfully | | ||
| name | type | description | | ||
| ------- | ------ | ---------------------------------------------------------------------------------------------------------------- | | ||
| `input` | object | object containing the input values of the workflow. The schema for this object is defined in the workflow editor | | ||
|
||
#### Example | ||
|
||
```sh | ||
curl -X POST \ | ||
--url "https://app.prompt.studio/v1/flows/<flow_id>/run" \ | ||
--url "https://api.prompt.studio/v1/workflows/<version_id>/run" \ | ||
--header "Content-Type: application/json" \ | ||
--header "API_KEY: <apiKey>" \ | ||
--data ' | ||
{} | ||
--data '{ "input": {"prompt": "what is the fastest car in the world?"} }' | ||
``` | ||
|
||
### Responses | ||
|
||
| name | type | description | | ||
| ----- | -------------- | ----------------------------- | | ||
| `200` | FlowRunSuccess | the flow was run successfully | | ||
| `400` | | the request is malformed | | ||
| `404` | | the flow was not found | | ||
| `500` | | error running the flow | | ||
| name | type | description | | ||
| ----- | -------------- | --------------------------------- | | ||
| `200` | FlowRunSuccess | the workflow was run successfully | | ||
| `404` | {} | the workflow was not found | | ||
| `500` | {} | error running the workflow | | ||
|
||
::: details FlowRunSuccess | ||
|
||
> | name | data type | description | | ||
> | ---- | --------- | ----------- | | ||
> | `` | string | | ||
The flow completed successfully | ||
|
||
> | name | data type | description | | ||
> | -------- | --------- | ------------------------------------------------------------------------------------------------- | | ||
> | `result` | object | the results of running the workflow. The schema for this object is defined in the workflow editor | | ||
::: | ||
|
||
#### Example | ||
|
||
```json | ||
{} | ||
{ | ||
"result": { | ||
"completion": "The current record holder for the fastest car in the world is the Bugatti Chiron Super Sport 300+, which reached a top speed of 304.77 mph (490.48 km/h) in 2019." | ||
} | ||
} | ||
``` | ||
## `POST` `/v1/flows/:flow_id/run/:node_id` | ||
Run the flow starting from any node. |