gohumanloop 0.0.1__py3-none-any.whl → 0.0.3__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.
@@ -0,0 +1,67 @@
1
+ import asyncio
2
+ import os
3
+ from typing import Optional, Union
4
+ from pydantic import SecretStr
5
+ import warnings
6
+
7
+ def run_async_safely(coro):
8
+ """
9
+ Safely run async coroutines in synchronous environment
10
+ Will raise RuntimeError if called in async environment
11
+ """
12
+ try:
13
+ loop = asyncio.get_running_loop()
14
+ except RuntimeError: # No running event loop
15
+ loop = None
16
+
17
+ if loop is not None:
18
+ raise RuntimeError(
19
+ "Detected running event loop! "
20
+ "You should use 'await' directly instead of run_async_safely(). "
21
+ "If you really need to call sync code from async context, "
22
+ "consider using asyncio.to_thread() or other proper methods."
23
+ )
24
+
25
+ # Handle synchronous environment
26
+ try:
27
+ loop = asyncio.get_event_loop()
28
+ print("Using existing event loop.")
29
+ except RuntimeError:
30
+ loop = asyncio.new_event_loop()
31
+ asyncio.set_event_loop(loop)
32
+ own_loop = True
33
+ print("Created new event loop.")
34
+ else:
35
+ own_loop = False
36
+
37
+ try:
38
+ return loop.run_until_complete(coro)
39
+ finally:
40
+ if own_loop and not loop.is_closed():
41
+ loop.close()
42
+
43
+
44
+ def get_secret_from_env(
45
+ key: Union[str, list, tuple],
46
+ default: Optional[str] = None,
47
+ error_message: Optional[str] = None
48
+ ) -> Optional[SecretStr]:
49
+ """Get a value from an environment variable."""
50
+ if isinstance(key, (list, tuple)):
51
+ for k in key:
52
+ if k in os.environ:
53
+ return SecretStr(os.environ[k])
54
+ if isinstance(key, str) and key in os.environ:
55
+ return SecretStr(os.environ[key])
56
+ if isinstance(default, str):
57
+ return SecretStr(default)
58
+ if default is None:
59
+ return None
60
+ if error_message:
61
+ raise ValueError(error_message)
62
+ msg = (
63
+ f"Did not find {key}, please add an environment variable"
64
+ f" `{key}` which contains it, or pass"
65
+ f" `{key}` as a named parameter."
66
+ )
67
+ raise ValueError(msg)
@@ -1,7 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gohumanloop
3
- Version: 0.0.1
3
+ Version: 0.0.3
4
4
  Summary: Perfecting AI workflows with human intelligence
5
+ Author-email: gohumanloop authors <baird0917@163.com>
5
6
  Project-URL: repository, https://github.com/ptonlix/gohumanloop
6
7
  Requires-Python: >=3.10
7
8
  Description-Content-Type: text/markdown
@@ -0,0 +1,30 @@
1
+ gohumanloop/__init__.py,sha256=7_AkUtiG-_iozObldORElQS9mufxjZx_WfxuX0E5Af0,1845
2
+ gohumanloop/__main__.py,sha256=zdGKN92H9SgwZfL4xLqPkE1YaiRcHhVg_GqC-H1VurA,75
3
+ gohumanloop/adapters/__init__.py,sha256=alRiJPahmH5vIbiw7l6o3eFvEADVTkfWYIsXy5uPGSo,391
4
+ gohumanloop/adapters/langgraph_adapter.py,sha256=7w3ek8Yzr1r0tfJ4A5UNb_pcFRTfNVDc5gWNVq56IH0,34099
5
+ gohumanloop/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ gohumanloop/cli/main.py,sha256=54-0nwjaAeRH2WhbyO6pN-XADPQwk4_EUUvVWDWruLc,744
7
+ gohumanloop/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ gohumanloop/core/interface.py,sha256=UjeEBKGS_JjwIsT5sBzyq6_IhUkDFrUvBXqpkxkFrAA,22696
9
+ gohumanloop/core/manager.py,sha256=MAgT5Sx1aLRBIb1mWxp-XJkQxEoibut8-TVtze8bWXQ,33068
10
+ gohumanloop/manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ gohumanloop/manager/ghl_manager.py,sha256=m7KVdjd5bpxPNm2Sxk4LySzx_Ll4OfpJygxrfFhToDA,22026
12
+ gohumanloop/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ gohumanloop/models/api_model.py,sha256=cNTXTlfI7yrTk_87Qf6ms0VtRXO2fYFJFLPTLy2dmQk,2853
14
+ gohumanloop/models/glh_model.py,sha256=Ht93iCdLfVYz_nW-uW4bE5s0UoyKG3VEx9q-Gg8_tiY,870
15
+ gohumanloop/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ gohumanloop/providers/api_provider.py,sha256=ooZQfi4Zu27U8kyTJ9rssAVzAVoyga71xT8nUjdQJmE,24517
17
+ gohumanloop/providers/base.py,sha256=Eq2y4fqJXdDfbA4xkyHBBH7opGeOg8PAte5vAbx2lwI,24623
18
+ gohumanloop/providers/email_provider.py,sha256=G04557UxdyBnmCx4WTXiakElELRv1fHDYTYNbvzDtqw,42562
19
+ gohumanloop/providers/ghl_provider.py,sha256=YdxTpRzitFhTXTbhUcMhQlPUs3kwEBd4wyXEcGK8Svk,2524
20
+ gohumanloop/providers/terminal_provider.py,sha256=HBR6fLftaDRydueI5wxKtVOrgYF5RcPxzIhmLPrNVzo,11720
21
+ gohumanloop/utils/__init__.py,sha256=idlE5ZNCELVNF9WIiyhtyzG9HJuQQCOlKeTr2aHJ2-Q,56
22
+ gohumanloop/utils/context_formatter.py,sha256=v4vdgKNJCHjnTtIMq83AkyXwltL14vx-D4KahwcZhIQ,2171
23
+ gohumanloop/utils/threadsafedict.py,sha256=0-Pmre2-lqHkUPal9wSaqh3fLaEtbo-OnJ3Wbi_knWE,9601
24
+ gohumanloop/utils/utils.py,sha256=iwfIAYuuKSyuEpOUv4ftf7zRDqSvJ6ALgqceHaZNeO4,2102
25
+ gohumanloop-0.0.3.dist-info/licenses/LICENSE,sha256=-U5tuCcSpndQwSKWtZbFbazb-_AtZcZL2kQgHbSLg-M,1064
26
+ gohumanloop-0.0.3.dist-info/METADATA,sha256=e7exfCd8QVCiMbcAjFwgnAbqoziS1WMUnYh7GL7eZPc,1557
27
+ gohumanloop-0.0.3.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
28
+ gohumanloop-0.0.3.dist-info/entry_points.txt,sha256=wM6jqRRD8bQXkvIduRVCuAJIlbyWg_F5EDXo5OZ_PwY,88
29
+ gohumanloop-0.0.3.dist-info/top_level.txt,sha256=LvOXBqS6Mspmcuqp81uz0Vjx_m_YI0w06DOPCiI1BfY,12
30
+ gohumanloop-0.0.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.4.0)
2
+ Generator: setuptools (80.7.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,8 +0,0 @@
1
- gohumanloop/__init__.py,sha256=7_AkUtiG-_iozObldORElQS9mufxjZx_WfxuX0E5Af0,1845
2
- gohumanloop/__main__.py,sha256=zdGKN92H9SgwZfL4xLqPkE1YaiRcHhVg_GqC-H1VurA,75
3
- gohumanloop-0.0.1.dist-info/licenses/LICENSE,sha256=-U5tuCcSpndQwSKWtZbFbazb-_AtZcZL2kQgHbSLg-M,1064
4
- gohumanloop-0.0.1.dist-info/METADATA,sha256=Nxy1lk5-Kz44XUyV7XmViiLHpqkckkl0SwXgV_9-5mo,1503
5
- gohumanloop-0.0.1.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
6
- gohumanloop-0.0.1.dist-info/entry_points.txt,sha256=wM6jqRRD8bQXkvIduRVCuAJIlbyWg_F5EDXo5OZ_PwY,88
7
- gohumanloop-0.0.1.dist-info/top_level.txt,sha256=LvOXBqS6Mspmcuqp81uz0Vjx_m_YI0w06DOPCiI1BfY,12
8
- gohumanloop-0.0.1.dist-info/RECORD,,