letschatty 0.4.335__py3-none-any.whl → 0.4.337__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.
@@ -93,23 +93,10 @@ class SmartTaggingCallbackEvent(LambdaAiEvent):
93
93
  callback_metadata: SmartTaggingCallbackMetadata
94
94
 
95
95
  @model_validator(mode="before")
96
- def normalize_data(cls, values):
97
- if not isinstance(values, dict):
98
- return values
99
-
100
- data = values.get("data")
101
- if isinstance(data, str):
102
- import json
103
- try:
104
- data = json.loads(data)
105
- values["data"] = data
106
- except (json.JSONDecodeError, TypeError):
107
- return values
108
-
109
- if isinstance(data, dict) and "chain_of_thought" in data:
110
- data["chain_of_thought"]["chatty_ai_agent_id"] = "000000000000000000000000"
111
-
112
- return values
96
+ def validate_data(cls, data):
97
+ if isinstance(data, dict) and "data" in data and "chain_of_thought" in data["data"]:
98
+ data["data"]["chain_of_thought"]["chatty_ai_agent_id"] = "000000000000000000000000"
99
+ return data
113
100
 
114
101
  class ChatData(BaseModel):
115
102
  chat_id: StrObjectId
@@ -84,12 +84,13 @@ class ChainOfThoughtInChatPreview(ChattyAssetPreview):
84
84
  # trigger_id removed - trigger info is in: incoming_message_ids for user_message,
85
85
  # triggered_by_user_id for manual_trigger, smart_follow_up_id for follow_up
86
86
  chain_of_thought : Optional[str] = Field(default=None, description="The chain of thought")
87
+ confidence: Optional[int] = Field(default=None, ge=0, le=100, description="Confidence 0-100")
87
88
  status: Optional[ChainOfThoughtInChatStatus] = Field(default=None, description="The status of the chain of thought")
88
89
  name: str = Field(description="A title for the chain of thought")
89
90
 
90
91
  @classmethod
91
92
  def get_projection(cls) -> dict[str, Any]:
92
- return super().get_projection() | {"chat_id": 1, "trigger": 1, "chain_of_thought": 1, "name": 1, "status": 1}
93
+ return super().get_projection() | {"chat_id": 1, "trigger": 1, "chain_of_thought": 1, "confidence": 1, "name": 1, "status": 1}
93
94
 
94
95
  @classmethod
95
96
  def from_dict(cls, data: dict) -> 'ChainOfThoughtInChatPreview':
@@ -103,6 +104,7 @@ class ChainOfThoughtInChatPreview(ChattyAssetPreview):
103
104
  chat_id=asset.chat_id,
104
105
  trigger=asset.trigger,
105
106
  chain_of_thought=asset.chain_of_thought,
107
+ confidence=asset.confidence,
106
108
  status=asset.status,
107
109
  company_id=asset.company_id,
108
110
  created_at=asset.created_at,
@@ -121,6 +123,7 @@ class ChainOfThoughtInChat(CompanyAssetModel):
121
123
  chatty_ai_agent_id : StrObjectId = Field(description="The chatty ai agent id")
122
124
  chatty_ai_agent : Dict[str, Any] = Field(description="The chatty ai agent at the moment of triggering the chain of thought", exclude=True,default_factory=dict)
123
125
  chain_of_thought : Optional[str] = Field(default=None, description="The chain of thought")
126
+ confidence: Optional[int] = Field(default=None, ge=0, le=100, description="Confidence 0-100")
124
127
  name: str = Field(description="A title for the chain of thought", alias="title")
125
128
  preview_class: ClassVar[Type[ChattyAssetPreview]] = ChainOfThoughtInChatPreview
126
129
 
@@ -128,5 +131,4 @@ class ChainOfThoughtInChat(CompanyAssetModel):
128
131
  if self.chain_of_thought is None:
129
132
  self.chain_of_thought = cot
130
133
  else:
131
- self.chain_of_thought += f"\n{cot}"
132
-
134
+ self.chain_of_thought += f"\n{cot}"
@@ -4,7 +4,6 @@ from enum import StrEnum
4
4
  from pydantic_core.core_schema import str_schema
5
5
 
6
6
  from letschatty.models.company.assets.ai_agents_v2.chain_of_thought_in_chat import ChainOfThoughtInChatTrigger
7
- from letschatty.models.company.assets.ai_agents_v2.chatty_ai_agent_in_chat import DataCollectionStatus, PreQualifyStatus
8
7
  from ...utils.types.identifier import StrObjectId
9
8
  from datetime import datetime
