App
Get started with the App API
Chat App
POST /api/v2/chat/completions
Examples
Stream Chat App
- Curl
- Python
DBGPT_API_KEY=dbgpt
APP_ID={YOUR_APP_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_app\", \"chat_param\": \"$APP_ID\"}"
from dbgpt.client import Client
DBGPT_API_KEY = "dbgpt"
APP_ID="{YOUR_APP_ID}"
client = Client(api_key=DBGPT_API_KEY)
async for data in client.chat_stream(
messages="Introduce AWEL",
model="chatgpt_proxyllm",
chat_mode="chat_app",
chat_param=APP_ID
):
print(data)
Chat Completion Stream Response
data: {"id": "109bfc28-fe87-452c-8e1f-d4fe43283b7d", "created": 1710919480, "model": "chatgpt_proxyllm", "choices": [{"index": 0, "delta": {"role": "assistant", "content": "```agent-plans\n[{\"name\": \"Introduce Awel\", \"num\": 2, \"status\": \"complete\", \"agent\": \"Human\", \"markdown\": \"```agent-messages\\n[{\\\"sender\\\": \\\"Summarizer\\\", \\\"receiver\\\": \\\"Human\\\", \\\"model\\\": \\\"chatgpt_proxyllm\\\", \\\"markdown\\\": \\\"Agentic Workflow Expression Language (AWEL) is a specialized language designed for developing large model applications with intelligent agent workflows. It offers flexibility and functionality, allowing developers to focus on business logic for LLMs applications without getting bogged down in model and environment details. AWEL uses a layered API design architecture, making it easier to work with. You can find examples and source code to get started with AWEL, and it supports various operators and environments. AWEL is a powerful tool for building native data applications through workflows and agents.\"}]\n```"}}]}
data: [DONE]
Get App
GET /api/v2/serve/apps/{app_id}
- Curl
- Python
DBGPT_API_KEY=dbgpt
APP_ID={YOUR_APP_ID}
curl -X GET "http://localhost:5670/api/v2/serve/apps/$APP_ID" -H "Authorization: Bearer $DBGPT_API_KEY"
from dbgpt.client import Client
from dbgpt.client.app import get_app
DBGPT_API_KEY = "dbgpt"
app_id = "{your_app_id}"
client = Client(api_key=DBGPT_API_KEY)
res = await get_app(client=client, app_id=app_id)
Query Parameters
app_id string Required
app id
Response body
Return App Object
List App
GET /api/v2/serve/apps
- Curl
- Python
DBGPT_API_KEY=dbgpt
curl -X GET 'http://localhost:5670/api/v2/serve/apps' -H "Authorization: Bearer $DBGPT_API_KEY"
from dbgpt.client import Client
from dbgpt.client.app import list_app
DBGPT_API_KEY = "dbgpt"
app_id = "{your_app_id}"
client = Client(api_key=DBGPT_API_KEY)
res = await list_app(client=client)
Response body
Return App Object List
The App Model
app_code string
unique app id
app_name string
app name
app_describe string
app describe
team_mode string
team mode
language string
language
team_context string
team context
user_code string
user code
sys_code string
sys code
is_collected string
is collected
icon string
icon
created_at string
created at
updated_at string
updated at
details string
app details List[AppDetailModel]
The App Detail Model
app_code string
app code
app_name string
app name
agent_name string
agent name
node_id string
node id
resources string
resources
prompt_template string
prompt template
llm_strategy string
llm strategy
llm_strategy_value string
llm strategy value
created_at string
created at
updated_at string
updated at