Flow
Get started with the Flow API
Chat Flow
POST /api/v2/chat/completions
Examples
Stream Chat Flow
- Curl
- Python
DBGPT_API_KEY=dbgpt
FLOW_ID={YOUR_FLOW_ID}
curl -X POST "http://localhost:5670/api/v2/chat/completions" \
-H "Authorization: Bearer $DBGPT_API_KEY" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d "{\"messages\":\"Hello\",\"model\":\"chatgpt_proxyllm\", \"chat_mode\": \"chat_flow\", \"chat_param\": \"$FLOW_ID\"}"
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
- Curl
- Python
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" \
from dbgpt.client import Client
from dbgpt.client.flow import delete_flow
DBGPT_API_KEY = "dbgpt"
flow_id = "{your_flow_id}"
client = Client(api_key=DBGPT_API_KEY)
res = await delete_flow(client=client, flow_id=flow_id)
Delete Parameters
uid string Required
flow id
Response body
Return Flow Object
Get Flow
GET /api/v2/serve/awel/flows/{flow_id}