Skip to content

Commit 85de916

Browse files
authored
feat: add billing (#47)
* feat: add billing * nit: update sdk * fix: test
1 parent 3b819a1 commit 85de916

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
lightning_sdk >= 2025.08.08
1+
lightning_sdk >= 2025.08.08.post1

src/litai/llm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def __init__(
8080
self,
8181
model: Optional[ModelLiteral] = None,
8282
fallback_models: Optional[List[str]] = None,
83-
teamspace: Optional[str] = None,
83+
billing: Optional[str] = None,
8484
max_retries: int = 3,
8585
api_key: Optional[str] = None,
8686
enable_async: Optional[bool] = False,
@@ -93,7 +93,7 @@ def __init__(
9393
model (Optional[str]): The main model to use. Defaults to openai/gpt-4o.
9494
fallback_models (Optional[List[str]]): A list of fallback models to use
9595
if the main model fails. Defaults to None.
96-
teamspace (Optional[List[str]]): Teamspace used for billing.
96+
billing (Optional[List[str]]): Teamspace used for billing.
9797
max_retries (int): The maximum number of retries for API requests. Defaults to 3.
9898
api_key (Optional[str]): The API key for Lightning AI. Defaults to None.
9999
enable_async (Optional[bool]): Enable async requests. Defaults to True.
@@ -113,7 +113,7 @@ def __init__(
113113

114114
self._model = model
115115
self._fallback_models = fallback_models or []
116-
self._teamspace = teamspace
116+
self._teamspace = billing
117117
self._enable_async = enable_async
118118
self._verbose = verbose
119119
self.max_retries = max_retries

tests/test_llm.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ def test_default_model(monkeypatch):
4848
assert llm.model == "openai/gpt-4o"
4949

5050

51+
def test_billing(monkeypatch):
52+
"""Test billing."""
53+
mock_llm_instance = MagicMock()
54+
monkeypatch.setattr("litai.llm.SDKLLM", mock_llm_instance)
55+
llm = LLM(model="openai/gpt-4", billing="my-org/my-teamspace")
56+
57+
assert llm._teamspace == "my-org/my-teamspace"
58+
59+
5160
@patch("litai.llm.SDKLLM")
5261
def test_cloudy_models_preload(mock_sdkllm):
5362
"""Test that CLOUDY_MODELS are preloaded during LLM initialization."""
@@ -327,7 +336,7 @@ def test_llm_classify_method(mock_sdkllm_class):
327336
assert result == "positive"
328337

329338
# Test another classification
330-
result = llm.classify("this movie was awful.", ["positive", "negative"])
339+
result = llm.classify("this movie was really bad.", ["positive", "negative"])
331340
assert result == "negative"
332341

333342
# Test with multiple classes

0 commit comments

Comments
 (0)