projectdavid-common 0.17.2__py3-none-any.whl → 0.17.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.
@@ -1,112 +1,62 @@
1
- from enum import Enum
2
1
  from typing import Any, Dict, List, Optional
3
2
 
4
- from pydantic import BaseModel, ConfigDict, Field, HttpUrl, field_validator
3
+ from pydantic import BaseModel, ConfigDict, Field, HttpUrl
5
4
 
6
- from projectdavid_common.constants.tools import PLATFORM_TOOLS
7
5
  from projectdavid_common.schemas.vectors_schema import VectorStoreRead
8
6
 
9
- ToolName = Enum("ToolName", {name.upper(): name for name in PLATFORM_TOOLS})
10
7
 
11
-
12
- # ────────────────────────────────────────────────────────────────────────────
8
+ # ───────────────────────────────────────────────
13
9
  # ASSISTANT • CREATE
14
- # ────────────────────────────────────────────────────────────────────────────
10
+ # ───────────────────────────────────────────────
15
11
  class AssistantCreate(BaseModel):
16
- id: Optional[str] = Field(
17
- None,
18
- description="Optional pre-generated assistant ID (leave blank for auto).",
19
- )
12
+ id: Optional[str] = Field(None, description="Optional pre-generated assistant ID.")
13
+
14
+ # ─── core info ────────────────────────────
20
15
  name: str = Field(..., description="Assistant name")
21
16
  description: str = Field("", description="Brief description")
22
17
  model: str = Field(..., description="LLM model ID")
23
- instructions: str = Field("", description="System instructions / guidelines for the assistant")
18
+ instructions: str = Field("", description="System instructions")
24
19
 
25
- # ─── tool definitions ────────────────────────────────────────────
26
- tools: Optional[List[dict]] = Field(
27
- None, description="OpenAI-style tool specs (name, parameters …)"
28
- )
29
- platform_tools: Optional[List[Dict[str, Any]]] = Field(
30
- None,
31
- description=(
32
- "Inline platform tools. "
33
- "Example: [{'type': 'file_search', 'vector_store_ids': ['vs_123']}]"
34
- ),
35
- )
36
- tool_resources: Optional[Dict[str, Dict[str, Any]]] = Field(
37
- None,
38
- description=(
39
- "Per-tool resource map, keyed by tool type. Example:\n"
40
- "{\n"
41
- " 'code_interpreter': { 'file_ids': ['f_abc'] },\n"
42
- " 'file_search': { 'vector_store_ids': ['vs_123'] }\n"
43
- "}"
44
- ),
45
- )
20
+ # ─── tools & resources ────────────────────
21
+ tools: Optional[List[dict]] = Field(None, description="OpenAI-style tool specs (dicts).")
22
+ tool_resources: Optional[Dict[str, Dict[str, Any]]] = None
46
23
 
47
- # ─── misc settings ───────────────────────────────────────────────
48
- meta_data: Optional[dict] = Field(None, description="Free-form metadata")
49
- top_p: float = Field(1.0, ge=0, le=1, description="top-p sampling value")
50
- temperature: float = Field(1.0, ge=0, le=2, description="temperature value")
51
- response_format: str = Field("auto", description="Response format")
52
-
53
- # ─── webhook settings ────────────────────────────────────────────
54
- webhook_url: Optional[HttpUrl] = Field(
55
- None,
56
- description="Endpoint for run.action_required callbacks",
57
- examples=["https://myapp.com/webhooks/actions"],
58
- )
59
- webhook_secret: Optional[str] = Field(
60
- None,
61
- min_length=16,
62
- description="HMAC secret used to sign outgoing webhooks",
63
- examples=["whsec_ReplaceWithARealSecureSecret123"],
64
- )
24
+ # ─── misc settings ────────────────────────
25
+ meta_data: Optional[dict] = None
26
+ top_p: float = Field(1.0, ge=0, le=1)
27
+ temperature: float = Field(1.0, ge=0, le=2)
28
+ response_format: str = Field("auto")
65
29
 
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
30
+ # ─── webhooks ─────────────────────────────
31
+ webhook_url: Optional[HttpUrl] = None
32
+ webhook_secret: Optional[str] = Field(None, min_length=16)
78
33
 
79
34
  model_config = ConfigDict(
80
35
  json_schema_extra={
81
36
  "example": {
82
37
  "name": "Search Assistant",
83
- "description": "Assistant that can search company docs",
84
38
  "model": "gpt-4o-mini",
85
- "instructions": "Use tools when relevant.",
86
- "platform_tools": [{"type": "file_search", "vector_store_ids": ["vs_docs"]}],
87
39
  "tool_resources": {"file_search": {"vector_store_ids": ["vs_docs"]}},
88
- "top_p": 0.9,
89
- "temperature": 0.7,
90
40
  }
91
41
  }
92
42
  )
93
43
 
94
44
 
95
- # ────────────────────────────────────────────────────────────────────────────
45
+ # ───────────────────────────────────────────────
96
46
  # ASSISTANT • READ
97
- # ────────────────────────────────────────────────────────────────────────────
47
+ # ───────────────────────────────────────────────
98
48
  class AssistantRead(BaseModel):
