Skip to content

Commit f01e8c2

Browse files
committed
🐛 FIX: Timeout parameter
1 parent b83987c commit f01e8c2

File tree

6 files changed

+6
-21
lines changed

6 files changed

+6
-21
lines changed

examples/agent/agent.run.mcp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def main():
2424
exit(1)
2525

2626
# Initialize Langbase client
27-
langbase = Langbase(api_key=langbase_api_key, timeout=500)
27+
langbase = Langbase(api_key=langbase_api_key)
2828

2929
# Run the agent with MCP server
3030
response = langbase.agent_run(

langbase/langbase.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ class Langbase:
3131
def __init__(
3232
self,
3333
api_key: Optional[str] = None,
34-
base_url: str = "https://api.langbase.com",
35-
timeout: int = 30
34+
base_url: str = "https://api.langbase.com"
3635
):
3736
"""
3837
Initialize the Langbase client.
@@ -41,7 +40,6 @@ def __init__(
4140
api_key: The API key for authentication. If not provided, it will be read
4241
from the LANGBASE_API_KEY environment variable.
4342
base_url: The base URL for the API.
44-
timeout: The timeout for API requests in seconds.
4543
4644
Raises:
4745
ValueError: If no API key is provided and LANGBASE_API_KEY is not set.
@@ -53,12 +51,10 @@ def __init__(
5351
)
5452

5553
self.base_url = base_url
56-
self.timeout = timeout
5754

5855
self.request = Request({
5956
"api_key": self.api_key,
60-
"base_url": self.base_url,
61-
"timeout": self.timeout
57+
"base_url": self.base_url
6258
})
6359

6460
# Initialize properties and methods
@@ -162,8 +158,7 @@ def run(
162158
if api_key:
163159
request = Request({
164160
"api_key": api_key,
165-
"base_url": self.parent.base_url,
166-
"timeout": self.parent.timeout
161+
"base_url": self.parent.base_url
167162
})
168163

169164
headers = {}
@@ -679,8 +674,7 @@ def parser(
679674
response = requests.post(
680675
f"{self.base_url}/v1/parser",
681676
headers={"Authorization": f"Bearer {self.api_key}"},
682-
files=files,
683-
timeout=self.timeout
677+
files=files
684678
)
685679

686680
if not response.ok:

langbase/request.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@ def __init__(self, config: Dict[str, Any]):
2929
config: Configuration dictionary containing:
3030
- api_key: API key for authentication
3131
- base_url: Base URL for the API
32-
- timeout: Timeout for requests in seconds (default: 30)
3332
"""
3433
self.config = config
3534
self.api_key = config.get("api_key", "")
3635
self.base_url = config.get("base_url", "")
37-
self.timeout = config.get("timeout", 30)
3836

3937
def build_url(self, endpoint: str) -> str:
4038
"""
@@ -107,7 +105,6 @@ def make_request(
107105
url=url,
108106
headers={k: v for k, v in headers.items() if k != 'Content-Type'},
109107
files=files,
110-
timeout=self.timeout,
111108
stream=stream
112109
)
113110
else:
@@ -116,7 +113,6 @@ def make_request(
116113
url=url,
117114
headers=headers,
118115
json=body if body else None,
119-
timeout=self.timeout,
120116
stream=stream
121117
)
122118
return response

langbase/types.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,6 @@ class LangbaseOptions(TypedDict, total=False):
467467
"""Options for initializing Langbase client."""
468468
api_key: str
469469
base_url: Literal['https://api.langbase.com', 'https://eu-api.langbase.com']
470-
timeout: int
471470

472471

473472
# Protocol for file-like objects

tests/test_langbase.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ def test_initialization_with_api_key(self):
2121
"""Test initialization with API key parameter."""
2222
self.assertEqual(self.lb.api_key, self.api_key)
2323
self.assertEqual(self.lb.base_url, "https://api.langbase.com")
24-
self.assertEqual(self.lb.timeout, 30)
2524

2625
@patch.dict(os.environ, {"LANGBASE_API_KEY": "env-api-key"}, clear=True)
2726
def test_initialization_with_env_var(self):

tests/test_request.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,14 @@ def setUp(self):
2020
"""Set up test fixtures."""
2121
self.config = {
2222
"api_key": "test-api-key",
23-
"base_url": "https://api.langbase.com",
24-
"timeout": 30
23+
"base_url": "https://api.langbase.com"
2524
}
2625
self.request = Request(self.config)
2726

2827
def test_initialization(self):
2928
"""Test initialization."""
3029
self.assertEqual(self.request.api_key, "test-api-key")
3130
self.assertEqual(self.request.base_url, "https://api.langbase.com")
32-
self.assertEqual(self.request.timeout, 30)
3331

3432
def test_build_url(self):
3533
"""Test build_url method."""
@@ -66,7 +64,6 @@ def test_make_request(self, mock_request):
6664
url="https://api.langbase.com/test",
6765
headers={"Authorization": "Bearer test-api-key"},
6866
json=None,
69-
timeout=30,
7067
stream=False
7168
)
7269
self.assertEqual(response, mock_response)

0 commit comments

Comments
 (0)