stores 0.1.7.dev2__tar.gz → 0.1.7.dev4__tar.gz
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.
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/PKG-INFO +1 -1
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/pyproject.toml +1 -1
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/stores/indexes/venv_utils.py +41 -23
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/uv.lock +1 -1
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/.gitignore +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/.python-version +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/LICENSE +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/README.md +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/examples/README.md +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/examples/quickstarts/anthropic_api.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/examples/quickstarts/google_gemini_auto_call.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/examples/quickstarts/google_gemini_manual_call.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/examples/quickstarts/langchain_w_tool_calling.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/examples/quickstarts/langgraph_agent.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/examples/quickstarts/litellm_w_tool_calling.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/examples/quickstarts/llamaindex_agent.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/examples/quickstarts/openai_agent.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/examples/quickstarts/openai_chat_completions.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/examples/quickstarts/openai_responses.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/local_generator.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/run_browser_use.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/run_remote_tool.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/stores/__init__.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/stores/constants.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/stores/format.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/stores/indexes/__init__.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/stores/indexes/base_index.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/stores/indexes/index.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/stores/indexes/local_index.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/stores/indexes/remote_index.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/stores/parse.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/stores/utils.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/README.md +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/mock_index/hello/__init__.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/mock_index/tools.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/mock_index/tools.toml +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/mock_index_custom_class/foo.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/mock_index_custom_class/tools.toml +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/mock_index_function_error/foo.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/mock_index_function_error/tools.toml +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/mock_index_w_deps/mock_index/__init__.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/mock_index_w_deps/pyproject.toml +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/mock_index_w_deps/requirements.txt +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/mock_index_w_deps/tools.toml +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/test_format/conftest.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/test_format/test_format.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/test_indexes/conftest.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/test_indexes/test_base_index.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/test_indexes/test_index.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/test_indexes/test_local_index.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/test_indexes/test_remote_index.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/test_indexes/test_venv_utils.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/test_parse/conftest.py +0 -0
- {stores-0.1.7.dev2 → stores-0.1.7.dev4}/tests/test_parse/test_parse.py +0 -0
@@ -151,8 +151,14 @@ def get_tool_signature(
|
|
151
151
|
tool_name = tool_id.split(".")[-1]
|
152
152
|
env_var = env_var or {}
|
153
153
|
|
154
|
+
# We use sockets to pass pass function metadata
|
155
|
+
listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
156
|
+
listener.bind(("localhost", 0))
|
157
|
+
listener.listen(1)
|
158
|
+
_, port = listener.getsockname()
|
159
|
+
|
154
160
|
runner = f"""
|
155
|
-
import pickle, sys, traceback, inspect, enum
|
161
|
+
import pickle, sys, traceback, inspect, enum, socket
|
156
162
|
from typing import Any, Dict, List, Literal, Tuple, Union, get_args, get_origin, get_type_hints
|
157
163
|
import types as T
|
158
164
|
|
@@ -206,8 +212,9 @@ def extract_type_info(typ, custom_types: list[str] | None = None):
|
|
206
212
|
|
207
213
|
try:
|
208
214
|
from {module_name} import {tool_name}
|
209
|
-
|
210
|
-
|
215
|
+
func = {tool_name}
|
216
|
+
sig = inspect.signature(func)
|
217
|
+
hints = get_type_hints(func)
|
211
218
|
params = {{}}
|
212
219
|
for name, param in sig.parameters.items():
|
213
220
|
hint = hints.get(name, param.annotation)
|
@@ -218,33 +225,44 @@ try:
|
|
218
225
|
return_type = hints.get('return', sig.return_annotation)
|
219
226
|
return_info = extract_type_info(return_type)
|
220
227
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
"
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
"doc": inspect.getdoc({tool_name}),
|
232
|
-
}},
|
228
|
+
payload = {{
|
229
|
+
"ok": True,
|
230
|
+
"result": {{
|
231
|
+
"tool_id": "{tool_id}",
|
232
|
+
"params": params,
|
233
|
+
"return": return_info,
|
234
|
+
"iscoroutinefunction": inspect.iscoroutinefunction(func),
|
235
|
+
"isgeneratorfunction": inspect.isgeneratorfunction(func),
|
236
|
+
"isasyncgenfunction": inspect.isasyncgenfunction(func),
|
237
|
+
"doc": inspect.getdoc(func),
|
233
238
|
}},
|
234
|
-
|
235
|
-
)
|
239
|
+
}}
|
236
240
|
except Exception as e:
|
237
|
-
|
238
|
-
|
241
|
+
payload = {{"ok": False, "error": traceback.format_exc()}}
|
242
|
+
|
243
|
+
with socket.create_connection(("localhost", {port})) as s:
|
244
|
+
s.sendall(pickle.dumps(payload))
|
239
245
|
"""
|
240
|
-
|
246
|
+
proc = subprocess.Popen(
|
241
247
|
[get_python_command(Path(index_folder) / venv), "-c", runner],
|
242
|
-
capture_output=True,
|
243
248
|
cwd=index_folder,
|
244
249
|
env=env_var or None,
|
245
250
|
)
|
251
|
+
|
252
|
+
conn, _ = listener.accept()
|
253
|
+
with conn:
|
254
|
+
data = b""
|
255
|
+
while True:
|
256
|
+
chunk = conn.recv(4096)
|
257
|
+
if not chunk:
|
258
|
+
break
|
259
|
+
data += chunk
|
260
|
+
|
261
|
+
listener.close()
|
262
|
+
proc.wait()
|
263
|
+
|
246
264
|
try:
|
247
|
-
response = pickle.loads(
|
265
|
+
response = pickle.loads(data)
|
248
266
|
except ModuleNotFoundError as e:
|
249
267
|
raise RuntimeError(
|
250
268
|
f"Error loading tool {tool_id}:\nThe tool most likely has a parameter of a custom type that cannot be exported"
|
@@ -462,7 +480,7 @@ def run_remote_tool(
|
|
462
480
|
conn.close()
|
463
481
|
|
464
482
|
if not stream:
|
465
|
-
thread = threading.Thread(target=lambda:
|
483
|
+
thread = threading.Thread(target=lambda: handle_connection_sync())
|
466
484
|
thread.start()
|
467
485
|
|
468
486
|
runner = f"""
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|