hyperpocket 0.1.9__py3-none-any.whl → 0.1.10__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.
@@ -38,7 +38,7 @@ class PocketCore:
38
38
  lock = LocalLock(tool_like)
39
39
  req = WasmToolRequest(lock, "")
40
40
  else:
41
- base_repo_url, git_ref, rel_path = GitLock.parsing_repo_url(repo_url=tool_like)
41
+ base_repo_url, git_ref, rel_path = GitLock.parse_repo_url(repo_url=tool_like)
42
42
  lock = GitLock(repository_url=base_repo_url, git_ref=git_ref)
43
43
  req = WasmToolRequest(lock=lock, rel_path=rel_path, tool_vars={})
44
44
 
@@ -23,14 +23,12 @@ def extract_param_docstring_mapping(func) -> dict[str, str]:
23
23
  if not docstring:
24
24
  return {}
25
25
 
26
- pocket_logger.debug(f"try to extract docstring of {func.__name__} by google style..")
27
26
  param_mapping = extract_param_desc_by_google_stype_docstring(docstring, func_params)
28
27
  if param_mapping:
29
28
  pocket_logger.debug(f"success extract docstring of {func.__name__} by google style!")
30
29
  return param_mapping
31
30
  pocket_logger.debug(f"not found param desc of {func.__name__} by google style..")
32
31
 
33
- pocket_logger.debug(f"try to extract docstring of {func.__name__} by other style..")
34
32
  param_mapping = extract_param_desc_by_other_styles(docstring, func_params)
35
33
  if param_mapping:
36
34
  pocket_logger.debug(f"success extract docstring of {func.__name__} by other style!")
@@ -38,7 +36,6 @@ def extract_param_docstring_mapping(func) -> dict[str, str]:
38
36
  pocket_logger.debug(f"not found param desc of {func.__name__} by other styles..")
39
37
 
40
38
  # Plain Text Style matching
41
- pocket_logger.debug(f"try to extract docstring of {func.__name__} by plain text style..")
42
39
  param_descriptions = []
43
40
  for line in docstring.split("\n"):
44
41
  split_line = line.strip().split(":")
@@ -46,7 +43,8 @@ def extract_param_docstring_mapping(func) -> dict[str, str]:
46
43
  continue
47
44
 
48
45
  param_name = split_line[0]
49
- cleaned_param_name = clean_bracket_content(param_name)
46
+ cleaned_param_name = clean_string(param_name)
47
+ cleaned_param_name = clean_bracket_content(cleaned_param_name)
50
48
  description = ":".join(split_line[1:]).strip()
51
49
  if cleaned_param_name in func_params:
52
50
  param_descriptions.append((cleaned_param_name, description))
@@ -58,6 +56,11 @@ def extract_param_docstring_mapping(func) -> dict[str, str]:
58
56
  return param_mapping
59
57
 
60
58
 
59
+ def clean_string(input_string):
60
+ cleaned = re.sub(r"^[^a-zA-Z_]*|[^a-zA-Z0-9_()\s]*$", "", input_string)
61
+ return cleaned.strip()
62
+
63
+
61
64
  def clean_bracket_content(content):
62
65
  return re.sub(r"[(\[{<].*?[)\]}>]", "", content)
63
66
 
@@ -65,9 +68,9 @@ def clean_bracket_content(content):
65
68
  def extract_param_desc_by_other_styles(docstring, func_params) -> dict[str, str]:
66
69
  param_descriptions = []
67
70
  # Pattern for Sphinx-style or Javadoc-style `:param`, `@param`, `:arg`, `@arg`
68
- param_pattern = r"(?:@param|:param|:arg|@arg)\s+(\w+)(?:\s*:\s*|\s+|:\s+)(.*)"
69
- matches = re.findall(param_pattern, docstring)
70
- for param, desc in matches:
71
+ param_pattern = r"^\s*(?:@param|:param|:arg|@arg):?\s+(\w+)(?:\((.*?)\))?:?\s*(.*)"
72
+ matches = re.findall(param_pattern, docstring, re.MULTILINE)
73
+ for param, _, desc in matches:
71
74
  cleaned_param = clean_bracket_content(param)
72
75
  param_descriptions.append((cleaned_param, desc.strip()))
73
76
  # Ensure no duplicates and match with function parameters
