Skip to content

Commit 218e6d4

Browse files
committed
Refactor: Bump up llama-stack 0.4.3
1 parent 29422b4 commit 218e6d4

34 files changed

Lines changed: 1205 additions & 1376 deletions

File tree

README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Manual procedure, assuming an existing PyPI API token available:
3535
### Prerequisites
3636

3737
- Python >= 3.12
38-
- Llama Stack == 0.2.22
38+
- Llama Stack == 0.4.3
3939
- pydantic >= 2.10.6
4040

4141
### Installation
@@ -163,13 +163,13 @@ shields:
163163
164164
```bash
165165
# Test the redaction shield
166-
curl -X POST "http://localhost:8321/v1/safety/run_shield" \
166+
curl -X POST "http://localhost:8321/v1/safety/run-shield" \
167167
-H "Content-Type: application/json" \
168168
-d '{
169169
"shield_id": "redaction-shield",
170170
"messages": [
171171
{
172-
"role": "user",
172+
"role": "user",
173173
"content": "My API key is abc123xyz and password is secret456"
174174
}
175175
]
@@ -180,11 +180,8 @@ curl -X POST "http://localhost:8321/v1/safety/run_shield" \
180180
1. **Create provider directory**
181181
```bash
182182
mkdir -p ./providers.d/inline/safety/
183-
mkdir -p ./providers.d/remote/tool_runtime/
184183
curl -o ./providers.d/inline/safety/lightspeed_question_validity.yaml https://raw.githubusercontent.com/lightspeed-core/lightspeed- providers/refs/heads/main/resources/external_providers/inline/safety/lightspeed_question_validity.yaml
185-
curl -o ./providers.d/inline/safety/lightspeed_question_validity.yaml https://raw.githubusercontent.com/lightspeed-core/lightspeed- providers/refs/heads/main/resources/external_providers/inline/safety/lightspeed_redaction.yaml
186-
curl -o ./providers.d/remote/tool_runtime/lightspeed.yaml https://raw.githubusercontent.com/lightspeed-core/lightspeed-providers/refs/heads/main/resources/external_providers/remote/tool_runtime/lightspeed.yaml
187-
184+
curl -o ./providers.d/inline/safety/lightspeed_question_validity.yaml https://raw.githubusercontent.com/lightspeed-core/lightspeed- providers/refs/heads/main/resources/external_providers/inline/safety/lightspeed_redaction.yaml
188185
```
189186
3. **Add external provider definition**
190187
```yaml

lightspeed_stack_providers/providers/inline/agents/lightspeed_inline_agent/README.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,32 @@ agents:
1717
- provider_id: lightspeed_inline_agent
1818
provider_type: inline::lightspeed_inline_agent
1919
config:
20-
persistence_store:
21-
type: sqlite
22-
namespace: null
23-
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ollama}/agents_store.db
24-
responses_store:
25-
type: sqlite
26-
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ollama}/responses_store.db
20+
persistence:
21+
agent_state:
22+
namespace: lightspeed_agents
23+
backend: kv_default
24+
responses:
25+
table_name: lightspeed_responses
26+
backend: sql_default
2727
tools_filter:
28-
# Optional: Whether to enable tools filtering, default value is true
28+
# Optional: Whether to enable tools filtering, default value is true
2929
enabled: true
3030
# Optional: The model to use for filtering, the default value is the inference model used
3131
model_id: ${env.INFERENCE_MODEL_FILTER:=}
32-
# Optional: From how much tools we start filtering, default value is 10
32+
# Optional: From how much tools we start filtering, default value is 10
3333
min_tools: 10
3434
# Optional: the file path of the system prompt, default value is None
3535
system_prompt_path: ${env.FILTER_SYSTEM_PROMPT_PATH:=}
36-
# Optional: the system prompt if not in a file,
36+
# Optional: the system prompt if not in a file,
3737
# when system_prompt_path is defined system_prompt will be the content of the indicated file
38-
# when system_prompt is empty, the default filtering system prompt is used
38+
# when system_prompt is empty, the default filtering system prompt is used
3939
system_prompt: ${env.FILTER_SYSTEM_PROMPT:=}
40-
# Optional: tools to always include, for example rag tools, to not be filtered out,
40+
# Optional: tools to always include, for example rag tools, to not be filtered out,
4141
# the default is an empty list
4242
always_include_tools:
43-
- knowledge_search
43+
- knowledge_search
44+
# Optional: Override temperature for this agent (default: None)
45+
chatbot_temperature_override: 1.0
4446
...
4547
external_providers_dir: ~/.llama/distributions/ollama/external_providers/
4648
```

lightspeed_stack_providers/providers/inline/agents/lightspeed_inline_agent/__init__.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
from typing import Any
22

3-
from llama_stack.providers.datatypes import Api
3+
from llama_stack.core.datatypes import AccessRule
4+
from llama_stack_api import Api
45

56
from .config import LightspeedAgentsImplConfig
67

78

8-
async def get_provider_impl(config: LightspeedAgentsImplConfig, deps: dict[Api, Any]):
9+
async def get_provider_impl(
10+
config: LightspeedAgentsImplConfig,
11+
deps: dict[Api, Any],
12+
policy: list[AccessRule],
13+
):
914
# Configure litellm to drop unsupported params for models that reject them (e.g., top_p).
1015
# This is safe to set globally since it only affects models that don't support these params.
1116
import litellm
@@ -18,10 +23,13 @@ async def get_provider_impl(config: LightspeedAgentsImplConfig, deps: dict[Api,
1823
config,
1924
deps[Api.inference],
2025
deps[Api.vector_io],
21-
deps[Api.safety],
26+
deps.get(Api.safety),
2227
deps[Api.tool_runtime],
2328
deps[Api.tool_groups],
24-
[],
29+
deps[Api.conversations],
30+
deps[Api.prompts],
31+
deps[Api.files],
32+
policy,
2533
)
2634
await impl.initialize()
2735
return impl

lightspeed_stack_providers/providers/inline/agents/lightspeed_inline_agent/agent_instance.py

Lines changed: 0 additions & 199 deletions
This file was deleted.

0 commit comments

Comments
 (0)