re-gen openapi spec

This commit is contained in:
Ashwin Bharambe 2024-10-09 21:10:12 -07:00
parent fcd22b6baa
commit 6788173ffc
4 changed files with 360 additions and 686 deletions

View file

@ -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-10-08 15:18:57.600111"
"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-10-09 21:10:09.073430"
},
"servers": [
{
@ -521,39 +521,6 @@
}
}
},
"/memory/documents/delete": {
"post": {
"responses": {
"200": {
"description": "OK"
}
},
"tags": [
"Memory"
],
"parameters": [
{
"name": "X-LlamaStack-ProviderData",
"in": "header",
"description": "JSON-encoded provider data which will be made available to the adapter servicing the API",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DeleteDocumentsRequest"
}
}
},
"required": true
}
}
},
"/inference/embeddings": {
"post": {
"responses": {
@ -908,54 +875,6 @@
]
}
},
"/memory/documents/get": {
"post": {
"responses": {
"200": {
"description": "OK",
"content": {
"application/jsonl": {
"schema": {
"$ref": "#/components/schemas/MemoryBankDocument"
}
}
}
}
},
"tags": [
"Memory"
],
"parameters": [
{
"name": "bank_id",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "X-LlamaStack-ProviderData",
"in": "header",
"description": "JSON-encoded provider data which will be made available to the adapter servicing the API",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetDocumentsRequest"
}
}
},
"required": true
}
}
},
"/evaluate/job/artifacts": {
"get": {
"responses": {
@ -1168,7 +1087,7 @@
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/ModelDef"
"$ref": "#/components/schemas/ModelDefWithProvider"
},
{
"type": "null"
@ -1213,49 +1132,7 @@
"schema": {
"oneOf": [
{
"type": "object",
"properties": {
"identifier": {
"type": "string"
},
"type": {
"type": "string"
},
"provider_id": {
"type": "string"
},
"params": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
}
}
},
"additionalProperties": false,
"required": [
"identifier",
"type",
"params"
]
"$ref": "#/components/schemas/ShieldDefWithProvider"
},
{
"type": "null"
@ -1586,7 +1463,7 @@
"content": {
"application/jsonl": {
"schema": {
"$ref": "#/components/schemas/ModelDef"
"$ref": "#/components/schemas/ModelDefWithProvider"
}
}
}
@ -1685,7 +1562,7 @@
"content": {
"application/jsonl": {
"schema": {
"$ref": "#/components/schemas/ShieldDef"
"$ref": "#/components/schemas/ShieldDefWithProvider"
}
}
}
@ -1828,7 +1705,7 @@
}
},
"tags": [
"Memory"
"MemoryBanks"
],
"parameters": [
{
@ -1853,7 +1730,7 @@
}
}
},
"/inference/register_model": {
"/models/register": {
"post": {
"responses": {
"200": {
@ -1886,7 +1763,7 @@
}
}
},
"/safety/register_shield": {
"/shields/register": {
"post": {
"responses": {
"200": {
@ -2078,39 +1955,6 @@
"required": true
}
}
},
"/memory/update": {
"post": {
"responses": {
"200": {
"description": "OK"
}
},
"tags": [
"Memory"
],
"parameters": [
{
"name": "X-LlamaStack-ProviderData",
"in": "header",
"description": "JSON-encoded provider data which will be made available to the adapter servicing the API",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateDocumentsRequest"
}
}
},
"required": true
}
}
}
},
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
@ -4357,25 +4201,6 @@
"dataset_uuid"
]
},
"DeleteDocumentsRequest": {
"type": "object",
"properties": {
"bank_id": {
"type": "string"
},
"document_ids": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false,
"required": [
"bank_id",
"document_ids"
]
},
"EmbeddingsRequest": {
"type": "object",
"properties": {
@ -4522,7 +4347,8 @@
"type": "string"
},
"provider_id": {
"type": "string"
"type": "string",
"default": ""
},
"type": {
"type": "string",
@ -4533,6 +4359,7 @@
"additionalProperties": false,
"required": [
"identifier",
"provider_id",
"type"
]
},
@ -4543,7 +4370,8 @@
"type": "string"
},
"provider_id": {
"type": "string"
"type": "string",
"default": ""
},
"type": {
"type": "string",
@ -4554,6 +4382,7 @@
"additionalProperties": false,
"required": [
"identifier",
"provider_id",
"type"
]
},
@ -4564,7 +4393,8 @@
"type": "string"
},
"provider_id": {
"type": "string"
"type": "string",
"default": ""
},
"type": {
"type": "string",
@ -4575,6 +4405,7 @@
"additionalProperties": false,
"required": [
"identifier",
"provider_id",
"type"
]
},
@ -4630,7 +4461,8 @@
"type": "string"
},
"provider_id": {
"type": "string"
"type": "string",
"default": ""
},
"type": {
"type": "string",
@ -4650,6 +4482,7 @@
"additionalProperties": false,
"required": [
"identifier",
"provider_id",
"type",
"embedding_model",
"chunk_size_in_tokens"
@ -4680,89 +4513,6 @@
"step"
]
},
"GetDocumentsRequest": {
"type": "object",
"properties": {
"document_ids": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false,
"required": [
"document_ids"
]
},
"MemoryBankDocument": {
"type": "object",
"properties": {
"document_id": {
"type": "string"
},
"content": {
"oneOf": [
{
"type": "string"
},
{
"$ref": "#/components/schemas/ImageMedia"
},
{
"type": "array",
"items": {
"oneOf": [
{
"type": "string"
},
{
"$ref": "#/components/schemas/ImageMedia"
}
]
}
},
{
"$ref": "#/components/schemas/URL"
}
]
},
"mime_type": {
"type": "string"
},
"metadata": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
}
}
},
"additionalProperties": false,
"required": [
"document_id",
"content",
"metadata"
]
},
"EvaluationJobArtifactsResponse": {
"type": "object",
"properties": {
@ -4800,7 +4550,7 @@
"job_uuid"
]
},
"ModelDef": {
"ModelDefWithProvider": {
"type": "object",
"properties": {
"identifier": {
@ -4809,6 +4559,31 @@
"llama_model": {
"type": "string"
},
"metadata": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
}
},
"provider_id": {
"type": "string"
}
@ -4816,7 +4591,55 @@
"additionalProperties": false,
"required": [
"identifier",
"llama_model"
"llama_model",
"metadata",
"provider_id"
]
},
"ShieldDefWithProvider": {
"type": "object",
"properties": {
"identifier": {
"type": "string"
},
"type": {
"type": "string"
},
"params": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
}
},
"provider_id": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"identifier",
"type",
"params",
"provider_id"
]
},
"Trace": {
@ -4981,6 +4804,74 @@
"status"
]
},
"MemoryBankDocument": {
"type": "object",
"properties": {
"document_id": {
"type": "string"
},
"content": {
"oneOf": [
{
"type": "string"
},
{
"$ref": "#/components/schemas/ImageMedia"
},
{
"type": "array",
"items": {
"oneOf": [
{
"type": "string"
},
{
"$ref": "#/components/schemas/ImageMedia"
}
]
}
},
{
"$ref": "#/components/schemas/URL"
}
]
},
"mime_type": {
"type": "string"
},
"metadata": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
}
}
},
"additionalProperties": false,
"required": [
"document_id",
"content",
"metadata"
]
},
"InsertDocumentsRequest": {
"type": "object",
"properties": {
@ -5042,51 +4933,6 @@
"provider_types"
]
},
"ShieldDef": {
"type": "object",
"properties": {
"identifier": {
"type": "string"
},
"type": {
"type": "string"
},
"provider_id": {
"type": "string"
},
"params": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
}
}
},
"additionalProperties": false,
"required": [
"identifier",
"type",
"params"
]
},
"LogSeverity": {
"type": "string",
"enum": [
@ -5696,7 +5542,7 @@
"type": "object",
"properties": {
"model": {
"$ref": "#/components/schemas/ModelDef"
"$ref": "#/components/schemas/ModelDefWithProvider"
}
},
"additionalProperties": false,
@ -5708,49 +5554,7 @@
"type": "object",
"properties": {
"shield": {
"type": "object",
"properties": {
"identifier": {
"type": "string"
},
"type": {
"type": "string"
},
"provider_id": {
"type": "string"
},
"params": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
}
}
},
"additionalProperties": false,
"required": [
"identifier",
"type",
"params"
]
"$ref": "#/components/schemas/ShieldDefWithProvider"
}
},
"additionalProperties": false,
@ -6260,25 +6064,6 @@
"synthetic_data"
],
"title": "Response from the synthetic data generation. Batch of (prompt, response, score) tuples that pass the threshold."
},
"UpdateDocumentsRequest": {
"type": "object",
"properties": {
"bank_id": {
"type": "string"
},
"documents": {
"type": "array",
"items": {
"$ref": "#/components/schemas/MemoryBankDocument"
}
}
},
"additionalProperties": false,
"required": [
"bank_id",
"documents"
]
}
},
"responses": {}
@ -6290,49 +6075,49 @@
],
"tags": [
{
"name": "BatchInference"
},
{
"name": "Datasets"
},
{
"name": "Inference"
},
{
"name": "Evaluations"
"name": "RewardScoring"
},
{
"name": "Memory"
},
{
"name": "Safety"
},
{
"name": "PostTraining"
},
{
"name": "MemoryBanks"
"name": "SyntheticDataGeneration"
},
{
"name": "Models"
},
{
"name": "Shields"
"name": "Safety"
},
{
"name": "Inspect"
},
{
"name": "SyntheticDataGeneration"
},
{
"name": "Telemetry"
"name": "BatchInference"
},
{
"name": "Agents"
},
{
"name": "RewardScoring"
"name": "MemoryBanks"
},
{
"name": "Shields"
},
{
"name": "Datasets"
},
{
"name": "Evaluations"
},
{
"name": "Inspect"
},
{
"name": "PostTraining"
},
{
"name": "Telemetry"
},
{
"name": "Inference"
},
{
"name": "BuiltinTool",
@ -6606,10 +6391,6 @@
"name": "DeleteDatasetRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/DeleteDatasetRequest\" />"
},
{
"name": "DeleteDocumentsRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/DeleteDocumentsRequest\" />"
},
{
"name": "EmbeddingsRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/EmbeddingsRequest\" />"
@ -6662,14 +6443,6 @@
"name": "AgentStepResponse",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/AgentStepResponse\" />"
},
{
"name": "GetDocumentsRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/GetDocumentsRequest\" />"
},
{
"name": "MemoryBankDocument",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/MemoryBankDocument\" />"
},
{
"name": "EvaluationJobArtifactsResponse",
"description": "Artifacts of a evaluation job.\n\n<SchemaDefinition schemaRef=\"#/components/schemas/EvaluationJobArtifactsResponse\" />"
@ -6683,8 +6456,12 @@
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/EvaluationJobStatusResponse\" />"
},
{
"name": "ModelDef",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/ModelDef\" />"
"name": "ModelDefWithProvider",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/ModelDefWithProvider\" />"
},
{
"name": "ShieldDefWithProvider",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/ShieldDefWithProvider\" />"
},
{
"name": "Trace",
@ -6718,6 +6495,10 @@
"name": "HealthInfo",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/HealthInfo\" />"
},
{
"name": "MemoryBankDocument",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/MemoryBankDocument\" />"
},
{
"name": "InsertDocumentsRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/InsertDocumentsRequest\" />"
@ -6730,10 +6511,6 @@
"name": "RouteInfo",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/RouteInfo\" />"
},
{
"name": "ShieldDef",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/ShieldDef\" />"
},
{
"name": "LogSeverity",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/LogSeverity\" />"
@ -6861,10 +6638,6 @@
{
"name": "SyntheticDataGenerationResponse",
"description": "Response from the synthetic data generation. Batch of (prompt, response, score) tuples that pass the threshold.\n\n<SchemaDefinition schemaRef=\"#/components/schemas/SyntheticDataGenerationResponse\" />"
},
{
"name": "UpdateDocumentsRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/UpdateDocumentsRequest\" />"
}
],
"x-tagGroups": [
@ -6929,7 +6702,6 @@
"DeleteAgentsRequest",
"DeleteAgentsSessionRequest",
"DeleteDatasetRequest",
"DeleteDocumentsRequest",
"DialogGenerations",
"DoraFinetuningConfig",
"EmbeddingsRequest",
@ -6944,7 +6716,6 @@
"FinetuningAlgorithm",
"FunctionCallToolDefinition",
"GetAgentsSessionRequest",
"GetDocumentsRequest",
"GraphMemoryBankDef",
"HealthInfo",
"ImageMedia",
@ -6959,7 +6730,7 @@
"MemoryRetrievalStep",
"MemoryToolDefinition",
"MetricEvent",
"ModelDef",
"ModelDefWithProvider",
"OptimizerConfig",
"PhotogenToolDefinition",
"PostTrainingJob",
@ -6991,7 +6762,7 @@
"SearchToolDefinition",
"Session",
"ShieldCallStep",
"ShieldDef",
"ShieldDefWithProvider",
"SpanEndPayload",
"SpanStartPayload",
"SpanStatus",
@ -7019,7 +6790,6 @@
"Turn",
"URL",
"UnstructuredLogEvent",
"UpdateDocumentsRequest",
"UserMessage",
"VectorMemoryBankDef",
"ViolationLevel",

View file

@ -624,19 +624,6 @@ components:
required:
- dataset_uuid
type: object
DeleteDocumentsRequest:
additionalProperties: false
properties:
bank_id:
type: string
document_ids:
items:
type: string
type: array
required:
- bank_id
- document_ids
type: object
DialogGenerations:
additionalProperties: false
properties:
@ -833,22 +820,13 @@ components:
type: string
type: array
type: object
GetDocumentsRequest:
additionalProperties: false
properties:
document_ids:
items:
type: string
type: array
required:
- document_ids
type: object
GraphMemoryBankDef:
additionalProperties: false
properties:
identifier:
type: string
provider_id:
default: ''
type: string
type:
const: graph
@ -856,6 +834,7 @@ components:
type: string
required:
- identifier
- provider_id
- type
type: object
HealthInfo:
@ -929,6 +908,7 @@ components:
identifier:
type: string
provider_id:
default: ''
type: string
type:
const: keyvalue
@ -936,6 +916,7 @@ components:
type: string
required:
- identifier
- provider_id
- type
type: object
KeywordMemoryBankDef:
@ -944,6 +925,7 @@ components:
identifier:
type: string
provider_id:
default: ''
type: string
type:
const: keyword
@ -951,6 +933,7 @@ components:
type: string
required:
- identifier
- provider_id
- type
type: object
LogEventRequest:
@ -1234,18 +1217,30 @@ components:
- value
- unit
type: object
ModelDef:
ModelDefWithProvider:
additionalProperties: false
properties:
identifier:
type: string
llama_model:
type: string
metadata:
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
type: object
provider_id:
type: string
required:
- identifier
- llama_model
- metadata
- provider_id
type: object
OptimizerConfig:
additionalProperties: false
@ -1533,7 +1528,7 @@ components:
additionalProperties: false
properties:
model:
$ref: '#/components/schemas/ModelDef'
$ref: '#/components/schemas/ModelDefWithProvider'
required:
- model
type: object
@ -1541,29 +1536,7 @@ components:
additionalProperties: false
properties:
shield:
additionalProperties: false
properties:
identifier:
type: string
params:
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
type: object
provider_id:
type: string
type:
type: string
required:
- identifier
- type
- params
type: object
$ref: '#/components/schemas/ShieldDefWithProvider'
required:
- shield
type: object
@ -1856,7 +1829,7 @@ components:
- step_id
- step_type
type: object
ShieldDef:
ShieldDefWithProvider:
additionalProperties: false
properties:
identifier:
@ -1879,6 +1852,7 @@ components:
- identifier
- type
- params
- provider_id
type: object
SpanEndPayload:
additionalProperties: false
@ -2446,19 +2420,6 @@ components:
- message
- severity
type: object
UpdateDocumentsRequest:
additionalProperties: false
properties:
bank_id:
type: string
documents:
items:
$ref: '#/components/schemas/MemoryBankDocument'
type: array
required:
- bank_id
- documents
type: object
UserMessage:
additionalProperties: false
properties:
@ -2500,6 +2461,7 @@ components:
overlap_size_in_tokens:
type: integer
provider_id:
default: ''
type: string
type:
const: vector
@ -2507,6 +2469,7 @@ components:
type: string
required:
- identifier
- provider_id
- type
- embedding_model
- chunk_size_in_tokens
@ -2544,7 +2507,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-10-08 15:18:57.600111"
\ draft and subject to change.\n Generated at 2024-10-09 21:10:09.073430"
title: '[DRAFT] Llama Stack Specification'
version: 0.0.1
jsonSchemaDialect: https://json-schema.org/draft/2020-12/schema
@ -3166,78 +3129,6 @@ paths:
description: OK
tags:
- Inference
/inference/register_model:
post:
parameters:
- description: JSON-encoded provider data which will be made available to the
adapter servicing the API
in: header
name: X-LlamaStack-ProviderData
required: false
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RegisterModelRequest'
required: true
responses:
'200':
description: OK
tags:
- Models
/memory/documents/delete:
post:
parameters:
- description: JSON-encoded provider data which will be made available to the
adapter servicing the API
in: header
name: X-LlamaStack-ProviderData
required: false
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DeleteDocumentsRequest'
required: true
responses:
'200':
description: OK
tags:
- Memory
/memory/documents/get:
post:
parameters:
- in: query
name: bank_id
required: true
schema:
type: string
- description: JSON-encoded provider data which will be made available to the
adapter servicing the API
in: header
name: X-LlamaStack-ProviderData
required: false
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/GetDocumentsRequest'
required: true
responses:
'200':
content:
application/jsonl:
schema:
$ref: '#/components/schemas/MemoryBankDocument'
description: OK
tags:
- Memory
/memory/insert:
post:
parameters:
@ -3284,27 +3175,6 @@ paths:
description: OK
tags:
- Memory
/memory/update:
post:
parameters:
- description: JSON-encoded provider data which will be made available to the
adapter servicing the API
in: header
name: X-LlamaStack-ProviderData
required: false
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateDocumentsRequest'
required: true
responses:
'200':
description: OK
tags:
- Memory
/memory_banks/get:
get:
parameters:
@ -3378,7 +3248,7 @@ paths:
'200':
description: OK
tags:
- Memory
- MemoryBanks
/models/get:
get:
parameters:
@ -3400,7 +3270,7 @@ paths:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/ModelDef'
- $ref: '#/components/schemas/ModelDefWithProvider'
- type: 'null'
description: OK
tags:
@ -3420,7 +3290,28 @@ paths:
content:
application/jsonl:
schema:
$ref: '#/components/schemas/ModelDef'
$ref: '#/components/schemas/ModelDefWithProvider'
description: OK
tags:
- Models
/models/register:
post:
parameters:
- description: JSON-encoded provider data which will be made available to the
adapter servicing the API
in: header
name: X-LlamaStack-ProviderData
required: false
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RegisterModelRequest'
required: true
responses:
'200':
description: OK
tags:
- Models
@ -3655,27 +3546,6 @@ paths:
description: OK
tags:
- Inspect
/safety/register_shield:
post:
parameters:
- description: JSON-encoded provider data which will be made available to the
adapter servicing the API
in: header
name: X-LlamaStack-ProviderData
required: false
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RegisterShieldRequest'
required: true
responses:
'200':
description: OK
tags:
- Shields
/safety/run_shield:
post:
parameters:
@ -3722,29 +3592,7 @@ paths:
application/json:
schema:
oneOf:
- additionalProperties: false
properties:
identifier:
type: string
params:
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
type: object
provider_id:
type: string
type:
type: string
required:
- identifier
- type
- params
type: object
- $ref: '#/components/schemas/ShieldDefWithProvider'
- type: 'null'
description: OK
tags:
@ -3764,7 +3612,28 @@ paths:
content:
application/jsonl:
schema:
$ref: '#/components/schemas/ShieldDef'
$ref: '#/components/schemas/ShieldDefWithProvider'
description: OK
tags:
- Shields
/shields/register:
post:
parameters:
- description: JSON-encoded provider data which will be made available to the
adapter servicing the API
in: header
name: X-LlamaStack-ProviderData
required: false
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RegisterShieldRequest'
required: true
responses:
'200':
description: OK
tags:
- Shields
@ -3843,21 +3712,21 @@ security:
servers:
- url: http://any-hosted-llama-stack.com
tags:
- name: BatchInference
- name: Datasets
- name: Inference
- name: Evaluations
- name: Memory
- name: Safety
- name: PostTraining
- name: MemoryBanks
- name: Models
- name: Shields
- name: Inspect
- name: SyntheticDataGeneration
- name: Telemetry
- name: Agents
- name: RewardScoring
- name: Memory
- name: SyntheticDataGeneration
- name: Models
- name: Safety
- name: BatchInference
- name: Agents
- name: MemoryBanks
- name: Shields
- name: Datasets
- name: Evaluations
- name: Inspect
- name: PostTraining
- name: Telemetry
- name: Inference
- description: <SchemaDefinition schemaRef="#/components/schemas/BuiltinTool" />
name: BuiltinTool
- description: <SchemaDefinition schemaRef="#/components/schemas/CompletionMessage"
@ -4070,9 +3939,6 @@ tags:
- description: <SchemaDefinition schemaRef="#/components/schemas/DeleteDatasetRequest"
/>
name: DeleteDatasetRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/DeleteDocumentsRequest"
/>
name: DeleteDocumentsRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/EmbeddingsRequest"
/>
name: EmbeddingsRequest
@ -4113,12 +3979,6 @@ tags:
- description: <SchemaDefinition schemaRef="#/components/schemas/AgentStepResponse"
/>
name: AgentStepResponse
- description: <SchemaDefinition schemaRef="#/components/schemas/GetDocumentsRequest"
/>
name: GetDocumentsRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/MemoryBankDocument"
/>
name: MemoryBankDocument
- description: 'Artifacts of a evaluation job.
@ -4131,8 +3991,12 @@ tags:
- description: <SchemaDefinition schemaRef="#/components/schemas/EvaluationJobStatusResponse"
/>
name: EvaluationJobStatusResponse
- description: <SchemaDefinition schemaRef="#/components/schemas/ModelDef" />
name: ModelDef
- description: <SchemaDefinition schemaRef="#/components/schemas/ModelDefWithProvider"
/>
name: ModelDefWithProvider
- description: <SchemaDefinition schemaRef="#/components/schemas/ShieldDefWithProvider"
/>
name: ShieldDefWithProvider
- description: <SchemaDefinition schemaRef="#/components/schemas/Trace" />
name: Trace
- description: 'Checkpoint created during training runs
@ -4165,6 +4029,9 @@ tags:
name: PostTrainingJob
- description: <SchemaDefinition schemaRef="#/components/schemas/HealthInfo" />
name: HealthInfo
- description: <SchemaDefinition schemaRef="#/components/schemas/MemoryBankDocument"
/>
name: MemoryBankDocument
- description: <SchemaDefinition schemaRef="#/components/schemas/InsertDocumentsRequest"
/>
name: InsertDocumentsRequest
@ -4172,8 +4039,6 @@ tags:
name: ProviderInfo
- description: <SchemaDefinition schemaRef="#/components/schemas/RouteInfo" />
name: RouteInfo
- description: <SchemaDefinition schemaRef="#/components/schemas/ShieldDef" />
name: ShieldDef
- description: <SchemaDefinition schemaRef="#/components/schemas/LogSeverity" />
name: LogSeverity
- description: <SchemaDefinition schemaRef="#/components/schemas/MetricEvent" />
@ -4270,9 +4135,6 @@ tags:
<SchemaDefinition schemaRef="#/components/schemas/SyntheticDataGenerationResponse"
/>'
name: SyntheticDataGenerationResponse
- description: <SchemaDefinition schemaRef="#/components/schemas/UpdateDocumentsRequest"
/>
name: UpdateDocumentsRequest
x-tagGroups:
- name: Operations
tags:
@ -4331,7 +4193,6 @@ x-tagGroups:
- DeleteAgentsRequest
- DeleteAgentsSessionRequest
- DeleteDatasetRequest
- DeleteDocumentsRequest
- DialogGenerations
- DoraFinetuningConfig
- EmbeddingsRequest
@ -4346,7 +4207,6 @@ x-tagGroups:
- FinetuningAlgorithm
- FunctionCallToolDefinition
- GetAgentsSessionRequest
- GetDocumentsRequest
- GraphMemoryBankDef
- HealthInfo
- ImageMedia
@ -4361,7 +4221,7 @@ x-tagGroups:
- MemoryRetrievalStep
- MemoryToolDefinition
- MetricEvent
- ModelDef
- ModelDefWithProvider
- OptimizerConfig
- PhotogenToolDefinition
- PostTrainingJob
@ -4393,7 +4253,7 @@ x-tagGroups:
- SearchToolDefinition
- Session
- ShieldCallStep
- ShieldDef
- ShieldDefWithProvider
- SpanEndPayload
- SpanStartPayload
- SpanStatus
@ -4421,7 +4281,6 @@ x-tagGroups:
- Turn
- URL
- UnstructuredLogEvent
- UpdateDocumentsRequest
- UserMessage
- VectorMemoryBankDef
- ViolationLevel

View file

@ -0,0 +1,59 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import pytest
import pytest_asyncio
from llama_models.llama3.api.datatypes import * # noqa: F403
from llama_stack.apis.agents import * # noqa: F403
from llama_stack.distribution.datatypes import * # noqa: F403
from llama_stack.providers.tests.resolver import resolve_impls_for_test
# How to run this test:
#
# 1. Ensure you have a conda with the right dependencies installed. This is a bit tricky
# since it depends on the provider you are testing. On top of that you need
# `pytest` and `pytest-asyncio` installed.
#
# 2. Copy and modify the provider_config_example.yaml depending on the provider you are testing.
#
# 3. Run:
#
# ```bash
# PROVIDER_ID=<your_provider> \
# PROVIDER_CONFIG=provider_config.yaml \
# pytest -s llama_stack/providers/tests/agents/test_agents.py \
# --tb=short --disable-warnings
# ```
@pytest_asyncio.fixture(scope="session")
async def agents_settings():
impls = await resolve_impls_for_test(
Api.agents, deps=[Api.inference, Api.memory, Api.safety]
)
return {
"impl": impls[Api.safety],
"memory_impl": impls[Api.memory],
"inference_impl": impls[Api.inference],
"safety_impl": impls[Api.safety],
}
@pytest.fixture
def sample_tool_definition():
return ToolDefinition(
tool_name="get_weather",
description="Get the current weather",
parameters={
"location": ToolParamDefinition(
param_type="string",
description="The city and state, e.g. San Francisco, CA",
),
},
)

View file

@ -41,20 +41,6 @@ async def safety_settings():
}
@pytest.fixture
def sample_tool_definition():
return ToolDefinition(
tool_name="get_weather",
description="Get the current weather",
parameters={
"location": ToolParamDefinition(
param_type="string",
description="The city and state, e.g. San Francisco, CA",
),
},
)
@pytest.mark.asyncio
async def test_shield_list(safety_settings):
shields_impl = safety_settings["shields_impl"]