10
9
  from zoneinfo import ZoneInfo
@@ -76,14 +75,6 @@ class ChattyAIAgentAssignedToChat(AssignedAssetToChat):
76
75
  mode: ChattyAIMode = Field(default=ChattyAIMode.OFF)
77
76
  requires_human_intervention: bool = Field(default=False)
78
77
  is_processing: bool = Field(default=False)
79
- data_collection_status: Optional[DataCollectionStatus] = Field(
80
- default=None,
81
- description="Status of data collection for pre-qualification"
82
- )
83
- pre_qualify_status: Optional[PreQualifyStatus] = Field(
84
- default=None,
85
- description="Status of pre-qualification"
86
- )
87
78
  last_call_started_at: Optional[datetime] = Field(default=None, description="The timestamp of the get chat with prompt (the moment n8n started processing the call)")
88
79
  trigger_timestamp: Optional[datetime] = Field(default=None, description="The timestamp of the trigger that started the call, if it's a manual trigger, it will be the timestamp of the manual trigger, if it's a follow up, it will be the timestamp of the follow up, if it's a user message, it will be the timestamp of the user message")
89
80
  last_call_cot_id: Optional[StrObjectId] = Field(default=None)
@@ -1,4 +1,4 @@
1
- from pydantic import BaseModel, Field, field_validator, ConfigDict
1
+ from pydantic import BaseModel, Field, field_validator
2
2
  from typing import Optional, Any, ClassVar, List
3
3
  from letschatty.models.base_models.chatty_asset_model import CompanyAssetModel, ChattyAssetPreview
4
4
  import re
@@ -212,11 +212,7 @@ class CollectedData(BaseModel):
212
212
  name: Optional[str] = Field(default=None, description="Customer's name")
213
213
  email: Optional[str] = Field(default=None, description="Customer's email address")
214
214
  phone: Optional[str] = Field(default=None, description="Customer's phone number")
215
- document_id: Optional[str] = Field(
216
- default=None,
217
- alias="dni",
218
- description="Customer's DNI/ID number"
219
- )
215
+ document_id: Optional[str] = Field(default=None, description="Customer's DNI/ID number")
220
216
 
221
217
  # Generic key-value store for any other collected fields
222
218
  additional_fields: dict[str, Any] = Field(
@@ -224,9 +220,6 @@ class CollectedData(BaseModel):
224
220
  description="Additional collected fields as key-value pairs"
225
221
  )
226
222
 
227
- model_config = ConfigDict(
228
- populate_by_name=True
229
- )
230
223
 
231
224
  @classmethod
232
225
  def example(cls) -> dict:
@@ -849,13 +849,6 @@ class ChatService:
849
849
  chat.client.email = collected_data.email
850
850
  updated_fields.append("email")
851
851
 
852
- if collected_data.phone:
853
- if chat.client.lead_form_data is None:
854
- chat.client.lead_form_data = {}
855
- if chat.client.lead_form_data.get("phone") != collected_data.phone:
856
- chat.client.lead_form_data["phone"] = collected_data.phone
857
- updated_fields.append("phone")
858
-
859
852
  if collected_data.document_id and chat.client.document_id != collected_data.document_id:
860
853
  chat.client.document_id = collected_data.document_id
861
854
  updated_fields.append("document_id")
@@ -880,4 +873,4 @@ class ChatService:
880
873
  context=ChattyContext(chain_of_thought_id=execution_context.chain_of_thought_id)
881
874
  )
882
875
 
883
- return chat.client.lead_form_data
876
+ return chat.client.lead_form_data
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: letschatty
3
- Version: 0.4.335
3
+ Version: 0.4.337
4
4
  Summary: Models and custom classes to work across the Chattyverse
5
5
  License: MIT
6
6
  Author: Axel
@@ -2,7 +2,7 @@ letschatty/__init__.py,sha256=6dGYdy5edB1dHdgvpqUpENZ347CpIyWgR1CsGYwPSk8,45
2
2
  letschatty/models/__init__.py,sha256=obWHa796C-O1mqo_lk22KhUC2ODVvG7cICY3Lo-AqJg,126
3
3
  letschatty/models/ai_microservices/__init__.py,sha256=Ijt8hsCpqZoAlUNPfj8O2gE4zCwEGshio4THxdMT06c,601
4
4
  letschatty/models/ai_microservices/expected_output.py,sha256=oEaTE4Y9lgRog0GmW20b5xdLl9Yiq6Ln_H2_0r1dGvQ,10956
