botrun-flow-lang 5.10.82__py3-none-any.whl → 5.10.83__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.
- botrun_flow_lang/api/auth_api.py +39 -39
- botrun_flow_lang/api/auth_utils.py +183 -183
- botrun_flow_lang/api/botrun_back_api.py +65 -65
- botrun_flow_lang/api/flow_api.py +3 -3
- botrun_flow_lang/api/hatch_api.py +481 -481
- botrun_flow_lang/api/langgraph_api.py +796 -796
- botrun_flow_lang/api/line_bot_api.py +1357 -1357
- botrun_flow_lang/api/model_api.py +300 -300
- botrun_flow_lang/api/rate_limit_api.py +32 -32
- botrun_flow_lang/api/routes.py +79 -79
- botrun_flow_lang/api/search_api.py +53 -53
- botrun_flow_lang/api/storage_api.py +316 -316
- botrun_flow_lang/api/subsidy_api.py +290 -290
- botrun_flow_lang/api/subsidy_api_system_prompt.txt +109 -109
- botrun_flow_lang/api/user_setting_api.py +70 -70
- botrun_flow_lang/api/version_api.py +31 -31
- botrun_flow_lang/api/youtube_api.py +26 -26
- botrun_flow_lang/constants.py +13 -13
- botrun_flow_lang/langgraph_agents/agents/agent_runner.py +174 -174
- botrun_flow_lang/langgraph_agents/agents/agent_tools/step_planner.py +77 -77
- botrun_flow_lang/langgraph_agents/agents/checkpointer/firestore_checkpointer.py +666 -666
- botrun_flow_lang/langgraph_agents/agents/gov_researcher/GOV_RESEARCHER_PRD.md +192 -192
- botrun_flow_lang/langgraph_agents/agents/gov_researcher/gov_researcher_2_graph.py +1002 -1002
- botrun_flow_lang/langgraph_agents/agents/gov_researcher/gov_researcher_graph.py +822 -822
- botrun_flow_lang/langgraph_agents/agents/langgraph_react_agent.py +591 -548
- botrun_flow_lang/langgraph_agents/agents/search_agent_graph.py +864 -864
- botrun_flow_lang/langgraph_agents/agents/tools/__init__.py +4 -4
- botrun_flow_lang/langgraph_agents/agents/tools/gemini_code_execution.py +376 -376
- botrun_flow_lang/langgraph_agents/agents/util/gemini_grounding.py +66 -66
- botrun_flow_lang/langgraph_agents/agents/util/html_util.py +316 -316
- botrun_flow_lang/langgraph_agents/agents/util/img_util.py +294 -294
- botrun_flow_lang/langgraph_agents/agents/util/local_files.py +345 -345
- botrun_flow_lang/langgraph_agents/agents/util/mermaid_util.py +86 -86
- botrun_flow_lang/langgraph_agents/agents/util/model_utils.py +143 -143
- botrun_flow_lang/langgraph_agents/agents/util/pdf_analyzer.py +160 -160
- botrun_flow_lang/langgraph_agents/agents/util/perplexity_search.py +464 -464
- botrun_flow_lang/langgraph_agents/agents/util/plotly_util.py +59 -59
- botrun_flow_lang/langgraph_agents/agents/util/tavily_search.py +199 -199
- botrun_flow_lang/langgraph_agents/agents/util/youtube_util.py +90 -90
- botrun_flow_lang/langgraph_agents/cache/langgraph_botrun_cache.py +197 -197
- botrun_flow_lang/llm_agent/llm_agent.py +19 -19
- botrun_flow_lang/llm_agent/llm_agent_util.py +83 -83
- botrun_flow_lang/log/.gitignore +2 -2
- botrun_flow_lang/main.py +61 -61
- botrun_flow_lang/main_fast.py +51 -51
- botrun_flow_lang/mcp_server/__init__.py +10 -10
- botrun_flow_lang/mcp_server/default_mcp.py +711 -711
- botrun_flow_lang/models/nodes/utils.py +205 -205
- botrun_flow_lang/models/token_usage.py +34 -34
- botrun_flow_lang/requirements.txt +21 -21
- botrun_flow_lang/services/base/firestore_base.py +30 -30
- botrun_flow_lang/services/hatch/hatch_factory.py +11 -11
- botrun_flow_lang/services/hatch/hatch_fs_store.py +372 -372
- botrun_flow_lang/services/storage/storage_cs_store.py +202 -202
- botrun_flow_lang/services/storage/storage_factory.py +12 -12
- botrun_flow_lang/services/storage/storage_store.py +65 -65
- botrun_flow_lang/services/user_setting/user_setting_factory.py +9 -9
- botrun_flow_lang/services/user_setting/user_setting_fs_store.py +66 -66
- botrun_flow_lang/static/docs/tools/index.html +926 -926
- botrun_flow_lang/tests/api_functional_tests.py +1525 -1525
- botrun_flow_lang/tests/api_stress_test.py +357 -357
- botrun_flow_lang/tests/shared_hatch_tests.py +333 -333
- botrun_flow_lang/tests/test_botrun_app.py +46 -46
- botrun_flow_lang/tests/test_html_util.py +31 -31
- botrun_flow_lang/tests/test_img_analyzer.py +190 -190
- botrun_flow_lang/tests/test_img_util.py +39 -39
- botrun_flow_lang/tests/test_local_files.py +114 -114
- botrun_flow_lang/tests/test_mermaid_util.py +103 -103
- botrun_flow_lang/tests/test_pdf_analyzer.py +104 -104
- botrun_flow_lang/tests/test_plotly_util.py +151 -151
- botrun_flow_lang/tests/test_run_workflow_engine.py +65 -65
- botrun_flow_lang/tools/generate_docs.py +133 -133
- botrun_flow_lang/tools/templates/tools.html +153 -153
- botrun_flow_lang/utils/__init__.py +7 -7
- botrun_flow_lang/utils/botrun_logger.py +344 -344
- botrun_flow_lang/utils/clients/rate_limit_client.py +209 -209
- botrun_flow_lang/utils/clients/token_verify_client.py +153 -153
- botrun_flow_lang/utils/google_drive_utils.py +654 -654
- botrun_flow_lang/utils/langchain_utils.py +324 -324
- botrun_flow_lang/utils/yaml_utils.py +9 -9
- {botrun_flow_lang-5.10.82.dist-info → botrun_flow_lang-5.10.83.dist-info}/METADATA +3 -2
- botrun_flow_lang-5.10.83.dist-info/RECORD +99 -0
- botrun_flow_lang-5.10.82.dist-info/RECORD +0 -99
- {botrun_flow_lang-5.10.82.dist-info → botrun_flow_lang-5.10.83.dist-info}/WHEEL +0 -0
botrun_flow_lang/api/routes.py
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from fastapi import APIRouter
|
|
3
|
-
from dotenv import load_dotenv
|
|
4
|
-
from google.oauth2 import service_account
|
|
5
|
-
|
|
6
|
-
# Include hatch routes
|
|
7
|
-
from botrun_flow_lang.api import (
|
|
8
|
-
auth_api,
|
|
9
|
-
botrun_back_api,
|
|
10
|
-
hatch_api,
|
|
11
|
-
langgraph_api,
|
|
12
|
-
storage_api,
|
|
13
|
-
subsidy_api,
|
|
14
|
-
user_setting_api,
|
|
15
|
-
search_api,
|
|
16
|
-
rate_limit_api,
|
|
17
|
-
line_bot_api,
|
|
18
|
-
version_api,
|
|
19
|
-
youtube_api,
|
|
20
|
-
model_api,
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
load_dotenv()
|
|
24
|
-
|
|
25
|
-
router = APIRouter(prefix="/api")
|
|
26
|
-
router.include_router(
|
|
27
|
-
auth_api.router,
|
|
28
|
-
)
|
|
29
|
-
router.include_router(
|
|
30
|
-
hatch_api.router,
|
|
31
|
-
)
|
|
32
|
-
router.include_router(
|
|
33
|
-
user_setting_api.router,
|
|
34
|
-
)
|
|
35
|
-
router.include_router(
|
|
36
|
-
search_api.router,
|
|
37
|
-
)
|
|
38
|
-
router.include_router(
|
|
39
|
-
langgraph_api.router,
|
|
40
|
-
)
|
|
41
|
-
router.include_router(
|
|
42
|
-
storage_api.router,
|
|
43
|
-
)
|
|
44
|
-
router.include_router(
|
|
45
|
-
subsidy_api.router,
|
|
46
|
-
)
|
|
47
|
-
router.include_router(
|
|
48
|
-
rate_limit_api.router,
|
|
49
|
-
)
|
|
50
|
-
router.include_router(
|
|
51
|
-
line_bot_api.router,
|
|
52
|
-
)
|
|
53
|
-
router.include_router(
|
|
54
|
-
botrun_back_api.router,
|
|
55
|
-
)
|
|
56
|
-
router.include_router(
|
|
57
|
-
version_api.router,
|
|
58
|
-
)
|
|
59
|
-
router.include_router(
|
|
60
|
-
youtube_api.router,
|
|
61
|
-
)
|
|
62
|
-
router.include_router(
|
|
63
|
-
model_api.router,
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
@router.get("/hello")
|
|
68
|
-
async def hello():
|
|
69
|
-
env_name = os.getenv("ENV_NAME")
|
|
70
|
-
google_service_account_key_path = os.getenv(
|
|
71
|
-
"GOOGLE_APPLICATION_CREDENTIALS_FOR_FASTAPI",
|
|
72
|
-
"/app/keys/scoop-386004-d22d99a7afd9.json",
|
|
73
|
-
)
|
|
74
|
-
credentials = service_account.Credentials.from_service_account_file(
|
|
75
|
-
google_service_account_key_path,
|
|
76
|
-
scopes=["https://www.googleapis.com/auth/datastore"],
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
return {"message": f"Hello World {env_name}"}
|
|
1
|
+
import os
|
|
2
|
+
from fastapi import APIRouter
|
|
3
|
+
from dotenv import load_dotenv
|
|
4
|
+
from google.oauth2 import service_account
|
|
5
|
+
|
|
6
|
+
# Include hatch routes
|
|
7
|
+
from botrun_flow_lang.api import (
|
|
8
|
+
auth_api,
|
|
9
|
+
botrun_back_api,
|
|
10
|
+
hatch_api,
|
|
11
|
+
langgraph_api,
|
|
12
|
+
storage_api,
|
|
13
|
+
subsidy_api,
|
|
14
|
+
user_setting_api,
|
|
15
|
+
search_api,
|
|
16
|
+
rate_limit_api,
|
|
17
|
+
line_bot_api,
|
|
18
|
+
version_api,
|
|
19
|
+
youtube_api,
|
|
20
|
+
model_api,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
load_dotenv()
|
|
24
|
+
|
|
25
|
+
router = APIRouter(prefix="/api")
|
|
26
|
+
router.include_router(
|
|
27
|
+
auth_api.router,
|
|
28
|
+
)
|
|
29
|
+
router.include_router(
|
|
30
|
+
hatch_api.router,
|
|
31
|
+
)
|
|
32
|
+
router.include_router(
|
|
33
|
+
user_setting_api.router,
|
|
34
|
+
)
|
|
35
|
+
router.include_router(
|
|
36
|
+
search_api.router,
|
|
37
|
+
)
|
|
38
|
+
router.include_router(
|
|
39
|
+
langgraph_api.router,
|
|
40
|
+
)
|
|
41
|
+
router.include_router(
|
|
42
|
+
storage_api.router,
|
|
43
|
+
)
|
|
44
|
+
router.include_router(
|
|
45
|
+
subsidy_api.router,
|
|
46
|
+
)
|
|
47
|
+
router.include_router(
|
|
48
|
+
rate_limit_api.router,
|
|
49
|
+
)
|
|
50
|
+
router.include_router(
|
|
51
|
+
line_bot_api.router,
|
|
52
|
+
)
|
|
53
|
+
router.include_router(
|
|
54
|
+
botrun_back_api.router,
|
|
55
|
+
)
|
|
56
|
+
router.include_router(
|
|
57
|
+
version_api.router,
|
|
58
|
+
)
|
|
59
|
+
router.include_router(
|
|
60
|
+
youtube_api.router,
|
|
61
|
+
)
|
|
62
|
+
router.include_router(
|
|
63
|
+
model_api.router,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@router.get("/hello")
|
|
68
|
+
async def hello():
|
|
69
|
+
env_name = os.getenv("ENV_NAME")
|
|
70
|
+
google_service_account_key_path = os.getenv(
|
|
71
|
+
"GOOGLE_APPLICATION_CREDENTIALS_FOR_FASTAPI",
|
|
72
|
+
"/app/keys/scoop-386004-d22d99a7afd9.json",
|
|
73
|
+
)
|
|
74
|
+
credentials = service_account.Credentials.from_service_account_file(
|
|
75
|
+
google_service_account_key_path,
|
|
76
|
+
scopes=["https://www.googleapis.com/auth/datastore"],
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
return {"message": f"Hello World {env_name}"}
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
from fastapi import APIRouter, HTTPException
|
|
2
|
-
from pydantic import BaseModel
|
|
3
|
-
from typing import Dict
|
|
4
|
-
import requests
|
|
5
|
-
import os
|
|
6
|
-
from dotenv import load_dotenv
|
|
7
|
-
|
|
8
|
-
router = APIRouter()
|
|
9
|
-
|
|
10
|
-
load_dotenv()
|
|
11
|
-
|
|
12
|
-
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
|
13
|
-
GOOGLE_CSE_ID = os.getenv("GOOGLE_SEARCH_ENGINE_ID")
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class SearchRequest(BaseModel):
|
|
17
|
-
query: str
|
|
18
|
-
num: int = 10
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def google_search(search_request: SearchRequest) -> Dict:
|
|
22
|
-
query = f"{search_request.query}"
|
|
23
|
-
url = (
|
|
24
|
-
f"https://www.googleapis.com/customsearch/v1"
|
|
25
|
-
f"?key={GOOGLE_API_KEY}"
|
|
26
|
-
f"&cx={GOOGLE_CSE_ID}"
|
|
27
|
-
f"&q={query}"
|
|
28
|
-
f"&num={search_request.num}"
|
|
29
|
-
f"&lr=lang_zh-TW" # 設定語言為繁體中文
|
|
30
|
-
f"&cr=countryTW" # 設定地區為台灣
|
|
31
|
-
f"&fileType=-pdf,-doc,-docx,-xls,-xlsx,-ppt,-pptx"
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
response = requests.get(url)
|
|
35
|
-
search_results = response.json()
|
|
36
|
-
|
|
37
|
-
return search_results
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
@router.post("/search")
|
|
41
|
-
async def search(search_request: SearchRequest):
|
|
42
|
-
if not GOOGLE_API_KEY or not GOOGLE_CSE_ID:
|
|
43
|
-
raise HTTPException(
|
|
44
|
-
status_code=500, detail="Google API credentials are not set"
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
try:
|
|
48
|
-
results = google_search(search_request)
|
|
49
|
-
return results
|
|
50
|
-
except Exception as e:
|
|
51
|
-
raise HTTPException(
|
|
52
|
-
status_code=500, detail=f"An error occurred during the search: {str(e)}"
|
|
53
|
-
)
|
|
1
|
+
from fastapi import APIRouter, HTTPException
|
|
2
|
+
from pydantic import BaseModel
|
|
3
|
+
from typing import Dict
|
|
4
|
+
import requests
|
|
5
|
+
import os
|
|
6
|
+
from dotenv import load_dotenv
|
|
7
|
+
|
|
8
|
+
router = APIRouter()
|
|
9
|
+
|
|
10
|
+
load_dotenv()
|
|
11
|
+
|
|
12
|
+
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
|
13
|
+
GOOGLE_CSE_ID = os.getenv("GOOGLE_SEARCH_ENGINE_ID")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class SearchRequest(BaseModel):
|
|
17
|
+
query: str
|
|
18
|
+
num: int = 10
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def google_search(search_request: SearchRequest) -> Dict:
|
|
22
|
+
query = f"{search_request.query}"
|
|
23
|
+
url = (
|
|
24
|
+
f"https://www.googleapis.com/customsearch/v1"
|
|
25
|
+
f"?key={GOOGLE_API_KEY}"
|
|
26
|
+
f"&cx={GOOGLE_CSE_ID}"
|
|
27
|
+
f"&q={query}"
|
|
28
|
+
f"&num={search_request.num}"
|
|
29
|
+
f"&lr=lang_zh-TW" # 設定語言為繁體中文
|
|
30
|
+
f"&cr=countryTW" # 設定地區為台灣
|
|
31
|
+
f"&fileType=-pdf,-doc,-docx,-xls,-xlsx,-ppt,-pptx"
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
response = requests.get(url)
|
|
35
|
+
search_results = response.json()
|
|
36
|
+
|
|
37
|
+
return search_results
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@router.post("/search")
|
|
41
|
+
async def search(search_request: SearchRequest):
|
|
42
|
+
if not GOOGLE_API_KEY or not GOOGLE_CSE_ID:
|
|
43
|
+
raise HTTPException(
|
|
44
|
+
status_code=500, detail="Google API credentials are not set"
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
try:
|
|
48
|
+
results = google_search(search_request)
|
|
49
|
+
return results
|
|
50
|
+
except Exception as e:
|
|
51
|
+
raise HTTPException(
|
|
52
|
+
status_code=500, detail=f"An error occurred during the search: {str(e)}"
|
|
53
|
+
)
|