mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-18 15:27:16 +00:00
Kill the notion of shield_type
This commit is contained in:
parent
09269e2a44
commit
b1c3a95485
20 changed files with 87 additions and 161 deletions
|
@ -21,7 +21,7 @@
|
|||
"info": {
|
||||
"title": "[DRAFT] Llama Stack Specification",
|
||||
"version": "0.0.1",
|
||||
"description": "This is the specification of the llama stack that provides\n a set of endpoints and their corresponding interfaces that are tailored to\n best leverage Llama Models. The specification is still in draft and subject to change.\n Generated at 2024-11-12 11:16:58.657871"
|
||||
"description": "This is the specification of the llama stack that provides\n a set of endpoints and their corresponding interfaces that are tailored to\n best leverage Llama Models. The specification is still in draft and subject to change.\n Generated at 2024-11-12 11:39:48.665782"
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
|
@ -5743,9 +5743,6 @@
|
|||
"const": "shield",
|
||||
"default": "shield"
|
||||
},
|
||||
"shield_type": {
|
||||
"$ref": "#/components/schemas/ShieldType"
|
||||
},
|
||||
"params": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
|
@ -5777,20 +5774,10 @@
|
|||
"identifier",
|
||||
"provider_resource_id",
|
||||
"provider_id",
|
||||
"type",
|
||||
"shield_type"
|
||||
"type"
|
||||
],
|
||||
"title": "A safety shield resource that can be used to check content"
|
||||
},
|
||||
"ShieldType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"generic_content_shield",
|
||||
"llama_guard",
|
||||
"code_scanner",
|
||||
"prompt_guard"
|
||||
]
|
||||
},
|
||||
"Trace": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -7262,9 +7249,6 @@
|
|||
"shield_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"shield_type": {
|
||||
"$ref": "#/components/schemas/ShieldType"
|
||||
},
|
||||
"provider_shield_id": {
|
||||
"type": "string"
|
||||
},
|
||||
|
@ -7299,8 +7283,7 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"shield_id",
|
||||
"shield_type"
|
||||
"shield_id"
|
||||
]
|
||||
},
|
||||
"RunEvalRequest": {
|
||||
|
@ -7854,13 +7837,19 @@
|
|||
],
|
||||
"tags": [
|
||||
{
|
||||
"name": "Inference"
|
||||
"name": "MemoryBanks"
|
||||
},
|
||||
{
|
||||
"name": "BatchInference"
|
||||
},
|
||||
{
|
||||
"name": "Agents"
|
||||
},
|
||||
{
|
||||
"name": "Telemetry"
|
||||
"name": "Inference"
|
||||
},
|
||||
{
|
||||
"name": "DatasetIO"
|
||||
},
|
||||
{
|
||||
"name": "Eval"
|
||||
|
@ -7869,43 +7858,37 @@
|
|||
"name": "Models"
|
||||
},
|
||||
{
|
||||
"name": "Inspect"
|
||||
},
|
||||
{
|
||||
"name": "EvalTasks"
|
||||
"name": "PostTraining"
|
||||
},
|
||||
{
|
||||
"name": "ScoringFunctions"
|
||||
},
|
||||
{
|
||||
"name": "Memory"
|
||||
},
|
||||
{
|
||||
"name": "Safety"
|
||||
},
|
||||
{
|
||||
"name": "DatasetIO"
|
||||
},
|
||||
{
|
||||
"name": "MemoryBanks"
|
||||
"name": "Datasets"
|
||||
},
|
||||
{
|
||||
"name": "Shields"
|
||||
},
|
||||
{
|
||||
"name": "PostTraining"
|
||||
"name": "Telemetry"
|
||||
},
|
||||
{
|
||||
"name": "Datasets"
|
||||
"name": "Inspect"
|
||||
},
|
||||
{
|
||||
"name": "Scoring"
|
||||
"name": "Safety"
|
||||
},
|
||||
{
|
||||
"name": "SyntheticDataGeneration"
|
||||
},
|
||||
{
|
||||
"name": "BatchInference"
|
||||
"name": "Memory"
|
||||
},
|
||||
{
|
||||
"name": "Scoring"
|
||||
},
|
||||
{
|
||||
"name": "EvalTasks"
|
||||
},
|
||||
{
|
||||
"name": "BuiltinTool",
|
||||
|
@ -8255,10 +8238,6 @@
|
|||
"name": "Shield",
|
||||
"description": "A safety shield resource that can be used to check content\n\n<SchemaDefinition schemaRef=\"#/components/schemas/Shield\" />"
|
||||
},
|
||||
{
|
||||
"name": "ShieldType",
|
||||
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/ShieldType\" />"
|
||||
},
|
||||
{
|
||||
"name": "Trace",
|
||||
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/Trace\" />"
|
||||
|
@ -8614,7 +8593,6 @@
|
|||
"Session",
|
||||
"Shield",
|
||||
"ShieldCallStep",
|
||||
"ShieldType",
|
||||
"SpanEndPayload",
|
||||
"SpanStartPayload",
|
||||
"SpanStatus",
|
||||
|
|
|
@ -2227,11 +2227,8 @@ components:
|
|||
type: string
|
||||
shield_id:
|
||||
type: string
|
||||
shield_type:
|
||||
$ref: '#/components/schemas/ShieldType'
|
||||
required:
|
||||
- shield_id
|
||||
- shield_type
|
||||
type: object
|
||||
RestAPIExecutionConfig:
|
||||
additionalProperties: false
|
||||
|
@ -2698,8 +2695,6 @@ components:
|
|||
type: string
|
||||
provider_resource_id:
|
||||
type: string
|
||||
shield_type:
|
||||
$ref: '#/components/schemas/ShieldType'
|
||||
type:
|
||||
const: shield
|
||||
default: shield
|
||||
|
@ -2709,7 +2704,6 @@ components:
|
|||
- provider_resource_id
|
||||
- provider_id
|
||||
- type
|
||||
- shield_type
|
||||
title: A safety shield resource that can be used to check content
|
||||
type: object
|
||||
ShieldCallStep:
|
||||
|
@ -2736,13 +2730,6 @@ components:
|
|||
- step_id
|
||||
- step_type
|
||||
type: object
|
||||
ShieldType:
|
||||
enum:
|
||||
- generic_content_shield
|
||||
- llama_guard
|
||||
- code_scanner
|
||||
- prompt_guard
|
||||
type: string
|
||||
SpanEndPayload:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
|
@ -3397,7 +3384,7 @@ info:
|
|||
description: "This is the specification of the llama stack that provides\n \
|
||||
\ a set of endpoints and their corresponding interfaces that are tailored\
|
||||
\ to\n best leverage Llama Models. The specification is still in\
|
||||
\ draft and subject to change.\n Generated at 2024-11-12 11:16:58.657871"
|
||||
\ draft and subject to change.\n Generated at 2024-11-12 11:39:48.665782"
|
||||
title: '[DRAFT] Llama Stack Specification'
|
||||
version: 0.0.1
|
||||
jsonSchemaDialect: https://json-schema.org/draft/2020-12/schema
|
||||
|
@ -4761,24 +4748,24 @@ security:
|
|||
servers:
|
||||
- url: http://any-hosted-llama-stack.com
|
||||
tags:
|
||||
- name: Inference
|
||||
- name: MemoryBanks
|
||||
- name: BatchInference
|
||||
- name: Agents
|
||||
- name: Telemetry
|
||||
- name: Inference
|
||||
- name: DatasetIO
|
||||
- name: Eval
|
||||
- name: Models
|
||||
- name: Inspect
|
||||
- name: EvalTasks
|
||||
- name: ScoringFunctions
|
||||
- name: Memory
|
||||
- name: Safety
|
||||
- name: DatasetIO
|
||||
- name: MemoryBanks
|
||||
- name: Shields
|
||||
- name: PostTraining
|
||||
- name: ScoringFunctions
|
||||
- name: Datasets
|
||||
- name: Scoring
|
||||
- name: Shields
|
||||
- name: Telemetry
|
||||
- name: Inspect
|
||||
- name: Safety
|
||||
- name: SyntheticDataGeneration
|
||||
- name: BatchInference
|
||||
- name: Memory
|
||||
- name: Scoring
|
||||
- name: EvalTasks
|
||||
- description: <SchemaDefinition schemaRef="#/components/schemas/BuiltinTool" />
|
||||
name: BuiltinTool
|
||||
- description: <SchemaDefinition schemaRef="#/components/schemas/CompletionMessage"
|
||||
|
@ -5046,8 +5033,6 @@ tags:
|
|||
|
||||
<SchemaDefinition schemaRef="#/components/schemas/Shield" />'
|
||||
name: Shield
|
||||
- description: <SchemaDefinition schemaRef="#/components/schemas/ShieldType" />
|
||||
name: ShieldType
|
||||
- description: <SchemaDefinition schemaRef="#/components/schemas/Trace" />
|
||||
name: Trace
|
||||
- description: 'Checkpoint created during training runs
|
||||
|
@ -5343,7 +5328,6 @@ x-tagGroups:
|
|||
- Session
|
||||
- Shield
|
||||
- ShieldCallStep
|
||||
- ShieldType
|
||||
- SpanEndPayload
|
||||
- SpanStartPayload
|
||||
- SpanStatus
|
||||
|
|
|
@ -182,13 +182,13 @@
|
|||
" pass\n",
|
||||
"\n",
|
||||
" async def run_shield(\n",
|
||||
" self, shield_type: str, messages: List[dict]\n",
|
||||
" self, shield_id: str, messages: List[dict]\n",
|
||||
" ) -> RunShieldResponse:\n",
|
||||
" async with httpx.AsyncClient() as client:\n",
|
||||
" response = await client.post(\n",
|
||||
" f\"{self.base_url}/safety/run_shield\",\n",
|
||||
" json=dict(\n",
|
||||
" shield_type=shield_type,\n",
|
||||
" shield_id=shield_id,\n",
|
||||
" messages=[encodable_dict(m) for m in messages],\n",
|
||||
" ),\n",
|
||||
" headers={\n",
|
||||
|
@ -216,7 +216,7 @@
|
|||
" ]:\n",
|
||||
" cprint(f\"User>{message['content']}\", \"green\")\n",
|
||||
" response = await client.run_shield(\n",
|
||||
" shield_type=\"llama_guard\",\n",
|
||||
" shield_id=\"Llama-Guard-3-1B\",\n",
|
||||
" messages=[message],\n",
|
||||
" )\n",
|
||||
" print(response)\n",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue