hyperpocket-llamaindex 0.0.1__py3-none-any.whl → 0.1.9__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 +36 -7
- {hyperpocket_llamaindex-0.0.1.dist-info → hyperpocket_llamaindex-0.1.9.dist-info}/METADATA +7 -13
- hyperpocket_llamaindex-0.1.9.dist-info/RECORD +5 -0
- {hyperpocket_llamaindex-0.0.1.dist-info → hyperpocket_llamaindex-0.1.9.dist-info}/WHEEL +1 -1
- hyperpocket_llamaindex-0.0.1.dist-info/RECORD +0 -5
| @@ -1,4 +1,6 @@ | |
| 1 | 
            -
            from typing import List,  | 
| 1 | 
            +
            from typing import List, Optional
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            from pydantic import BaseModel
         | 
| 2 4 |  | 
| 3 5 | 
             
            try:
         | 
| 4 6 | 
             
                from llama_index.core.tools import FunctionTool, BaseTool, ToolMetadata
         | 
| @@ -12,12 +14,27 @@ from hyperpocket.tool import Tool | |
| 12 14 |  | 
| 13 15 |  | 
| 14 16 | 
             
            class PocketLlamaindex(Pocket):
         | 
| 15 | 
            -
                def get_tools(self) -> List[BaseTool]:
         | 
| 16 | 
            -
                     | 
| 17 | 
            +
                def get_tools(self, use_profile: Optional[bool] = None) -> List[BaseTool]:
         | 
| 18 | 
            +
                    if use_profile is not None:
         | 
| 19 | 
            +
                        self.use_profile = use_profile
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                    tools = [self.get_tool(pk) for pk in self.core.tools.values()]
         | 
| 17 22 | 
             
                    return tools
         | 
| 18 23 |  | 
| 19 24 | 
             
                def get_tool(self, pocket_tool: Tool) -> BaseTool:
         | 
