projectdavid-common 0.17.0__py3-none-any.whl → 0.17.2__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.
@@ -1,21 +1,13 @@
1
- """
2
- projectdavid_common.schemas.assistants
3
- -------------------------------------
4
-
5
- Assistant - create / read / update models, 0.4-series.
6
-
7
- * Adds `platform_tools` (array of inline tool specs)
8
- * Adds `tool_resources` (dict keyed by tool-type → resource map)
9
- """
10
-
11
- from __future__ import annotations
12
-
1
+ from enum import Enum
13
2
  from typing import Any, Dict, List, Optional
14
3
 
15
- from pydantic import BaseModel, ConfigDict, Field, HttpUrl
4
+ from pydantic import BaseModel, ConfigDict, Field, HttpUrl, field_validator
16
5
 
6
+ from projectdavid_common.constants.tools import PLATFORM_TOOLS
17
7
  from projectdavid_common.schemas.vectors_schema import VectorStoreRead
18
8
 
9
+ ToolName = Enum("ToolName", {name.upper(): name for name in PLATFORM_TOOLS})
10
+
19
11
 
20
12
  # ────────────────────────────────────────────────────────────────────────────
21
13
  # ASSISTANT • CREATE
@@ -71,6 +63,19 @@ class AssistantCreate(BaseModel):
71
63
  examples=["whsec_ReplaceWithARealSecureSecret123"],
72
64
  )
73
65
 