99
49
  id: str
100
50
  user_id: Optional[str] = None
101
51
  object: str
102
52
  created_at: int
53
+
103
54
  name: str
104
55
  description: Optional[str] = None
105
56
  model: str
106
57
  instructions: Optional[str] = None
107
58
 
108
59
  tools: Optional[List[dict]] = None
109
- platform_tools: Optional[List[Dict[str, Any]]] = None
110
60
  tool_resources: Optional[Dict[str, Dict[str, Any]]] = None
111
61
 
112
62
  meta_data: Optional[Dict[str, Any]] = None
@@ -117,79 +67,34 @@ class AssistantRead(BaseModel):
117
67
  vector_stores: List[VectorStoreRead] = Field(default_factory=list)
118
68
  webhook_url: Optional[HttpUrl] = None
119
69
 
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
-
133
- model_config = ConfigDict(
134
- from_attributes=True,
135
- json_schema_extra={
136
- "example": {
137
- "id": "asst_abc123",
138
- "user_id": "user_xyz",
139
- "object": "assistant",
140
- "created_at": 1710000000,
141
- "name": "Search Assistant",
142
- "model": "gpt-4o-mini",
143
- "platform_tools": [{"type": "file_search", "vector_store_ids": ["vs_docs"]}],
144
- "tool_resources": {"file_search": {"vector_store_ids": ["vs_docs"]}},
145
- "top_p": 1.0,
146
- "temperature": 0.7,
147
- "response_format": "auto",
148
- }
149
- },
150
- )
70
+ model_config = ConfigDict(from_attributes=True)
151
71
 
152
72
 
153
- # ────────────────────────────────────────────────────────────────────────────
154
- # ASSISTANT • UPDATE
155
- # ────────────────────────────────────────────────────────────────────────────
73
+ # ───────────────────────────────────────────────
74
+ # ASSISTANT • UPDATE (patched)
75
+ # ───────────────────────────────────────────────
156
76
  class AssistantUpdate(BaseModel):
77
+ # ─── scalar fields ────────────────────────
157
78
  name: Optional[str] = None
158
79
  description: Optional[str] = None
159
80
  model: Optional[str] = None
160
81
  instructions: Optional[str] = None
161
-
162
- tools: Optional[List[Any]] = None
163
- platform_tools: Optional[List[Dict[str, Any]]] = None
164
- tool_resources: Optional[Dict[str, Dict[str, Any]]] = None
165
-
166
82
  meta_data: Optional[Dict[str, Any]] = None
167
83
  top_p: Optional[float] = Field(None, ge=0, le=1)
168
84
  temperature: Optional[float] = Field(None, ge=0, le=2)
169
85
  response_format: Optional[str] = None
170
86
 
87
+ # ─── relationship IDs (lists of strings) ──
88
+ tools: Optional[List[str]] = None
89
+ users: Optional[List[str]] = None
90
+ vector_stores: Optional[List[str]] = None
91
+
92
+ # ─── JSON config ─────────────────────────
93
+ tool_resources: Optional[Dict[str, Dict[str, Any]]] = None
94
+
95
+ # ─── webhooks ─────────────────────────────
171
96
  webhook_url: Optional[HttpUrl] = None
172
97
  webhook_secret: Optional[str] = Field(None, min_length=16)
173
98
 
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
-
187
- model_config = ConfigDict(
188
- json_schema_extra={
189
- "example": {
190
- "name": "Updated name",
191
- "platform_tools": [{"type": "calculator"}],
192
- "tool_resources": {"code_interpreter": {"file_ids": ["f_new_readme"]}},
193
- }
194
- }
195
- )
99
+ # forbid unknown keys so stray dicts can’t sneak in
100
+ model_config = ConfigDict(extra="forbid")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: projectdavid_common
3
- Version: 0.17.2
3
+ Version: 0.17.4
4
4
  Summary: Common shared custom packages
5
5
  Author-email: "Francis N." <francis.neequaye@projectdavid.co.uk>
6
6
  License: MIT
@@ -11,7 +11,7 @@ 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=1-ciMT5dWW77cV97gbnMLG5ue0G8EA_zumIEziRxYTU,8493
14
+ projectdavid_common/schemas/assistants_schema.py,sha256=TMH50SM2ZPbTdnaY7_qmvLev2CES8xQtrQAcwnBH5tI,4401
15
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
@@ -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.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,,
29
+ projectdavid_common-0.17.4.dist-info/METADATA,sha256=nBPeZ6JUqPB14QVo7Qhf0YbIw7jC1e0kI6ObQqnbchA,1673
30
+ projectdavid_common-0.17.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
31
+ projectdavid_common-0.17.4.dist-info/entry_points.txt,sha256=Y8HAIUW0ifCKcAzAqR21wu1ATHNFWWWiUB33UYv095o,74
32
+ projectdavid_common-0.17.4.dist-info/top_level.txt,sha256=lJ-jkZ0n0jWktoMJFcw-DzLoMTY2juuw5fgMIqYu1UU,20
33
+ projectdavid_common-0.17.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.7.1)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5