mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-20 23:21:06 +02:00
feat: add interface params minor changes
This commit is contained in:
parent
1b77269da6
commit
f1a6f186a8
4 changed files with 72 additions and 10 deletions
|
|
@ -0,0 +1,38 @@
|
|||
"""add inference_params to searchspaces 3
|
||||
|
||||
Revision ID: b86972495f7d
|
||||
Revises: 2c3ace3296c0
|
||||
Create Date: 2025-10-05 15:05:06.391825
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'b86972495f7d'
|
||||
down_revision: Union[str, None] = '2c3ace3296c0'
|
||||
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 ###
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
"""add inference_params to searchspaces 4
|
||||
|
||||
Revision ID: d17628273e13
|
||||
Revises: b86972495f7d
|
||||
Create Date: 2025-10-05 15:30:12.651638
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'd17628273e13'
|
||||
down_revision: Union[str, None] = 'b86972495f7d'
|
||||
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! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
|
@ -27,8 +27,6 @@ from app.config import config
|
|||
from app.retriver.chunks_hybrid_search import ChucksHybridSearchRetriever
|
||||
from app.retriver.documents_hybrid_search import DocumentHybridSearchRetriever
|
||||
|
||||
from sqlalchemy.ext.mutable import MutableDict
|
||||
|
||||
if config.AUTH_TYPE == "GOOGLE":
|
||||
from fastapi_users.db import SQLAlchemyBaseOAuthAccountTableUUID
|
||||
|
||||
|
|
@ -206,13 +204,7 @@ class SearchSpace(BaseModel, TimestampMixin):
|
|||
name = Column(String(100), nullable=False, index=True)
|
||||
description = Column(String(500), nullable=True)
|
||||
|
||||
inference_params = Column(
|
||||
MutableDict.as_mutable(JSON),
|
||||
nullable=True,
|
||||
server_default=text(
|
||||
'\'{"temperature":0.0,"max_tokens":0,"top_k":0,"top_p":0}\'::json'
|
||||
)
|
||||
)
|
||||
inference_params = Column(JSON, nullable=True)
|
||||
|
||||
user_id = Column(
|
||||
UUID(as_uuid=True), ForeignKey("user.id", ondelete="CASCADE"), nullable=False
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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: int | None = Field(None, ge=0, le=1)
|
||||
top_p: float | None = Field(None, ge=0.0, le=1.0)
|
||||
|
||||
|
||||
class SearchSpaceBase(BaseModel):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue