From 8ba29b19f2f4e0335273ed0c2696c5e7be22543b Mon Sep 17 00:00:00 2001 From: Derek Slager Date: Mon, 30 Dec 2024 14:19:05 -0800 Subject: [PATCH 1/2] Minor Quick Start documentation updates. (#692) Clarifying Python version requirement, fixing a sample command. --- docs/source/getting_started/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/getting_started/index.md b/docs/source/getting_started/index.md index 04ba6e4e4..d7c3fe9e5 100644 --- a/docs/source/getting_started/index.md +++ b/docs/source/getting_started/index.md @@ -43,7 +43,7 @@ Configuration for this is available at `distributions/ollama/run.yaml`. ### 3. Use the Llama Stack client SDK -You can interact with the Llama Stack server using various client SDKs. We will use the Python SDK which you can install using: +You can interact with the Llama Stack server using various client SDKs. We will use the Python SDK which you can install using the following command. Note that you must be using Python 3.10 or newer: ```bash pip install llama-stack-client ``` @@ -62,7 +62,7 @@ llama-stack-client models list You can test basic Llama inference completion using the CLI too. ```bash -llama-stack-client +llama-stack-client \ inference chat-completion \ --message "hello, what model are you?" ``` From 7c1e3daa75a01b1f05daba8da88c3f797da50ed1 Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Mon, 30 Dec 2024 16:25:46 -0800 Subject: [PATCH 2/2] [bugfix] fix meta-reference agents w/ safety multiple model loading pytest (#694) # What does this PR do? - Fix broken pytest for meta-reference's agents - Safety model needs to be registered to a different provider id from inference model in order to be recognized ## Test Plan ``` torchrun $CONDA_PREFIX/bin/pytest -v -s llama_stack/providers/tests/agents/test_agents.py -m "meta_reference" --safety-shield meta-llama/Llama-Guard-3-1B --inference-model meta-llama/Llama-3.1-8B-Instruct ``` **Before** image **After** image **Other test not broken** ``` pytest -v -s llama_stack/providers/tests/agents/test_agents.py -m "together" --safety-shield meta-llama/Llama-Guard-3-8B --inference-model meta-llama/Llama-3.1-405B-Instruct-FP8 ``` ## Sources Please link relevant resources if necessary. ## Before submitting - [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case). - [ ] Ran pre-commit to handle lint / formatting issues. - [ ] Read the [contributor guideline](https://github.com/meta-llama/llama-stack/blob/main/CONTRIBUTING.md), Pull Request section? - [ ] Updated relevant documentation. - [ ] Wrote necessary unit or integration tests. --- .../providers/tests/agents/fixtures.py | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/llama_stack/providers/tests/agents/fixtures.py b/llama_stack/providers/tests/agents/fixtures.py index 13c250439..9f8e7a12b 100644 --- a/llama_stack/providers/tests/agents/fixtures.py +++ b/llama_stack/providers/tests/agents/fixtures.py @@ -81,14 +81,28 @@ async def agents_stack(request, inference_model, safety_shield): inference_models = ( inference_model if isinstance(inference_model, list) else [inference_model] ) - models = [ - ModelInput( - model_id=model, - model_type=ModelType.llm, - provider_id=providers["inference"][0].provider_id, + + # NOTE: meta-reference provider needs 1 provider per model, lookup provider_id from provider config + model_to_provider_id = {} + for provider in providers["inference"]: + if "model" in provider.config: + model_to_provider_id[provider.config["model"]] = provider.provider_id + + models = [] + for model in inference_models: + if model in model_to_provider_id: + provider_id = model_to_provider_id[model] + else: + provider_id = providers["inference"][0].provider_id + + models.append( + ModelInput( + model_id=model, + model_type=ModelType.llm, + provider_id=provider_id, + ) ) - for model in inference_models - ] + models.append( ModelInput( model_id="all-MiniLM-L6-v2",