@@ -87,7 +90,7 @@ def extract_param_desc_by_google_stype_docstring(docstring, func_params) -> dict
87
90
  param_descriptions = {}
88
91
  for line in param_lines:
89
92
  # Match parameter line with "name (type): description"
90
- param_match = re.match(r"^\s*(\w+)\s*\(\s*(.*?)\s*\)\s*:\s*(.*)", line)
93
+ param_match = re.match(r"^[^a-zA-Z_]*([a-zA-Z_]\w*)\s*[\(\[]\s*(.*?)\s*[\)\]]\s*:\s*(.*)", line)
91
94
  if param_match:
92
95
  param, _, desc = param_match.groups()
93
96
  cleaned_param = clean_bracket_content(param)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperpocket
3
- Version: 0.1.9
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
@@ -76,16 +76,16 @@ Or just use LLM API Clients out of the box.
76
76
  ### Using out-of-the-box tools
77
77
 
78
78
  ```python
79
- from hyperpocket.tool import from_git
79
+
80
80
  from langchain_openai import ChatOpenAI
81
81
 
82
82
  from hyperpocket_langchain import PocketLangchain
83
83
 
84
84
  pklc = PocketLangchain(
85
- tools=[
86
- from_git("https://github.com/vessl-ai/hyperawesometools", "main", "managed-tools/slack/get-message"),
87
- from_git("https://github.com/vessl-ai/hyperawesometools", "main", "managed-tools/slack/post-message"),
88
- ]
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
+ ]
89
89
  )
90
90
  tools = pklc.get_tools()
91
91
 
@@ -124,7 +124,7 @@ Hyperpocket provides way to use end user auth easily.
124
124
  You can manage your auths in request-wise level. (e.g. you can use different auths for different requests)
125
125
 
126
126
  ```python
127
- from hyperpocket.tool import from_git
127
+
128
128
  from langchain_openai import ChatOpenAI
129
129
  from langgraph.graph import StateGraph, START, MessagesState
130
130
  from langgraph.prebuilt import tools_condition
@@ -132,10 +132,10 @@ from langgraph.prebuilt import tools_condition
132
132
  from hyperpocket_langgraph import PocketLanggraph
133
133
 
134
134
  pklg = PocketLanggraph(
135
- tools=[
136
- from_git("https://github.com/vessl-ai/hyperawesometools", "main", "managed-tools/slack/get-message"),
137
- from_git("https://github.com/vessl-ai/hyperawesometools", "main", "managed-tools/slack/post-message"),
138
- ],
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
+ ],
139
139
  )
140
140
  llm = ChatOpenAI()
141
141
 
@@ -160,22 +160,21 @@ graph_builder.compile()
160
160
  ```
161
161
 
162
162
  ```python
163
- from hyperpocket.config import secret
164
- from hyperpocket.tool import from_git
165
163
  from llama_index.core.agent import FunctionCallingAgent
166
164
  from llama_index.llms.openai import OpenAI
167
165
 
166
+ from hyperpocket.config import secret
168
167
  from hyperpocket_llamaindex import PocketLlamaindex
169
168
 
170
169
  llm = OpenAI(api_key=secret["OPENAI_API_KEY"])
171
170
  pocket = PocketLlamaindex(
172
- tools=[
173
- from_git("https://github.com/vessl-ai/hyperawesometools", "main", "managed-tools/slack/get-message"),
174
- from_git("https://github.com/vessl-ai/hyperawesometools", "main", "managed-tools/slack/post-message"),
175
- from_git("https://github.com/vessl-ai/hyperawesometools", "main", "managed-tools/linear/get-issues"),
176
- from_git("https://github.com/vessl-ai/hyperawesometools", "main", "managed-tools/google/get-calendar-events"),
177
- from_git("https://github.com/vessl-ai/hyperawesometools", "main", "managed-tools/google/get-calendar-list"),
178
- ]
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
+ ]
179
178
  )
180
179
  tools = pocket.get_tools()
181
180
 
@@ -2,7 +2,7 @@ hyperpocket/__init__.py,sha256=iaJvrZ0rgHwAndGFVv8m1Iz_DWtWEcphFPL-1D8f9SY,136
2
2
  hyperpocket/builtin.py,sha256=FnsASGfieQKvVrFVESjvm73qsxPvCf7iiHGd7HNVpuQ,2371
3
3
  hyperpocket/constants.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  hyperpocket/pocket_auth.py,sha256=-d5UvLkjvsSkem5DGrDphowckVCB3NCLt2jOw9k5U9c,16934
5
- hyperpocket/pocket_core.py,sha256=bEl91BFXL1b-JHGPQoK5pzoy-RgDDcyfv0FUQZn86Ss,10175
5
+ hyperpocket/pocket_core.py,sha256=pt_IBciSlJUOq00siVNk_qVP3FK8PoIs2Bs7ZMsmm9U,10173
6
6
  hyperpocket/pocket_main.py,sha256=eSwevmX7vgRQebpNtOGG5jhVGU-DE_hTUJi-zRWAvdo,10231
7
7
  hyperpocket/prompts.py,sha256=XAmTTCzCkXWK50zcmWmGA25v9-HKd_4dL5o85uisbGM,472
8
8
  hyperpocket/tool_like.py,sha256=ur8oMU5p4DUYBEF5MBP3faQ7CKsOzb0lLOaL6p8JqSw,134
@@ -124,14 +124,14 @@ hyperpocket/tool/wasm/templates/__init__.py,sha256=cQ-uNsO418xvv54i8bD0IrqcAKUxM
124
124
  hyperpocket/tool/wasm/templates/node.py,sha256=8ghVQGS9L3IJGdBB8waLK_ej4FS34dCA_bwPKjm8QSU,2782
125
125
  hyperpocket/tool/wasm/templates/python.py,sha256=Gi_tn3QQZjolFpbhVDXHLoj4juRLTEGsq_A-iyvTyUk,2733
126
126
  hyperpocket/util/__init__.py,sha256=V36_ztskLaKQxOhW2OhrhxRFn4QCxtX3jGjAT4lqNQE,35
127
- hyperpocket/util/extract_func_param_desc_from_docstring.py,sha256=3bek0BRwDGdlKBATDAhBrSSqzdVshXKD02zNi6KvxO4,4067
127
+ hyperpocket/util/extract_func_param_desc_from_docstring.py,sha256=Ud1eRp1LyEO-qI34OUpZ1Osaxhzt_r93swRYFxbfSRs,4040
128
128
  hyperpocket/util/find_all_leaf_class_in_package.py,sha256=afGLqe5s7irOOPh7DI70v-utDL2a0vhNzHjtgSmDeZU,528
129
129
  hyperpocket/util/find_all_subclass_in_package.py,sha256=CfsM5sWHHbFZD6M-jbJRN8Zo3m57R1E7FGg_V__HdFU,964
130
130
  hyperpocket/util/flatten_json_schema.py,sha256=PXK6I1S2QDxwSGmUVEl5bbSPrjTa38GBllBQ8uKXJNQ,1587
131
131
  hyperpocket/util/function_to_model.py,sha256=zPBrxtvfieJearmvJeMOeIGGLn1ymXNvL9PlMoXZbwA,2061
132
132
  hyperpocket/util/get_objects_from_subpackage.py,sha256=Aq87PD_H57c2IjLS28Hf0Wu5vLVyoOtDoBvKzvQ1UPw,929
133
133
  hyperpocket/util/json_schema_to_model.py,sha256=hmXqiU67WrdHZMGELvHfKxfQ12EqPtTD8x_KezCcEFk,3465
134
- hyperpocket-0.1.9.dist-info/METADATA,sha256=xXCNAMvXwN0u0ZhkITy943hcfjKj1VE-Rm6my2kFBHM,9961
135
- hyperpocket-0.1.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
136
- hyperpocket-0.1.9.dist-info/entry_points.txt,sha256=KpBleaYr0SaENXOa-dFvJ_cvFCHYFEQ4LMl11ShAcBI,61
137
- hyperpocket-0.1.9.dist-info/RECORD,,
134
+ hyperpocket-0.1.10.dist-info/METADATA,sha256=Rp9BULH23ZqLLSU2_POT_K9T_PaDkmXPpBYFzcYoNds,9577
135
+ hyperpocket-0.1.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
136
+ hyperpocket-0.1.10.dist-info/entry_points.txt,sha256=KpBleaYr0SaENXOa-dFvJ_cvFCHYFEQ4LMl11ShAcBI,61
137
+ hyperpocket-0.1.10.dist-info/RECORD,,