hyperpocket-llamaindex 0.1.10__py3-none-any.whl → 0.2.0__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.
- hyperpocket_llamaindex/pocket_llamaindex.py +19 -11
- {hyperpocket_llamaindex-0.1.10.dist-info → hyperpocket_llamaindex-0.2.0.dist-info}/METADATA +1 -1
- hyperpocket_llamaindex-0.2.0.dist-info/RECORD +5 -0
- hyperpocket_llamaindex-0.1.10.dist-info/RECORD +0 -5
- {hyperpocket_llamaindex-0.1.10.dist-info → hyperpocket_llamaindex-0.2.0.dist-info}/WHEEL +0 -0
@@ -3,11 +3,9 @@ from typing import List, Optional
|
|
3
3
|
from pydantic import BaseModel
|
4
4
|
|
5
5
|
try:
|
6
|
-
from llama_index.core.tools import
|
6
|
+
from llama_index.core.tools import BaseTool, FunctionTool, ToolMetadata
|
7
7
|
except ImportError:
|
8
|
-
raise ImportError(
|
9
|
-
"You need to install llama-index to use pocket llamaindex"
|
10
|
-
)
|
8
|
+
raise ImportError("You need to install llama-index to use pocket llamaindex")
|
11
9
|
|
12
10
|
from hyperpocket import Pocket
|
13
11
|
from hyperpocket.tool import Tool
|
@@ -35,11 +33,16 @@ class PocketLlamaindex(Pocket):
|
|
35
33
|
if isinstance(body, BaseModel):
|
36
34
|
body = body.model_dump()
|
37
35
|
|
38
|
-
result, interrupted = self.invoke_with_state(
|
39
|
-
|
36
|
+
result, interrupted = self.invoke_with_state(
|
37
|
+
pocket_tool.name,
|
38
|
+
body=body,
|
39
|
+
thread_id=thread_id,
|
40
|
+
profile=profile,
|
41
|
+
**kwargs,
|
42
|
+
)
|
40
43
|
say = result
|
41
44
|
if interrupted:
|
42
|
-
say = f
|
45
|
+
say = f"{say}\n\nThe tool execution interrupted. Please talk to me to resume."
|
43
46
|
return say
|
44
47
|
|
45
48
|
async def _ainvoke(**kwargs) -> str:
|
@@ -55,11 +58,16 @@ class PocketLlamaindex(Pocket):
|
|
55
58
|
if isinstance(body, BaseModel):
|
56
59
|
body = body.model_dump()
|
57
60
|
|
58
|
-
result, interrupted = await self.ainvoke_with_state(
|
59
|
-
|
61
|
+
result, interrupted = await self.ainvoke_with_state(
|
62
|
+
pocket_tool.name,
|
63
|
+
body=body,
|
64
|
+
thread_id=thread_id,
|
65
|
+
profile=profile,
|
66
|
+
**kwargs,
|
67
|
+
)
|
60
68
|
say = result
|
61
69
|
if interrupted:
|
62
|
-
say = f
|
70
|
+
say = f"{say}\n\nThe tool execution interrupted. Please talk to me to resume."
|
63
71
|
return say
|
64
72
|
|
65
73
|
return FunctionTool.from_defaults(
|
@@ -69,5 +77,5 @@ class PocketLlamaindex(Pocket):
|
|
69
77
|
name=pocket_tool.name,
|
70
78
|
description=pocket_tool.get_description(use_profile=self.use_profile),
|
71
79
|
fn_schema=pocket_tool.schema_model(use_profile=self.use_profile),
|
72
|
-
)
|
80
|
+
),
|
73
81
|
)
|
@@ -0,0 +1,5 @@
|
|
1
|
+
hyperpocket_llamaindex/__init__.py,sha256=tZQ6ZnSlrc6zkUafpiYTbknXy7cac1fRLGJ6lBsGtvw,102
|
2
|
+
hyperpocket_llamaindex/pocket_llamaindex.py,sha256=Q5pw_0ZVQWh3U2bkJeEr73v5goWEx20mhtx7blkPq98,2724
|
3
|
+
hyperpocket_llamaindex-0.2.0.dist-info/METADATA,sha256=A2u5VjTdcIzLtXoGxWeQf4UIyYLYqs8NQ2rQsEYd9bI,1239
|
4
|
+
hyperpocket_llamaindex-0.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
5
|
+
hyperpocket_llamaindex-0.2.0.dist-info/RECORD,,
|
@@ -1,5 +0,0 @@
|
|
1
|
-
hyperpocket_llamaindex/__init__.py,sha256=tZQ6ZnSlrc6zkUafpiYTbknXy7cac1fRLGJ6lBsGtvw,102
|
2
|
-
hyperpocket_llamaindex/pocket_llamaindex.py,sha256=36O1S64e_4XgRb-WDx-lCTaaDqMvy4M_XCj4UdIUdtQ,2668
|
3
|
-
hyperpocket_llamaindex-0.1.10.dist-info/METADATA,sha256=nbT8oxhT1TYB57-J5hBKgTJhMNab04e3HD0Hxi3VN1k,1240
|
4
|
-
hyperpocket_llamaindex-0.1.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
5
|
-
hyperpocket_llamaindex-0.1.10.dist-info/RECORD,,
|
File without changes
|