mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-29 15:23:51 +00:00
a
This commit is contained in:
parent
bcdb6fcc15
commit
2788761f6e
5 changed files with 73 additions and 26 deletions
|
@ -235,9 +235,9 @@ Before finalizing documentation, verify:
|
||||||
[x] 14. `/Users/saip/Documents/GitHub/llama-stack/llama_stack/apis/scoring/scoring.py` - Scoring system
|
[x] 14. `/Users/saip/Documents/GitHub/llama-stack/llama_stack/apis/scoring/scoring.py` - Scoring system
|
||||||
[x] 15. `/Users/saip/Documents/GitHub/llama-stack/llama_stack/apis/scoring_functions/scoring_functions.py` - Scoring function definitions
|
[x] 15. `/Users/saip/Documents/GitHub/llama-stack/llama_stack/apis/scoring_functions/scoring_functions.py` - Scoring function definitions
|
||||||
[x] 16. `/Users/saip/Documents/GitHub/llama-stack/llama_stack/apis/benchmarks/benchmarks.py` - Benchmarking framework
|
[x] 16. `/Users/saip/Documents/GitHub/llama-stack/llama_stack/apis/benchmarks/benchmarks.py` - Benchmarking framework
|
||||||
17. `/Users/saip/Documents/GitHub/llama-stack/llama_stack/apis/shields/shields.py` - Safety shields
|
[x] 17. `/Users/saip/Documents/GitHub/llama-stack/llama_stack/apis/shields/shields.py` - Safety shields
|
||||||
18. `/Users/saip/Documents/GitHub/llama-stack/llama_stack/apis/batch_inference/batch_inference.py` - Batch inference operations
|
[x] 18. `/Users/saip/Documents/GitHub/llama-stack/llama_stack/apis/batch_inference/batch_inference.py` - Batch inference operations
|
||||||
19. `/Users/saip/Documents/GitHub/llama-stack/llama_stack/apis/synthetic_data_generation/synthetic_data_generation.py` - Data generation
|
[x] 19. `/Users/saip/Documents/GitHub/llama-stack/llama_stack/apis/synthetic_data_generation/synthetic_data_generation.py` - Data generation
|
||||||
20. `/Users/saip/Documents/GitHub/llama-stack/llama_stack/apis/telemetry/telemetry.py` - Telemetry and monitoring
|
20. `/Users/saip/Documents/GitHub/llama-stack/llama_stack/apis/telemetry/telemetry.py` - Telemetry and monitoring
|
||||||
21. `/Users/saip/Documents/GitHub/llama-stack/llama_stack/apis/providers/providers.py` - Provider management
|
21. `/Users/saip/Documents/GitHub/llama-stack/llama_stack/apis/providers/providers.py` - Provider management
|
||||||
22. `/Users/saip/Documents/GitHub/llama-stack/llama_stack/apis/inspect/inspect.py` - System inspection
|
22. `/Users/saip/Documents/GitHub/llama-stack/llama_stack/apis/inspect/inspect.py` - System inspection
|
||||||
|
|
28
docs/_static/llama-stack-spec.html
vendored
28
docs/_static/llama-stack-spec.html
vendored
|
@ -4912,7 +4912,7 @@
|
||||||
"post": {
|
"post": {
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "Response containing filtered synthetic data samples and optional statistics",
|
||||||
"content": {
|
"content": {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
"schema": {
|
"schema": {
|
||||||
|
@ -4937,7 +4937,7 @@
|
||||||
"tags": [
|
"tags": [
|
||||||
"SyntheticDataGeneration (Coming Soon)"
|
"SyntheticDataGeneration (Coming Soon)"
|
||||||
],
|
],
|
||||||
"description": "",
|
"description": "Generate synthetic data based on input dialogs and apply filtering.",
|
||||||
"parameters": [],
|
"parameters": [],
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
"content": {
|
"content": {
|
||||||
|
@ -10888,9 +10888,9 @@
|
||||||
"tool",
|
"tool",
|
||||||
"tool_group"
|
"tool_group"
|
||||||
],
|
],
|
||||||
"title": "ResourceType",
|
|
||||||
"const": "shield",
|
"const": "shield",
|
||||||
"default": "shield"
|
"default": "shield",
|
||||||
|
"description": "The resource type, always shield"
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
@ -10915,7 +10915,8 @@
|
||||||
"type": "object"
|
"type": "object"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"description": "(Optional) Configuration parameters for the shield"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
|
@ -10925,7 +10926,7 @@
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"title": "Shield",
|
"title": "Shield",
|
||||||
"description": "A safety shield resource that can be used to check content"
|
"description": "A safety shield resource that can be used to check content."
|
||||||
},
|
},
|
||||||
"Span": {
|
"Span": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
@ -16334,7 +16335,8 @@
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/components/schemas/Message"
|
"$ref": "#/components/schemas/Message"
|
||||||
}
|
},
|
||||||
|
"description": "List of conversation messages to use as input for synthetic data generation"
|
||||||
},
|
},
|
||||||
"filtering_function": {
|
"filtering_function": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
@ -16346,11 +16348,11 @@
|
||||||
"top_k_top_p",
|
"top_k_top_p",
|
||||||
"sigmoid"
|
"sigmoid"
|
||||||
],
|
],
|
||||||
"title": "FilteringFunction",
|
"description": "Type of filtering to apply to generated synthetic data samples"
|
||||||
"description": "The type of filtering function."
|
|
||||||
},
|
},
|
||||||
"model": {
|
"model": {
|
||||||
"type": "string"
|
"type": "string",
|
||||||
|
"description": "(Optional) The identifier of the model to use. The model must be registered with Llama Stack and available via the /models endpoint"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
|
@ -16389,7 +16391,8 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"description": "List of generated synthetic data samples that passed the filtering criteria"
|
||||||
},
|
},
|
||||||
"statistics": {
|
"statistics": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
@ -16414,7 +16417,8 @@
|
||||||
"type": "object"
|
"type": "object"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"description": "(Optional) Statistical information about the generation process and filtering results"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
|
|
26
docs/_static/llama-stack-spec.yaml
vendored
26
docs/_static/llama-stack-spec.yaml
vendored
|
@ -3475,7 +3475,8 @@ paths:
|
||||||
post:
|
post:
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: OK
|
description: >-
|
||||||
|
Response containing filtered synthetic data samples and optional statistics
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
|
@ -3492,7 +3493,8 @@ paths:
|
||||||
$ref: '#/components/responses/DefaultError'
|
$ref: '#/components/responses/DefaultError'
|
||||||
tags:
|
tags:
|
||||||
- SyntheticDataGeneration (Coming Soon)
|
- SyntheticDataGeneration (Coming Soon)
|
||||||
description: ''
|
description: >-
|
||||||
|
Generate synthetic data based on input dialogs and apply filtering.
|
||||||
parameters: []
|
parameters: []
|
||||||
requestBody:
|
requestBody:
|
||||||
content:
|
content:
|
||||||
|
@ -7851,9 +7853,9 @@ components:
|
||||||
- benchmark
|
- benchmark
|
||||||
- tool
|
- tool
|
||||||
- tool_group
|
- tool_group
|
||||||
title: ResourceType
|
|
||||||
const: shield
|
const: shield
|
||||||
default: shield
|
default: shield
|
||||||
|
description: The resource type, always shield
|
||||||
params:
|
params:
|
||||||
type: object
|
type: object
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
|
@ -7864,6 +7866,8 @@ components:
|
||||||
- type: string
|
- type: string
|
||||||
- type: array
|
- type: array
|
||||||
- type: object
|
- type: object
|
||||||
|
description: >-
|
||||||
|
(Optional) Configuration parameters for the shield
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
required:
|
required:
|
||||||
- identifier
|
- identifier
|
||||||
|
@ -7871,7 +7875,7 @@ components:
|
||||||
- type
|
- type
|
||||||
title: Shield
|
title: Shield
|
||||||
description: >-
|
description: >-
|
||||||
A safety shield resource that can be used to check content
|
A safety shield resource that can be used to check content.
|
||||||
Span:
|
Span:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
@ -11777,6 +11781,8 @@ components:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/Message'
|
$ref: '#/components/schemas/Message'
|
||||||
|
description: >-
|
||||||
|
List of conversation messages to use as input for synthetic data generation
|
||||||
filtering_function:
|
filtering_function:
|
||||||
type: string
|
type: string
|
||||||
enum:
|
enum:
|
||||||
|
@ -11786,10 +11792,13 @@ components:
|
||||||
- top_p
|
- top_p
|
||||||
- top_k_top_p
|
- top_k_top_p
|
||||||
- sigmoid
|
- sigmoid
|
||||||
title: FilteringFunction
|
description: >-
|
||||||
description: The type of filtering function.
|
Type of filtering to apply to generated synthetic data samples
|
||||||
model:
|
model:
|
||||||
type: string
|
type: string
|
||||||
|
description: >-
|
||||||
|
(Optional) The identifier of the model to use. The model must be registered
|
||||||
|
with Llama Stack and available via the /models endpoint
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
required:
|
required:
|
||||||
- dialogs
|
- dialogs
|
||||||
|
@ -11810,6 +11819,8 @@ components:
|
||||||
- type: string
|
- type: string
|
||||||
- type: array
|
- type: array
|
||||||
- type: object
|
- type: object
|
||||||
|
description: >-
|
||||||
|
List of generated synthetic data samples that passed the filtering criteria
|
||||||
statistics:
|
statistics:
|
||||||
type: object
|
type: object
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
|
@ -11820,6 +11831,9 @@ components:
|
||||||
- type: string
|
- type: string
|
||||||
- type: array
|
- type: array
|
||||||
- type: object
|
- type: object
|
||||||
|
description: >-
|
||||||
|
(Optional) Statistical information about the generation process and filtering
|
||||||
|
results
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
required:
|
required:
|
||||||
- synthetic_data
|
- synthetic_data
|
||||||
|
|
|
@ -19,7 +19,11 @@ class CommonShieldFields(BaseModel):
|
||||||
|
|
||||||
@json_schema_type
|
@json_schema_type
|
||||||
class Shield(CommonShieldFields, Resource):
|
class Shield(CommonShieldFields, Resource):
|
||||||
"""A safety shield resource that can be used to check content"""
|
"""A safety shield resource that can be used to check content.
|
||||||
|
|
||||||
|
:param params: (Optional) Configuration parameters for the shield
|
||||||
|
:param type: The resource type, always shield
|
||||||
|
"""
|
||||||
|
|
||||||
type: Literal[ResourceType.shield] = ResourceType.shield
|
type: Literal[ResourceType.shield] = ResourceType.shield
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,15 @@ from llama_stack.schema_utils import json_schema_type, webmethod
|
||||||
|
|
||||||
|
|
||||||
class FilteringFunction(Enum):
|
class FilteringFunction(Enum):
|
||||||
"""The type of filtering function."""
|
"""The type of filtering function.
|
||||||
|
|
||||||
|
:cvar none: No filtering applied, accept all generated synthetic data
|
||||||
|
:cvar random: Random sampling of generated data points
|
||||||
|
:cvar top_k: Keep only the top-k highest scoring synthetic data samples
|
||||||
|
:cvar top_p: Nucleus-style filtering, keep samples exceeding cumulative score threshold
|
||||||
|
:cvar top_k_top_p: Combined top-k and top-p filtering strategy
|
||||||
|
:cvar sigmoid: Apply sigmoid function for probability-based filtering
|
||||||
|
"""
|
||||||
|
|
||||||
none = "none"
|
none = "none"
|
||||||
random = "random"
|
random = "random"
|
||||||
|
@ -26,7 +34,12 @@ class FilteringFunction(Enum):
|
||||||
|
|
||||||
@json_schema_type
|
@json_schema_type
|
||||||
class SyntheticDataGenerationRequest(BaseModel):
|
class SyntheticDataGenerationRequest(BaseModel):
|
||||||
"""Request to generate synthetic data. A small batch of prompts and a filtering function"""
|
"""Request to generate synthetic data. A small batch of prompts and a filtering function
|
||||||
|
|
||||||
|
:param dialogs: List of conversation messages to use as input for synthetic data generation
|
||||||
|
:param filtering_function: Type of filtering to apply to generated synthetic data samples
|
||||||
|
:param model: (Optional) The identifier of the model to use. The model must be registered with Llama Stack and available via the /models endpoint
|
||||||
|
"""
|
||||||
|
|
||||||
dialogs: list[Message]
|
dialogs: list[Message]
|
||||||
filtering_function: FilteringFunction = FilteringFunction.none
|
filtering_function: FilteringFunction = FilteringFunction.none
|
||||||
|
@ -35,7 +48,11 @@ class SyntheticDataGenerationRequest(BaseModel):
|
||||||
|
|
||||||
@json_schema_type
|
@json_schema_type
|
||||||
class SyntheticDataGenerationResponse(BaseModel):
|
class SyntheticDataGenerationResponse(BaseModel):
|
||||||
"""Response from the synthetic data generation. Batch of (prompt, response, score) tuples that pass the threshold."""
|
"""Response from the synthetic data generation. Batch of (prompt, response, score) tuples that pass the threshold.
|
||||||
|
|
||||||
|
:param synthetic_data: List of generated synthetic data samples that passed the filtering criteria
|
||||||
|
:param statistics: (Optional) Statistical information about the generation process and filtering results
|
||||||
|
"""
|
||||||
|
|
||||||
synthetic_data: list[dict[str, Any]]
|
synthetic_data: list[dict[str, Any]]
|
||||||
statistics: dict[str, Any] | None = None
|
statistics: dict[str, Any] | None = None
|
||||||
|
@ -48,4 +65,12 @@ class SyntheticDataGeneration(Protocol):
|
||||||
dialogs: list[Message],
|
dialogs: list[Message],
|
||||||
filtering_function: FilteringFunction = FilteringFunction.none,
|
filtering_function: FilteringFunction = FilteringFunction.none,
|
||||||
model: str | None = None,
|
model: str | None = None,
|
||||||
) -> SyntheticDataGenerationResponse: ...
|
) -> SyntheticDataGenerationResponse:
|
||||||
|
"""Generate synthetic data based on input dialogs and apply filtering.
|
||||||
|
|
||||||
|
:param dialogs: List of conversation messages to use as input for synthetic data generation
|
||||||
|
:param filtering_function: Type of filtering to apply to generated synthetic data samples
|
||||||
|
:param model: (Optional) The identifier of the model to use. The model must be registered with Llama Stack and available via the /models endpoint
|
||||||
|
:returns: Response containing filtered synthetic data samples and optional statistics
|
||||||
|
"""
|
||||||
|
...
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue