hyperpocket 0.0.3__py3-none-any.whl → 0.1.9__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- hyperpocket/auth/README.md +3 -3
- hyperpocket/auth/__init__.py +0 -8
- hyperpocket/auth/gumloop/context.py +13 -0
- hyperpocket/auth/gumloop/token_context.py +15 -0
- hyperpocket/auth/gumloop/token_handler.py +66 -0
- hyperpocket/auth/gumloop/token_schema.py +8 -0
- hyperpocket/auth/linear/token_context.py +1 -1
- hyperpocket/auth/notion/README.md +28 -0
- hyperpocket/auth/notion/context.py +15 -0
- hyperpocket/auth/notion/token_context.py +14 -0
- hyperpocket/auth/notion/token_handler.py +65 -0
- hyperpocket/auth/notion/token_schema.py +10 -0
- hyperpocket/auth/provider.py +8 -5
- hyperpocket/auth/reddit/context.py +15 -0
- hyperpocket/auth/reddit/oauth2_context.py +32 -0
- hyperpocket/auth/reddit/oauth2_handler.py +151 -0
- hyperpocket/auth/reddit/oauth2_schema.py +18 -0
- hyperpocket/auth/slack/token_context.py +1 -1
- hyperpocket/builtin.py +63 -0
- hyperpocket/cli/__main__.py +12 -0
- hyperpocket/cli/auth.py +83 -0
- hyperpocket/cli/codegen/auth/__init__.py +13 -0
- hyperpocket/cli/codegen/auth/auth_context_template.py +16 -0
- hyperpocket/cli/codegen/auth/auth_token_context_template.py +16 -0
- hyperpocket/cli/codegen/auth/auth_token_handler_template.py +69 -0
- hyperpocket/cli/codegen/auth/auth_token_schema_template.py +12 -0
- hyperpocket/cli/codegen/auth/server_auth_template.py +18 -0
- hyperpocket/cli/eject.py +19 -0
- hyperpocket/cli/sync.py +5 -5
- hyperpocket/config/settings.py +14 -12
- hyperpocket/futures/futurestore.py +0 -1
- hyperpocket/pocket_auth.py +25 -5
- hyperpocket/pocket_core.py +264 -0
- hyperpocket/pocket_main.py +127 -174
- hyperpocket/prompts.py +6 -8
- hyperpocket/repository/__init__.py +2 -2
- hyperpocket/repository/lock.py +71 -1
- hyperpocket/repository/lockfile.py +19 -13
- hyperpocket/repository/repository.py +26 -1
- hyperpocket/server/auth/__init__.py +0 -6
- hyperpocket/server/auth/gumloop.py +16 -0
- hyperpocket/server/auth/notion.py +19 -0
- hyperpocket/server/auth/reddit.py +16 -0
- hyperpocket/server/server.py +56 -20
- hyperpocket/server/tool/dto/script.py +15 -2
- hyperpocket/server/tool/wasm.py +20 -8
- hyperpocket/session/README.md +2 -2
- hyperpocket/session/in_memory.py +18 -5
- hyperpocket/session/interface.py +14 -0
- hyperpocket/session/redis.py +29 -5
- hyperpocket/tool/README.md +16 -12
- hyperpocket/tool/__init__.py +4 -3
- hyperpocket/tool/function/README.md +39 -10
- hyperpocket/tool/function/__init__.py +2 -0
- hyperpocket/tool/function/annotation.py +2 -1
- hyperpocket/tool/function/tool.py +108 -29
- hyperpocket/tool/tool.py +100 -28
- hyperpocket/tool/wasm/README.md +27 -5
- hyperpocket/tool/wasm/browser.py +2 -7
- hyperpocket/tool/wasm/script.py +40 -1
- hyperpocket/tool/wasm/templates/python.py +32 -14
- hyperpocket/tool/wasm/tool.py +21 -18
- hyperpocket/tool_like.py +5 -0
- hyperpocket/util/__init__.py +1 -1
- hyperpocket/util/extract_func_param_desc_from_docstring.py +4 -4
- hyperpocket/util/function_to_model.py +5 -2
- hyperpocket/util/json_schema_to_model.py +47 -26
- {hyperpocket-0.0.3.dist-info → hyperpocket-0.1.9.dist-info}/METADATA +107 -88
- hyperpocket-0.1.9.dist-info/RECORD +137 -0
- {hyperpocket-0.0.3.dist-info → hyperpocket-0.1.9.dist-info}/WHEEL +1 -1
- hyperpocket-0.1.9.dist-info/entry_points.txt +2 -0
- hyperpocket/auth/README.KR.md +0 -309
- hyperpocket/auth/slack/tests/test_oauth2_handler.py +0 -32
- hyperpocket/auth/slack/tests/test_token_handler.py +0 -23
- hyperpocket/auth/tests/test_google_oauth2_handler.py +0 -147
- hyperpocket/auth/tests/test_slack_oauth2_handler.py +0 -147
- hyperpocket/auth/tests/test_slack_token_handler.py +0 -66
- hyperpocket/external/__init__.py +0 -7
- hyperpocket/external/github_client.py +0 -19
- hyperpocket/session/README.KR.md +0 -62
- hyperpocket/session/tests/test_in_memory.py +0 -145
- hyperpocket/session/tests/test_redis.py +0 -151
- hyperpocket/tests/test_pocket.py +0 -116
- hyperpocket/tests/test_pocket_auth.py +0 -982
- hyperpocket/tool/README.KR.md +0 -68
- hyperpocket/tool/builtins/__init__.py +0 -0
- hyperpocket/tool/builtins/example/__init__.py +0 -0
- hyperpocket/tool/builtins/example/add_tool.py +0 -18
- hyperpocket/tool/function/README.KR.md +0 -159
- hyperpocket/tool/tests/test_function_tool.py +0 -266
- hyperpocket/tool/wasm/README.KR.md +0 -144
- hyperpocket-0.0.3.dist-info/RECORD +0 -130
- hyperpocket-0.0.3.dist-info/entry_points.txt +0 -3
- /hyperpocket/auth/{slack/tests → gumloop}/__init__.py +0 -0
- /hyperpocket/auth/{tests → notion}/__init__.py +0 -0
- /hyperpocket/{session/tests → auth/reddit}/__init__.py +0 -0
- /hyperpocket/{tests → cli/codegen}/__init__.py +0 -0
hyperpocket/tests/test_pocket.py
DELETED
@@ -1,116 +0,0 @@
|
|
1
|
-
from pathlib import Path
|
2
|
-
from unittest.async_case import IsolatedAsyncioTestCase
|
3
|
-
|
4
|
-
from pydantic import BaseModel
|
5
|
-
|
6
|
-
from hyperpocket import Pocket
|
7
|
-
from hyperpocket.config import config
|
8
|
-
from hyperpocket.tool import from_local, from_git
|
9
|
-
|
10
|
-
|
11
|
-
class TestPocket(IsolatedAsyncioTestCase):
|
12
|
-
|
13
|
-
async def asyncSetUp(self):
|
14
|
-
self.profile = "test-profile"
|
15
|
-
self.thread_id = "test_thread_id"
|
16
|
-
|
17
|
-
config.public_server_port = "https"
|
18
|
-
config.public_hostname = "localhost"
|
19
|
-
config.public_server_port = 8001
|
20
|
-
config.internal_server_port = 8000
|
21
|
-
config.enable_local_callback_proxy = True
|
22
|
-
|
23
|
-
self.pocket = Pocket(
|
24
|
-
tools=[
|
25
|
-
from_git("https://github.com/vessl-ai/hyperawesometools", "main", "managed-tools/simple-echo-tool"),
|
26
|
-
self.add,
|
27
|
-
self.add_pydantic_args
|
28
|
-
],
|
29
|
-
)
|
30
|
-
|
31
|
-
async def test_function_tool(self):
|
32
|
-
# given
|
33
|
-
tool_name = "add"
|
34
|
-
|
35
|
-
# when
|
36
|
-
result = await self.pocket.ainvoke(
|
37
|
-
tool_name=tool_name,
|
38
|
-
body={
|
39
|
-
"a": 1,
|
40
|
-
"b": 3
|
41
|
-
},
|
42
|
-
thread_id=self.thread_id,
|
43
|
-
profile=self.profile,
|
44
|
-
)
|
45
|
-
|
46
|
-
# then
|
47
|
-
self.assertEqual(result, "4")
|
48
|
-
|
49
|
-
async def test_pydantic_arg_function_tool(self):
|
50
|
-
# given
|
51
|
-
tool_name = "add_pydantic_args"
|
52
|
-
|
53
|
-
# when
|
54
|
-
result = await self.pocket.ainvoke(
|
55
|
-
tool_name=tool_name,
|
56
|
-
body={
|
57
|
-
"a": {
|
58
|
-
"first": 1
|
59
|
-
},
|
60
|
-
"b": {
|
61
|
-
"second": 3
|
62
|
-
}
|
63
|
-
},
|
64
|
-
thread_id=self.thread_id,
|
65
|
-
profile=self.profile,
|
66
|
-
)
|
67
|
-
|
68
|
-
# then
|
69
|
-
self.assertEqual(result, "4")
|
70
|
-
|
71
|
-
async def test_wasm_tool(self):
|
72
|
-
# given
|
73
|
-
tool_name = "simple_echo_text"
|
74
|
-
|
75
|
-
# when
|
76
|
-
result = await self.pocket.ainvoke(
|
77
|
-
tool_name=tool_name,
|
78
|
-
body={
|
79
|
-
"text": "test"
|
80
|
-
},
|
81
|
-
thread_id=self.thread_id,
|
82
|
-
profile=self.profile,
|
83
|
-
)
|
84
|
-
|
85
|
-
# then
|
86
|
-
self.assertTrue(result.startswith("echo message : test"))
|
87
|
-
|
88
|
-
@staticmethod
|
89
|
-
def add(a: int, b: int) -> int:
|
90
|
-
"""
|
91
|
-
Add two numbers
|
92
|
-
|
93
|
-
Args:
|
94
|
-
a(int): first number
|
95
|
-
b(int): second number
|
96
|
-
|
97
|
-
"""
|
98
|
-
|
99
|
-
return a + b
|
100
|
-
|
101
|
-
class FirstNumber(BaseModel):
|
102
|
-
first: int
|
103
|
-
|
104
|
-
class SecondNumber(BaseModel):
|
105
|
-
second: int
|
106
|
-
|
107
|
-
@staticmethod
|
108
|
-
def add_pydantic_args(a: FirstNumber, b: SecondNumber):
|
109
|
-
"""
|
110
|
-
Add two numbers
|
111
|
-
|
112
|
-
Args:
|
113
|
-
a(FirstNumber): first number
|
114
|
-
b(SecondNumber): second number
|
115
|
-
"""
|
116
|
-
return a.first + b.second
|