Add knowledge retrieval configuration to Assistant model and related components
- Introduce new fields for knowledge retrieval configuration in AssistantConfig and Assistant models, including mode, top_n, and score_threshold. - Implement KnowledgeRetrievalConfig schema with validation for top_n. - Update backend services and routes to handle knowledge retrieval settings. - Enhance frontend components to support knowledge retrieval configuration, including a new dialog for advanced settings. - Add tests for knowledge retrieval configuration validation and description generation.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
"""add assistant knowledge retrieval config
|
||||
|
||||
Revision ID: 20260712_0006
|
||||
Revises: 20260712_0005
|
||||
"""
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
revision: str = "20260712_0006"
|
||||
down_revision: str | Sequence[str] | None = "20260712_0005"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column(
|
||||
"assistants",
|
||||
sa.Column(
|
||||
"knowledge_retrieval_config",
|
||||
sa.JSON(),
|
||||
server_default=sa.text(
|
||||
"'{\"mode\": \"automatic\", \"top_n\": 5, \"score_threshold\": 0.0}'"
|
||||
),
|
||||
nullable=False,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("assistants", "knowledge_retrieval_config")
|
||||
Reference in New Issue
Block a user