5
- letschatty/models/ai_microservices/lambda_events.py,sha256=uh0gPVf9iP5FkWagxJjxy2pQQxdaud2TNoovIROFKD0,18449
5
+ letschatty/models/ai_microservices/lambda_events.py,sha256=Ti5E_qEV1kKFH1VnnIiPpmJp7D0sv_-Iryh-IgQBbkQ,18142
6
6
  letschatty/models/ai_microservices/lambda_invokation_types.py,sha256=qvwEj2Cn9Pe0WSxi4I7pwdD9qbLSu_i3c_ZVhUjYxR4,2033
7
7
  letschatty/models/ai_microservices/n8n_ai_agents_payload.py,sha256=yV7WhAdnIOxWymrUTYJiDLH71A5mSUsX2gac8oAAGJw,882
8
8
  letschatty/models/ai_microservices/openai_payloads.py,sha256=HauUGf4c37khJJsKyH4ikxzHKboGWnerjDQgDOnMFrY,271
@@ -83,7 +83,7 @@ letschatty/models/company/__init__.py,sha256=5D1Ya_ZRGq2sLf9MXXTLZwGcrZPzo87t1Nh
83
83
  letschatty/models/company/assets/__init__.py,sha256=z0xN_lt1D76bXt8DXVdbH3GkofUPQPZU9NioRSLt_lI,244
84
84
  letschatty/models/company/assets/ai_agents_v2/ai_agent_message_draft.py,sha256=xbshA34RSjHm2g8J7hW2FkWo-Qm8MH2HTbcRcoYmyvc,2076
85
85
  letschatty/models/company/assets/ai_agents_v2/ai_agents_decision_output.py,sha256=Bgca167vDr9TNP56nTJykj6I8uLB70D6TcgCchByahA,5866
86
- letschatty/models/company/assets/ai_agents_v2/chain_of_thought_in_chat.py,sha256=LJqtSl1A1V0frPLYwW-5cMZxaGx7-0x1HvujRXsZsNU,5877
86
+ letschatty/models/company/assets/ai_agents_v2/chain_of_thought_in_chat.py,sha256=xK7IbM_sEN7_-SZXcgiRyALq6IjYaJ-ivq9BE8B8Bdg,6129
87
87
  letschatty/models/company/assets/ai_agents_v2/chat_example.py,sha256=yCKt6ifNYch3C78zAvj8To0_Sb9CPAZ8sC-hyoBPa4s,1816
88
88
  letschatty/models/company/assets/ai_agents_v2/chat_example_test.py,sha256=vChD-TkX1ORRD9LMbd2HlpbK4QyrsfhDiJd-LDjIqlk,4618
89
89
  letschatty/models/company/assets/ai_agents_v2/chatty_ai_agent.py,sha256=R2rCANri8ZiqnmPP10PWoanGddMImCMxrl78Y6d-194,8204
@@ -102,7 +102,7 @@ letschatty/models/company/assets/ai_agents_v2/pre_qualify_config.py,sha256=tXsUX
102
102
  letschatty/models/company/assets/assignment/__init__.py,sha256=eWYZfaDQde5OJNIDed8D-LNRXOa5O_O4mGMToNFtaW8,239
103
103
  letschatty/models/company/assets/assignment/assignment_assets.py,sha256=phIJqNh4UGTU-Hux_kaOYhJm2GCqv37AnCGePSDVKmM,2245
104
104
  letschatty/models/company/assets/automation.py,sha256=QDMCHm--85tEGUwddjWGeUSxmCT27HiH8lRm4w4DJLE,1871
105
- letschatty/models/company/assets/chat_assets.py,sha256=zxmI3D_ZDcNqK5jusZ7mFgPka3DMSlzeE2u8WXdo46w,7949
105
+ letschatty/models/company/assets/chat_assets.py,sha256=OV33LPOBOaK02Va0yH7rCH5ufmEyOploQPTEefjlsdk,7524
106
106
  letschatty/models/company/assets/chatty_fast_answers/__init__.py,sha256=tbgWS0n1i0nVi9f79U44GPRnrW25NKcjl6Port92alk,48
107
107
  letschatty/models/company/assets/chatty_fast_answers/chatty_fast_answer.py,sha256=PxW3eStHXo0BY7Z9hMDqBTHmgO7XcwtOvEpwXi-rA5g,1076
108
108
  letschatty/models/company/assets/company_assets.py,sha256=YKRo_uXhQYRQ8HvMf4HhrHTBC2zp7xlE_B0nqSMfMFY,726
