Skip to content

Commit 9e2c7b8

Browse files
authored
fix: remove local auth (#5)
1 parent 66f9050 commit 9e2c7b8

2 files changed

Lines changed: 0 additions & 34 deletions

File tree

src/litai/client.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,6 @@ def __init__(
112112
if lightning_user_id is not None:
113113
os.environ["LIGHTNING_USER_ID"] = lightning_user_id
114114

115-
if teamspace is None:
116-
teamspace = os.environ.get("LIGHTNING_TEAMSPACE")
117-
118-
self._authenticate(lightning_api_key, lightning_user_id)
119-
120115
if verbose not in [0, 1, 2]:
121116
raise ValueError("Verbose must be 0, 1, or 2.")
122117
self._verbose = verbose

tests/test_llm.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -255,32 +255,3 @@ def test_get_history(monkeypatch, capsys):
255255
{"role": "user", "content": "Hello, world!", "model": "mock-model"},
256256
{"role": "assistant", "content": "I am a mock model!", "model": "mock-model"},
257257
]
258-
259-
260-
def test_authenticate_method(monkeypatch):
261-
# Mock the login.Auth class
262-
mock_auth = MagicMock()
263-
mock_auth.api_key = "test-api-key"
264-
mock_auth.user_id = "test-user-id"
265-
266-
def mock_auth_constructor():
267-
return mock_auth
268-
269-
monkeypatch.setattr("litai.client.login.Auth", mock_auth_constructor)
270-
271-
# Test case 1: Both api_key and user_id provided
272-
LLM(model="openai/gpt-4", lightning_api_key="my-key", lightning_user_id="my-user-id")
273-
274-
# Verify that the authentication was called
275-
mock_auth.authenticate.assert_called_once()
276-
277-
# Verify that environment variables were set
278-
assert os.getenv("LIGHTNING_API_KEY") == "test-api-key"
279-
assert os.getenv("LIGHTNING_USER_ID") == "test-user-id"
280-
281-
# Test case 2: Neither api_key nor user_id provided
282-
mock_auth.reset_mock()
283-
LLM(model="openai/gpt-4")
284-
285-
# Verify that authentication was not called
286-
mock_auth.authenticate.assert_not_called()

0 commit comments

Comments
 (0)