DeepImagix commited on
Commit
20ca490
·
verified ·
1 Parent(s): 96bf8e2

Upload tool_schemas.py

Browse files
Files changed (1) hide show
  1. agent/schemas/tool_schemas.py +133 -54
agent/schemas/tool_schemas.py CHANGED
@@ -1,6 +1,6 @@
1
  """
2
- NeuraPrompt Agent — Tool Input Schemas (v7.6)
3
- Added GitHub MCP connector schemas
4
  """
5
 
6
  from pydantic import BaseModel, Field
@@ -8,7 +8,6 @@ from typing import Optional, List, Dict, Any
8
 
9
 
10
  class BaseToolInput(BaseModel):
11
- """Base class for all tool inputs"""
12
  pass
13
 
14
 
@@ -26,7 +25,7 @@ class CreateFileInput(BaseToolInput):
26
  filename: str = Field(..., description="Name of the file to create")
27
  content: str = Field(..., description="Content of the file")
28
  file_type: str = Field(default="text", description="Type of file")
29
- extra_files: Optional[List[Dict[str, str]]] = Field(default=None, description="Additional files to create")
30
 
31
 
32
  class WebSearchInput(BaseToolInput):
@@ -39,95 +38,175 @@ class FetchUrlInput(BaseToolInput):
39
 
40
  class AnalyzeImageInput(BaseToolInput):
41
  image_b64: str = Field(..., description="Base64 encoded image")
42
- prompt: str = Field(default="Describe this image in detail", description="Analysis prompt")
43
 
44
 
45
  class FinishInput(BaseToolInput):
46
  final_answer: str = Field(..., description="Final response to the user")
47
 
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  # ==================== GITHUB MCP SCHEMAS ====================
50
 
51
  class GitHubListReposInput(BaseToolInput):
52
  user_id: str = Field(..., description="User ID of the connected GitHub account")
53
- type_filter: str = Field(default="owner", description="Filter: all, owner, member, public, private")
54
- sort: str = Field(default="updated", description="Sort by: created, updated, pushed, full_name")
55
- per_page: int = Field(default=10, description="Number of repos to return (max 100)")
56
 
57
 
58
  class GitHubCreateRepoInput(BaseToolInput):
59
  user_id: str = Field(..., description="User ID of the connected GitHub account")
60
  name: str = Field(..., description="Repository name")
61
- description: str = Field(default="", description="Repository description")
62
- private: bool = Field(default=False, description="Create as private repository")
63
- auto_init: bool = Field(default=True, description="Initialize with README")
64
 
65
 
66
  class GitHubGetRepoInput(BaseToolInput):
67
- user_id: str = Field(..., description="User ID of the connected GitHub account")
68
- owner: str = Field(..., description="Repository owner (username or org)")
69
- repo: str = Field(..., description="Repository name")
70
 
71
 
72
  class GitHubListIssuesInput(BaseToolInput):
73
- user_id: str = Field(..., description="User ID of the connected GitHub account")
74
- owner: str = Field(..., description="Repository owner")
75
- repo: str = Field(..., description="Repository name")
76
- state: str = Field(default="open", description="Issue state: open, closed, all")
77
- per_page: int = Field(default=10, description="Number of issues to return")
78
 
79
 
80
  class GitHubCreateIssueInput(BaseToolInput):
81
- user_id: str = Field(..., description="User ID of the connected GitHub account")
82
- owner: str = Field(..., description="Repository owner")
83
- repo: str = Field(..., description="Repository name")
84
- title: str = Field(..., description="Issue title")
85
- body: str = Field(default="", description="Issue body/description")
86
- labels: Optional[List[str]] = Field(default=None, description="List of label names")
87
 
88
 
89
  class GitHubReadFileInput(BaseToolInput):
90
- user_id: str = Field(..., description="User ID of the connected GitHub account")
91
- owner: str = Field(..., description="Repository owner")
92
- repo: str = Field(..., description="Repository name")
93
- path: str = Field(..., description="File path within the repo (e.g. 'src/main.py')")
94
- ref: str = Field(default="main", description="Branch, tag, or commit SHA")
95
 
96
 
97
  class GitHubWriteFileInput(BaseToolInput):
98
- user_id: str = Field(..., description="User ID of the connected GitHub account")
99
- owner: str = Field(..., description="Repository owner")
100
- repo: str = Field(..., description="Repository name")
101
- path: str = Field(..., description="File path within the repo")
102
- content: str = Field(..., description="File content to write")
103
- message: str = Field(..., description="Git commit message")
104
- branch: str = Field(default="main", description="Branch to commit to")
105
 
106
 
107
  class GitHubCreateBranchInput(BaseToolInput):
108
- user_id: str = Field(..., description="User ID of the connected GitHub account")
109
- owner: str = Field(..., description="Repository owner")
110
- repo: str = Field(..., description="Repository name")
111
- branch: str = Field(..., description="New branch name")
112
- from_branch: str = Field(default="main", description="Source branch to branch from")
113
 
114
 
115
  class GitHubCreatePullRequestInput(BaseToolInput):
116
- user_id: str = Field(..., description="User ID of the connected GitHub account")
117
- owner: str = Field(..., description="Repository owner")
118
- repo: str = Field(..., description="Repository name")
119
- title: str = Field(..., description="PR title")
120
- head: str = Field(..., description="Branch containing changes")
121
- base: str = Field(..., description="Branch to merge into")
122
- body: str = Field(default="", description="PR description/body")
123
 
124
 
125
  class GitHubSearchCodeInput(BaseToolInput):
126
- user_id: str = Field(..., description="User ID of the connected GitHub account")
127
- query: str = Field(..., description="Search query (e.g. 'language:python flask')")
128
- per_page: int = Field(default=10, description="Number of results to return")
129
 
130
 
131
  class GitHubGetUserProfileInput(BaseToolInput):
132
- user_id: str = Field(..., description="User ID of the connected GitHub account")
133
-
 
1
  """
2
+ NeuraPrompt Agent — Tool Input Schemas (v9.0)
3
+ Added: document_tools, media_tools schemas
4
  """
5
 
6
  from pydantic import BaseModel, Field
 
8
 
9
 
10
  class BaseToolInput(BaseModel):
 
11
  pass
12
 
13
 
 
25
  filename: str = Field(..., description="Name of the file to create")
26
  content: str = Field(..., description="Content of the file")
27
  file_type: str = Field(default="text", description="Type of file")
28
+ extra_files: Optional[List[Dict[str, str]]] = Field(default=None)
29
 
30
 
31
  class WebSearchInput(BaseToolInput):
 
38
 
39
  class AnalyzeImageInput(BaseToolInput):
40
  image_b64: str = Field(..., description="Base64 encoded image")
41
+ prompt: str = Field(default="Describe this image in detail")
42
 
43
 
44
  class FinishInput(BaseToolInput):
45
  final_answer: str = Field(..., description="Final response to the user")
46
 
47
 
48
+ # ==================== DOCUMENT TOOL SCHEMAS ====================
49
+
50
+ class CreatePDFInput(BaseToolInput):
51
+ title: str = Field(..., description="PDF document title")
52
+ content: str = Field(..., description="Body text content (use \\n for new lines)")
53
+ filename: Optional[str] = Field(default=None, description="Optional output filename")
54
+
55
+
56
+ class CreateDOCXInput(BaseToolInput):
57
+ title: str = Field(..., description="Document title")
58
+ content: str = Field(..., description="Body text content (use \\n for new lines)")
59
+ filename: Optional[str] = Field(default=None, description="Optional output filename")
60
+ sections: Optional[List[Dict[str, str]]] = Field(
61
+ default=None,
62
+ description="Optional structured sections: [{heading: str, text: str}]"
63
+ )
64
+
65
+
66
+ class CreateExcelInput(BaseToolInput):
67
+ sheet_name: str = Field(..., description="Name of the worksheet")
68
+ headers: List[str] = Field(..., description="Column header names")
69
+ rows: List[List[Any]] = Field(..., description="List of rows, each row is a list of values")
70
+ filename: Optional[str] = Field(default=None, description="Optional output filename")
71
+
72
+
73
+ class CreateCSVInput(BaseToolInput):
74
+ headers: List[str] = Field(..., description="Column header names")
75
+ rows: List[List[Any]] = Field(..., description="List of data rows")
76
+ filename: Optional[str] = Field(default=None, description="Optional output filename")
77
+
78
+
79
+ class CreateTextFileInput(BaseToolInput):
80
+ content: str = Field(..., description="File content")
81
+ filename: Optional[str] = Field(default=None, description="Optional output filename")
82
+ file_format: str = Field(default="txt", description="File format: txt or md")
83
+
84
+
85
+ # ==================== MEDIA TOOL SCHEMAS ====================
86
+
87
+ class CreateBarChartInput(BaseToolInput):
88
+ labels: List[str] = Field(..., description="Bar labels")
89
+ values: List[float] = Field(..., description="Bar values")
90
+ title: str = Field(default="Chart", description="Chart title")
91
+ x_label: str = Field(default="", description="X axis label")
92
+ y_label: str = Field(default="", description="Y axis label")
93
+ filename: Optional[str] = Field(default=None, description="Optional output filename")
94
+
95
+
96
+ class CreateLineChartInput(BaseToolInput):
97
+ x_values: List[Any] = Field(..., description="X axis values")
98
+ y_values: List[float] = Field(..., description="Y axis values")
99
+ title: str = Field(default="Line Chart", description="Chart title")
100
+ x_label: str = Field(default="", description="X axis label")
101
+ y_label: str = Field(default="", description="Y axis label")
102
+ filename: Optional[str] = Field(default=None, description="Optional output filename")
103
+
104
+
105
+ class CreatePieChartInput(BaseToolInput):
106
+ labels: List[str] = Field(..., description="Slice labels")
107
+ values: List[float] = Field(..., description="Slice values")
108
+ title: str = Field(default="Pie Chart", description="Chart title")
109
+ filename: Optional[str] = Field(default=None, description="Optional output filename")
110
+
111
+
112
+ class CreateQRCodeInput(BaseToolInput):
113
+ data: str = Field(..., description="Text or URL to encode in the QR code")
114
+ filename: Optional[str] = Field(default=None, description="Optional output filename")
115
+
116
+
117
+ class ResizeImageInput(BaseToolInput):
118
+ image_b64: str = Field(..., description="Base64 encoded image")
119
+ width: int = Field(..., description="Target width in pixels")
120
+ height: int = Field(..., description="Target height in pixels")
121
+ filename: Optional[str] = Field(default=None, description="Optional output filename")
122
+
123
+
124
+ class CreateZipInput(BaseToolInput):
125
+ file_paths: List[str] = Field(..., description="List of filenames in agent_outputs folder to zip")
126
+ zip_filename: Optional[str] = Field(default=None, description="Optional output zip filename")
127
+
128
+
129
  # ==================== GITHUB MCP SCHEMAS ====================
130
 
131
  class GitHubListReposInput(BaseToolInput):
132
  user_id: str = Field(..., description="User ID of the connected GitHub account")
133
+ type_filter: str = Field(default="owner")
134
+ sort: str = Field(default="updated")
135
+ per_page: int = Field(default=10)
136
 
137
 
138
  class GitHubCreateRepoInput(BaseToolInput):
139
  user_id: str = Field(..., description="User ID of the connected GitHub account")
140
  name: str = Field(..., description="Repository name")
141
+ description: str = Field(default="")
142
+ private: bool = Field(default=False)
143
+ auto_init: bool = Field(default=True)
144
 
145
 
146
  class GitHubGetRepoInput(BaseToolInput):
147
+ user_id: str = Field(...)
148
+ owner: str = Field(...)
149
+ repo: str = Field(...)
150
 
151
 
152
  class GitHubListIssuesInput(BaseToolInput):
153
+ user_id: str = Field(...)
154
+ owner: str = Field(...)
155
+ repo: str = Field(...)
156
+ state: str = Field(default="open")
157
+ per_page: int = Field(default=10)
158
 
159
 
160
  class GitHubCreateIssueInput(BaseToolInput):
161
+ user_id: str = Field(...)
162
+ owner: str = Field(...)
163
+ repo: str = Field(...)
164
+ title: str = Field(...)
165
+ body: str = Field(default="")
166
+ labels: Optional[List[str]] = Field(default=None)
167
 
168
 
169
  class GitHubReadFileInput(BaseToolInput):
170
+ user_id: str = Field(...)
171
+ owner: str = Field(...)
172
+ repo: str = Field(...)
173
+ path: str = Field(...)
174
+ ref: str = Field(default="main")
175
 
176
 
177
  class GitHubWriteFileInput(BaseToolInput):
178
+ user_id: str = Field(...)
179
+ owner: str = Field(...)
180
+ repo: str = Field(...)
181
+ path: str = Field(...)
182
+ content: str = Field(...)
183
+ message: str = Field(...)
184
+ branch: str = Field(default="main")
185
 
186
 
187
  class GitHubCreateBranchInput(BaseToolInput):
188
+ user_id: str = Field(...)
189
+ owner: str = Field(...)
190
+ repo: str = Field(...)
191
+ branch: str = Field(...)
192
+ from_branch: str = Field(default="main")
193
 
194
 
195
  class GitHubCreatePullRequestInput(BaseToolInput):
196
+ user_id: str = Field(...)
197
+ owner: str = Field(...)
198
+ repo: str = Field(...)
199
+ title: str = Field(...)
200
+ head: str = Field(...)
201
+ base: str = Field(...)
202
+ body: str = Field(default="")
203
 
204
 
205
  class GitHubSearchCodeInput(BaseToolInput):
206
+ user_id: str = Field(...)
207
+ query: str = Field(...)
208
+ per_page: int = Field(default=10)
209
 
210
 
211
  class GitHubGetUserProfileInput(BaseToolInput):
212
+ user_id: str = Field(...)