Remove llama-guard in Cerebras template & improve agent test (#798)

# What does this PR do?

- fix cerebras template
- fix agent test case without shields

## Test Plan

<img width="1261" alt="image"
src="https://github.com/user-attachments/assets/04381f85-9192-4fc6-984b-c9bec99bdb82"
/>

```
llama stack run ./llama_stack/templates/cerebras/run.yaml 

LLAMA_STACK_BASE_URL="http://localhost:8321" pytest -v tests/client-sdk/ --html=report.html --self-contained-html
```

## 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.
This commit is contained in:
Xi Yan 2025-01-16 18:11:35 -08:00 committed by GitHub
parent 0fefd4390a
commit 38009631bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 15 deletions

View file

@ -9,15 +9,11 @@ from pathlib import Path
from llama_models.sku_list import all_registered_models
from llama_stack.apis.models.models import ModelType
from llama_stack.distribution.datatypes import (
ModelInput,
Provider,
ShieldInput,
ToolGroupInput,
)
from llama_stack.distribution.datatypes import ModelInput, Provider, ToolGroupInput
from llama_stack.providers.inline.inference.sentence_transformers import (
SentenceTransformersInferenceConfig,
)
from llama_stack.providers.inline.memory.faiss.config import FaissImplConfig
from llama_stack.providers.remote.inference.cerebras import CerebrasImplConfig
from llama_stack.providers.remote.inference.cerebras.cerebras import model_aliases
from llama_stack.templates.template import DistributionTemplate, RunConfigSettings
@ -41,6 +37,7 @@ def get_distribution_template() -> DistributionTemplate:
],
}
name = "cerebras"
inference_provider = Provider(
provider_id="cerebras",
provider_type="remote::cerebras",
@ -71,6 +68,11 @@ def get_distribution_template() -> DistributionTemplate:
"embedding_dimension": 384,
},
)
memory_provider = Provider(
provider_id="faiss",
provider_type="inline::faiss",
config=FaissImplConfig.sample_run_config(f"distributions/{name}"),
)
default_tool_groups = [
ToolGroupInput(
toolgroup_id="builtin::websearch",
@ -98,9 +100,10 @@ def get_distribution_template() -> DistributionTemplate:
"run.yaml": RunConfigSettings(
provider_overrides={
"inference": [inference_provider, embedding_provider],
"memory": [memory_provider],
},
default_models=default_models + [embedding_model],
default_shields=[ShieldInput(shield_id="meta-llama/Llama-Guard-3-8B")],
default_shields=[],
default_tool_groups=default_tool_groups,
),
},