hyperpocket 0.1.8__tar.gz → 0.1.10__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/.gitignore +1 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/PKG-INFO +27 -38
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/README.md +25 -36
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/config/settings.py +12 -8
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/pocket_core.py +4 -2
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/pocket_main.py +3 -1
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/repository/lock.py +52 -1
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/server/server.py +8 -8
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/tool/function/tool.py +31 -37
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/tool/tool.py +42 -33
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/tool/wasm/browser.py +2 -7
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/util/extract_func_param_desc_from_docstring.py +11 -8
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/util/json_schema_to_model.py +2 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/pyproject.toml +7 -3
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/tests/test_pocket.py +25 -16
- {hyperpocket-0.1.8/hyperpocket/tool/tests → hyperpocket-0.1.10/tests/tool}/test_function_tool.py +4 -4
- hyperpocket-0.1.10/tests/utils/test_extract_func_param_desc_from_docstring.py +214 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/uv.lock +80 -1
- hyperpocket-0.1.8/tests/tool/test_function_tool.py +0 -266
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/README.md +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/calendly/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/calendly/context.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/calendly/oauth2_context.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/calendly/oauth2_handler.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/calendly/oauth2_schema.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/context.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/github/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/github/context.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/github/oauth2_context.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/github/oauth2_handler.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/github/oauth2_schema.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/github/token_context.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/github/token_handler.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/github/token_schema.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/google/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/google/context.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/google/oauth2_context.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/google/oauth2_handler.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/google/oauth2_schema.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/gumloop/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/gumloop/context.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/gumloop/token_context.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/gumloop/token_handler.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/gumloop/token_schema.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/handler.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/linear/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/linear/context.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/linear/token_context.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/linear/token_handler.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/linear/token_schema.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/notion/README.md +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/notion/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/notion/context.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/notion/token_context.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/notion/token_handler.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/notion/token_schema.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/provider.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/reddit/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/reddit/context.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/reddit/oauth2_context.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/reddit/oauth2_handler.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/reddit/oauth2_schema.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/schema.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/slack/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/slack/context.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/slack/oauth2_context.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/slack/oauth2_handler.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/slack/oauth2_schema.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/slack/token_context.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/slack/token_handler.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/auth/slack/token_schema.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/builtin.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/cli/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/cli/__main__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/cli/auth.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/cli/codegen/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/cli/codegen/auth/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/cli/codegen/auth/auth_context_template.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/cli/codegen/auth/auth_token_context_template.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/cli/codegen/auth/auth_token_handler_template.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/cli/codegen/auth/auth_token_schema_template.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/cli/codegen/auth/server_auth_template.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/cli/eject.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/cli/pull.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/cli/sync.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/config/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/config/auth.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/config/git.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/config/logger.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/config/session.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/constants.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/futures/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/futures/futurestore.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/pocket_auth.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/prompts.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/repository/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/repository/lockfile.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/repository/repository.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/server/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/server/auth/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/server/auth/calendly.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/server/auth/github.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/server/auth/google.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/server/auth/gumloop.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/server/auth/linear.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/server/auth/notion.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/server/auth/reddit.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/server/auth/slack.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/server/auth/token.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/server/proxy.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/server/tool/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/server/tool/dto/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/server/tool/dto/script.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/server/tool/wasm.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/session/README.md +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/session/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/session/in_memory.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/session/interface.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/session/redis.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/tool/README.md +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/tool/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/tool/function/README.md +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/tool/function/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/tool/function/annotation.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/tool/tests/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/tool/wasm/README.md +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/tool/wasm/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/tool/wasm/invoker.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/tool/wasm/script.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/tool/wasm/templates/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/tool/wasm/templates/node.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/tool/wasm/templates/python.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/tool/wasm/tool.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/tool_like.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/util/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/util/find_all_leaf_class_in_package.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/util/find_all_subclass_in_package.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/util/flatten_json_schema.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/util/function_to_model.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/hyperpocket/util/get_objects_from_subpackage.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/tests/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/tests/auth/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/tests/auth/test_google_oauth2_handler.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/tests/auth/test_gumloop_token_handler.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/tests/auth/test_notion_token_handler.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/tests/auth/test_slack_oauth2_handler.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/tests/auth/test_slack_token_handler.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/tests/session/__init__.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/tests/session/test_in_memory.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/tests/session/test_redis.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/tests/test_pocket_auth.py +0 -0
- {hyperpocket-0.1.8 → hyperpocket-0.1.10}/tests/tool/__init__.py +0 -0
- {hyperpocket-0.1.8/hyperpocket/tool/tests → hyperpocket-0.1.10/tests/tool}/test_wasm_tool.py +0 -0
@@ -1,10 +1,10 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: hyperpocket
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.10
|
4
4
|
Summary: Building AI agent with hyperpocket tool in a flash
|
5
5
|
Project-URL: Homepage, https://vessl-ai.github.io/hyperpocket
|
6
6
|
Project-URL: Repository, https://github.com/vessl-ai/hyperpocket
|
7
|
-
Author-email:
|
7
|
+
Author-email: Hyperpocket Team <hyperpocket@vessl.ai>
|
8
8
|
Requires-Python: >=3.10
|
9
9
|
Requires-Dist: click>=8.1.7
|
10
10
|
Requires-Dist: dynaconf>=3.2.6
|
@@ -23,20 +23,19 @@ Requires-Dist: toml>=0.10.2
|
|
23
23
|
Requires-Dist: uvicorn>=0.32.1
|
24
24
|
Description-Content-Type: text/markdown
|
25
25
|
|
26
|
-
#
|
26
|
+
# Hyperpocket 👛
|
27
27
|
|
28
|
-
|
28
|
+
Hyperpocket is where tools belong. Power your agent up with a pocket of tools. 👛
|
29
29
|
|
30
30
|
<figure>
|
31
|
-
<img src="
|
32
|
-
<figcaption>© Doraemon</figcaption>
|
31
|
+
<img src="../../logo.png" alt="hyperpocket" width="200"/>
|
33
32
|
</figure>
|
34
33
|
|
35
34
|
## Introduction
|
36
35
|
|
37
|
-
|
36
|
+
Hyperpocket is a tool that allows you to easily use tool and auth for agents on your machine.
|
38
37
|
|
39
|
-
**_Start fast._** Just install
|
38
|
+
**_Start fast._** Just install Hyperpocket and use it. We know you don't have time to authenticate to our server.
|
40
39
|
|
41
40
|
**_Go securely._** Not like others, you are the only one who knows your secret tokens. We do NOT. All of your secret
|
42
41
|
tokens belong to your infrastructure, not ours.
|
@@ -47,11 +46,6 @@ with the dependency spaghetti.
|
|
47
46
|
|
48
47
|
**_Battery Included_** You can use popular tools and authentication providers out-of-the-box.
|
49
48
|
|
50
|
-
<figure>
|
51
|
-
<img src="pocket1.png" alt="pocket-flow" width="400"/>
|
52
|
-
<figcaption></figcaption>
|
53
|
-
</figure>
|
54
|
-
|
55
49
|
## Installation
|
56
50
|
|
57
51
|
1. install hyperpocket
|
@@ -82,16 +76,16 @@ Or just use LLM API Clients out of the box.
|
|
82
76
|
### Using out-of-the-box tools
|
83
77
|
|
84
78
|
```python
|
85
|
-
|
79
|
+
|
86
80
|
from langchain_openai import ChatOpenAI
|
87
81
|
|
88
82
|
from hyperpocket_langchain import PocketLangchain
|
89
83
|
|
90
84
|
pklc = PocketLangchain(
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
85
|
+
tools=[
|
86
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/get-message",
|
87
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/post-message",
|
88
|
+
]
|
95
89
|
)
|
96
90
|
tools = pklc.get_tools()
|
97
91
|
|
@@ -104,7 +98,7 @@ llm_tool_binding.invoke(...)
|
|
104
98
|
|
105
99
|
There are two kinds of auth process, one is using system auth(developer api key) and the other is using end user auth.
|
106
100
|
|
107
|
-
|
101
|
+
Hyperpocket provides way to use end user auth easily.
|
108
102
|
(Of course, you can also just set your STRIPE_API_KEY when using Stripe API related tools)
|
109
103
|
|
110
104
|
- Supported methods
|
@@ -130,7 +124,7 @@ Pocket provides way to use end user auth easily.
|
|
130
124
|
You can manage your auths in request-wise level. (e.g. you can use different auths for different requests)
|
131
125
|
|
132
126
|
```python
|
133
|
-
|
127
|
+
|
134
128
|
from langchain_openai import ChatOpenAI
|
135
129
|
from langgraph.graph import StateGraph, START, MessagesState
|
136
130
|
from langgraph.prebuilt import tools_condition
|
@@ -138,10 +132,10 @@ from langgraph.prebuilt import tools_condition
|
|
138
132
|
from hyperpocket_langgraph import PocketLanggraph
|
139
133
|
|
140
134
|
pklg = PocketLanggraph(
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
135
|
+
tools=[
|
136
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/get-message",
|
137
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/post-message",
|
138
|
+
],
|
145
139
|
)
|
146
140
|
llm = ChatOpenAI()
|
147
141
|
|
@@ -166,22 +160,21 @@ graph_builder.compile()
|
|
166
160
|
```
|
167
161
|
|
168
162
|
```python
|
169
|
-
from hyperpocket.config import secret
|
170
|
-
from hyperpocket.tool import from_git
|
171
163
|
from llama_index.core.agent import FunctionCallingAgent
|
172
164
|
from llama_index.llms.openai import OpenAI
|
173
165
|
|
166
|
+
from hyperpocket.config import secret
|
174
167
|
from hyperpocket_llamaindex import PocketLlamaindex
|
175
168
|
|
176
169
|
llm = OpenAI(api_key=secret["OPENAI_API_KEY"])
|
177
170
|
pocket = PocketLlamaindex(
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
171
|
+
tools=[
|
172
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/get-message",
|
173
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/post-message",
|
174
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/linear/get-issues",
|
175
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/google/get-calendar-events",
|
176
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/google/get-calendar-list",
|
177
|
+
]
|
185
178
|
)
|
186
179
|
tools = pocket.get_tools()
|
187
180
|
|
@@ -218,12 +211,8 @@ Assistance: Here are the recent 10 messages.
|
|
218
211
|
|
219
212
|
### Config
|
220
213
|
|
221
|
-
Running `pocket config init` will create your config file in `$HOME/.pocket/settings.toml`
|
222
|
-
|
223
214
|
The `settings.toml` looks as follows.
|
224
215
|
|
225
|
-
TODO: Add `secrets.toml`.
|
226
|
-
|
227
216
|
```toml
|
228
217
|
log_level = "debug"
|
229
218
|
internal_server_port = "8000" # optional, default is 8000
|
@@ -265,7 +254,7 @@ client_secret = "" # your github client secret
|
|
265
254
|
- While creating your github OAuth app, configuring your app's `Authorization callback URL` is different for your
|
266
255
|
development environment and production environment.
|
267
256
|
- For development environment, you can use `http://localhost:8000/auth/github/callback`
|
268
|
-
- **Note**: Default port for
|
257
|
+
- **Note**: Default port for hyperpocket dev server is `8000`. If you are using a different port, make sure to
|
269
258
|
replace `8000` with your actual port number.
|
270
259
|
- For production environment, you can use `https://yourdomain.com/auth/github/callback`
|
271
260
|
- **Note**: Make sure to replace `yourdomain.com` with your actual domain name that this app will be hosted on.
|
@@ -1,17 +1,16 @@
|
|
1
|
-
#
|
1
|
+
# Hyperpocket 👛
|
2
2
|
|
3
|
-
|
3
|
+
Hyperpocket is where tools belong. Power your agent up with a pocket of tools. 👛
|
4
4
|
|
5
5
|
<figure>
|
6
|
-
<img src="
|
7
|
-
<figcaption>© Doraemon</figcaption>
|
6
|
+
<img src="../../logo.png" alt="hyperpocket" width="200"/>
|
8
7
|
</figure>
|
9
8
|
|
10
9
|
## Introduction
|
11
10
|
|
12
|
-
|
11
|
+
Hyperpocket is a tool that allows you to easily use tool and auth for agents on your machine.
|
13
12
|
|
14
|
-
**_Start fast._** Just install
|
13
|
+
**_Start fast._** Just install Hyperpocket and use it. We know you don't have time to authenticate to our server.
|
15
14
|
|
16
15
|
**_Go securely._** Not like others, you are the only one who knows your secret tokens. We do NOT. All of your secret
|
17
16
|
tokens belong to your infrastructure, not ours.
|
@@ -22,11 +21,6 @@ with the dependency spaghetti.
|
|
22
21
|
|
23
22
|
**_Battery Included_** You can use popular tools and authentication providers out-of-the-box.
|
24
23
|
|
25
|
-
<figure>
|
26
|
-
<img src="pocket1.png" alt="pocket-flow" width="400"/>
|
27
|
-
<figcaption></figcaption>
|
28
|
-
</figure>
|
29
|
-
|
30
24
|
## Installation
|
31
25
|
|
32
26
|
1. install hyperpocket
|
@@ -57,16 +51,16 @@ Or just use LLM API Clients out of the box.
|
|
57
51
|
### Using out-of-the-box tools
|
58
52
|
|
59
53
|
```python
|
60
|
-
|
54
|
+
|
61
55
|
from langchain_openai import ChatOpenAI
|
62
56
|
|
63
57
|
from hyperpocket_langchain import PocketLangchain
|
64
58
|
|
65
59
|
pklc = PocketLangchain(
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
60
|
+
tools=[
|
61
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/get-message",
|
62
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/post-message",
|
63
|
+
]
|
70
64
|
)
|
71
65
|
tools = pklc.get_tools()
|
72
66
|
|
@@ -79,7 +73,7 @@ llm_tool_binding.invoke(...)
|
|
79
73
|
|
80
74
|
There are two kinds of auth process, one is using system auth(developer api key) and the other is using end user auth.
|
81
75
|
|
82
|
-
|
76
|
+
Hyperpocket provides way to use end user auth easily.
|
83
77
|
(Of course, you can also just set your STRIPE_API_KEY when using Stripe API related tools)
|
84
78
|
|
85
79
|
- Supported methods
|
@@ -105,7 +99,7 @@ Pocket provides way to use end user auth easily.
|
|
105
99
|
You can manage your auths in request-wise level. (e.g. you can use different auths for different requests)
|
106
100
|
|
107
101
|
```python
|
108
|
-
|
102
|
+
|
109
103
|
from langchain_openai import ChatOpenAI
|
110
104
|
from langgraph.graph import StateGraph, START, MessagesState
|
111
105
|
from langgraph.prebuilt import tools_condition
|
@@ -113,10 +107,10 @@ from langgraph.prebuilt import tools_condition
|
|
113
107
|
from hyperpocket_langgraph import PocketLanggraph
|
114
108
|
|
115
109
|
pklg = PocketLanggraph(
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
110
|
+
tools=[
|
111
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/get-message",
|
112
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/post-message",
|
113
|
+
],
|
120
114
|
)
|
121
115
|
llm = ChatOpenAI()
|
122
116
|
|
@@ -141,22 +135,21 @@ graph_builder.compile()
|
|
141
135
|
```
|
142
136
|
|
143
137
|
```python
|
144
|
-
from hyperpocket.config import secret
|
145
|
-
from hyperpocket.tool import from_git
|
146
138
|
from llama_index.core.agent import FunctionCallingAgent
|
147
139
|
from llama_index.llms.openai import OpenAI
|
148
140
|
|
141
|
+
from hyperpocket.config import secret
|
149
142
|
from hyperpocket_llamaindex import PocketLlamaindex
|
150
143
|
|
151
144
|
llm = OpenAI(api_key=secret["OPENAI_API_KEY"])
|
152
145
|
pocket = PocketLlamaindex(
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
146
|
+
tools=[
|
147
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/get-message",
|
148
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/post-message",
|
149
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/linear/get-issues",
|
150
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/google/get-calendar-events",
|
151
|
+
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/google/get-calendar-list",
|
152
|
+
]
|
160
153
|
)
|
161
154
|
tools = pocket.get_tools()
|
162
155
|
|
@@ -193,12 +186,8 @@ Assistance: Here are the recent 10 messages.
|
|
193
186
|
|
194
187
|
### Config
|
195
188
|
|
196
|
-
Running `pocket config init` will create your config file in `$HOME/.pocket/settings.toml`
|
197
|
-
|
198
189
|
The `settings.toml` looks as follows.
|
199
190
|
|
200
|
-
TODO: Add `secrets.toml`.
|
201
|
-
|
202
191
|
```toml
|
203
192
|
log_level = "debug"
|
204
193
|
internal_server_port = "8000" # optional, default is 8000
|
@@ -240,7 +229,7 @@ client_secret = "" # your github client secret
|
|
240
229
|
- While creating your github OAuth app, configuring your app's `Authorization callback URL` is different for your
|
241
230
|
development environment and production environment.
|
242
231
|
- For development environment, you can use `http://localhost:8000/auth/github/callback`
|
243
|
-
- **Note**: Default port for
|
232
|
+
- **Note**: Default port for hyperpocket dev server is `8000`. If you are using a different port, make sure to
|
244
233
|
replace `8000` with your actual port number.
|
245
234
|
- For production environment, you can use `https://yourdomain.com/auth/github/callback`
|
246
235
|
- **Note**: Make sure to replace `yourdomain.com` with your actual domain name that this app will be hosted on.
|
@@ -7,18 +7,22 @@ from pydantic import BaseModel, Field
|
|
7
7
|
from hyperpocket.config.auth import AuthConfig, DefaultAuthConfig
|
8
8
|
from hyperpocket.config.session import DefaultSessionConfig, SessionConfig
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
POCKET_ROOT = Path.home() / ".pocket"
|
11
|
+
SETTING_ROOT = Path.cwd()
|
12
|
+
|
13
|
+
|
14
|
+
settings_path = SETTING_ROOT / "settings.toml"
|
14
15
|
if not settings_path.exists():
|
15
16
|
with open(settings_path, "w"):
|
16
17
|
pass
|
17
|
-
|
18
|
+
|
19
|
+
secret_path = SETTING_ROOT / ".secrets.toml"
|
18
20
|
if not secret_path.exists():
|
19
21
|
with open(secret_path, "w"):
|
20
22
|
pass
|
21
|
-
|
23
|
+
|
24
|
+
|
25
|
+
toolpkg_path = POCKET_ROOT / "toolpkg"
|
22
26
|
if not toolpkg_path.exists():
|
23
27
|
os.makedirs(toolpkg_path)
|
24
28
|
|
@@ -50,9 +54,9 @@ class Config(BaseModel):
|
|
50
54
|
|
51
55
|
@property
|
52
56
|
def public_base_url(self):
|
53
|
-
if self.public_server_protocol ==
|
57
|
+
if self.public_server_protocol == "https" and self.public_server_port == 443:
|
54
58
|
return f"{self.public_server_protocol}://{self.public_hostname}"
|
55
|
-
elif self.public_server_protocol ==
|
59
|
+
elif self.public_server_protocol == "http" and self.public_server_port == 80:
|
56
60
|
return f"{self.public_server_protocol}://{self.public_hostname}"
|
57
61
|
return f"{self.public_server_protocol}://{self.public_hostname}:{self.public_server_port}"
|
58
62
|
|
@@ -38,8 +38,10 @@ class PocketCore:
|
|
38
38
|
lock = LocalLock(tool_like)
|
39
39
|
req = WasmToolRequest(lock, "")
|
40
40
|
else:
|
41
|
-
|
42
|
-
|
41
|
+
base_repo_url, git_ref, rel_path = GitLock.parse_repo_url(repo_url=tool_like)
|
42
|
+
lock = GitLock(repository_url=base_repo_url, git_ref=git_ref)
|
43
|
+
req = WasmToolRequest(lock=lock, rel_path=rel_path, tool_vars={})
|
44
|
+
|
43
45
|
lockfile.add_lock(lock)
|
44
46
|
tool_likes.append(req)
|
45
47
|
elif isinstance(tool_like, WasmToolRequest):
|
@@ -16,7 +16,9 @@ class Pocket(object):
|
|
16
16
|
tools: list[ToolLike],
|
17
17
|
auth: PocketAuth = None,
|
18
18
|
lockfile_path: Optional[str] = None,
|
19
|
-
force_update: bool = False
|
19
|
+
force_update: bool = False,
|
20
|
+
use_profile: bool = False):
|
21
|
+
self.use_profile = use_profile
|
20
22
|
|
21
23
|
self.core = PocketCore(
|
22
24
|
tools=tools,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import abc
|
2
2
|
import pathlib
|
3
3
|
import shutil
|
4
|
-
from typing import Optional
|
4
|
+
from typing import Optional, Tuple
|
5
5
|
|
6
6
|
import git
|
7
7
|
from pydantic import BaseModel, Field
|
@@ -159,6 +159,57 @@ class GitLock(Lock):
|
|
159
159
|
break
|
160
160
|
return new_sha
|
161
161
|
|
162
|
+
@classmethod
|
163
|
+
def get_git_branches(cls, repo_url):
|
164
|
+
ls_lists = git.cmd.Git().ls_remote(repo_url)
|
165
|
+
|
166
|
+
branches = {}
|
167
|
+
for line in ls_lists.split("\n"):
|
168
|
+
sha, ref = line.split("\t")
|
169
|
+
if ref.startswith("refs/heads/"):
|
170
|
+
branch_name = ref.replace("refs/heads/", "")
|
171
|
+
branches[branch_name] = sha
|
172
|
+
|
173
|
+
return branches
|
174
|
+
|
175
|
+
@classmethod
|
176
|
+
def parse_repo_url(cls, repo_url: str) -> Tuple[str, str, str]:
|
177
|
+
"""
|
178
|
+
Parses a GitHub repository URL with optional branch and path information.
|
179
|
+
|
180
|
+
Returns:
|
181
|
+
Tuple[str, str, str]: base_repo, branch_name, directory_path
|
182
|
+
"""
|
183
|
+
if not repo_url.startswith("https://github.com/"):
|
184
|
+
raise AttributeError("Only GitHub URLs are supported")
|
185
|
+
|
186
|
+
# Remove the base URL and split the path
|
187
|
+
repo_path = repo_url.removeprefix("https://github.com/")
|
188
|
+
repo_path_list = repo_path.split("/")
|
189
|
+
|
190
|
+
# Check if the URL contains 'tree' (indicating branch and sub-path information)
|
191
|
+
if "tree" not in repo_path_list:
|
192
|
+
# If no 'tree', return the full repository URL
|
193
|
+
return repo_url, "HEAD", ""
|
194
|
+
|
195
|
+
# Parse base repo URL and remaining path
|
196
|
+
tree_index = repo_path_list.index("tree")
|
197
|
+
base_repo = f"https://github.com/{'/'.join(repo_path_list[:tree_index])}"
|
198
|
+
sub_path = repo_path_list[tree_index + 1:]
|
199
|
+
|
200
|
+
# Fetch branch information
|
201
|
+
branches = cls.get_git_branches(base_repo)
|
202
|
+
|
203
|
+
# Find branch and sub-directory path
|
204
|
+
for idx in range(1, len(sub_path) + 1):
|
205
|
+
branch_name = "/".join(sub_path[:idx])
|
206
|
+
if branch_name in branches:
|
207
|
+
directory_path = "/".join(sub_path[idx:]) if idx < len(sub_path) else None
|
208
|
+
return base_repo, branch_name, directory_path
|
209
|
+
|
210
|
+
# If no valid branch is found, raise an error
|
211
|
+
raise ValueError("Branch not found in repository")
|
212
|
+
|
162
213
|
def eject_to_path(self, dest_path: pathlib.Path, src_sub_path: str = None):
|
163
214
|
|
164
215
|
# clone the git repository to the target path
|
@@ -136,11 +136,11 @@ class PocketServer(object):
|
|
136
136
|
while True:
|
137
137
|
if conn.poll():
|
138
138
|
op, uid, result, error = conn.recv()
|
139
|
-
if error:
|
140
|
-
raise error
|
141
|
-
|
142
139
|
future = self.future_store[uid]
|
143
|
-
|
140
|
+
if error:
|
141
|
+
future.set_exception(error)
|
142
|
+
else:
|
143
|
+
future.set_result(result)
|
144
144
|
break
|
145
145
|
else:
|
146
146
|
await asyncio.sleep(0)
|
@@ -158,7 +158,7 @@ class PocketServer(object):
|
|
158
158
|
self._set_mp_start_method()
|
159
159
|
|
160
160
|
self.pipe = mp.Pipe()
|
161
|
-
self.process = mp.Process(target=self._run, args=(pocket_core,)
|
161
|
+
self.process = mp.Process(target=self._run, args=(pocket_core,))
|
162
162
|
self.process.start()
|
163
163
|
|
164
164
|
def _run(self, pocket_core):
|
@@ -185,9 +185,9 @@ class PocketServer(object):
|
|
185
185
|
from hyperpocket.server.proxy import _generate_ssl_certificates
|
186
186
|
from hyperpocket.server.proxy import https_proxy_app
|
187
187
|
|
188
|
-
from hyperpocket.config.settings import
|
189
|
-
ssl_keypath =
|
190
|
-
ssl_certpath =
|
188
|
+
from hyperpocket.config.settings import POCKET_ROOT
|
189
|
+
ssl_keypath = POCKET_ROOT / "callback_server.key"
|
190
|
+
ssl_certpath = POCKET_ROOT / "callback_server.crt"
|
191
191
|
|
192
192
|
if not ssl_keypath.exists() or not ssl_certpath.exists():
|
193
193
|
_generate_ssl_certificates(ssl_keypath, ssl_certpath)
|
@@ -1,11 +1,9 @@
|
|
1
1
|
import asyncio
|
2
2
|
import copy
|
3
3
|
import inspect
|
4
|
-
import pathlib
|
5
4
|
from typing import Any, Coroutine
|
6
5
|
from typing import Callable, Optional
|
7
6
|
|
8
|
-
import toml
|
9
7
|
from pydantic import BaseModel
|
10
8
|
|
11
9
|
from hyperpocket.tool.tool import Tool, ToolAuth
|
@@ -47,32 +45,37 @@ class FunctionTool(Tool):
|
|
47
45
|
_kwargs = copy.deepcopy(kwargs)
|
48
46
|
|
49
47
|
# make body args to model
|
50
|
-
schema_model = self.schema_model()
|
51
|
-
model = schema_model(
|
48
|
+
schema_model = self.schema_model(use_profile=False)
|
49
|
+
model = schema_model(**_kwargs["body"])
|
52
50
|
_kwargs.pop("body")
|
53
51
|
|
54
52
|
# body model to dict
|
55
|
-
args = self.model_to_kwargs(model
|
53
|
+
args = self.model_to_kwargs(model)
|
56
54
|
|
57
55
|
# binding args
|
58
56
|
binding_args = {}
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
57
|
+
if self.func.__dict__.get("__model__") is not None:
|
58
|
+
# when a function signature is not inferrable from the function itself
|
59
|
+
binding_args = args.copy()
|
60
|
+
binding_args |= _kwargs.get("envs", {}) | self.tool_vars
|
61
|
+
else:
|
62
|
+
sig = inspect.signature(self.func)
|
63
|
+
for param_name, param in sig.parameters.items():
|
64
|
+
if param_name not in args:
|
65
|
+
continue
|
63
66
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
67
|
+
if param.kind == param.VAR_KEYWORD:
|
68
|
+
# var keyword args should be passed by plain dict
|
69
|
+
binding_args |= args[param_name]
|
70
|
+
binding_args |= _kwargs.get("envs", {}) | self.tool_vars
|
68
71
|
|
69
|
-
|
70
|
-
|
72
|
+
if "envs" in _kwargs:
|
73
|
+
_kwargs.pop("envs")
|
71
74
|
|
72
|
-
|
73
|
-
|
75
|
+
binding_args |= _kwargs # add other kwargs
|
76
|
+
continue
|
74
77
|
|
75
|
-
|
78
|
+
binding_args[param_name] = args[param_name]
|
76
79
|
|
77
80
|
return binding_args
|
78
81
|
|
@@ -113,7 +116,7 @@ class FunctionTool(Tool):
|
|
113
116
|
func=func,
|
114
117
|
afunc=afunc,
|
115
118
|
name=func.__name__,
|
116
|
-
description=
|
119
|
+
description=func.__doc__ if func.__doc__ is not None else "",
|
117
120
|
argument_json_schema=argument_json_schema,
|
118
121
|
auth=auth,
|
119
122
|
default_tool_vars=tool_vars
|
@@ -123,10 +126,16 @@ class FunctionTool(Tool):
|
|
123
126
|
def from_dock(
|
124
127
|
cls,
|
125
128
|
dock: list[Callable[..., str]],
|
129
|
+
tool_vars: Optional[dict[str, str]] = None,
|
126
130
|
) -> list["FunctionTool"]:
|
131
|
+
if tool_vars is None:
|
132
|
+
tool_vars = dict()
|
127
133
|
tools = []
|
128
134
|
for func in dock:
|
129
|
-
|
135
|
+
if (_model := func.__dict__.get("__model__")) is not None:
|
136
|
+
model = _model
|
137
|
+
else:
|
138
|
+
model = function_to_model(func)
|
130
139
|
argument_json_schema = flatten_json_schema(model.model_json_schema())
|
131
140
|
if not callable(func):
|
132
141
|
raise ValueError(f"Dock element should be a list of functions, but found {func}")
|
@@ -142,6 +151,7 @@ class FunctionTool(Tool):
|
|
142
151
|
description=func.__doc__,
|
143
152
|
argument_json_schema=argument_json_schema,
|
144
153
|
auth=auth,
|
154
|
+
default_tool_vars=(tool_vars | func.__dict__.get("__vars__", {})),
|
145
155
|
))
|
146
156
|
else:
|
147
157
|
tools.append(cls(
|
@@ -151,22 +161,6 @@ class FunctionTool(Tool):
|
|
151
161
|
description=func.__doc__,
|
152
162
|
argument_json_schema=argument_json_schema,
|
153
163
|
auth=auth,
|
164
|
+
default_tool_vars=(tool_vars | func.__dict__.get("__vars__", {})),
|
154
165
|
))
|
155
166
|
return tools
|
156
|
-
|
157
|
-
@classmethod
|
158
|
-
def _get_tool_vars_from_config(cls, func: Callable) -> dict:
|
159
|
-
print(func.__name__)
|
160
|
-
tool_path = inspect.getfile(func)
|
161
|
-
print(tool_path)
|
162
|
-
tool_parent = "/".join(tool_path.split("/")[:-1])
|
163
|
-
tool_config_path = pathlib.Path(tool_parent) / "config.toml"
|
164
|
-
with tool_config_path.open("r") as f:
|
165
|
-
tool_config = toml.load(f)
|
166
|
-
tool_vars = tool_config.get("tool_var")
|
167
|
-
if not tool_vars:
|
168
|
-
return
|
169
|
-
tool_vars_dict = {}
|
170
|
-
for key, value in tool_vars.items():
|
171
|
-
tool_vars_dict[key] = value
|
172
|
-
return tool_vars_dict
|