Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

test: update hf test to check if client closed

Krrish Dholakiaaa7f416b7f8a
diff --git a/tests/local_testing/test_text_completion.py b/tests/local_testing/test_text_completion.py
index 19588a9720f..cf78b4b3d6b 100644
--- a/tests/local_testing/test_text_completion.py
+++ b/tests/local_testing/test_text_completion.py
@@ -3969,14 +3969,15 @@ def test_completion_hf_prompt_array():
def test_text_completion_stream():
try:
- response = text_completion(
- model="huggingface/mistralai/Mistral-7B-v0.1",
- prompt="good morning",
- stream=True,
- max_tokens=10,
- )
- for chunk in response:
- print(f"chunk: {chunk}")
+ for _ in range(2): # check if closed client used
+ response = text_completion(
+ model="huggingface/mistralai/Mistral-7B-v0.1",
+ prompt="good morning",
+ stream=True,
+ max_tokens=10,
+ )
+ for chunk in response:
+ print(f"chunk: {chunk}")
except Exception as e:
pytest.fail(f"GOT exception for HF In streaming{e}")