meshagent-markitdown 0.0.38__py3-none-any.whl → 0.0.39__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 meshagent-markitdown might be problematic. Click here for more details.
- meshagent/markitdown/tools/markitdown.py +1 -66
- meshagent/markitdown/version.py +1 -1
- {meshagent_markitdown-0.0.38.dist-info → meshagent_markitdown-0.0.39.dist-info}/METADATA +2 -2
- meshagent_markitdown-0.0.39.dist-info/RECORD +9 -0
- meshagent_markitdown-0.0.38.dist-info/RECORD +0 -9
- {meshagent_markitdown-0.0.38.dist-info → meshagent_markitdown-0.0.39.dist-info}/WHEEL +0 -0
- {meshagent_markitdown-0.0.38.dist-info → meshagent_markitdown-0.0.39.dist-info}/licenses/LICENSE +0 -0
- {meshagent_markitdown-0.0.38.dist-info → meshagent_markitdown-0.0.39.dist-info}/top_level.txt +0 -0
|
@@ -2,7 +2,7 @@ import aiohttp
|
|
|
2
2
|
import mimetypes
|
|
3
3
|
from typing import Optional
|
|
4
4
|
import os
|
|
5
|
-
from meshagent.api import EmptyResponse,
|
|
5
|
+
from meshagent.api import EmptyResponse, FileResponse
|
|
6
6
|
from meshagent.tools import (
|
|
7
7
|
Tool,
|
|
8
8
|
ToolContext,
|
|
@@ -104,70 +104,6 @@ class UrlMarkItDownTool(Tool):
|
|
|
104
104
|
)
|
|
105
105
|
|
|
106
106
|
|
|
107
|
-
class AskUserMarkItDownTool(Tool):
|
|
108
|
-
def __init__(self):
|
|
109
|
-
super().__init__(
|
|
110
|
-
name="markitdown_from_user",
|
|
111
|
-
title="Read a file from a user",
|
|
112
|
-
description="Read the contents of a PDF or Office document the user. Requires ask_user_file tool to be available at runtime",
|
|
113
|
-
input_schema={
|
|
114
|
-
"type": "object",
|
|
115
|
-
"additionalProperties": False,
|
|
116
|
-
"required": ["title", "description"],
|
|
117
|
-
"properties": {
|
|
118
|
-
"title": {
|
|
119
|
-
"type": "string",
|
|
120
|
-
"description": "a very short description suitable for a dialog title",
|
|
121
|
-
},
|
|
122
|
-
"description": {
|
|
123
|
-
"type": "string",
|
|
124
|
-
"description": "helpful information that explains why this information is being collected and how it will be used",
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
)
|
|
129
|
-
|
|
130
|
-
async def execute(self, *, context: ToolContext, title: str, description: str):
|
|
131
|
-
who = context.caller
|
|
132
|
-
if context.on_behalf_of is not None:
|
|
133
|
-
who = context.on_behalf_of
|
|
134
|
-
|
|
135
|
-
file_response: FileResponse = await context.room.agents.invoke_tool(
|
|
136
|
-
participant_id=who.id,
|
|
137
|
-
toolkit="ui",
|
|
138
|
-
tool="ask_user_for_file",
|
|
139
|
-
arguments={"title": title, "description": description},
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
ext = mimetypes.guess_extension(file_response.mime_type)
|
|
143
|
-
|
|
144
|
-
logger.info(f"got file: {file_response.mime_type} {ext}")
|
|
145
|
-
|
|
146
|
-
if ext in supported_extensions:
|
|
147
|
-
async with aiofiles.tempfile.NamedTemporaryFile("wb", suffix=ext) as f:
|
|
148
|
-
# TODO: should protect against too large files with maximum file length?
|
|
149
|
-
await f.write(file_response.data)
|
|
150
|
-
|
|
151
|
-
converter = markitdown.MarkItDown()
|
|
152
|
-
|
|
153
|
-
def convert():
|
|
154
|
-
return converter.convert(f.name)
|
|
155
|
-
|
|
156
|
-
result = await asyncio.get_event_loop().run_in_executor(None, convert)
|
|
157
|
-
|
|
158
|
-
return JsonResponse(
|
|
159
|
-
json={
|
|
160
|
-
"filename": file_response.name,
|
|
161
|
-
"mime_type": file_response.mime_type,
|
|
162
|
-
"content": result.text_content,
|
|
163
|
-
}
|
|
164
|
-
)
|
|
165
|
-
else:
|
|
166
|
-
raise Exception(
|
|
167
|
-
"Unsupported file type, you cannot use this tool to retreive its content"
|
|
168
|
-
)
|
|
169
|
-
|
|
170
|
-
|
|
171
107
|
class MarkItDownToolkit(RemoteToolkit):
|
|
172
108
|
def __init__(
|
|
173
109
|
self, blob_storage: Optional[BlobStorage] = None, name="meshagent.markitdown"
|
|
@@ -179,6 +115,5 @@ class MarkItDownToolkit(RemoteToolkit):
|
|
|
179
115
|
tools=[
|
|
180
116
|
FileMarkItDownTool(),
|
|
181
117
|
UrlMarkItDownTool(blob_storage=blob_storage),
|
|
182
|
-
AskUserMarkItDownTool(),
|
|
183
118
|
],
|
|
184
119
|
)
|
meshagent/markitdown/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.0.
|
|
1
|
+
__version__ = "0.0.39"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meshagent-markitdown
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.39
|
|
4
4
|
Summary: Markitdown support for Meshagent
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
Project-URL: Documentation, https://docs.meshagent.com
|
|
@@ -11,7 +11,7 @@ Description-Content-Type: text/markdown
|
|
|
11
11
|
License-File: LICENSE
|
|
12
12
|
Requires-Dist: pytest~=8.4
|
|
13
13
|
Requires-Dist: pytest-asyncio~=0.26
|
|
14
|
-
Requires-Dist: meshagent-api~=0.0.
|
|
14
|
+
Requires-Dist: meshagent-api~=0.0.39
|
|
15
15
|
Requires-Dist: openapi-core~=0.19
|
|
16
16
|
Requires-Dist: markitdown[docx,outlook,pdf,pptx,xlsx]~=0.1
|
|
17
17
|
Dynamic: license-file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
meshagent/markitdown/__init__.py,sha256=X78Z4yEg5XfkNKH0HiIdG4k1q5ktB-ampTuXHLNFrAw,58
|
|
2
|
+
meshagent/markitdown/version.py,sha256=rFnu2wT8xSk2KNzRssUju1l870Gz9DdJMfBB8jhzzO0,23
|
|
3
|
+
meshagent/markitdown/tools/__init__.py,sha256=aIzTx7LQwjq3v189-WGXRyPH8GiTdt6mdtfW36Pqz2Q,73
|
|
4
|
+
meshagent/markitdown/tools/markitdown.py,sha256=NZ9UQ0PT8nWzKG-cTO_tEbNG_n_uTWYEeCMVI4T0Y_Y,3850
|
|
5
|
+
meshagent_markitdown-0.0.39.dist-info/licenses/LICENSE,sha256=eTt0SPW-sVNdkZe9PS_S8WfCIyLjRXRl7sUBWdlteFg,10254
|
|
6
|
+
meshagent_markitdown-0.0.39.dist-info/METADATA,sha256=S2OmD1J80IHEWqNG_PEvKlSV3UXNoQFnLZ8nhYa4_8M,615
|
|
7
|
+
meshagent_markitdown-0.0.39.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
+
meshagent_markitdown-0.0.39.dist-info/top_level.txt,sha256=GlcXnHtRP6m7zlG3Df04M35OsHtNXy_DY09oFwWrH74,10
|
|
9
|
+
meshagent_markitdown-0.0.39.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
meshagent/markitdown/__init__.py,sha256=X78Z4yEg5XfkNKH0HiIdG4k1q5ktB-ampTuXHLNFrAw,58
|
|
2
|
-
meshagent/markitdown/version.py,sha256=R5QxTjVaID7odO0eBWpOnyCjNQxBZ7cpyruM_NMOoDc,23
|
|
3
|
-
meshagent/markitdown/tools/__init__.py,sha256=aIzTx7LQwjq3v189-WGXRyPH8GiTdt6mdtfW36Pqz2Q,73
|
|
4
|
-
meshagent/markitdown/tools/markitdown.py,sha256=D5nsR3QWkPoK3JYqvO1lNcjCn6HAv0LIuiE7oaVq2J4,6389
|
|
5
|
-
meshagent_markitdown-0.0.38.dist-info/licenses/LICENSE,sha256=eTt0SPW-sVNdkZe9PS_S8WfCIyLjRXRl7sUBWdlteFg,10254
|
|
6
|
-
meshagent_markitdown-0.0.38.dist-info/METADATA,sha256=6IzfVOUu1dmKJlKeV3Ggf6sR-uNVfSwEQkNs9uIhf04,615
|
|
7
|
-
meshagent_markitdown-0.0.38.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
-
meshagent_markitdown-0.0.38.dist-info/top_level.txt,sha256=GlcXnHtRP6m7zlG3Df04M35OsHtNXy_DY09oFwWrH74,10
|
|
9
|
-
meshagent_markitdown-0.0.38.dist-info/RECORD,,
|
|
File without changes
|
{meshagent_markitdown-0.0.38.dist-info → meshagent_markitdown-0.0.39.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{meshagent_markitdown-0.0.38.dist-info → meshagent_markitdown-0.0.39.dist-info}/top_level.txt
RENAMED
|
File without changes
|