| 20 | 
            -
                    def _invoke( | 
| 25 | 
            +
                    def _invoke(**kwargs) -> str:
         | 
| 26 | 
            +
                        if self.use_profile:
         | 
| 27 | 
            +
                            body = kwargs["body"]
         | 
| 28 | 
            +
                            thread_id = kwargs.pop("thread_id", "default")
         | 
| 29 | 
            +
                            profile = kwargs.pop("profile", "default")
         | 
| 30 | 
            +
                        else:
         | 
| 31 | 
            +
                            body = kwargs
         | 
| 32 | 
            +
                            thread_id = "default"
         | 
| 33 | 
            +
                            profile = "default"
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                        if isinstance(body, BaseModel):
         | 
| 36 | 
            +
                            body = body.model_dump()
         | 
| 37 | 
            +
             | 
| 21 38 | 
             
                        result, interrupted = self.invoke_with_state(pocket_tool.name, body=body, thread_id=thread_id,
         | 
| 22 39 | 
             
                                                                     profile=profile, **kwargs)
         | 
| 23 40 | 
             
                        say = result
         | 
| @@ -25,7 +42,19 @@ class PocketLlamaindex(Pocket): | |
| 25 42 | 
             
                            say = f'{say}\n\nThe tool execution interrupted. Please talk to me to resume.'
         | 
| 26 43 | 
             
                        return say
         | 
| 27 44 |  | 
| 28 | 
            -
                    async def _ainvoke( | 
| 45 | 
            +
                    async def _ainvoke(**kwargs) -> str:
         | 
| 46 | 
            +
                        if self.use_profile:
         | 
| 47 | 
            +
                            body = kwargs["body"]
         | 
| 48 | 
            +
                            thread_id = kwargs.pop("thread_id", "default")
         | 
| 49 | 
            +
                            profile = kwargs.pop("profile", "default")
         | 
| 50 | 
            +
                        else:
         | 
| 51 | 
            +
                            body = kwargs
         | 
| 52 | 
            +
                            thread_id = "default"
         | 
| 53 | 
            +
                            profile = "default"
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                        if isinstance(body, BaseModel):
         | 
| 56 | 
            +
                            body = body.model_dump()
         | 
| 57 | 
            +
             | 
| 29 58 | 
             
                        result, interrupted = await self.ainvoke_with_state(pocket_tool.name, body=body,
         | 
| 30 59 | 
             
                                                                            thread_id=thread_id, profile=profile, **kwargs)
         | 
| 31 60 | 
             
                        say = result
         | 
| @@ -37,8 +66,8 @@ class PocketLlamaindex(Pocket): | |
| 37 66 | 
             
                        fn=_invoke,
         | 
| 38 67 | 
             
                        async_fn=_ainvoke,
         | 
| 39 68 | 
             
                        tool_metadata=ToolMetadata(
         | 
| 40 | 
            -
                            description=pocket_tool.description,
         | 
| 41 69 | 
             
                            name=pocket_tool.name,
         | 
| 42 | 
            -
                             | 
| 70 | 
            +
                            description=pocket_tool.get_description(use_profile=self.use_profile),
         | 
| 71 | 
            +
                            fn_schema=pocket_tool.schema_model(use_profile=self.use_profile),
         | 
| 43 72 | 
             
                        )
         | 
| 44 73 | 
             
                    )
         | 
| @@ -1,16 +1,10 @@ | |
| 1 | 
            -
            Metadata-Version: 2. | 
| 1 | 
            +
            Metadata-Version: 2.4
         | 
| 2 2 | 
             
            Name: hyperpocket-llamaindex
         | 
| 3 | 
            -
            Version: 0. | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
            Requires- | 
| 8 | 
            -
            Classifier: Programming Language :: Python :: 3
         | 
| 9 | 
            -
            Classifier: Programming Language :: Python :: 3.11
         | 
| 10 | 
            -
            Classifier: Programming Language :: Python :: 3.12
         | 
| 11 | 
            -
            Classifier: Programming Language :: Python :: 3.13
         | 
| 12 | 
            -
            Requires-Dist: hyperpocket (==0.0.3)
         | 
| 13 | 
            -
            Requires-Dist: llama-index (>=0.12.5,<0.13.0)
         | 
| 3 | 
            +
            Version: 0.1.9
         | 
| 4 | 
            +
            Author-email: Hyperpocket Team <hyperpocket@vessl.ai>
         | 
| 5 | 
            +
            Requires-Python: >=3.10
         | 
| 6 | 
            +
            Requires-Dist: hyperpocket>=0.0.3
         | 
| 7 | 
            +
            Requires-Dist: llama-index>=0.12.5
         | 
| 14 8 | 
             
            Description-Content-Type: text/markdown
         | 
| 15 9 |  | 
| 16 10 | 
             
            ## Anthropic extensions
         | 
| @@ -56,4 +50,4 @@ llm = OpenAI() | |
| 56 50 | 
             
            agent = FunctionCallingAgent.from_tools(
         | 
| 57 51 | 
             
                tools=tools, llm=llm, verbose=True
         | 
| 58 52 | 
             
            )
         | 
| 59 | 
            -
            ```
         | 
| 53 | 
            +
            ```
         | 
| @@ -0,0 +1,5 @@ | |
| 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.9.dist-info/METADATA,sha256=qechw2kDiE_UDKVfdXsoNdlmQNkhz66kUBr8GyLe9-E,1239
         | 
| 4 | 
            +
            hyperpocket_llamaindex-0.1.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
         | 
| 5 | 
            +
            hyperpocket_llamaindex-0.1.9.dist-info/RECORD,,
         | 
| @@ -1,5 +0,0 @@ | |
| 1 | 
            -
            hyperpocket_llamaindex/__init__.py,sha256=tZQ6ZnSlrc6zkUafpiYTbknXy7cac1fRLGJ6lBsGtvw,102
         | 
| 2 | 
            -
            hyperpocket_llamaindex/pocket_llamaindex.py,sha256=AGKrJ8lO1wZPig0gEriQiBqlZ-Gk-r0N_cqZBDaWw1g,1774
         | 
| 3 | 
            -
            hyperpocket_llamaindex-0.0.1.dist-info/METADATA,sha256=ClC4ekflbRsMAk7OGulxqL-7r3tst0sjPxhuK7k_jk0,1457
         | 
| 4 | 
            -
            hyperpocket_llamaindex-0.0.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
         | 
| 5 | 
            -
            hyperpocket_llamaindex-0.0.1.dist-info/RECORD,,
         |