mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-03 21:02:40 +02:00
feat: feat: add interface params
This commit is contained in:
parent
6b7ce53c58
commit
9f99b09e0d
3 changed files with 51 additions and 2 deletions
|
|
@ -0,0 +1,38 @@
|
|||
"""add inference_params to searchspaces
|
||||
|
||||
Revision ID: eb0c978da8fd
|
||||
Revises: 22
|
||||
Create Date: 2025-10-06 02:54:11.618100
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'eb0c978da8fd'
|
||||
down_revision: Union[str, None] = '22'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(op.f('chucks_search_index'), table_name='chunks', postgresql_using='gin')
|
||||
op.drop_index(op.f('chucks_vector_index'), table_name='chunks', postgresql_using='hnsw')
|
||||
op.drop_index(op.f('document_search_index'), table_name='documents', postgresql_using='gin')
|
||||
op.drop_index(op.f('document_vector_index'), table_name='documents', postgresql_using='hnsw')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_index(op.f('document_vector_index'), 'documents', ['embedding'], unique=False, postgresql_using='hnsw')
|
||||
op.create_index(op.f('document_search_index'), 'documents', [sa.literal_column("to_tsvector('english'::regconfig, content)")], unique=False, postgresql_using='gin')
|
||||
op.create_index(op.f('chucks_vector_index'), 'chunks', ['embedding'], unique=False, postgresql_using='hnsw')
|
||||
op.create_index(op.f('chucks_search_index'), 'chunks', [sa.literal_column("to_tsvector('english'::regconfig, content)")], unique=False, postgresql_using='gin')
|
||||
# ### end Alembic commands ###
|
||||
|
|
@ -205,6 +205,8 @@ class SearchSpace(BaseModel, TimestampMixin):
|
|||
name = Column(String(100), nullable=False, index=True)
|
||||
description = Column(String(500), nullable=True)
|
||||
|
||||
inference_params = Column(JSON, nullable=True)
|
||||
|
||||
user_id = Column(
|
||||
UUID(as_uuid=True), ForeignKey("user.id", ondelete="CASCADE"), nullable=False
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,14 +1,21 @@
|
|||
import uuid
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from .base import IDModel, TimestampModel
|
||||
|
||||
class InferenceParams(BaseModel):
|
||||
temperature: float | None = Field(None, ge=0.0, le=2.0)
|
||||
max_tokens: int | None = Field(None, ge=0)
|
||||
top_k: int | None = Field(None, ge=0)
|
||||
top_p: float | None = Field(None, ge=0.0, le=1.0)
|
||||
|
||||
|
||||
class SearchSpaceBase(BaseModel):
|
||||
name: str
|
||||
description: str | None = None
|
||||
inference_params: InferenceParams | None = None
|
||||
|
||||
|
||||
class SearchSpaceCreate(SearchSpaceBase):
|
||||
|
|
@ -16,7 +23,9 @@ class SearchSpaceCreate(SearchSpaceBase):
|
|||
|
||||
|
||||
class SearchSpaceUpdate(SearchSpaceBase):
|
||||
pass
|
||||
name: str | None = None
|
||||
description: str | None = None
|
||||
inference_params: InferenceParams | None = None
|
||||
|
||||
|
||||
class SearchSpaceRead(SearchSpaceBase, IDModel, TimestampModel):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue