Skip to content

Commit 4a87ceb

Browse files
authored
Use Phi isntead (#8982)
1 parent f741df8 commit 4a87ceb

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

test/components/generators/chat/test_hugging_face_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ def test_run_with_tools(self, mock_check_valid_model, tools):
570570
def test_live_run_serverless(self):
571571
generator = HuggingFaceAPIChatGenerator(
572572
api_type=HFGenerationAPIType.SERVERLESS_INFERENCE_API,
573-
api_params={"model": "mistralai/Mistral-7B-Instruct-v0.3"},
573+
api_params={"model": "microsoft/Phi-3.5-mini-instruct"},
574574
generation_kwargs={"max_tokens": 20},
575575
)
576576

@@ -598,7 +598,7 @@ def test_live_run_serverless(self):
598598
def test_live_run_serverless_streaming(self):
599599
generator = HuggingFaceAPIChatGenerator(
600600
api_type=HFGenerationAPIType.SERVERLESS_INFERENCE_API,
601-
api_params={"model": "mistralai/Mistral-7B-Instruct-v0.3"},
601+
api_params={"model": "microsoft/Phi-3.5-mini-instruct"},
602602
generation_kwargs={"max_tokens": 20},
603603
streaming_callback=streaming_callback_handler,
604604
)
@@ -825,7 +825,7 @@ async def test_run_async_with_tools(self, tools, mock_check_valid_model):
825825
async def test_live_run_async_serverless(self):
826826
generator = HuggingFaceAPIChatGenerator(
827827
api_type=HFGenerationAPIType.SERVERLESS_INFERENCE_API,
828-
api_params={"model": "mistralai/Mistral-7B-Instruct-v0.3"},
828+
api_params={"model": "microsoft/Phi-3.5-mini-instruct"},
829829
generation_kwargs={"max_tokens": 20},
830830
)
831831

test/components/generators/test_hugging_face_api.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,14 +298,14 @@ def mock_iter(self):
298298
def test_run_serverless(self):
299299
generator = HuggingFaceAPIGenerator(
300300
api_type=HFGenerationAPIType.SERVERLESS_INFERENCE_API,
301-
api_params={"model": "mistralai/Mistral-7B-Instruct-v0.3"},
301+
api_params={"model": "microsoft/Phi-3.5-mini-instruct"},
302302
generation_kwargs={"max_new_tokens": 20},
303303
)
304304

305305
# You must include the instruction tokens in the prompt. HF does not add them automatically.
306306
# Without them the model will behave erratically.
307307
response = generator.run(
308-
"<s>[INST] What is the capital of France? Be concise only provide the capital, nothing else.[/INST]"
308+
"<|user|>\nWhat is the capital of France? Be concise only provide the capital, nothing else.<|end|>\n<|assistant|>\n"
309309
)
310310

311311
# Assert that the response contains the generated replies
@@ -329,12 +329,14 @@ def test_run_serverless(self):
329329
def test_live_run_streaming_check_completion_start_time(self):
330330
generator = HuggingFaceAPIGenerator(
331331
api_type=HFGenerationAPIType.SERVERLESS_INFERENCE_API,
332-
api_params={"model": "HuggingFaceH4/zephyr-7b-beta"},
332+
api_params={"model": "microsoft/Phi-3.5-mini-instruct"},
333333
generation_kwargs={"max_new_tokens": 30},
334334
streaming_callback=streaming_callback_handler,
335335
)
336336

337-
results = generator.run("You are a helpful agent that answers questions. What is the capital of France?")
337+
results = generator.run(
338+
"<|user|>\nWhat is the capital of France? Be concise only provide the capital, nothing else.<|end|>\n<|assistant|>\n"
339+
)
338340

339341
# Assert that the response contains the generated replies
340342
assert "replies" in results

0 commit comments

Comments
 (0)