@@ -126,7 +126,7 @@ letschatty/models/company/company_chats_snapshot.py,sha256=Mg9Wmu3pfE-t5Sf57FCj-
126
126
  letschatty/models/company/company_messaging_settgins.py,sha256=7isXt7gmqw-FKSUSZwdctdXDFMfPi2OyPuWqB7WpC6c,957
127
127
  letschatty/models/company/conversation_topic.py,sha256=__IinJ3YcUsiApF4Em5uAgd01ydRUrlCVxaat-pCCRg,1704
128
128
  letschatty/models/company/empresa.py,sha256=2INPC8YSZJcT10Gny_zXV_PujeqUGccsZHV31ZSywyw,5961
129
- letschatty/models/company/form_field.py,sha256=LGyMLybwvfEPG3hMmwsoP_4wnMaPJbVFpG6c1HdVC8E,9802
129
+ letschatty/models/company/form_field.py,sha256=Twzpieo0yia_kJ8uEXJq7pX9drsKuBYEslAMa3iO0Mg,9680
130
130
  letschatty/models/company/insight.py,sha256=B7BL07E4Z1b9aJHi3PXC1atln4-7fSo9JeqgQoeB_ao,7459
131
131
  letschatty/models/company/notifications/notification.py,sha256=wE7rIi21nZno6jjIxajMz4e7OJbzrDHjH1KdkNzJiF8,1907
132
132
  letschatty/models/copilot/links.py,sha256=mcddNR6WdWOoOr3NgDl_FElxF15SiZZXw9wmIV08HRw,185
@@ -230,7 +230,7 @@ letschatty/services/ai_agents/tool_descriptions/human_handover.json,sha256=-b3l_
230
230
  letschatty/services/ai_agents/tool_descriptions.py,sha256=MMFhcgEl6Z7k8BUv3Yx1pCxHzIjc8HD93S0uM5OPj8Y,105
231
231
  letschatty/services/ai_components_service.py,sha256=QUb-NdzHj4nPmnceVSQ9Pe3swFWUrkUFKzDZeuP0b5o,3762
232
232
  letschatty/services/chat/chat_extractors.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
233
- letschatty/services/chat/chat_service.py,sha256=DsnjSYmOXGSRQPtnYEx2O4NPdEXpG1GBOjk53M-jYM8,47832
233
+ letschatty/services/chat/chat_service.py,sha256=h1AkzLDA7PSKXIuol18a5-lXq48ODfBPPLtHog0fzzE,47496
234
234
  letschatty/services/chat/client_service.py,sha256=TtlG0GJDqx6YemfueiJzAtMNk_udnPhg0MJG0bKwnk8,1097
235
235
  letschatty/services/chat/conversation_topics_service.py,sha256=jvIkpHTCz0JKXui3n_BRs6UQ-TB3x7DrQsnX2zUVFVw,2461
236
236
  letschatty/services/chatty_assets/__init__.py,sha256=yNe0X8N86OBgrUagYVexX8u8wxoqeepNiCSUwa0OnNo,375
@@ -310,7 +310,7 @@ letschatty/services/template_campaigns/template_campaign_service.py,sha256=jORgD
310
310
  letschatty/services/users/agent_service.py,sha256=hIkUUJ1SpkKbh5_uo4i2CeqGtuMTjU7tSV8k5J7WPG4,279
311
311
  letschatty/services/users/user_factory.py,sha256=FCB9uiAfjMeYfh4kMdx5h8VDHJ8MCsD-uaxW3X3KaWM,6681
312
312
  letschatty/services/validators/analytics_validator.py,sha256=-QBR6XIqEv2qw3stcBQehkwui1EcfWUM6M9DRQODykY,6335
313
- letschatty-0.4.335.dist-info/LICENSE,sha256=EClLu_bO2HBLDcThowIwfaIg5EOwIYhpRsBJjVEk92A,1197
314
- letschatty-0.4.335.dist-info/METADATA,sha256=21mIuvAaavZ1voihEuwOh-mMKIJj96O69YwG3rFLklU,3283
315
- letschatty-0.4.335.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
316
- letschatty-0.4.335.dist-info/RECORD,,
313
+ letschatty-0.4.337.dist-info/LICENSE,sha256=EClLu_bO2HBLDcThowIwfaIg5EOwIYhpRsBJjVEk92A,1197
314
+ letschatty-0.4.337.dist-info/METADATA,sha256=goPA4IWZT1rJpEvIFjtGU8x4heWI5nL0QB5bWrT_ItA,3283
315
+ letschatty-0.4.337.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
316
+ letschatty-0.4.337.dist-info/RECORD,,