blaxel 0.1.20rc68__py3-none-any.whl → 0.1.21__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.
- blaxel/agents/__init__.py +2 -6
- blaxel/common/internal.py +68 -0
- blaxel/jobs/__init__.py +2 -6
- blaxel/sandbox/base.py +2 -4
- blaxel/tools/__init__.py +2 -6
- {blaxel-0.1.20rc68.dist-info → blaxel-0.1.21.dist-info}/METADATA +1 -1
- {blaxel-0.1.20rc68.dist-info → blaxel-0.1.21.dist-info}/RECORD +9 -9
- {blaxel-0.1.20rc68.dist-info → blaxel-0.1.21.dist-info}/WHEEL +0 -0
- {blaxel-0.1.20rc68.dist-info → blaxel-0.1.21.dist-info}/licenses/LICENSE +0 -0
blaxel/agents/__init__.py
CHANGED
@@ -6,8 +6,7 @@ from ..cache import find_from_cache
|
|
6
6
|
from ..client import client
|
7
7
|
from ..client.api.agents import get_agent
|
8
8
|
from ..client.models import Agent
|
9
|
-
from ..common.
|
10
|
-
from ..common.internal import get_global_unique_hash
|
9
|
+
from ..common.internal import get_global_unique_hash, get_forced_url
|
11
10
|
from ..common.settings import settings
|
12
11
|
from ..instrumentation.span import SpanManager
|
13
12
|
|
@@ -26,10 +25,7 @@ class BlAgent:
|
|
26
25
|
@property
|
27
26
|
def forced_url(self):
|
28
27
|
"""Get the forced URL from environment variables if set."""
|
29
|
-
|
30
|
-
if env[f"BL_AGENT_{env_var}_URL"]:
|
31
|
-
return env[f"BL_AGENT_{env_var}_URL"]
|
32
|
-
return None
|
28
|
+
return get_forced_url("agent", self.name)
|
33
29
|
|
34
30
|
@property
|
35
31
|
def external_url(self):
|
blaxel/common/internal.py
CHANGED
@@ -2,6 +2,7 @@ import hashlib
|
|
2
2
|
import os
|
3
3
|
from logging import getLogger
|
4
4
|
from typing import Optional
|
5
|
+
from .env import env
|
5
6
|
|
6
7
|
logger = getLogger(__name__)
|
7
8
|
|
@@ -75,3 +76,70 @@ class Agent:
|
|
75
76
|
env_var = self.agent_name.replace("-", "_").upper()
|
76
77
|
env_key = f"BL_AGENT_{env_var}_URL"
|
77
78
|
return os.environ.get(env_key)
|
79
|
+
|
80
|
+
def pluralize(type_str: str) -> str:
|
81
|
+
"""
|
82
|
+
Convert a string to its plural form following English pluralization rules.
|
83
|
+
|
84
|
+
Args:
|
85
|
+
type_str: The input string to pluralize
|
86
|
+
|
87
|
+
Returns:
|
88
|
+
The pluralized form of the input string
|
89
|
+
"""
|
90
|
+
word = type_str.lower()
|
91
|
+
|
92
|
+
# Words ending in s, ss, sh, ch, x, z - add 'es'
|
93
|
+
if (word.endswith('s') or word.endswith('ss') or word.endswith('sh') or
|
94
|
+
word.endswith('ch') or word.endswith('x') or word.endswith('z')):
|
95
|
+
return type_str + 'es'
|
96
|
+
|
97
|
+
# Words ending in consonant + y - change y to ies
|
98
|
+
if word.endswith('y') and len(word) > 1:
|
99
|
+
before_y = word[-2]
|
100
|
+
if before_y not in 'aeiou':
|
101
|
+
return type_str[:-1] + 'ies'
|
102
|
+
|
103
|
+
# Words ending in f or fe - change to ves
|
104
|
+
if word.endswith('f'):
|
105
|
+
return type_str[:-1] + 'ves'
|
106
|
+
if word.endswith('fe'):
|
107
|
+
return type_str[:-2] + 'ves'
|
108
|
+
|
109
|
+
# Words ending in consonant + o - add 'es'
|
110
|
+
if word.endswith('o') and len(word) > 1:
|
111
|
+
before_o = word[-2]
|
112
|
+
if before_o not in 'aeiou':
|
113
|
+
return type_str + 'es'
|
114
|
+
|
115
|
+
# Default case - just add 's'
|
116
|
+
return type_str + 's'
|
117
|
+
|
118
|
+
|
119
|
+
def get_forced_url(type_str: str, name: str) -> Optional[str]:
|
120
|
+
"""
|
121
|
+
Check for forced URLs in environment variables using both plural and singular forms.
|
122
|
+
|
123
|
+
Args:
|
124
|
+
type_str: The type identifier
|
125
|
+
name: The name identifier
|
126
|
+
|
127
|
+
Returns:
|
128
|
+
The forced URL if found in environment variables, None otherwise
|
129
|
+
"""
|
130
|
+
plural_type = pluralize(type_str)
|
131
|
+
env_var = name.replace("-", "_").upper()
|
132
|
+
|
133
|
+
# BL_FUNCTIONS_NAME_URL (plural form)
|
134
|
+
plural_env_key = f"BL_{plural_type.upper()}_{env_var}_URL"
|
135
|
+
if env[plural_env_key] is not None:
|
136
|
+
return env[plural_env_key]
|
137
|
+
|
138
|
+
# BL_FUNCTION_NAME_URL (singular form)
|
139
|
+
singular_env_key = f"BL_{type_str.upper()}_{env_var}_URL"
|
140
|
+
if env[singular_env_key] is not None:
|
141
|
+
return env[singular_env_key]
|
142
|
+
|
143
|
+
return None
|
144
|
+
|
145
|
+
|
blaxel/jobs/__init__.py
CHANGED
@@ -8,8 +8,7 @@ from typing import Any, Awaitable, Callable, Dict
|
|
8
8
|
import requests
|
9
9
|
|
10
10
|
from ..client import client
|
11
|
-
from ..common.
|
12
|
-
from ..common.internal import get_global_unique_hash
|
11
|
+
from ..common.internal import get_global_unique_hash, get_forced_url
|
13
12
|
from ..common.settings import settings
|
14
13
|
from ..instrumentation.span import SpanManager
|
15
14
|
|
@@ -77,10 +76,7 @@ class BlJob:
|
|
77
76
|
@property
|
78
77
|
def forced_url(self):
|
79
78
|
"""Get the forced URL from environment variables if set."""
|
80
|
-
|
81
|
-
if env[f"BL_JOB_{env_var}_URL"]:
|
82
|
-
return env[f"BL_JOB_{env_var}_URL"]
|
83
|
-
return None
|
79
|
+
return get_forced_url("job", self.name)
|
84
80
|
|
85
81
|
@property
|
86
82
|
def external_url(self):
|
blaxel/sandbox/base.py
CHANGED
@@ -3,7 +3,7 @@ import os
|
|
3
3
|
from httpx import Response
|
4
4
|
|
5
5
|
from ..client.models import Sandbox
|
6
|
-
from ..common.internal import get_global_unique_hash
|
6
|
+
from ..common.internal import get_global_unique_hash, get_forced_url
|
7
7
|
from ..common.settings import settings
|
8
8
|
from .client.client import client
|
9
9
|
from .client.models import ErrorResponse
|
@@ -50,9 +50,7 @@ class SandboxHandleBase:
|
|
50
50
|
|
51
51
|
@property
|
52
52
|
def forced_url(self):
|
53
|
-
|
54
|
-
env_name = f"BL_SANDBOX_{env_var}_URL"
|
55
|
-
return os.environ.get(env_name)
|
53
|
+
return get_forced_url("sandbox", self.name)
|
56
54
|
|
57
55
|
@property
|
58
56
|
def url(self):
|
blaxel/tools/__init__.py
CHANGED
@@ -10,8 +10,7 @@ from mcp import ClientSession
|
|
10
10
|
from mcp.types import CallToolResult
|
11
11
|
from mcp.types import Tool as MCPTool
|
12
12
|
|
13
|
-
from ..common.
|
14
|
-
from ..common.internal import get_global_unique_hash
|
13
|
+
from ..common.internal import get_global_unique_hash, get_forced_url
|
15
14
|
from ..common.settings import settings
|
16
15
|
from ..instrumentation.span import SpanManager
|
17
16
|
from ..mcp.client import websocket_client
|
@@ -197,10 +196,7 @@ class BlTools:
|
|
197
196
|
|
198
197
|
def _forced_url(self, name: str):
|
199
198
|
"""Get the forced URL from environment variables if set."""
|
200
|
-
|
201
|
-
if env[f"BL_FUNCTION_{env_var}_URL"]:
|
202
|
-
return env[f"BL_FUNCTION_{env_var}_URL"]
|
203
|
-
return None
|
199
|
+
return get_forced_url("function", name)
|
204
200
|
|
205
201
|
def _external_url(self, name: str):
|
206
202
|
return f"{settings.run_url}/{settings.workspace}/functions/{name}"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
blaxel/__init__.py,sha256=qmuJKjl5oGnjj4TbqHcJqUkKoxk4PvCsMb6-8rp67pE,159
|
2
|
-
blaxel/agents/__init__.py,sha256=
|
2
|
+
blaxel/agents/__init__.py,sha256=zvhjkFOUD3Rz4TAs_IC_TC2ElHgASPpZPW9HS0NrTQc,5132
|
3
3
|
blaxel/authentication/__init__.py,sha256=tL9XKNCek5ixszTqjlKRBvidXMg4Nj6ODlBKlxxA9uk,3283
|
4
4
|
blaxel/authentication/apikey.py,sha256=nOgLVba7EfVk3V-qm7cj-30LAL-BT7NOMIlGL9Ni1jY,1249
|
5
5
|
blaxel/authentication/clientcredentials.py,sha256=BZTg2cYmTe9hhWpHrkoVEoRe-ku8VY5RsxbyYpA7mdc,3879
|
@@ -284,7 +284,7 @@ blaxel/client/models/workspace_runtime.py,sha256=dxEpmwCFPOCRKHRKhY-iW7j6TbtL5qU
|
|
284
284
|
blaxel/client/models/workspace_user.py,sha256=70CcifQWYbeWG7TDui4pblTzUe5sVK0AS19vNCzKE8g,3423
|
285
285
|
blaxel/common/autoload.py,sha256=NFuK71-IHOY2JQyEBSjDCVfUaQ8D8PJsEUEryIdG4AU,263
|
286
286
|
blaxel/common/env.py,sha256=wTbzPDdNgz4HMJiS2NCZmQlN0qpxy1PQEYBaZgtvhoc,1247
|
287
|
-
blaxel/common/internal.py,sha256=
|
287
|
+
blaxel/common/internal.py,sha256=Koy2p0XLgn8BKm2stxZ3E-zY-3236vgWPiiDrAXh6Mo,4387
|
288
288
|
blaxel/common/logger.py,sha256=TNuWqwFDU87TwPDHLLDTluwgEyw2axj-d0kPOkN5J8M,4489
|
289
289
|
blaxel/common/settings.py,sha256=7KTryuBdud0IfHqykX7xEEtpgq5M5h1Z8YEzYKsHB-Q,2327
|
290
290
|
blaxel/instrumentation/exporters.py,sha256=EoX3uaBVku1Rg49pSNXKFyHhgY5OV3Ih6UlqgjF5epw,1670
|
@@ -292,7 +292,7 @@ blaxel/instrumentation/log.py,sha256=RvQByRjZMoP_dRaAZu8oK6DTegsHs-xV4W-UIqis6CA
|
|
292
292
|
blaxel/instrumentation/manager.py,sha256=odiz9ew5eB3LnuG-pqU27Vf05V5ifjSbikZuLMZAj50,8974
|
293
293
|
blaxel/instrumentation/map.py,sha256=zZoiUiQHmik5WQZ4VCWNARSa6ppMi0r7D6hlb41N-Mg,1589
|
294
294
|
blaxel/instrumentation/span.py,sha256=X2lwfu_dyxwQTMQJT2vbXOrbVSChEhjRLc413QOxQJM,3244
|
295
|
-
blaxel/jobs/__init__.py,sha256=
|
295
|
+
blaxel/jobs/__init__.py,sha256=J7D2qNUWAn41C6vuCUYw2UFcH2QaOqL99d4QS-NGX9k,6345
|
296
296
|
blaxel/mcp/__init__.py,sha256=KednMrtuc4Y0O3lv7u1Lla54FCk8UX9c1k0USjL3Ahk,69
|
297
297
|
blaxel/mcp/client.py,sha256=cFFXfpKXoMu8qTUly2ejF0pX2iBQkSNAxqwvDV1V6xY,4979
|
298
298
|
blaxel/mcp/server.py,sha256=GIldtA_NgIc2dzd7ZpPvpbhpIt_7AfKu5yS_YJ0bDGg,7310
|
@@ -307,7 +307,7 @@ blaxel/models/pydantic.py,sha256=4_z2KtaeEiRMt_Zz6Ghy6il-QiaXzE3yizDJnCBcWO8,332
|
|
307
307
|
blaxel/models/custom/langchain/gemini.py,sha256=AkhpuVMXnh1CyJ0zR2NMTtxQFPPHtAdHf_cyNzV3EsA,55421
|
308
308
|
blaxel/models/custom/llamaindex/cohere.py,sha256=Igj5Y1ozf1V4feIXfBHDdaTFU7od_wuOhm0yChZNxMY,19109
|
309
309
|
blaxel/models/custom/pydantic/gemini.py,sha256=rbsunh-M7EEKlD5ir3GlA-8a12JzPFcvsf6NISjzE5I,1052
|
310
|
-
blaxel/sandbox/base.py,sha256=
|
310
|
+
blaxel/sandbox/base.py,sha256=rc05uTkb8k0ymJK0l6wX9NZUNg6tahyXRJjXPXvBVbo,2212
|
311
311
|
blaxel/sandbox/filesystem.py,sha256=3dvg92owjHypv0aFmBdx6i9QfMSfp6z9Z0D93yKfeiQ,4653
|
312
312
|
blaxel/sandbox/preview.py,sha256=2L9JVfyvD7-65YXqLlvj3rOjq3p-Q-ich9gVAjMbDPs,4893
|
313
313
|
blaxel/sandbox/process.py,sha256=Xma8fIMgDoJM8z-XZOeqU8R-0yjDFGDgnxW8Fi4YPJQ,2531
|
@@ -354,7 +354,7 @@ blaxel/sandbox/client/models/process_response.py,sha256=13UN4aTg0OZJnABCD-bzsHNz
|
|
354
354
|
blaxel/sandbox/client/models/process_response_status.py,sha256=hCE1gCtheV83T6PYURG3k-rPZSauvyTFhsxLEtudgYE,246
|
355
355
|
blaxel/sandbox/client/models/subdirectory.py,sha256=j1ORkqO74vAdPQ-oUMer85P8Gb2mAwky3P2gBCnqyGQ,1761
|
356
356
|
blaxel/sandbox/client/models/success_response.py,sha256=JQbCUIdVJy_TJ3mp8IuvCGbKgCm_iZQMMrqn8uZkxCk,1874
|
357
|
-
blaxel/tools/__init__.py,sha256=
|
357
|
+
blaxel/tools/__init__.py,sha256=8uQI2fldDyd2ZFu2UB6PIq-5PpZB6O-2e9emknsGM8Q,11767
|
358
358
|
blaxel/tools/common.py,sha256=JGK052v_fvwWBFYnIArlBnFFViYyFrqdDn3gdVf53EU,1332
|
359
359
|
blaxel/tools/crewai.py,sha256=rPrRGwkXejunJQ6In1IsYAxJPNbr6d9EckXrSIHQods,638
|
360
360
|
blaxel/tools/googleadk.py,sha256=65qJysecgAMujxsyGxuCEVL0fWoR5I489DMiSA3ZaGs,2265
|
@@ -364,7 +364,7 @@ blaxel/tools/llamaindex.py,sha256=-gQ-C9V_h9a11J4ItsbWjXrCJOg0lRKsb98v9rVsNak,71
|
|
364
364
|
blaxel/tools/openai.py,sha256=GuFXkj6bXEwldyVr89jEsRAi5ihZUVEVe327QuWiGNs,653
|
365
365
|
blaxel/tools/pydantic.py,sha256=CvnNbAG_J4yBtA-XFI4lQrq3FYKjNd39hu841vZT004,1801
|
366
366
|
blaxel/tools/types.py,sha256=YPCGJ4vZDhqR0X2H_TWtc5chQScsC32nGTQdRKJlO8Y,707
|
367
|
-
blaxel-0.1.
|
368
|
-
blaxel-0.1.
|
369
|
-
blaxel-0.1.
|
370
|
-
blaxel-0.1.
|
367
|
+
blaxel-0.1.21.dist-info/METADATA,sha256=Zfjidi3oap0WZC-O7bUgyLNWzJwSiX4lFf63XQoyJ6Y,6702
|
368
|
+
blaxel-0.1.21.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
369
|
+
blaxel-0.1.21.dist-info/licenses/LICENSE,sha256=p5PNQvpvyDT_0aYBDgmV1fFI_vAD2aSV0wWG7VTgRis,1069
|
370
|
+
blaxel-0.1.21.dist-info/RECORD,,
|
File without changes
|
File without changes
|