31 lines
998 B
Python
31 lines
998 B
Python
"""Persist prepared evidence and Chat Completions requests without invoking a model."""
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision = "0007_rag_contexts"
|
|
down_revision = "0006_vectors"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
op.create_table(
|
|
"rag_contexts",
|
|
sa.Column("id", sa.String(36), primary_key=True),
|
|
sa.Column(
|
|
"retrieval_run_id", sa.String(36), sa.ForeignKey("retrieval_runs.id"), nullable=False
|
|
),
|
|
sa.Column("created_by", sa.Integer(), sa.ForeignKey("users.id"), nullable=False),
|
|
sa.Column("response", sa.JSON(), nullable=False),
|
|
sa.Column(
|
|
"created_at", sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False
|
|
),
|
|
)
|
|
op.create_index("ix_rag_contexts_retrieval_run_id", "rag_contexts", ["retrieval_run_id"])
|
|
op.create_index("ix_rag_contexts_created_at", "rag_contexts", ["created_at"])
|
|
|
|
|
|
def downgrade():
|
|
op.drop_table("rag_contexts")
|