feat(core): Add common schemas

This commit is contained in:
Fangyin Cheng
2024-03-21 11:23:24 +08:00
parent ab3e8e54a1
commit b4b810d68f
18 changed files with 188 additions and 123 deletions

View File

@@ -50,11 +50,12 @@ 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)
messages="Introduce AWEL",
model="chatgpt_proxyllm",
chat_mode="chat_app",
chat_param=APP_ID
):
print(data)
```
</TabItem>

View File

@@ -45,6 +45,7 @@ import TabItem from '@theme/TabItem';
from dbgpt.client import Client
DBGPT_API_KEY = "dbgpt"
client = Client(api_key=DBGPT_API_KEY)
async for data in client.chat_stream(
model="chatgpt_proxyllm",

View File

@@ -49,11 +49,12 @@ 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)
messages="Introduce AWEL",
model="chatgpt_proxyllm",
chat_mode="chat_flow",
chat_param=FLOW_ID
):
print(data)
```
</TabItem>
</Tabs>

View File

@@ -49,11 +49,12 @@ SPACE_NAME="{YOUR_SPACE_NAME}"
client = Client(api_key=DBGPT_API_KEY)
async for data in client.chat_stream(
messages="Introduce AWEL",
model="chatgpt_proxyllm",
chat_mode="chat_knowledge",
chat_param=SPACE_NAME):
print(data)
messages="Introduce AWEL",
model="chatgpt_proxyllm",
chat_mode="chat_knowledge",
chat_param=SPACE_NAME
):
print(data)
```
</TabItem>
</Tabs>
@@ -343,21 +344,20 @@ POST /api/v2/serve/knowledge/spaces
<TabItem value="python_knowledge">
```python
from dbgpt.client import Client
from dbgpt.client.knowledge import create_space
from dbgpt.client.schemas import SpaceModel
from dbgpt.client.schema import SpaceModel
DBGPT_API_KEY = "dbgpt"
client = Client(api_key=DBGPT_API_KEY)
res = await create_space(client,SpaceModel(
name="test_space",
vector_type="Chroma",
desc="for client space",
owner="dbgpt"))
res = await create_space(client, SpaceModel(
name="test_space",
vector_type="Chroma",
desc="for client space",
owner="dbgpt"
))
```
</TabItem>
@@ -420,20 +420,20 @@ PUT /api/v2/serve/knowledge/spaces
<TabItem value="python_update_knowledge">
```python
from dbgpt.client import Client
from dbgpt.client.knowledge import update_space
from dbgpt.client.schemas import SpaceModel
from dbgpt.client.schema import SpaceModel
DBGPT_API_KEY = "dbgpt"
client = Client(api_key=DBGPT_API_KEY)
res = await update_space(client, SpaceModel(
name="test_space",
vector_type="Chroma",
desc="for client space update",
owner="dbgpt"))
name="test_space",
vector_type="Chroma",
desc="for client space update",
owner="dbgpt"
))
```