66
+ @field_validator("platform_tools")
67
+ def validate_platform_tools(cls, v):
68
+ if v is None:
69
+ return v
70
+ for tool in v:
71
+ if "type" not in tool:
72
+ raise ValueError("Platform tool must have a 'type' field")
73
+ if tool["type"] not in [t.value for t in ToolName]:
74
+ raise ValueError(
75
+ f"Invalid tool type: {tool['type']}. Allowed types are {[t.value for t in ToolName]}"
76
+ )
77
+ return v
78
+
74
79
  model_config = ConfigDict(
75
80
  json_schema_extra={
76
81
  "example": {
@@ -112,6 +117,19 @@ class AssistantRead(BaseModel):
112
117
  vector_stores: List[VectorStoreRead] = Field(default_factory=list)
113
118
  webhook_url: Optional[HttpUrl] = None
114
119
 
120
+ @field_validator("platform_tools")
121
+ def validate_platform_tools(cls, v):
122
+ if v is None:
123
+ return v
124
+ for tool in v:
125
+ if "type" not in tool:
126
+ raise ValueError("Platform tool must have a 'type' field")
127
+ if tool["type"] not in [t.value for t in ToolName]:
128
+ raise ValueError(
129
+ f"Invalid tool type: {tool['type']}. Allowed types are {[t.value for t in ToolName]}"
130
+ )
131
+ return v
132
+
115
133
  model_config = ConfigDict(
116
134
  from_attributes=True,
117
135
  json_schema_extra={
@@ -153,6 +171,19 @@ class AssistantUpdate(BaseModel):
153
171
  webhook_url: Optional[HttpUrl] = None
154
172
  webhook_secret: Optional[str] = Field(None, min_length=16)
155
173
 
174
+ @field_validator("platform_tools")
175
+ def validate_platform_tools(cls, v):
176
+ if v is None:
177
+ return v
178
+ for tool in v:
179
+ if "type" not in tool:
180
+ raise ValueError("Platform tool must have a 'type' field")
181
+ if tool["type"] not in [t.value for t in ToolName]:
182
+ raise ValueError(
183
+ f"Invalid tool type: {tool['type']}. Allowed types are {[t.value for t in ToolName]}"
184
+ )
185
+ return v
186
+
156
187
  model_config = ConfigDict(
157
188
  json_schema_extra={
158
189
  "example": {
@@ -23,3 +23,12 @@ class StatusEnum(str, Enum):
23
23
  processing = "processing"
24
24
  expired = "expired"
25
25
  retrying = "retrying"
26
+
27
+
28
+ PLATFORM_TOOLS = [
29
+ "code_interpreter",
30
+ "web_search",
31
+ "vector_store_search",
32
+ "computer",
33
+ "file_search",
34
+ ]
@@ -34,7 +34,12 @@ class RunStatus(str, Enum):
34
34
  # --------------------------------------------------------------------------- #
35
35
  class Run(BaseModel):
36
36
  id: str
37
- user_id: str # NEW
37
+ user_id: Optional[str] = Field(
38
+ default=None,
39
+ description="Filled in by the server from the caller’s API‑key. "
40
+ "Clients MAY omit or set to None.",
41
+ )
42
+
38
43
  assistant_id: str
39
44
  cancelled_at: Optional[int]
40
45
  completed_at: Optional[int]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: projectdavid_common
3
- Version: 0.17.0
3
+ Version: 0.17.2
4
4
  Summary: Common shared custom packages
5
5
  Author-email: "Francis N." <francis.neequaye@projectdavid.co.uk>
6
6
  License: MIT
@@ -11,12 +11,12 @@ projectdavid_common/constants/tools.py,sha256=FOsrnmwccklDrxRP1OUr22Xx5Uswg80LFa
11
11
  projectdavid_common/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  projectdavid_common/schemas/actions_schema.py,sha256=fJPZoY9hoL0-e6Lp_NqpjVhSIr_qrNLjmQycJf5gmN0,2985
13
13
  projectdavid_common/schemas/api_key_schemas.py,sha256=PM6WOlzE-Y06v5YXLYXH5B2EmttMc8oiWbHd4Su81p4,4031
14
- projectdavid_common/schemas/assistants_schema.py,sha256=90ll5oInPG3xH6Za8DGhekUzc0ejo4oBhesDjtBChG8,7126
15
- projectdavid_common/schemas/enums.py,sha256=1fyrH1pKvxXaOUwCGpr3TZovJZOolgezdOXvpKi-AJI,565
14
+ projectdavid_common/schemas/assistants_schema.py,sha256=1-ciMT5dWW77cV97gbnMLG5ue0G8EA_zumIEziRxYTU,8493
15
+ projectdavid_common/schemas/enums.py,sha256=pQdkz_hmfU_vcZdn4XOvcPOcQihaX_iuQIFk-yKTiaw,692
16
16
  projectdavid_common/schemas/files_schema.py,sha256=hNMqVDRc5lsdhxyPWO79QjIpE7NKmKzdQ6hJG8L6LfA,3025
17
17
  projectdavid_common/schemas/inference_schema.py,sha256=LPjKDCq7jBPbQCgwlM97rxO477v3vWwb6RYh4DW0KIs,228
18
18
  projectdavid_common/schemas/messages_schema.py,sha256=HNGFO-3_xPBDl133CauL5lK3hhUXpLCM3LU9VylyIDg,2589
19
- projectdavid_common/schemas/runs_schema.py,sha256=CfX7w8SeuZ5Sd_kmz4QVw60NmQZDc_tgDBcyspH0yM0,5337
19
+ projectdavid_common/schemas/runs_schema.py,sha256=zpW-QurH_Zla7fcCzs5vLHobXo195OMHweDj4IDzH78,5496
20
20
  projectdavid_common/schemas/stream_schema.py,sha256=_0Op35E5TZ-XLM8j5b3xDRuUobGq2eh40oCx1RyGi_A,645
21
21
  projectdavid_common/schemas/threads_schema.py,sha256=DRqiVDoAdAvJ-ALhvjzyVoGkFVrewtA3GOGPVt0IG_0,1293
22
22
  projectdavid_common/schemas/tools_schema.py,sha256=RywLJk1a1-liPnqpf8s9IfTaMBG6uqj3YtV52H7U18g,1815
@@ -26,8 +26,8 @@ projectdavid_common/schemas/vectors_schema.py,sha256=KG4HSa6yVgBLe01iSdXKoU3UxRS
26
26
  projectdavid_common/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  projectdavid_common/utilities/identifier_service.py,sha256=7hL4_i7pGs6bibCSkXQIwpMSUCFASFE0VPm6gqMv4sk,2950
28
28
  projectdavid_common/utilities/logging_service.py,sha256=ONKy3PRjIrxIrTJ_X3iv7v9HA0wyejyw4WrQYlJy7Oc,2614
29
- projectdavid_common-0.17.0.dist-info/METADATA,sha256=-Zqu00MJsYaRiLGygmtN1RyCn8qyzDaYT5Rn6WBFYsU,1673
30
- projectdavid_common-0.17.0.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
31
- projectdavid_common-0.17.0.dist-info/entry_points.txt,sha256=Y8HAIUW0ifCKcAzAqR21wu1ATHNFWWWiUB33UYv095o,74
32
- projectdavid_common-0.17.0.dist-info/top_level.txt,sha256=lJ-jkZ0n0jWktoMJFcw-DzLoMTY2juuw5fgMIqYu1UU,20
33
- projectdavid_common-0.17.0.dist-info/RECORD,,
29
+ projectdavid_common-0.17.2.dist-info/METADATA,sha256=KifP4N7pUXuk1z3J8gbs2tl4Peo6C3IoSHp41KTWiOM,1673
30
+ projectdavid_common-0.17.2.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
31
+ projectdavid_common-0.17.2.dist-info/entry_points.txt,sha256=Y8HAIUW0ifCKcAzAqR21wu1ATHNFWWWiUB33UYv095o,74
32
+ projectdavid_common-0.17.2.dist-info/top_level.txt,sha256=lJ-jkZ0n0jWktoMJFcw-DzLoMTY2juuw5fgMIqYu1UU,20
33
+ projectdavid_common-0.17.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.4.0)
2
+ Generator: setuptools (80.7.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5