-
Notifications
You must be signed in to change notification settings - Fork 785
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidating Memory tests under client-sdk
Summary: Part of #651 Requirements * add more integration tests in tests/client-sdk covering functionalities in llama-stack-apps Porting tests from * llama_stack/providers/tests/memory/test_memory.py Ensuring we cover some basic functions * MemoryResource src/llama_stack_client/resources/memory.py * MemoryBanksResource src/llama_stack_client/resources/memory_banks.py Test Plan: Run against the stack as lib ``` LLAMA_STACK_CONFIG=tests/client-sdk/memory/resources/run.yaml pytest tests/client-sdk/memory -v tests/client-sdk/memory/test_memory.py::test_memory_bank_list PASSED [ 20%] tests/client-sdk/memory/test_memory.py::test_memory_bank_register PASSED [ 40%] tests/client-sdk/memory/test_memory.py::test_memory_bank_unregister PASSED [ 60%] tests/client-sdk/memory/test_memory.py::test_memory_bank_insert_inline_and_query PASSED [ 80%] tests/client-sdk/memory/test_memory.py::test_memory_bank_insert_from_url_and_query PASSED [100%] ``` Run agianst the local server ``` LLAMA_STACK_BASE_URL=http://localhost:5000 pytest tests/client-sdk/memory -v tests/client-sdk/memory/test_memory.py::test_memory_bank_list PASSED [ 20%] tests/client-sdk/memory/test_memory.py::test_memory_bank_register PASSED [ 40%] tests/client-sdk/memory/test_memory.py::test_memory_bank_unregister PASSED [ 60%] tests/client-sdk/memory/test_memory.py::test_memory_bank_insert_inline_and_query PASSED [ 80%] tests/client-sdk/memory/test_memory.py::test_memory_bank_insert_from_url_and_query PASSED [100%] ```
- Loading branch information
1 parent
a6c206e
commit ff09600
Showing
3 changed files
with
339 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
version: '2' | ||
image_name: ollama | ||
docker_image: null | ||
conda_env: ollama | ||
apis: | ||
- agents | ||
- datasetio | ||
- eval | ||
- inference | ||
- memory | ||
- safety | ||
- scoring | ||
- telemetry | ||
providers: | ||
inference: | ||
- provider_id: ollama | ||
provider_type: remote::ollama | ||
config: | ||
url: ${env.OLLAMA_URL:http://localhost:11434} | ||
- provider_id: sentence-transformers | ||
provider_type: inline::sentence-transformers | ||
config: {} | ||
memory: | ||
- provider_id: faiss | ||
provider_type: inline::faiss | ||
config: | ||
kvstore: | ||
type: sqlite | ||
namespace: null | ||
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/ollama}/faiss_store.db | ||
safety: | ||
- provider_id: llama-guard | ||
provider_type: inline::llama-guard | ||
config: {} | ||
- provider_id: code-scanner | ||
provider_type: inline::code-scanner | ||
config: {} | ||
agents: | ||
- provider_id: meta-reference | ||
provider_type: inline::meta-reference | ||
config: | ||
persistence_store: | ||
type: sqlite | ||
namespace: null | ||
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/ollama}/agents_store.db | ||
telemetry: | ||
- provider_id: meta-reference | ||
provider_type: inline::meta-reference | ||
config: | ||
service_name: ${env.OTEL_SERVICE_NAME:llama-stack} | ||
sinks: ${env.TELEMETRY_SINKS:console,sqlite} | ||
sqlite_db_path: ${env.SQLITE_DB_PATH:~/.llama/distributions/ollama/trace_store.db} | ||
eval: | ||
- provider_id: meta-reference | ||
provider_type: inline::meta-reference | ||
config: {} | ||
datasetio: | ||
- provider_id: huggingface | ||
provider_type: remote::huggingface | ||
config: {} | ||
- provider_id: localfs | ||
provider_type: inline::localfs | ||
config: {} | ||
scoring: | ||
- provider_id: basic | ||
provider_type: inline::basic | ||
config: {} | ||
- provider_id: llm-as-judge | ||
provider_type: inline::llm-as-judge | ||
config: {} | ||
- provider_id: braintrust | ||
provider_type: inline::braintrust | ||
config: | ||
openai_api_key: ${env.OPENAI_API_KEY:} | ||
metadata_store: | ||
namespace: null | ||
type: sqlite | ||
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/ollama}/registry.db | ||
models: | ||
- metadata: {} | ||
model_id: ${env.INFERENCE_MODEL} | ||
provider_id: ollama | ||
provider_model_id: null | ||
model_type: llm | ||
- metadata: {} | ||
model_id: ${env.SAFETY_MODEL} | ||
provider_id: ollama | ||
provider_model_id: null | ||
model_type: llm | ||
- metadata: | ||
embedding_dimension: 384 | ||
model_id: all-MiniLM-L6-v2 | ||
provider_id: sentence-transformers | ||
provider_model_id: null | ||
model_type: embedding | ||
shields: | ||
- params: null | ||
shield_id: ${env.SAFETY_MODEL} | ||
provider_id: llama-guard | ||
provider_shield_id: null | ||
- params: null | ||
shield_id: CodeScanner | ||
provider_id: code-scanner | ||
provider_shield_id: null | ||
memory_banks: [] | ||
datasets: [] | ||
scoring_fns: [] | ||
eval_tasks: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Using Llama Stack as Library | ||
``` | ||
LLAMA_STACK_CONFIG=tests/client-sdk/memory/resources/run.yaml pytest tests/client-sdk/memory -v | ||
# Alternatively, you can use distribution template names e.g. "ollama", "together", "vllm" | ||
LLAMA_STACK_CONFIG=ollama pytest tests/client-sdk/memory -v | ||
``` | ||
|
||
# Using local Llama Stack server instance | ||
``` | ||
# Export Llama Stack naming vars | ||
export SAFETY_MODEL=meta-llama/Llama-Guard-3-1B | ||
export INFERENCE_MODEL="meta-llama/Llama-3.2-3B-Instruct" | ||
# Export Ollama naming vars | ||
export OLLAMA_INFERENCE_MODEL="llama3.2:3b-instruct-fp16" | ||
export OLLAMA_SAFETY_MODEL="llama-guard3:1b" | ||
# Start Ollama instance | ||
ollama run $OLLAMA_INFERENCE_MODEL --keepalive 60m | ||
ollama run $OLLAMA_SAFETY_MODEL --keepalive 60m | ||
# Start the Llama Stack server | ||
llama stack run ./llama_stack/templates/ollama/run-with-safety.yaml | ||
# Run the tests | ||
LLAMA_STACK_BASE_URL=http://localhost:5000 pytest tests/client-sdk/memory -v | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters