beamlit 0.0.20rc7__py3-none-any.whl → 0.0.20rc8__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.
- beamlit/functions/github/__init__.py +3 -0
- beamlit/functions/github/github.py +21 -0
- beamlit/functions/github/kit/__init__.py +7 -0
- beamlit/functions/github/kit/pull_request.py +51 -0
- beamlit/functions/math/__init__.py +3 -0
- beamlit/functions/math/math.py +40 -0
- beamlit/functions/search/__init__.py +3 -0
- beamlit/functions/search/search.py +15 -0
- {beamlit-0.0.20rc7.dist-info → beamlit-0.0.20rc8.dist-info}/METADATA +1 -1
- {beamlit-0.0.20rc7.dist-info → beamlit-0.0.20rc8.dist-info}/RECORD +11 -3
- {beamlit-0.0.20rc7.dist-info → beamlit-0.0.20rc8.dist-info}/WHEEL +0 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
from beamlit.common.secrets import Secret
|
2
|
+
|
3
|
+
from . import kit
|
4
|
+
|
5
|
+
|
6
|
+
def github(name: str, *args):
|
7
|
+
"""This function kit is used to perform actions on Github."""
|
8
|
+
github_token = Secret.get("GITHUB_TOKEN")
|
9
|
+
if not github_token:
|
10
|
+
raise ValueError("github_token missing from configuration.")
|
11
|
+
|
12
|
+
modes = {}
|
13
|
+
|
14
|
+
for func_name in dir(kit):
|
15
|
+
if not func_name.startswith("_"):
|
16
|
+
modes[func_name] = getattr(kit, func_name)
|
17
|
+
if name not in modes:
|
18
|
+
msg = f"Invalid mode: {name}"
|
19
|
+
raise ValueError(msg)
|
20
|
+
return modes[name](*args)
|
21
|
+
return modes[name](*args)
|
@@ -0,0 +1,51 @@
|
|
1
|
+
"""Functions for interacting with GitHub pull requests."""
|
2
|
+
|
3
|
+
from typing import Any
|
4
|
+
|
5
|
+
from github import Auth, Github, PullRequest
|
6
|
+
from pydash import pick
|
7
|
+
|
8
|
+
from beamlit.common.secrets import Secret
|
9
|
+
|
10
|
+
|
11
|
+
def list_open_pull_requests(
|
12
|
+
repository: str,
|
13
|
+
):
|
14
|
+
"""
|
15
|
+
This function will fetch a list of the repository's Pull Requests (PRs).
|
16
|
+
It will return the title, and PR number of 5 PRs.
|
17
|
+
"""
|
18
|
+
auth = Auth.Token(Secret.get("GITHUB_TOKEN"))
|
19
|
+
gh = Github(auth=auth)
|
20
|
+
repo = gh.get_repo(repository)
|
21
|
+
return [_format_pull_request(pr) for pr in repo.get_pulls(state="open")[:5]]
|
22
|
+
|
23
|
+
|
24
|
+
def _format_pull_request(pr: PullRequest) -> dict[str, Any]:
|
25
|
+
raw_data = pr.raw_data
|
26
|
+
raw_data["reviewers"] = [reviewer["login"] for reviewer in raw_data["requested_reviewers"]]
|
27
|
+
raw_data["assignees"] = [assignee["login"] for assignee in raw_data["assignees"]]
|
28
|
+
|
29
|
+
return pick(
|
30
|
+
raw_data,
|
31
|
+
[
|
32
|
+
"id",
|
33
|
+
"title",
|
34
|
+
"labels",
|
35
|
+
"number",
|
36
|
+
"html_url",
|
37
|
+
"diff_url",
|
38
|
+
"patch_url",
|
39
|
+
"commits",
|
40
|
+
"additions",
|
41
|
+
"deletions",
|
42
|
+
"changed_files",
|
43
|
+
"comments",
|
44
|
+
"state",
|
45
|
+
"user.login",
|
46
|
+
"assignees",
|
47
|
+
"reviewers",
|
48
|
+
"created_at",
|
49
|
+
"updated_at",
|
50
|
+
],
|
51
|
+
)
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import math as math_operation
|
2
|
+
import operator
|
3
|
+
|
4
|
+
|
5
|
+
def math(query: str):
|
6
|
+
"""A function for performing mathematical calculations.."""
|
7
|
+
safe_dict = {
|
8
|
+
"abs": abs,
|
9
|
+
"round": round,
|
10
|
+
"min": min,
|
11
|
+
"max": max,
|
12
|
+
"pow": math_operation.pow,
|
13
|
+
"sqrt": math_operation.sqrt,
|
14
|
+
"sin": math_operation.sin,
|
15
|
+
"cos": math_operation.cos,
|
16
|
+
"tan": math_operation.tan,
|
17
|
+
"pi": math_operation.pi,
|
18
|
+
"e": math_operation.e,
|
19
|
+
}
|
20
|
+
|
21
|
+
# Add basic arithmetic operators
|
22
|
+
safe_dict.update(
|
23
|
+
{
|
24
|
+
"+": operator.add,
|
25
|
+
"-": operator.sub,
|
26
|
+
"*": operator.mul,
|
27
|
+
"/": operator.truediv,
|
28
|
+
"**": operator.pow,
|
29
|
+
"%": operator.mod,
|
30
|
+
}
|
31
|
+
)
|
32
|
+
|
33
|
+
try:
|
34
|
+
# Replace 'x' with '*'
|
35
|
+
query = query.replace("x", "*")
|
36
|
+
|
37
|
+
# Evaluate the expression in a restricted environment
|
38
|
+
return eval(query, {"__builtins__": {}}, safe_dict)
|
39
|
+
except Exception as e:
|
40
|
+
raise ValueError(f"Invalid expression: {str(e)}")
|
@@ -0,0 +1,15 @@
|
|
1
|
+
from langchain_community.tools.tavily_search.tool import TavilySearchResults
|
2
|
+
|
3
|
+
from beamlit.common.secrets import Secret
|
4
|
+
|
5
|
+
|
6
|
+
def search(query: str):
|
7
|
+
"""
|
8
|
+
A search engine optimized for comprehensive, accurate, and trusted results.
|
9
|
+
Useful for when you need to answer questions about current events.
|
10
|
+
Input should be a search query.
|
11
|
+
"""
|
12
|
+
api_key = Secret.get("TAVILY_API_KEY")
|
13
|
+
tavily = TavilySearchResults(api_key=api_key, max_results=2)
|
14
|
+
result = tavily.invoke(input=query)
|
15
|
+
return result
|
@@ -142,6 +142,14 @@ beamlit/common/settings.py,sha256=WF7_BztXwfHC1LY7DXtj7plYNFgYnCx_hk_wO1DUPJ8,51
|
|
142
142
|
beamlit/common/utils.py,sha256=jouz5igBvT37Xn_e94-foCHyQczVim-UzVcoIF6RWJ4,657
|
143
143
|
beamlit/functions/__init__.py,sha256=_RPG1Bfg54JGdIPnViAU6n9zD7E1cDNsdXi8oYGskzE,138
|
144
144
|
beamlit/functions/decorator.py,sha256=-2newMBztweIgFuh0ABKOdxCfUzWaRxf0ym-YAgggJI,3168
|
145
|
+
beamlit/functions/github/__init__.py,sha256=gYnUkeegukOfbymdabuuJkScvH-_ZJygX05BoqkPn0o,49
|
146
|
+
beamlit/functions/github/github.py,sha256=FajzLCNkpXcwfgnC0l9rOGT2eSPLCz8-qrMzK9N_ZNc,598
|
147
|
+
beamlit/functions/github/kit/__init__.py,sha256=jBwPqZv6C23_utukohxqXZwrlicNlI7PYPUj0Den7Cw,136
|
148
|
+
beamlit/functions/github/kit/pull_request.py,sha256=wQVeRBakiqu-2ouflO8p1z7D5u07KNsitwyNRrp0KjM,1357
|
149
|
+
beamlit/functions/math/__init__.py,sha256=wie4WME8jT-WpFRrtu-lDlHW31Mg6K2cwstjkUdLF3o,43
|
150
|
+
beamlit/functions/math/math.py,sha256=CpoLJGwuvwCPGnVC8k9GYuIyvfUYPDQHKlZg3cx-z-A,1049
|
151
|
+
beamlit/functions/search/__init__.py,sha256=5NAthQ9PBwrkNg1FpLRx4flauvv0HyWuwaVS589c1Pw,49
|
152
|
+
beamlit/functions/search/search.py,sha256=8s9ECltq7YE17j6rTxb12uY2EQY4_eTLHmwlIMThI0w,515
|
145
153
|
beamlit/models/__init__.py,sha256=Jv0iTOtTs9G2zQRjbCmDjmNz8T9fX-MHoSt3b3zlRcI,8929
|
146
154
|
beamlit/models/acl.py,sha256=MmwPgwhydRBkO1EyqZkNn7jX57HUT2a4Y06iRX91mxI,4642
|
147
155
|
beamlit/models/agent.py,sha256=X5plQzNDoLcB2_4HoiuZ6ciw9jsalypfuehdR75SWBM,4829
|
@@ -288,6 +296,6 @@ beamlit/serve/app.py,sha256=riZWmczexN5t-PT172WxB5YZkoORDEl0ucS-2vxdWHg,2292
|
|
288
296
|
beamlit/serve/middlewares/__init__.py,sha256=1dVmnOmhAQWvWktqHkKSIX-YoF6fmMU8xkUQuhg_rJU,148
|
289
297
|
beamlit/serve/middlewares/accesslog.py,sha256=wM52-hcwtO-_hdM1pnsEJzerzJf1MzEyN5m85BdDccE,609
|
290
298
|
beamlit/serve/middlewares/processtime.py,sha256=lDAaIasZ4bwvN-HKHvZpaD9r-yrkVNZYx4abvbjbrCg,411
|
291
|
-
beamlit-0.0.
|
292
|
-
beamlit-0.0.
|
293
|
-
beamlit-0.0.
|
299
|
+
beamlit-0.0.20rc8.dist-info/METADATA,sha256=l6r_tFygyBqlBCuyazZ3V0C47kxXMsLFk1x00Nd1ZVc,2026
|
300
|
+
beamlit-0.0.20rc8.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
301
|
+
beamlit-0.0.20rc8.dist-info/RECORD,,
|
File without changes
|