跳到主要内容
版本:v0.6.1

Flow

Get started with the Flow API

Chat Flow

POST /api/v2/chat/completions

Examples

Stream Chat Flow

from dbgpt.client import Client

DBGPT_API_KEY = "dbgpt"
FLOW_ID="{YOUR_FLOW_ID}"

client = Client(api_key=DBGPT_API_KEY)
async for data in client.chat_stream(
messages="Introduce AWEL",
model="chatgpt_proxyllm",
chat_mode="chat_flow",
chat_param=FLOW_ID
):
print(data)

Chat Completion Stream Response

data: {"id": "579f8862-fc4b-481e-af02-a127e6d036c8", "created": 1710918094, "model": "chatgpt_proxyllm", "choices": [{"index": 0, "delta": {"role": "assistant", "content": "\n\n"}}]}

Create Flow

POST /api/v2/serve/awel/flows

Request body

Request Flow Object

Response body

Return Flow Object

Update Flow

PUT /api/v2/serve/awel/flows

Request body

Request Flow Object

Response body

Return Flow Object

Delete Flow

DELETE /api/v2/serve/awel/flows
DBGPT_API_KEY=dbgpt
FLOW_ID={YOUR_FLOW_ID}

curl -X DELETE "http://localhost:5670/api/v2/serve/awel/flows/$FLOW_ID" \
-H "Authorization: Bearer $DBGPT_API_KEY" \

Delete Parameters


uid string Required

flow id


Response body

Return Flow Object

Get Flow

GET /api/v2/serve/awel/flows/{flow_id}
DBGPT_API_KEY=dbgpt
FLOW_ID={YOUR_FLOW_ID}

curl -X GET "http://localhost:5670/api/v2/serve/awel/flows/$FLOW_ID" -H "Authorization: Bearer $DBGPT_API_KEY"

Query Parameters


uid string Required

flow id


Response body

Return Flow Object

List Flow

GET /api/v2/serve/awel/flows
DBGPT_API_KEY=dbgpt

curl -X GET "http://localhost:5670/api/v2/serve/awel/flows" -H "Authorization: Bearer $DBGPT_API_KEY"

Response body

Return Flow Object

The Flow Object


uid string

The unique id for the flow.


name string

The name of the flow.


description string

The description of the flow.


label string

The label of the flow.


flow_category string

The category of the flow. Default is FlowCategory.COMMON.


flow_data object

The flow data.


state string

The state of the flow.Default is INITIALIZING.


error_message string

The error message of the flow.


source string

The source of the flow. Default is DBGPT-WEB.


source_url string

The source url of the flow.


version string

The version of the flow. Default is 0.1.0.


editable boolean

Whether the flow is editable. Default is True.


user_name string

The user name of the flow.


sys_code string

The system code of the flow.


dag_id string

The dag id of the flow.


gmt_created string

The created time of the flow.


gmt_modified string

The modified time of the flow.