Skip to content

Commit

Permalink
update workflow endpoint docs
Browse files Browse the repository at this point in the history
  • Loading branch information
au-re committed Sep 4, 2023
1 parent 90e74d1 commit 6fa4f4f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion websites/docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default defineConfig({
text: "Rest API",
items: [
{ text: "Getting Started", link: "/api/getting-started" },
{ text: "Run a Flow", link: "/api/run-flow" },
{ text: "Run a Workflow", link: "/api/run-flow" },
],
},
{
Expand Down
54 changes: 27 additions & 27 deletions websites/docs/pages/api/run-flow.md
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.

0 comments on commit 6fa4f4f

Please sign in to comment.