prism-models 0.1.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- prism_models/__init__.py +46 -0
- prism_models/agent_profile.py +128 -0
- prism_models/base.py +75 -0
- prism_models/chat.py +355 -0
- prism_models/config.py +37 -0
- prism_models/content.py +240 -0
- prism_models/feedback.py +145 -0
- prism_models/migration/README +1 -0
- prism_models/migration/__init__.py +0 -0
- prism_models/migration/env.py +131 -0
- prism_models/migration/script.py.mako +28 -0
- prism_models/migration/versions/2025_09_11_1516_161f8829d93f_initial_schema.py +492 -0
- prism_models/migration/versions/2025_09_11_1558_5e011849ea76_changes_for_feedback.py +79 -0
- prism_models/migration/versions/2025_09_14_2243_059af231c2b2_profile_entities.py +108 -0
- prism_models/migration/versions/2025_09_15_1646_3219fec0bb10_agent_changes.py +32 -0
- prism_models/migration/versions/2025_09_16_1627_f2013b08daac_rename_metadata_to_additional_data.py +37 -0
- prism_models/migration/versions/2025_09_17_1147_327febbf555f_display_name_added.py +34 -0
- prism_models/migration/versions/2025_09_18_1106_b0bcb7ca1dc9_add_support_for_profile_on_create_convo.py +41 -0
- prism_models/migration/versions/2025_09_18_1511_bbc1955191e6_preview_mode.py +36 -0
- prism_models/migration/versions/2025_09_26_1115_6eb70e848451_added_publish_status_to_document.py +38 -0
- prism_models/migration/versions/2025_09_26_1240_f8b0ea2e743c_drop_unique_title_version_on_document.py +40 -0
- prism_models/migration/versions/2025_09_26_1505_07dc8c2589e0_added_chunk_id_and_vector_embeddings_to_.py +44 -0
- prism_models/migration/versions/2025_09_29_1220_46ba2693b883_add_markdown_markdown_file_path_s3_.py +32 -0
- prism_models/migration/versions/2025_10_02_1520_bf1472a9b021_removed_doc_id_from_config_table_and_.py +34 -0
- prism_models/migration/versions/2025_10_02_1525_6c0e63e0fef8_removed_doc_id_from_config_table_.py +34 -0
- prism_models/migration/versions/2025_10_02_1608_1b3eb48f5017_config_id_on_delete_will_be_set_to_null.py +34 -0
- prism_models/migration/versions/2025_10_03_1109_ac85b606d8a4_added_docling_hybrid_to_chunkstrategy.py +32 -0
- prism_models/migration/versions/2025_10_03_1204_7d1cb343a63f_added_s3_bucket_and_s3_dir_in_source_.py +42 -0
- prism_models/migration/versions/2025_10_03_1452_f9c750ec2a0b_1_to_1_relationship_between_collection_.py +52 -0
- prism_models/migration/versions/2025_10_07_1722_5cfa0c462948_added_travel_advisory_enum.py +38 -0
- prism_models/migration/versions/2025_10_08_1304_c91eb8e38cc7_added_destination_report_and_event_.py +38 -0
- prism_models/migration/versions/2025_10_09_1308_796b720ea35f_added_qa_id_to_vovetor.py +42 -0
- prism_models/migration/versions/2025_10_16_1611_663c66268631_added_sharepoint_drive_item_id_as_an_.py +32 -0
- prism_models/migration/versions/2025_10_23_1228_919d07a93f83_added_sharepoint_directory_in_source.py +32 -0
- prism_models/migration/versions/2025_10_27_1331_ff3be2c4311f_added_agentcollectionaccess_table.py +50 -0
- prism_models/migration/versions/2025_10_28_1333_b789e61df26a_ad_enum_and_field_added.py +46 -0
- prism_models/migration/versions/2025_11_03_1633_cc27b20a106e_removed_collection_from_source_.py +34 -0
- prism_models/migration/versions/2025_11_03_1653_bf5c2ce928e3_removed_collection_from_source_.py +36 -0
- prism_models/migration/versions/2025_11_03_1738_b733b48d78b5_remove_source.py +32 -0
- prism_models/qdrant.py +102 -0
- prism_models-0.1.8.dist-info/METADATA +10 -0
- prism_models-0.1.8.dist-info/RECORD +44 -0
- prism_models-0.1.8.dist-info/WHEEL +5 -0
- prism_models-0.1.8.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"""profile entities
|
|
2
|
+
|
|
3
|
+
Revision ID: 059af231c2b2
|
|
4
|
+
Revises: 5e011849ea76
|
|
5
|
+
Create Date: 2025-09-14 22:43:19.508532
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Sequence
|
|
10
|
+
|
|
11
|
+
import sqlalchemy as sa
|
|
12
|
+
from alembic import op
|
|
13
|
+
|
|
14
|
+
# revision identifiers, used by Alembic.
|
|
15
|
+
revision: str = "059af231c2b2"
|
|
16
|
+
down_revision: str | Sequence[str] | None = "5e011849ea76"
|
|
17
|
+
branch_labels: str | Sequence[str] | None = None
|
|
18
|
+
depends_on: str | Sequence[str] | None = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def upgrade() -> None:
|
|
22
|
+
"""Upgrade schema."""
|
|
23
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
24
|
+
op.create_table(
|
|
25
|
+
"agent",
|
|
26
|
+
sa.Column("name", sa.String(length=255), nullable=False),
|
|
27
|
+
sa.Column("description", sa.String(length=1024), nullable=True),
|
|
28
|
+
sa.Column("instructions", sa.Text(), nullable=True),
|
|
29
|
+
sa.Column("id", sa.Integer(), nullable=False),
|
|
30
|
+
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False),
|
|
31
|
+
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False),
|
|
32
|
+
sa.Column("deleted_at", sa.DateTime(timezone=True), nullable=True),
|
|
33
|
+
sa.PrimaryKeyConstraint("id", name=op.f("agent_pkey")),
|
|
34
|
+
sa.UniqueConstraint("name", name="uq_agent_name"),
|
|
35
|
+
)
|
|
36
|
+
op.create_index(op.f("agent_id_idx"), "agent", ["id"], unique=False)
|
|
37
|
+
op.create_index(op.f("agent_name_idx"), "agent", ["name"], unique=False)
|
|
38
|
+
op.create_table(
|
|
39
|
+
"profile",
|
|
40
|
+
sa.Column("name", sa.String(length=255), nullable=False),
|
|
41
|
+
sa.Column("description", sa.String(length=1024), nullable=True),
|
|
42
|
+
sa.Column("is_active", sa.Boolean(), nullable=False),
|
|
43
|
+
sa.Column("id", sa.Integer(), nullable=False),
|
|
44
|
+
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False),
|
|
45
|
+
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False),
|
|
46
|
+
sa.Column("deleted_at", sa.DateTime(timezone=True), nullable=True),
|
|
47
|
+
sa.PrimaryKeyConstraint("id", name=op.f("profile_pkey")),
|
|
48
|
+
sa.UniqueConstraint("name", name="uq_profile_name"),
|
|
49
|
+
)
|
|
50
|
+
op.create_index(op.f("profile_id_idx"), "profile", ["id"], unique=False)
|
|
51
|
+
op.create_index(op.f("profile_name_idx"), "profile", ["name"], unique=False)
|
|
52
|
+
op.create_table(
|
|
53
|
+
"agent_profile",
|
|
54
|
+
sa.Column("agent_id", sa.Integer(), nullable=False),
|
|
55
|
+
sa.Column("profile_id", sa.Integer(), nullable=False),
|
|
56
|
+
sa.Column("version", sa.Integer(), nullable=False),
|
|
57
|
+
sa.Column("status", sa.Enum("ACTIVE", "INACTIVE", "PREVIEW", name="agent_profile_status"), nullable=False),
|
|
58
|
+
sa.Column("is_default", sa.Boolean(), nullable=False),
|
|
59
|
+
sa.Column("prompt", sa.Text(), nullable=True),
|
|
60
|
+
sa.Column("id", sa.Integer(), nullable=False),
|
|
61
|
+
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False),
|
|
62
|
+
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False),
|
|
63
|
+
sa.Column("deleted_at", sa.DateTime(timezone=True), nullable=True),
|
|
64
|
+
sa.ForeignKeyConstraint(["agent_id"], ["agent.id"], name=op.f("agent_profile_agent_id_fkey")),
|
|
65
|
+
sa.ForeignKeyConstraint(["profile_id"], ["profile.id"], name=op.f("agent_profile_profile_id_fkey")),
|
|
66
|
+
sa.PrimaryKeyConstraint("id", name=op.f("agent_profile_pkey")),
|
|
67
|
+
)
|
|
68
|
+
op.create_index(op.f("agent_profile_agent_id_idx"), "agent_profile", ["agent_id"], unique=False)
|
|
69
|
+
op.create_index(op.f("agent_profile_id_idx"), "agent_profile", ["id"], unique=False)
|
|
70
|
+
op.create_index(op.f("agent_profile_profile_id_idx"), "agent_profile", ["profile_id"], unique=False)
|
|
71
|
+
op.create_table(
|
|
72
|
+
"profile_collection_access",
|
|
73
|
+
sa.Column("profile_id", sa.Integer(), nullable=False),
|
|
74
|
+
sa.Column("collection_id", sa.Integer(), nullable=False),
|
|
75
|
+
sa.Column("access_granted_at", sa.TIMESTAMP(timezone=True), server_default=sa.text("now()"), nullable=True),
|
|
76
|
+
sa.Column("id", sa.Integer(), nullable=False),
|
|
77
|
+
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False),
|
|
78
|
+
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False),
|
|
79
|
+
sa.Column("deleted_at", sa.DateTime(timezone=True), nullable=True),
|
|
80
|
+
sa.ForeignKeyConstraint(["collection_id"], ["collection.id"], name=op.f("profile_collection_access_collection_id_fkey"), ondelete="CASCADE"),
|
|
81
|
+
sa.ForeignKeyConstraint(["profile_id"], ["profile.id"], name=op.f("profile_collection_access_profile_id_fkey"), ondelete="CASCADE"),
|
|
82
|
+
sa.PrimaryKeyConstraint("id", name=op.f("profile_collection_access_pkey")),
|
|
83
|
+
sa.UniqueConstraint("profile_id", "collection_id", name="uq_profile_collection"),
|
|
84
|
+
)
|
|
85
|
+
op.create_index(op.f("profile_collection_access_collection_id_idx"), "profile_collection_access", ["collection_id"], unique=False)
|
|
86
|
+
op.create_index(op.f("profile_collection_access_id_idx"), "profile_collection_access", ["id"], unique=False)
|
|
87
|
+
op.create_index(op.f("profile_collection_access_profile_id_idx"), "profile_collection_access", ["profile_id"], unique=False)
|
|
88
|
+
# ### end Alembic commands ###
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def downgrade() -> None:
|
|
92
|
+
"""Downgrade schema."""
|
|
93
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
94
|
+
op.drop_index(op.f("profile_collection_access_profile_id_idx"), table_name="profile_collection_access")
|
|
95
|
+
op.drop_index(op.f("profile_collection_access_id_idx"), table_name="profile_collection_access")
|
|
96
|
+
op.drop_index(op.f("profile_collection_access_collection_id_idx"), table_name="profile_collection_access")
|
|
97
|
+
op.drop_table("profile_collection_access")
|
|
98
|
+
op.drop_index(op.f("agent_profile_profile_id_idx"), table_name="agent_profile")
|
|
99
|
+
op.drop_index(op.f("agent_profile_id_idx"), table_name="agent_profile")
|
|
100
|
+
op.drop_index(op.f("agent_profile_agent_id_idx"), table_name="agent_profile")
|
|
101
|
+
op.drop_table("agent_profile")
|
|
102
|
+
op.drop_index(op.f("profile_name_idx"), table_name="profile")
|
|
103
|
+
op.drop_index(op.f("profile_id_idx"), table_name="profile")
|
|
104
|
+
op.drop_table("profile")
|
|
105
|
+
op.drop_index(op.f("agent_name_idx"), table_name="agent")
|
|
106
|
+
op.drop_index(op.f("agent_id_idx"), table_name="agent")
|
|
107
|
+
op.drop_table("agent")
|
|
108
|
+
# ### end Alembic commands ###
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""agent changes
|
|
2
|
+
|
|
3
|
+
Revision ID: 3219fec0bb10
|
|
4
|
+
Revises: 059af231c2b2
|
|
5
|
+
Create Date: 2025-09-15 16:46:21.088546
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Sequence
|
|
10
|
+
|
|
11
|
+
import sqlalchemy as sa
|
|
12
|
+
from alembic import op
|
|
13
|
+
|
|
14
|
+
# revision identifiers, used by Alembic.
|
|
15
|
+
revision: str = "3219fec0bb10"
|
|
16
|
+
down_revision: str | Sequence[str] | None = "059af231c2b2"
|
|
17
|
+
branch_labels: str | Sequence[str] | None = None
|
|
18
|
+
depends_on: str | Sequence[str] | None = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def upgrade() -> None:
|
|
22
|
+
"""Upgrade schema."""
|
|
23
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
24
|
+
op.drop_column("agent", "instructions")
|
|
25
|
+
# ### end Alembic commands ###
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def downgrade() -> None:
|
|
29
|
+
"""Downgrade schema."""
|
|
30
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
31
|
+
op.add_column("agent", sa.Column("instructions", sa.TEXT(), autoincrement=False, nullable=True))
|
|
32
|
+
# ### end Alembic commands ###
|
prism_models/migration/versions/2025_09_16_1627_f2013b08daac_rename_metadata_to_additional_data.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""rename_metadata_to_additional_data
|
|
2
|
+
|
|
3
|
+
Revision ID: f2013b08daac
|
|
4
|
+
Revises: 3219fec0bb10
|
|
5
|
+
Create Date: 2025-09-16 16:27:07.722003
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Sequence
|
|
10
|
+
|
|
11
|
+
from alembic import op
|
|
12
|
+
|
|
13
|
+
# revision identifiers, used by Alembic.
|
|
14
|
+
revision: str = "f2013b08daac"
|
|
15
|
+
down_revision: str | Sequence[str] | None = "3219fec0bb10"
|
|
16
|
+
branch_labels: str | Sequence[str] | None = None
|
|
17
|
+
depends_on: str | Sequence[str] | None = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def upgrade() -> None:
|
|
21
|
+
"""Upgrade schema."""
|
|
22
|
+
# Rename metadata columns to additional_data
|
|
23
|
+
op.alter_column("source", "metadata", new_column_name="additional_data")
|
|
24
|
+
op.alter_column("collection", "metadata", new_column_name="additional_data")
|
|
25
|
+
op.alter_column("document", "metadata", new_column_name="additional_data")
|
|
26
|
+
op.alter_column("chunk_config", "metadata", new_column_name="additional_data")
|
|
27
|
+
op.alter_column("vector", "metadata", new_column_name="additional_data")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def downgrade() -> None:
|
|
31
|
+
"""Downgrade schema."""
|
|
32
|
+
# Rename additional_data columns back to metadata
|
|
33
|
+
op.alter_column("source", "additional_data", new_column_name="metadata")
|
|
34
|
+
op.alter_column("collection", "additional_data", new_column_name="metadata")
|
|
35
|
+
op.alter_column("document", "additional_data", new_column_name="metadata")
|
|
36
|
+
op.alter_column("chunk_config", "additional_data", new_column_name="metadata")
|
|
37
|
+
op.alter_column("vector", "additional_data", new_column_name="metadata")
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Display Name added
|
|
2
|
+
|
|
3
|
+
Revision ID: 327febbf555f
|
|
4
|
+
Revises: f2013b08daac
|
|
5
|
+
Create Date: 2025-09-17 11:47:14.197878
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Sequence
|
|
10
|
+
|
|
11
|
+
import sqlalchemy as sa
|
|
12
|
+
from alembic import op
|
|
13
|
+
|
|
14
|
+
# revision identifiers, used by Alembic.
|
|
15
|
+
revision: str = "327febbf555f"
|
|
16
|
+
down_revision: str | Sequence[str] | None = "f2013b08daac"
|
|
17
|
+
branch_labels: str | Sequence[str] | None = None
|
|
18
|
+
depends_on: str | Sequence[str] | None = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def upgrade() -> None:
|
|
22
|
+
"""Upgrade schema."""
|
|
23
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
24
|
+
op.add_column("agent", sa.Column("display_name", sa.String(length=255), nullable=True))
|
|
25
|
+
op.create_unique_constraint("uq_agent_display_name", "agent", ["display_name"])
|
|
26
|
+
# ### end Alembic commands ###
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def downgrade() -> None:
|
|
30
|
+
"""Downgrade schema."""
|
|
31
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
32
|
+
op.drop_constraint("uq_agent_display_name", "agent", type_="unique")
|
|
33
|
+
op.drop_column("agent", "display_name")
|
|
34
|
+
# ### end Alembic commands ###
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""add support for profile on create convo
|
|
2
|
+
|
|
3
|
+
Revision ID: b0bcb7ca1dc9
|
|
4
|
+
Revises: 327febbf555f
|
|
5
|
+
Create Date: 2025-09-18 11:06:41.548193
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Sequence
|
|
10
|
+
|
|
11
|
+
import sqlalchemy as sa
|
|
12
|
+
from alembic import op
|
|
13
|
+
|
|
14
|
+
# revision identifiers, used by Alembic.
|
|
15
|
+
revision: str = "b0bcb7ca1dc9"
|
|
16
|
+
down_revision: str | Sequence[str] | None = "327febbf555f"
|
|
17
|
+
branch_labels: str | Sequence[str] | None = None
|
|
18
|
+
depends_on: str | Sequence[str] | None = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def upgrade() -> None:
|
|
22
|
+
"""Upgrade schema."""
|
|
23
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
24
|
+
op.add_column("conversation", sa.Column("is_audio_analysis", sa.Boolean()))
|
|
25
|
+
op.add_column("conversation", sa.Column("profile_id", sa.Integer(), nullable=True))
|
|
26
|
+
op.create_foreign_key(op.f("conversation_profile_id_fkey"), "conversation", "profile", ["profile_id"], ["id"])
|
|
27
|
+
|
|
28
|
+
# set all is_audio_analysis to False
|
|
29
|
+
op.execute("UPDATE conversation SET is_audio_analysis = FALSE")
|
|
30
|
+
# set to non nullable
|
|
31
|
+
op.alter_column("conversation", "is_audio_analysis", nullable=False)
|
|
32
|
+
# ### end Alembic commands ###
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def downgrade() -> None:
|
|
36
|
+
"""Downgrade schema."""
|
|
37
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
38
|
+
op.drop_constraint(op.f("conversation_profile_id_fkey"), "conversation", type_="foreignkey")
|
|
39
|
+
op.drop_column("conversation", "profile_id")
|
|
40
|
+
op.drop_column("conversation", "is_audio_analysis")
|
|
41
|
+
# ### end Alembic commands ###
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""preview mode
|
|
2
|
+
|
|
3
|
+
Revision ID: bbc1955191e6
|
|
4
|
+
Revises: b0bcb7ca1dc9
|
|
5
|
+
Create Date: 2025-09-18 15:11:14.986185
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Sequence
|
|
10
|
+
|
|
11
|
+
import sqlalchemy as sa
|
|
12
|
+
from alembic import op
|
|
13
|
+
|
|
14
|
+
# revision identifiers, used by Alembic.
|
|
15
|
+
revision: str = "bbc1955191e6"
|
|
16
|
+
down_revision: str | Sequence[str] | None = "b0bcb7ca1dc9"
|
|
17
|
+
branch_labels: str | Sequence[str] | None = None
|
|
18
|
+
depends_on: str | Sequence[str] | None = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def upgrade() -> None:
|
|
22
|
+
"""Upgrade schema."""
|
|
23
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
24
|
+
op.add_column("conversation", sa.Column("preview_mode", sa.Boolean(), nullable=True))
|
|
25
|
+
# set old to false
|
|
26
|
+
op.execute("UPDATE conversation SET preview_mode = FALSE")
|
|
27
|
+
# set to non nullable
|
|
28
|
+
op.alter_column("conversation", "preview_mode", nullable=False)
|
|
29
|
+
# ### end Alembic commands ###
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def downgrade() -> None:
|
|
33
|
+
"""Downgrade schema."""
|
|
34
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
35
|
+
op.drop_column("conversation", "preview_mode")
|
|
36
|
+
# ### end Alembic commands ###
|
prism_models/migration/versions/2025_09_26_1115_6eb70e848451_added_publish_status_to_document.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""added publish status to Document
|
|
2
|
+
|
|
3
|
+
Revision ID: 6eb70e848451
|
|
4
|
+
Revises: bbc1955191e6
|
|
5
|
+
Create Date: 2025-09-26 11:15:57.436553
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from typing import Sequence, Union
|
|
9
|
+
|
|
10
|
+
from alembic import op
|
|
11
|
+
import sqlalchemy as sa
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# revision identifiers, used by Alembic.
|
|
15
|
+
revision: str = '6eb70e848451'
|
|
16
|
+
down_revision: Union[str, Sequence[str], None] = 'bbc1955191e6'
|
|
17
|
+
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
+
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def upgrade() -> None:
|
|
22
|
+
"""Upgrade schema."""
|
|
23
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
24
|
+
op.add_column('document', sa.Column('publish_status', sa.String(length=50), nullable=False))
|
|
25
|
+
op.drop_constraint(op.f('uq_document_title'), 'document', type_='unique')
|
|
26
|
+
op.create_index(op.f('document_publish_status_idx'), 'document', ['publish_status'], unique=False)
|
|
27
|
+
op.create_unique_constraint('uq_document_title_version', 'document', ['title', 'version'])
|
|
28
|
+
# ### end Alembic commands ###
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def downgrade() -> None:
|
|
32
|
+
"""Downgrade schema."""
|
|
33
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
34
|
+
op.drop_constraint('uq_document_title_version', 'document', type_='unique')
|
|
35
|
+
op.drop_index(op.f('document_publish_status_idx'), table_name='document')
|
|
36
|
+
op.create_unique_constraint(op.f('uq_document_title'), 'document', ['title'], postgresql_nulls_not_distinct=False)
|
|
37
|
+
op.drop_column('document', 'publish_status')
|
|
38
|
+
# ### end Alembic commands ###
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Drop unique (title, version) on document
|
|
2
|
+
|
|
3
|
+
Revision ID: f8b0ea2e743c
|
|
4
|
+
Revises: 6eb70e848451
|
|
5
|
+
Create Date: 2025-09-26 12:40:09.365217
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from typing import Sequence, Union
|
|
9
|
+
|
|
10
|
+
from alembic import op
|
|
11
|
+
import sqlalchemy as sa
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# revision identifiers, used by Alembic.
|
|
15
|
+
revision: str = 'f8b0ea2e743c'
|
|
16
|
+
down_revision: Union[str, Sequence[str], None] = '6eb70e848451'
|
|
17
|
+
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
+
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def upgrade() -> None:
|
|
22
|
+
"""Upgrade schema."""
|
|
23
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
24
|
+
op.drop_constraint(op.f('uq_document_title_version'), 'document', type_='unique')
|
|
25
|
+
op.alter_column('source', 'name',
|
|
26
|
+
existing_type=sa.VARCHAR(length=200),
|
|
27
|
+
type_=sa.Enum('USER_ADDED', 'CONFLUENCE', 'GRID', 'CRM', name='sourcename', native_enum=False),
|
|
28
|
+
existing_nullable=False)
|
|
29
|
+
# ### end Alembic commands ###
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def downgrade() -> None:
|
|
33
|
+
"""Downgrade schema."""
|
|
34
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
35
|
+
op.alter_column('source', 'name',
|
|
36
|
+
existing_type=sa.Enum('USER_ADDED', 'CONFLUENCE', 'GRID', 'CRM', name='sourcename', native_enum=False),
|
|
37
|
+
type_=sa.VARCHAR(length=200),
|
|
38
|
+
existing_nullable=False)
|
|
39
|
+
op.create_unique_constraint(op.f('uq_document_title_version'), 'document', ['title', 'version'], postgresql_nulls_not_distinct=False)
|
|
40
|
+
# ### end Alembic commands ###
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""Added chunk id and vector embeddings to vector table
|
|
2
|
+
|
|
3
|
+
Revision ID: 07dc8c2589e0
|
|
4
|
+
Revises: f8b0ea2e743c
|
|
5
|
+
Create Date: 2025-09-26 15:05:17.194213
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from typing import Sequence, Union
|
|
9
|
+
|
|
10
|
+
from alembic import op
|
|
11
|
+
import sqlalchemy as sa
|
|
12
|
+
from sqlalchemy.dialects import postgresql
|
|
13
|
+
|
|
14
|
+
# revision identifiers, used by Alembic.
|
|
15
|
+
revision: str = '07dc8c2589e0'
|
|
16
|
+
down_revision: Union[str, Sequence[str], None] = 'f8b0ea2e743c'
|
|
17
|
+
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
+
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def upgrade() -> None:
|
|
22
|
+
"""Upgrade schema."""
|
|
23
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
24
|
+
op.add_column('vector', sa.Column('chunk_id', sa.Integer(), nullable=False))
|
|
25
|
+
op.add_column('vector', sa.Column('vector_embeddings', postgresql.ARRAY(sa.Float()), nullable=True))
|
|
26
|
+
op.drop_index(op.f('idx_vector_source'), table_name='vector')
|
|
27
|
+
op.create_unique_constraint(op.f('vector_chunk_id_key'), 'vector', ['chunk_id'])
|
|
28
|
+
op.create_foreign_key(op.f('vector_chunk_id_fkey'), 'vector', 'chunk', ['chunk_id'], ['id'])
|
|
29
|
+
op.drop_column('vector', 'source_type')
|
|
30
|
+
op.drop_column('vector', 'source_id')
|
|
31
|
+
# ### end Alembic commands ###
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def downgrade() -> None:
|
|
35
|
+
"""Downgrade schema."""
|
|
36
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
37
|
+
op.add_column('vector', sa.Column('source_id', sa.INTEGER(), autoincrement=False, nullable=False))
|
|
38
|
+
op.add_column('vector', sa.Column('source_type', sa.VARCHAR(length=20), autoincrement=False, nullable=False))
|
|
39
|
+
op.drop_constraint(op.f('vector_chunk_id_fkey'), 'vector', type_='foreignkey')
|
|
40
|
+
op.drop_constraint(op.f('vector_chunk_id_key'), 'vector', type_='unique')
|
|
41
|
+
op.create_index(op.f('idx_vector_source'), 'vector', ['source_type', 'source_id'], unique=False)
|
|
42
|
+
op.drop_column('vector', 'vector_embeddings')
|
|
43
|
+
op.drop_column('vector', 'chunk_id')
|
|
44
|
+
# ### end Alembic commands ###
|
prism_models/migration/versions/2025_09_29_1220_46ba2693b883_add_markdown_markdown_file_path_s3_.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""Add markdown markdown_file_path_s3 column
|
|
2
|
+
|
|
3
|
+
Revision ID: 46ba2693b883
|
|
4
|
+
Revises: 07dc8c2589e0
|
|
5
|
+
Create Date: 2025-09-29 12:20:47.644058
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from typing import Sequence, Union
|
|
9
|
+
|
|
10
|
+
from alembic import op
|
|
11
|
+
import sqlalchemy as sa
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# revision identifiers, used by Alembic.
|
|
15
|
+
revision: str = '46ba2693b883'
|
|
16
|
+
down_revision: Union[str, Sequence[str], None] = '07dc8c2589e0'
|
|
17
|
+
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
+
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def upgrade() -> None:
|
|
22
|
+
"""Upgrade schema."""
|
|
23
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
24
|
+
op.add_column('document', sa.Column('markdown_file_path_s3', sa.String(length=2048), nullable=True))
|
|
25
|
+
# ### end Alembic commands ###
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def downgrade() -> None:
|
|
29
|
+
"""Downgrade schema."""
|
|
30
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
31
|
+
op.drop_column('document', 'markdown_file_path_s3')
|
|
32
|
+
# ### end Alembic commands ###
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Removed doc id from config table and add config id to document table
|
|
2
|
+
|
|
3
|
+
Revision ID: bf1472a9b021
|
|
4
|
+
Revises: 46ba2693b883
|
|
5
|
+
Create Date: 2025-10-02 15:20:08.035679
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from typing import Sequence, Union
|
|
9
|
+
|
|
10
|
+
from alembic import op
|
|
11
|
+
import sqlalchemy as sa
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# revision identifiers, used by Alembic.
|
|
15
|
+
revision: str = 'bf1472a9b021'
|
|
16
|
+
down_revision: Union[str, Sequence[str], None] = '46ba2693b883'
|
|
17
|
+
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
+
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def upgrade() -> None:
|
|
22
|
+
"""Upgrade schema."""
|
|
23
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
24
|
+
op.add_column('document', sa.Column('chunk_config_id', sa.Integer(), nullable=True))
|
|
25
|
+
op.create_foreign_key(op.f('document_chunk_config_id_fkey'), 'document', 'chunk_config', ['chunk_config_id'], ['id'])
|
|
26
|
+
# ### end Alembic commands ###
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def downgrade() -> None:
|
|
30
|
+
"""Downgrade schema."""
|
|
31
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
32
|
+
op.drop_constraint(op.f('document_chunk_config_id_fkey'), 'document', type_='foreignkey')
|
|
33
|
+
op.drop_column('document', 'chunk_config_id')
|
|
34
|
+
# ### end Alembic commands ###
|
prism_models/migration/versions/2025_10_02_1525_6c0e63e0fef8_removed_doc_id_from_config_table_.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Removed doc id from config table (previous revision didn't do this) and changed default values of chunk size and overlap
|
|
2
|
+
|
|
3
|
+
Revision ID: 6c0e63e0fef8
|
|
4
|
+
Revises: bf1472a9b021
|
|
5
|
+
Create Date: 2025-10-02 15:25:55.624896
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from typing import Sequence, Union
|
|
9
|
+
|
|
10
|
+
from alembic import op
|
|
11
|
+
import sqlalchemy as sa
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# revision identifiers, used by Alembic.
|
|
15
|
+
revision: str = '6c0e63e0fef8'
|
|
16
|
+
down_revision: Union[str, Sequence[str], None] = 'bf1472a9b021'
|
|
17
|
+
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
+
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def upgrade() -> None:
|
|
22
|
+
"""Upgrade schema."""
|
|
23
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
24
|
+
op.drop_constraint(op.f('chunk_config_document_id_fkey'), 'chunk_config', type_='foreignkey')
|
|
25
|
+
op.drop_column('chunk_config', 'document_id')
|
|
26
|
+
# ### end Alembic commands ###
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def downgrade() -> None:
|
|
30
|
+
"""Downgrade schema."""
|
|
31
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
32
|
+
op.add_column('chunk_config', sa.Column('document_id', sa.INTEGER(), autoincrement=False, nullable=True))
|
|
33
|
+
op.create_foreign_key(op.f('chunk_config_document_id_fkey'), 'chunk_config', 'document', ['document_id'], ['id'])
|
|
34
|
+
# ### end Alembic commands ###
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""config id on delete will be set to null
|
|
2
|
+
|
|
3
|
+
Revision ID: 1b3eb48f5017
|
|
4
|
+
Revises: 6c0e63e0fef8
|
|
5
|
+
Create Date: 2025-10-02 16:08:37.604477
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from typing import Sequence, Union
|
|
9
|
+
|
|
10
|
+
from alembic import op
|
|
11
|
+
import sqlalchemy as sa
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# revision identifiers, used by Alembic.
|
|
15
|
+
revision: str = '1b3eb48f5017'
|
|
16
|
+
down_revision: Union[str, Sequence[str], None] = '6c0e63e0fef8'
|
|
17
|
+
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
+
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def upgrade() -> None:
|
|
22
|
+
"""Upgrade schema."""
|
|
23
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
24
|
+
op.drop_constraint(op.f('document_chunk_config_id_fkey'), 'document', type_='foreignkey')
|
|
25
|
+
op.create_foreign_key(op.f('document_chunk_config_id_fkey'), 'document', 'chunk_config', ['chunk_config_id'], ['id'], ondelete='SET NULL')
|
|
26
|
+
# ### end Alembic commands ###
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def downgrade() -> None:
|
|
30
|
+
"""Downgrade schema."""
|
|
31
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
32
|
+
op.drop_constraint(op.f('document_chunk_config_id_fkey'), 'document', type_='foreignkey')
|
|
33
|
+
op.create_foreign_key(op.f('document_chunk_config_id_fkey'), 'document', 'chunk_config', ['chunk_config_id'], ['id'])
|
|
34
|
+
# ### end Alembic commands ###
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""Added docling_hybrid to chunkstrategy
|
|
2
|
+
|
|
3
|
+
Revision ID: ac85b606d8a4
|
|
4
|
+
Revises: 1b3eb48f5017
|
|
5
|
+
Create Date: 2025-10-03 11:09:33.100521
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from typing import Sequence, Union
|
|
9
|
+
|
|
10
|
+
from alembic import op
|
|
11
|
+
import sqlalchemy as sa
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# revision identifiers, used by Alembic.
|
|
15
|
+
revision: str = 'ac85b606d8a4'
|
|
16
|
+
down_revision: Union[str, Sequence[str], None] = '1b3eb48f5017'
|
|
17
|
+
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
+
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def upgrade() -> None:
|
|
22
|
+
"""Upgrade schema."""
|
|
23
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
24
|
+
pass
|
|
25
|
+
# ### end Alembic commands ###
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def downgrade() -> None:
|
|
29
|
+
"""Downgrade schema."""
|
|
30
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
31
|
+
pass
|
|
32
|
+
# ### end Alembic commands ###
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""added s3_bucket and s3_dir in Source table
|
|
2
|
+
|
|
3
|
+
Revision ID: 7d1cb343a63f
|
|
4
|
+
Revises: ac85b606d8a4
|
|
5
|
+
Create Date: 2025-10-03 12:04:15.507431
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from typing import Sequence, Union
|
|
9
|
+
|
|
10
|
+
from alembic import op
|
|
11
|
+
import sqlalchemy as sa
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# revision identifiers, used by Alembic.
|
|
15
|
+
revision: str = '7d1cb343a63f'
|
|
16
|
+
down_revision: Union[str, Sequence[str], None] = 'ac85b606d8a4'
|
|
17
|
+
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
+
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def upgrade() -> None:
|
|
22
|
+
"""Upgrade schema."""
|
|
23
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
24
|
+
op.add_column('source', sa.Column('s3_bucket', sa.String(length=255), nullable=True))
|
|
25
|
+
op.add_column('source', sa.Column('s3_directory', sa.String(length=2048), nullable=True))
|
|
26
|
+
op.alter_column('source', 'name',
|
|
27
|
+
existing_type=sa.VARCHAR(length=10),
|
|
28
|
+
type_=sa.Enum('USER_ADDED', 'S3', 'EVENTS_AND_DESTINATIONS', 'SHAREPOINT', name='sourcename', native_enum=False),
|
|
29
|
+
existing_nullable=False)
|
|
30
|
+
# ### end Alembic commands ###
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def downgrade() -> None:
|
|
34
|
+
"""Downgrade schema."""
|
|
35
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
36
|
+
op.alter_column('source', 'name',
|
|
37
|
+
existing_type=sa.Enum('USER_ADDED', 'S3', 'EVENTS_AND_DESTINATIONS', 'SHAREPOINT', name='sourcename', native_enum=False),
|
|
38
|
+
type_=sa.VARCHAR(length=10),
|
|
39
|
+
existing_nullable=False)
|
|
40
|
+
op.drop_column('source', 's3_directory')
|
|
41
|
+
op.drop_column('source', 's3_bucket')
|
|
42
|
+
# ### end Alembic commands ###
|