mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-15 14:08:00 +00:00
Merge branch 'main' into enable-vector-stores-files-api-tests
This commit is contained in:
commit
474671d462
12 changed files with 67 additions and 111 deletions
2
.github/workflows/README.md
vendored
2
.github/workflows/README.md
vendored
|
@ -1,6 +1,6 @@
|
||||||
# Llama Stack CI
|
# Llama Stack CI
|
||||||
|
|
||||||
Llama Stack uses GitHub Actions for Continous Integration (CI). Below is a table detailing what CI the project includes and the purpose.
|
Llama Stack uses GitHub Actions for Continuous Integration (CI). Below is a table detailing what CI the project includes and the purpose.
|
||||||
|
|
||||||
| Name | File | Purpose |
|
| Name | File | Purpose |
|
||||||
| ---- | ---- | ------- |
|
| ---- | ---- | ------- |
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
[](https://discord.gg/llama-stack)
|
[](https://discord.gg/llama-stack)
|
||||||
[](https://github.com/meta-llama/llama-stack/actions/workflows/unit-tests.yml?query=branch%3Amain)
|
[](https://github.com/meta-llama/llama-stack/actions/workflows/unit-tests.yml?query=branch%3Amain)
|
||||||
[](https://github.com/meta-llama/llama-stack/actions/workflows/integration-tests.yml?query=branch%3Amain)
|
[](https://github.com/meta-llama/llama-stack/actions/workflows/integration-tests.yml?query=branch%3Amain)
|
||||||

|
|
||||||
|
|
||||||
[**Quick Start**](https://llama-stack.readthedocs.io/en/latest/getting_started/index.html) | [**Documentation**](https://llama-stack.readthedocs.io/en/latest/index.html) | [**Colab Notebook**](./docs/getting_started.ipynb) | [**Discord**](https://discord.gg/llama-stack)
|
[**Quick Start**](https://llama-stack.readthedocs.io/en/latest/getting_started/index.html) | [**Documentation**](https://llama-stack.readthedocs.io/en/latest/index.html) | [**Colab Notebook**](./docs/getting_started.ipynb) | [**Discord**](https://discord.gg/llama-stack)
|
||||||
|
|
||||||
|
|
20
docs/_static/llama-stack-spec.html
vendored
20
docs/_static/llama-stack-spec.html
vendored
|
@ -15078,22 +15078,6 @@
|
||||||
"DPOAlignmentConfig": {
|
"DPOAlignmentConfig": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"reward_scale": {
|
|
||||||
"type": "number",
|
|
||||||
"description": "Scaling factor for the reward signal"
|
|
||||||
},
|
|
||||||
"reward_clip": {
|
|
||||||
"type": "number",
|
|
||||||
"description": "Maximum absolute value for reward clipping"
|
|
||||||
},
|
|
||||||
"epsilon": {
|
|
||||||
"type": "number",
|
|
||||||
"description": "Small value added for numerical stability"
|
|
||||||
},
|
|
||||||
"gamma": {
|
|
||||||
"type": "number",
|
|
||||||
"description": "Discount factor for future rewards"
|
|
||||||
},
|
|
||||||
"beta": {
|
"beta": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"description": "Temperature parameter for the DPO loss"
|
"description": "Temperature parameter for the DPO loss"
|
||||||
|
@ -15106,10 +15090,6 @@
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"required": [
|
"required": [
|
||||||
"reward_scale",
|
|
||||||
"reward_clip",
|
|
||||||
"epsilon",
|
|
||||||
"gamma",
|
|
||||||
"beta",
|
"beta",
|
||||||
"loss_type"
|
"loss_type"
|
||||||
],
|
],
|
||||||
|
|
18
docs/_static/llama-stack-spec.yaml
vendored
18
docs/_static/llama-stack-spec.yaml
vendored
|
@ -11163,20 +11163,6 @@ components:
|
||||||
DPOAlignmentConfig:
|
DPOAlignmentConfig:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
reward_scale:
|
|
||||||
type: number
|
|
||||||
description: Scaling factor for the reward signal
|
|
||||||
reward_clip:
|
|
||||||
type: number
|
|
||||||
description: >-
|
|
||||||
Maximum absolute value for reward clipping
|
|
||||||
epsilon:
|
|
||||||
type: number
|
|
||||||
description: >-
|
|
||||||
Small value added for numerical stability
|
|
||||||
gamma:
|
|
||||||
type: number
|
|
||||||
description: Discount factor for future rewards
|
|
||||||
beta:
|
beta:
|
||||||
type: number
|
type: number
|
||||||
description: Temperature parameter for the DPO loss
|
description: Temperature parameter for the DPO loss
|
||||||
|
@ -11186,10 +11172,6 @@ components:
|
||||||
description: The type of loss function to use for DPO
|
description: The type of loss function to use for DPO
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
required:
|
required:
|
||||||
- reward_scale
|
|
||||||
- reward_clip
|
|
||||||
- epsilon
|
|
||||||
- gamma
|
|
||||||
- beta
|
- beta
|
||||||
- loss_type
|
- loss_type
|
||||||
title: DPOAlignmentConfig
|
title: DPOAlignmentConfig
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
# External Providers Guide
|
# Creating External Providers
|
||||||
|
|
||||||
Llama Stack supports external providers that live outside of the main codebase. This allows you to:
|
|
||||||
- Create and maintain your own providers independently
|
|
||||||
- Share providers with others without contributing to the main codebase
|
|
||||||
- Keep provider-specific code separate from the core Llama Stack code
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
|
@ -55,17 +50,6 @@ Llama Stack supports two types of external providers:
|
||||||
1. **Remote Providers**: Providers that communicate with external services (e.g., cloud APIs)
|
1. **Remote Providers**: Providers that communicate with external services (e.g., cloud APIs)
|
||||||
2. **Inline Providers**: Providers that run locally within the Llama Stack process
|
2. **Inline Providers**: Providers that run locally within the Llama Stack process
|
||||||
|
|
||||||
## Known External Providers
|
|
||||||
|
|
||||||
Here's a list of known external providers that you can use with Llama Stack:
|
|
||||||
|
|
||||||
| Name | Description | API | Type | Repository |
|
|
||||||
|------|-------------|-----|------|------------|
|
|
||||||
| KubeFlow Training | Train models with KubeFlow | Post Training | Remote | [llama-stack-provider-kft](https://github.com/opendatahub-io/llama-stack-provider-kft) |
|
|
||||||
| KubeFlow Pipelines | Train models with KubeFlow Pipelines | Post Training | Inline **and** Remote | [llama-stack-provider-kfp-trainer](https://github.com/opendatahub-io/llama-stack-provider-kfp-trainer) |
|
|
||||||
| RamaLama | Inference models with RamaLama | Inference | Remote | [ramalama-stack](https://github.com/containers/ramalama-stack) |
|
|
||||||
| TrustyAI LM-Eval | Evaluate models with TrustyAI LM-Eval | Eval | Remote | [llama-stack-provider-lmeval](https://github.com/trustyai-explainability/llama-stack-provider-lmeval) |
|
|
||||||
|
|
||||||
### Remote Provider Specification
|
### Remote Provider Specification
|
||||||
|
|
||||||
Remote providers are used when you need to communicate with external services. Here's an example for a custom Ollama provider:
|
Remote providers are used when you need to communicate with external services. Here's an example for a custom Ollama provider:
|
||||||
|
@ -119,9 +103,9 @@ container_image: custom-vector-store:latest # optional
|
||||||
- `provider_data_validator`: Optional validator for provider data
|
- `provider_data_validator`: Optional validator for provider data
|
||||||
- `container_image`: Optional container image to use instead of pip packages
|
- `container_image`: Optional container image to use instead of pip packages
|
||||||
|
|
||||||
## Required Implementation
|
## Required Fields
|
||||||
|
|
||||||
## All Providers
|
### All Providers
|
||||||
|
|
||||||
All providers must contain a `get_provider_spec` function in their `provider` module. This is a standardized structure that Llama Stack expects and is necessary for getting things such as the config class. The `get_provider_spec` method returns a structure identical to the `adapter`. An example function may look like:
|
All providers must contain a `get_provider_spec` function in their `provider` module. This is a standardized structure that Llama Stack expects and is necessary for getting things such as the config class. The `get_provider_spec` method returns a structure identical to the `adapter`. An example function may look like:
|
||||||
|
|
||||||
|
@ -146,7 +130,7 @@ def get_provider_spec() -> ProviderSpec:
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Remote Providers
|
#### Remote Providers
|
||||||
|
|
||||||
Remote providers must expose a `get_adapter_impl()` function in their module that takes two arguments:
|
Remote providers must expose a `get_adapter_impl()` function in their module that takes two arguments:
|
||||||
1. `config`: An instance of the provider's config class
|
1. `config`: An instance of the provider's config class
|
||||||
|
@ -162,7 +146,7 @@ async def get_adapter_impl(
|
||||||
return OllamaInferenceAdapter(config)
|
return OllamaInferenceAdapter(config)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Inline Providers
|
#### Inline Providers
|
||||||
|
|
||||||
Inline providers must expose a `get_provider_impl()` function in their module that takes two arguments:
|
Inline providers must expose a `get_provider_impl()` function in their module that takes two arguments:
|
||||||
1. `config`: An instance of the provider's config class
|
1. `config`: An instance of the provider's config class
|
||||||
|
@ -189,7 +173,40 @@ Version: 0.1.0
|
||||||
Location: /path/to/venv/lib/python3.10/site-packages
|
Location: /path/to/venv/lib/python3.10/site-packages
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example using `external_providers_dir`: Custom Ollama Provider
|
## Best Practices
|
||||||
|
|
||||||
|
1. **Package Naming**: Use the prefix `llama-stack-provider-` for your provider packages to make them easily identifiable.
|
||||||
|
|
||||||
|
2. **Version Management**: Keep your provider package versioned and compatible with the Llama Stack version you're using.
|
||||||
|
|
||||||
|
3. **Dependencies**: Only include the minimum required dependencies in your provider package.
|
||||||
|
|
||||||
|
4. **Documentation**: Include clear documentation in your provider package about:
|
||||||
|
- Installation requirements
|
||||||
|
- Configuration options
|
||||||
|
- Usage examples
|
||||||
|
- Any limitations or known issues
|
||||||
|
|
||||||
|
5. **Testing**: Include tests in your provider package to ensure it works correctly with Llama Stack.
|
||||||
|
You can refer to the [integration tests
|
||||||
|
guide](https://github.com/meta-llama/llama-stack/blob/main/tests/integration/README.md) for more
|
||||||
|
information. Execute the test for the Provider type you are developing.
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
If your external provider isn't being loaded:
|
||||||
|
|
||||||
|
1. Check that `module` points to a published pip package with a top level `provider` module including `get_provider_spec`.
|
||||||
|
1. Check that the `external_providers_dir` path is correct and accessible.
|
||||||
|
2. Verify that the YAML files are properly formatted.
|
||||||
|
3. Ensure all required Python packages are installed.
|
||||||
|
4. Check the Llama Stack server logs for any error messages - turn on debug logging to get more
|
||||||
|
information using `LLAMA_STACK_LOGGING=all=debug`.
|
||||||
|
5. Verify that the provider package is installed in your Python environment if using `external_providers_dir`.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Example using `external_providers_dir`: Custom Ollama Provider
|
||||||
|
|
||||||
Here's a complete example of creating and using a custom Ollama provider:
|
Here's a complete example of creating and using a custom Ollama provider:
|
||||||
|
|
||||||
|
@ -241,7 +258,7 @@ external_providers_dir: ~/.llama/providers.d/
|
||||||
The provider will now be available in Llama Stack with the type `remote::custom_ollama`.
|
The provider will now be available in Llama Stack with the type `remote::custom_ollama`.
|
||||||
|
|
||||||
|
|
||||||
## Example using `module`: ramalama-stack
|
### Example using `module`: ramalama-stack
|
||||||
|
|
||||||
[ramalama-stack](https://github.com/containers/ramalama-stack) is a recognized external provider that supports installation via module.
|
[ramalama-stack](https://github.com/containers/ramalama-stack) is a recognized external provider that supports installation via module.
|
||||||
|
|
||||||
|
@ -266,35 +283,4 @@ additional_pip_packages:
|
||||||
|
|
||||||
No other steps are required other than `llama stack build` and `llama stack run`. The build process will use `module` to install all of the provider dependencies, retrieve the spec, etc.
|
No other steps are required other than `llama stack build` and `llama stack run`. The build process will use `module` to install all of the provider dependencies, retrieve the spec, etc.
|
||||||
|
|
||||||
The provider will now be available in Llama Stack with the type `remote::ramalama`.
|
The provider will now be available in Llama Stack with the type `remote::ramalama`.
|
||||||
|
|
||||||
## Best Practices
|
|
||||||
|
|
||||||
1. **Package Naming**: Use the prefix `llama-stack-provider-` for your provider packages to make them easily identifiable.
|
|
||||||
|
|
||||||
2. **Version Management**: Keep your provider package versioned and compatible with the Llama Stack version you're using.
|
|
||||||
|
|
||||||
3. **Dependencies**: Only include the minimum required dependencies in your provider package.
|
|
||||||
|
|
||||||
4. **Documentation**: Include clear documentation in your provider package about:
|
|
||||||
- Installation requirements
|
|
||||||
- Configuration options
|
|
||||||
- Usage examples
|
|
||||||
- Any limitations or known issues
|
|
||||||
|
|
||||||
5. **Testing**: Include tests in your provider package to ensure it works correctly with Llama Stack.
|
|
||||||
You can refer to the [integration tests
|
|
||||||
guide](https://github.com/meta-llama/llama-stack/blob/main/tests/integration/README.md) for more
|
|
||||||
information. Execute the test for the Provider type you are developing.
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
If your external provider isn't being loaded:
|
|
||||||
|
|
||||||
1. Check that `module` points to a published pip package with a top level `provider` module including `get_provider_spec`.
|
|
||||||
1. Check that the `external_providers_dir` path is correct and accessible.
|
|
||||||
2. Verify that the YAML files are properly formatted.
|
|
||||||
3. Ensure all required Python packages are installed.
|
|
||||||
4. Check the Llama Stack server logs for any error messages - turn on debug logging to get more
|
|
||||||
information using `LLAMA_STACK_LOGGING=all=debug`.
|
|
||||||
5. Verify that the provider package is installed in your Python environment if using `external_providers_dir`.
|
|
10
docs/source/providers/external/external-providers-list.md
vendored
Normal file
10
docs/source/providers/external/external-providers-list.md
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# Known External Providers
|
||||||
|
|
||||||
|
Here's a list of known external providers that you can use with Llama Stack:
|
||||||
|
|
||||||
|
| Name | Description | API | Type | Repository |
|
||||||
|
|------|-------------|-----|------|------------|
|
||||||
|
| KubeFlow Training | Train models with KubeFlow | Post Training | Remote | [llama-stack-provider-kft](https://github.com/opendatahub-io/llama-stack-provider-kft) |
|
||||||
|
| KubeFlow Pipelines | Train models with KubeFlow Pipelines | Post Training | Inline **and** Remote | [llama-stack-provider-kfp-trainer](https://github.com/opendatahub-io/llama-stack-provider-kfp-trainer) |
|
||||||
|
| RamaLama | Inference models with RamaLama | Inference | Remote | [ramalama-stack](https://github.com/containers/ramalama-stack) |
|
||||||
|
| TrustyAI LM-Eval | Evaluate models with TrustyAI LM-Eval | Eval | Remote | [llama-stack-provider-lmeval](https://github.com/trustyai-explainability/llama-stack-provider-lmeval) |
|
13
docs/source/providers/external/index.md
vendored
Normal file
13
docs/source/providers/external/index.md
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# External Providers
|
||||||
|
|
||||||
|
Llama Stack supports external providers that live outside of the main codebase. This allows you to:
|
||||||
|
- Create and maintain your own providers independently
|
||||||
|
- Share providers with others without contributing to the main codebase
|
||||||
|
- Keep provider-specific code separate from the core Llama Stack code
|
||||||
|
|
||||||
|
```{toctree}
|
||||||
|
:maxdepth: 1
|
||||||
|
|
||||||
|
external-providers-list
|
||||||
|
external-providers-guide
|
||||||
|
```
|
|
@ -15,7 +15,7 @@ Importantly, Llama Stack always strives to provide at least one fully inline pro
|
||||||
```{toctree}
|
```{toctree}
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|
||||||
external
|
external/index
|
||||||
openai
|
openai
|
||||||
inference/index
|
inference/index
|
||||||
agents/index
|
agents/index
|
||||||
|
|
|
@ -193,18 +193,10 @@ class DPOLossType(Enum):
|
||||||
class DPOAlignmentConfig(BaseModel):
|
class DPOAlignmentConfig(BaseModel):
|
||||||
"""Configuration for Direct Preference Optimization (DPO) alignment.
|
"""Configuration for Direct Preference Optimization (DPO) alignment.
|
||||||
|
|
||||||
:param reward_scale: Scaling factor for the reward signal
|
|
||||||
:param reward_clip: Maximum absolute value for reward clipping
|
|
||||||
:param epsilon: Small value added for numerical stability
|
|
||||||
:param gamma: Discount factor for future rewards
|
|
||||||
:param beta: Temperature parameter for the DPO loss
|
:param beta: Temperature parameter for the DPO loss
|
||||||
:param loss_type: The type of loss function to use for DPO
|
:param loss_type: The type of loss function to use for DPO
|
||||||
"""
|
"""
|
||||||
|
|
||||||
reward_scale: float
|
|
||||||
reward_clip: float
|
|
||||||
epsilon: float
|
|
||||||
gamma: float
|
|
||||||
beta: float
|
beta: float
|
||||||
loss_type: DPOLossType = DPOLossType.sigmoid
|
loss_type: DPOLossType = DPOLossType.sigmoid
|
||||||
|
|
||||||
|
|
|
@ -84,8 +84,6 @@ class VectorDBsRoutingTable(CommonRoutingTableImpl, VectorDBs):
|
||||||
|
|
||||||
async def unregister_vector_db(self, vector_db_id: str) -> None:
|
async def unregister_vector_db(self, vector_db_id: str) -> None:
|
||||||
existing_vector_db = await self.get_vector_db(vector_db_id)
|
existing_vector_db = await self.get_vector_db(vector_db_id)
|
||||||
if existing_vector_db is None:
|
|
||||||
raise VectorStoreNotFoundError(vector_db_id)
|
|
||||||
await self.unregister_object(existing_vector_db)
|
await self.unregister_object(existing_vector_db)
|
||||||
|
|
||||||
async def openai_retrieve_vector_store(
|
async def openai_retrieve_vector_store(
|
||||||
|
|
|
@ -36,7 +36,7 @@ def generate_ci_docs():
|
||||||
# Header section to preserve
|
# Header section to preserve
|
||||||
header = """# Llama Stack CI
|
header = """# Llama Stack CI
|
||||||
|
|
||||||
Llama Stack uses GitHub Actions for Continous Integration (CI). Below is a table detailing what CI the project includes and the purpose.
|
Llama Stack uses GitHub Actions for Continuous Integration (CI). Below is a table detailing what CI the project includes and the purpose.
|
||||||
|
|
||||||
| Name | File | Purpose |
|
| Name | File | Purpose |
|
||||||
| ---- | ---- | ------- |
|
| ---- | ---- | ------- |
|
||||||
|
|
|
@ -195,10 +195,6 @@ class TestPostTraining:
|
||||||
algorithm_config = DPOAlignmentConfig(
|
algorithm_config = DPOAlignmentConfig(
|
||||||
beta=0.1,
|
beta=0.1,
|
||||||
loss_type=DPOLossType.sigmoid, # Default loss type
|
loss_type=DPOLossType.sigmoid, # Default loss type
|
||||||
reward_scale=1.0, # Scaling factor for reward signal (neutral scaling)
|
|
||||||
reward_clip=5.0, # Maximum absolute value for reward clipping (prevents extreme values)
|
|
||||||
epsilon=1e-8, # Small value for numerical stability
|
|
||||||
gamma=1.0,
|
|
||||||
)
|
)
|
||||||
data_config = DataConfig(
|
data_config = DataConfig(
|
||||||
dataset_id=dataset.identifier,
|
dataset_id=dataset.identifier,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue