prism-models 0.1.2__py3-none-any.whl → 0.1.4__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.

Potentially problematic release.


This version of prism-models might be problematic. Click here for more details.

prism_models/__init__.py CHANGED
@@ -3,7 +3,7 @@
3
3
  __version__ = "0.1.0"
4
4
 
5
5
 
6
- from prism_models.agent_profile import Agent, AgentProfile, AgentProfileStatus, Profile, ProfileCollectionAccess
6
+ from prism_models.agent_profile import Agent, AgentCollectionAccess, AgentProfile, AgentProfileStatus, Profile, ProfileCollectionAccess
7
7
  from prism_models.base import POSTGRES_NAMING_CONVENTION, Base, BaseModel, TimestampMixin
8
8
  from prism_models.chat import Contact, Conversation, ConversationMessage, ConversationMessageMetadata
9
9
  from prism_models.content import Chunk, ChunkConfig, Collection, CollectionDocument, Document, IntegrationConfig, QAPair, Source, Vector
@@ -13,6 +13,7 @@ from prism_models.qdrant import QdrantVectorPayload, DestinationVectorPayload, P
13
13
  __all__ = [
14
14
  "POSTGRES_NAMING_CONVENTION",
15
15
  "Agent",
16
+ "AgentCollectionAccess",
16
17
  "AgentProfile",
17
18
  "AgentProfileStatus",
18
19
  "Augmentation",
@@ -99,3 +99,30 @@ class ProfileCollectionAccess(BaseModel):
99
99
  collection: Mapped["Collection"] = relationship()
100
100
 
101
101
  __table_args__ = (UniqueConstraint("profile_id", "collection_id", name="uq_profile_collection"),)
102
+
103
+
104
+ class AgentCollectionAccess(BaseModel):
105
+ """AgentCollectionAccess model for storing agent collection information."""
106
+
107
+ agent_id: Mapped[int] = mapped_column(
108
+ Integer,
109
+ ForeignKey("agent.id", ondelete="CASCADE"),
110
+ nullable=False,
111
+ index=True,
112
+ )
113
+ collection_id: Mapped[int] = mapped_column(
114
+ Integer,
115
+ ForeignKey("collection.id", ondelete="CASCADE"),
116
+ nullable=False,
117
+ index=True,
118
+ )
119
+ access_granted_at: Mapped[datetime] = mapped_column(
120
+ TIMESTAMP(timezone=True),
121
+ server_default=func.now(),
122
+ nullable=True,
123
+ )
124
+
125
+ agent: Mapped["Agent"] = relationship()
126
+ collection: Mapped["Collection"] = relationship()
127
+
128
+ __table_args__ = (UniqueConstraint("agent_id", "collection_id", name="uq_agent_collection"),)
prism_models/chat.py CHANGED
@@ -24,6 +24,7 @@ class ContactSource(PyEnum):
24
24
  GRID = "GRID"
25
25
  CRM = "CRM"
26
26
  EXTERNAL = "EXTERNAL"
27
+ MICROSOFT_AD = "MICROSOFT_AD"
27
28
 
28
29
 
29
30
  class ConversationType(PyEnum):
@@ -46,6 +47,7 @@ class MessageStatus(PyEnum):
46
47
 
47
48
  class MessageType(PyEnum):
48
49
  TEXT = "TEXT"
50
+
49
51
 
50
52
 
51
53
  class Contact(ChatSchemaMixin, BaseModel):
@@ -78,6 +80,10 @@ class Contact(ChatSchemaMixin, BaseModel):
78
80
  crm_contact_guid = Column(String(36), nullable=True)
79
81
 
80
82
  account_id = Column(String(36), nullable=True)
83
+
84
+ # oid claim from Azure AD
85
+ azure_ad_object_id = Column(String(36), nullable=True, unique=True, index=True)
86
+ azure_ad_tenant_id = Column(String(36), nullable=True, index=True)
81
87
 
82
88
  conversations = relationship("Conversation", back_populates="contact", cascade="all, delete-orphan")
83
89
 
prism_models/config.py CHANGED
@@ -26,7 +26,7 @@ class Settings(BaseSettings):
26
26
  @property
27
27
  def PG_DATABASE_URL_PRISM(self) -> str:
28
28
  """Get the Prism database URL."""
29
- return self.PG_DATABASE_URL + "/prism"
29
+ return self.PG_DATABASE_URL + "/prism2"
30
30
 
31
31
  @property
32
32
  def is_development(self) -> bool:
@@ -0,0 +1,50 @@
1
+ """added AgentCollectionAccess table
2
+
3
+ Revision ID: ff3be2c4311f
4
+ Revises: 919d07a93f83
5
+ Create Date: 2025-10-27 13:31:19.882851
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 = 'ff3be2c4311f'
16
+ down_revision: Union[str, Sequence[str], None] = '919d07a93f83'
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.create_table('agent_collection_access',
25
+ sa.Column('agent_id', sa.Integer(), nullable=False),
26
+ sa.Column('collection_id', sa.Integer(), nullable=False),
27
+ sa.Column('access_granted_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=True),
28
+ sa.Column('id', sa.Integer(), nullable=False),
29
+ sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
30
+ sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
31
+ sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
32
+ sa.ForeignKeyConstraint(['agent_id'], ['agent.id'], name=op.f('agent_collection_access_agent_id_fkey'), ondelete='CASCADE'),
33
+ sa.ForeignKeyConstraint(['collection_id'], ['collection.id'], name=op.f('agent_collection_access_collection_id_fkey'), ondelete='CASCADE'),
34
+ sa.PrimaryKeyConstraint('id', name=op.f('agent_collection_access_pkey')),
35
+ sa.UniqueConstraint('agent_id', 'collection_id', name='uq_agent_collection')
36
+ )
37
+ op.create_index(op.f('agent_collection_access_agent_id_idx'), 'agent_collection_access', ['agent_id'], unique=False)
38
+ op.create_index(op.f('agent_collection_access_collection_id_idx'), 'agent_collection_access', ['collection_id'], unique=False)
39
+ op.create_index(op.f('agent_collection_access_id_idx'), 'agent_collection_access', ['id'], unique=False)
40
+ # ### end Alembic commands ###
41
+
42
+
43
+ def downgrade() -> None:
44
+ """Downgrade schema."""
45
+ # ### commands auto generated by Alembic - please adjust! ###
46
+ op.drop_index(op.f('agent_collection_access_id_idx'), table_name='agent_collection_access')
47
+ op.drop_index(op.f('agent_collection_access_collection_id_idx'), table_name='agent_collection_access')
48
+ op.drop_index(op.f('agent_collection_access_agent_id_idx'), table_name='agent_collection_access')
49
+ op.drop_table('agent_collection_access')
50
+ # ### end Alembic commands ###
@@ -0,0 +1,46 @@
1
+ """AD Enum and field added
2
+
3
+ Revision ID: b789e61df26a
4
+ Revises: ff3be2c4311f
5
+ Create Date: 2025-10-28 13:33:30.377086
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 = 'b789e61df26a'
16
+ down_revision: Union[str, Sequence[str], None] = 'ff3be2c4311f'
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
+ # Add new MICROSOFT_AD value to the existing contactsource enum type
24
+ op.execute("ALTER TYPE contactsource ADD VALUE IF NOT EXISTS 'MICROSOFT_AD'")
25
+
26
+ # ### commands auto generated by Alembic - please adjust! ###
27
+ op.add_column('contact', sa.Column('azure_ad_object_id', sa.String(length=36), nullable=True))
28
+ op.add_column('contact', sa.Column('azure_ad_tenant_id', sa.String(length=36), nullable=True))
29
+ op.create_index(op.f('contact_azure_ad_object_id_idx'), 'contact', ['azure_ad_object_id'], unique=True)
30
+ op.create_index(op.f('contact_azure_ad_tenant_id_idx'), 'contact', ['azure_ad_tenant_id'], unique=False)
31
+ # ### end Alembic commands ###
32
+
33
+
34
+ def downgrade() -> None:
35
+ """Downgrade schema."""
36
+ # ### commands auto generated by Alembic - please adjust! ###
37
+ op.drop_index(op.f('contact_azure_ad_tenant_id_idx'), table_name='contact')
38
+ op.drop_index(op.f('contact_azure_ad_object_id_idx'), table_name='contact')
39
+ op.drop_column('contact', 'azure_ad_tenant_id')
40
+ op.drop_column('contact', 'azure_ad_object_id')
41
+ # ### end Alembic commands ###
42
+
43
+ # NOTE: Removing enum values from PostgreSQL types is complex and risky.
44
+ # The 'MICROSOFT_AD' value will remain in the contactsource type after downgrade.
45
+ # If you need to remove it, you would need to recreate the enum type entirely,
46
+ # which requires updating all dependent columns. Not recommended for production.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: prism-models
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Requires-Python: >=3.12
5
5
  Requires-Dist: sqlalchemy[asyncio]>=2.0.0
6
6
  Requires-Dist: alembic>=1.16.0
@@ -1,8 +1,8 @@
1
- prism_models/__init__.py,sha256=QNgzPjt8lzBV7j0e70zUoJurYiLMSsVcWEHnQz4hO-c,1396
2
- prism_models/agent_profile.py,sha256=SlZyd59q5DhdMmbcW9SAQCy44sgF_I7arz-M8_71an4,3789
1
+ prism_models/__init__.py,sha256=IMDlzCmXkCSiY2Ag5BUS4KS2muPJrinwgSquMcmLCG0,1448
2
+ prism_models/agent_profile.py,sha256=pyWv0yZlt32iMzSht8z90F-RUZlLqVAFdjJKJlOuMEk,4602
3
3
  prism_models/base.py,sha256=Ka8zNToTiTG0jNgzqqj2goGmPXt8zxuuSMYvotnb8wY,2281
4
- prism_models/chat.py,sha256=zncfBav1YdB8AdC-9McY9fsKZ3-2plLLhy_NMd8JoyA,11784
5
- prism_models/config.py,sha256=gy_6HknnG17Clv8X_EBhaXEBFBLGR1PLjvN5-SFTo5E,962
4
+ prism_models/chat.py,sha256=apkzBWRhJyhT2VBMOSewhFfueyjkpR3u3vQYTSWG2qc,12013
5
+ prism_models/config.py,sha256=L1e7yJ3D3ySzNNzYQYyfBOpNJFwjwdOSTOo2gkfBaXw,963
6
6
  prism_models/content.py,sha256=gRyampLEpZnAeaVljVt4jz8X723eAAFzF10Ds2qUkcA,11083
7
7
  prism_models/feedback.py,sha256=tMZISQ0mk7_1ADsK4bO36_VZ0f-JDdAPcfWzIZBk0_g,6202
8
8
  prism_models/qdrant.py,sha256=ORIpLv1fbRJiL9qq2F-WurtY42MGEPku4ojY_-cdsRY,3266
@@ -33,7 +33,9 @@ prism_models/migration/versions/2025_10_08_1304_c91eb8e38cc7_added_destination_r
33
33
  prism_models/migration/versions/2025_10_09_1308_796b720ea35f_added_qa_id_to_vovetor.py,sha256=tW58ejf2_NcaK038Igf3zicZQymeVt4I4uzZULNtHV0,1467
34
34
  prism_models/migration/versions/2025_10_16_1611_663c66268631_added_sharepoint_drive_item_id_as_an_.py,sha256=IaG9NDyTGENq65GyrhGoScBb-U82x5V7NBKpG9PYy5Q,968
35
35
  prism_models/migration/versions/2025_10_23_1228_919d07a93f83_added_sharepoint_directory_in_source.py,sha256=dk7jTusquTc9rDlJtduGIi-YiqNpGfex63WQkVLMeuk,923
36
- prism_models-0.1.2.dist-info/METADATA,sha256=RgJqAieqZdMOhxt58L1araYgEVAN49o8xodj5OeTftA,283
37
- prism_models-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
- prism_models-0.1.2.dist-info/top_level.txt,sha256=UNzqwpLgFYU0EoyB9LiB1jTtc89A1sQ24fSEyNVvgJI,13
39
- prism_models-0.1.2.dist-info/RECORD,,
36
+ prism_models/migration/versions/2025_10_27_1331_ff3be2c4311f_added_agentcollectionaccess_table.py,sha256=wFa9DJSQjhHSrl2JUA2vgPz8qLcL01xepu_MDHhSjGo,2528
37
+ prism_models/migration/versions/2025_10_28_1333_b789e61df26a_ad_enum_and_field_added.py,sha256=rdtLBBRs8Sin4IkZZ4veV8cO_n_clFMGyPz5kIgIAwc,1922
38
+ prism_models-0.1.4.dist-info/METADATA,sha256=Do9k7ePDAccQyChr2NNNyu-CZGxTLjyUCepRm-_5bGU,283
39
+ prism_models-0.1.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
+ prism_models-0.1.4.dist-info/top_level.txt,sha256=UNzqwpLgFYU0EoyB9LiB1jTtc89A1sQ24fSEyNVvgJI,13
41
+ prism_models-0.1.4.dist-info/RECORD,,