58 lines
2.5 KiB
Python
58 lines
2.5 KiB
Python
|
|
#
|
|||
|
|
# Copyright 2024 The InfiniFlow Authors. All Rights Reserved.
|
|||
|
|
#
|
|||
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|||
|
|
# you may not use this file except in compliance with the License.
|
|||
|
|
# You may obtain a copy of the License at
|
|||
|
|
#
|
|||
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|||
|
|
#
|
|||
|
|
# Unless required by applicable law or agreed to in writing, software
|
|||
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|||
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
|
|
# See the License for the specific language governing permissions and
|
|||
|
|
# limitations under the License.
|
|||
|
|
#
|
|||
|
|
|
|||
|
|
from typing import Optional, List, Dict, Any
|
|||
|
|
from pydantic import BaseModel, Field
|
|||
|
|
|
|||
|
|
|
|||
|
|
class SetDialogRequest(BaseModel):
|
|||
|
|
"""设置/创建对话框请求"""
|
|||
|
|
dialog_id: Optional[str] = Field(default="", description="对话框ID,为空时创建新对话框")
|
|||
|
|
name: Optional[str] = Field(default="New Dialog", description="对话框名称")
|
|||
|
|
description: Optional[str] = Field(default="A helpful dialog", description="对话框描述")
|
|||
|
|
icon: Optional[str] = Field(default="", description="图标")
|
|||
|
|
top_n: Optional[int] = Field(default=6, description="Top N")
|
|||
|
|
top_k: Optional[int] = Field(default=1024, description="Top K")
|
|||
|
|
rerank_id: Optional[str] = Field(default="", description="重排序模型ID")
|
|||
|
|
similarity_threshold: Optional[float] = Field(default=0.1, description="相似度阈值")
|
|||
|
|
vector_similarity_weight: Optional[float] = Field(default=0.3, description="向量相似度权重")
|
|||
|
|
llm_setting: Optional[Dict[str, Any]] = Field(default={}, description="LLM设置")
|
|||
|
|
meta_data_filter: Optional[Dict[str, Any]] = Field(default={}, description="元数据过滤器")
|
|||
|
|
prompt_config: Dict[str, Any] = Field(..., description="提示配置")
|
|||
|
|
kb_ids: Optional[List[str]] = Field(default=[], description="知识库ID列表")
|
|||
|
|
llm_id: Optional[str] = Field(default=None, description="LLM ID")
|
|||
|
|
|
|||
|
|
|
|||
|
|
class ListDialogsNextQuery(BaseModel):
|
|||
|
|
"""列出对话框查询参数"""
|
|||
|
|
keywords: Optional[str] = ""
|
|||
|
|
page: Optional[int] = 0
|
|||
|
|
page_size: Optional[int] = 0
|
|||
|
|
parser_id: Optional[str] = None
|
|||
|
|
orderby: Optional[str] = "create_time"
|
|||
|
|
desc: Optional[str] = "true"
|
|||
|
|
|
|||
|
|
|
|||
|
|
class ListDialogsNextBody(BaseModel):
|
|||
|
|
"""列出对话框请求体"""
|
|||
|
|
owner_ids: Optional[List[str]] = []
|
|||
|
|
|
|||
|
|
|
|||
|
|
class DeleteDialogRequest(BaseModel):
|
|||
|
|
"""删除对话框请求"""
|
|||
|
|
dialog_ids: List[str] = Field(..., description="要删除的对话框ID列表")
|
|||
|
|
|