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

View file

@ -624,19 +624,6 @@ components:
required: required:
- dataset_uuid - dataset_uuid
type: object 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: DialogGenerations:
additionalProperties: false additionalProperties: false
properties: properties:
@ -833,22 +820,13 @@ components:
type: string type: string
type: array type: array
type: object type: object
GetDocumentsRequest:
additionalProperties: false
properties:
document_ids:
items:
type: string
type: array
required:
- document_ids
type: object
GraphMemoryBankDef: GraphMemoryBankDef:
additionalProperties: false additionalProperties: false
properties: properties:
identifier: identifier:
type: string type: string
provider_id: provider_id:
default: ''
type: string type: string
type: type:
const: graph const: graph
@ -856,6 +834,7 @@ components:
type: string type: string
required: required:
- identifier - identifier
- provider_id
- type - type
type: object type: object
HealthInfo: HealthInfo:
@ -929,6 +908,7 @@ components:
identifier: identifier:
type: string type: string
provider_id: provider_id:
default: ''
type: string type: string
type: type:
const: keyvalue const: keyvalue
@ -936,6 +916,7 @@ components:
type: string type: string
required: required:
- identifier - identifier
- provider_id
- type - type
type: object type: object
KeywordMemoryBankDef: KeywordMemoryBankDef:
@ -944,6 +925,7 @@ components:
identifier: identifier:
type: string type: string
provider_id: provider_id:
default: ''
type: string type: string
type: type:
const: keyword const: keyword
@ -951,6 +933,7 @@ components:
type: string type: string
required: required:
- identifier - identifier
- provider_id
- type - type
type: object type: object
LogEventRequest: LogEventRequest:
@ -1234,18 +1217,30 @@ components:
- value - value
- unit - unit
type: object type: object
ModelDef: ModelDefWithProvider:
additionalProperties: false additionalProperties: false
properties: properties:
identifier: identifier:
type: string type: string
llama_model: llama_model:
type: string type: string
metadata:
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
type: object
provider_id: provider_id:
type: string type: string
required: required:
- identifier - identifier
- llama_model - llama_model
- metadata
- provider_id
type: object type: object
OptimizerConfig: OptimizerConfig:
additionalProperties: false additionalProperties: false
@ -1533,7 +1528,7 @@ components:
additionalProperties: false additionalProperties: false
properties: properties:
model: model:
$ref: '#/components/schemas/ModelDef' $ref: '#/components/schemas/ModelDefWithProvider'
required: required:
- model - model
type: object type: object
@ -1541,29 +1536,7 @@ components:
additionalProperties: false additionalProperties: false
properties: properties:
shield: shield:
additionalProperties: false $ref: '#/components/schemas/ShieldDefWithProvider'
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
required: required:
- shield - shield
type: object type: object
@ -1856,7 +1829,7 @@ components:
- step_id - step_id
- step_type - step_type
type: object type: object
ShieldDef: ShieldDefWithProvider:
additionalProperties: false additionalProperties: false
properties: properties:
identifier: identifier:
@ -1879,6 +1852,7 @@ components:
- identifier - identifier
- type - type
- params - params
- provider_id
type: object type: object
SpanEndPayload: SpanEndPayload:
additionalProperties: false additionalProperties: false
@ -2446,19 +2420,6 @@ components:
- message - message
- severity - severity
type: object 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: UserMessage:
additionalProperties: false additionalProperties: false
properties: properties:
@ -2500,6 +2461,7 @@ components:
overlap_size_in_tokens: overlap_size_in_tokens:
type: integer type: integer
provider_id: provider_id:
default: ''
type: string type: string
type: type:
const: vector const: vector
@ -2507,6 +2469,7 @@ components:
type: string type: string
required: required:
- identifier - identifier
- provider_id
- type - type
- embedding_model - embedding_model
- chunk_size_in_tokens - chunk_size_in_tokens
@ -2544,7 +2507,7 @@ info:
description: "This is the specification of the llama stack that provides\n \ description: "This is the specification of the llama stack that provides\n \
\ a set of endpoints and their corresponding interfaces that are tailored\ \ a set of endpoints and their corresponding interfaces that are tailored\
\ to\n best leverage Llama Models. The specification is still in\ \ 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' title: '[DRAFT] Llama Stack Specification'
version: 0.0.1 version: 0.0.1
jsonSchemaDialect: https://json-schema.org/draft/2020-12/schema jsonSchemaDialect: https://json-schema.org/draft/2020-12/schema
@ -3166,78 +3129,6 @@ paths:
description: OK description: OK
tags: tags:
- Inference - 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: /memory/insert:
post: post:
parameters: parameters:
@ -3284,27 +3175,6 @@ paths:
description: OK description: OK
tags: tags:
- Memory - 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: /memory_banks/get:
get: get:
parameters: parameters:
@ -3378,7 +3248,7 @@ paths:
'200': '200':
description: OK description: OK
tags: tags:
- Memory - MemoryBanks
/models/get: /models/get:
get: get:
parameters: parameters:
@ -3400,7 +3270,7 @@ paths:
application/json: application/json:
schema: schema:
oneOf: oneOf:
- $ref: '#/components/schemas/ModelDef' - $ref: '#/components/schemas/ModelDefWithProvider'
- type: 'null' - type: 'null'
description: OK description: OK
tags: tags:
@ -3420,7 +3290,28 @@ paths:
content: content:
application/jsonl: application/jsonl:
schema: 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 description: OK
tags: tags:
- Models - Models
@ -3655,27 +3546,6 @@ paths:
description: OK description: OK
tags: tags:
- Inspect - 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: /safety/run_shield:
post: post:
parameters: parameters:
@ -3722,29 +3592,7 @@ paths:
application/json: application/json:
schema: schema:
oneOf: oneOf:
- additionalProperties: false - $ref: '#/components/schemas/ShieldDefWithProvider'
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
- type: 'null' - type: 'null'
description: OK description: OK
tags: tags:
@ -3764,7 +3612,28 @@ paths:
content: content:
application/jsonl: application/jsonl:
schema: 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 description: OK
tags: tags:
- Shields - Shields
@ -3843,21 +3712,21 @@ security:
servers: servers:
- url: http://any-hosted-llama-stack.com - url: http://any-hosted-llama-stack.com
tags: 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: 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" /> - description: <SchemaDefinition schemaRef="#/components/schemas/BuiltinTool" />
name: BuiltinTool name: BuiltinTool
- description: <SchemaDefinition schemaRef="#/components/schemas/CompletionMessage" - description: <SchemaDefinition schemaRef="#/components/schemas/CompletionMessage"
@ -4070,9 +3939,6 @@ tags:
- description: <SchemaDefinition schemaRef="#/components/schemas/DeleteDatasetRequest" - description: <SchemaDefinition schemaRef="#/components/schemas/DeleteDatasetRequest"
/> />
name: DeleteDatasetRequest name: DeleteDatasetRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/DeleteDocumentsRequest"
/>
name: DeleteDocumentsRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/EmbeddingsRequest" - description: <SchemaDefinition schemaRef="#/components/schemas/EmbeddingsRequest"
/> />
name: EmbeddingsRequest name: EmbeddingsRequest
@ -4113,12 +3979,6 @@ tags:
- description: <SchemaDefinition schemaRef="#/components/schemas/AgentStepResponse" - description: <SchemaDefinition schemaRef="#/components/schemas/AgentStepResponse"
/> />
name: 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. - description: 'Artifacts of a evaluation job.
@ -4131,8 +3991,12 @@ tags:
- description: <SchemaDefinition schemaRef="#/components/schemas/EvaluationJobStatusResponse" - description: <SchemaDefinition schemaRef="#/components/schemas/EvaluationJobStatusResponse"
/> />
name: EvaluationJobStatusResponse name: EvaluationJobStatusResponse
- description: <SchemaDefinition schemaRef="#/components/schemas/ModelDef" /> - description: <SchemaDefinition schemaRef="#/components/schemas/ModelDefWithProvider"
name: ModelDef />
name: ModelDefWithProvider
- description: <SchemaDefinition schemaRef="#/components/schemas/ShieldDefWithProvider"
/>
name: ShieldDefWithProvider
- description: <SchemaDefinition schemaRef="#/components/schemas/Trace" /> - description: <SchemaDefinition schemaRef="#/components/schemas/Trace" />
name: Trace name: Trace
- description: 'Checkpoint created during training runs - description: 'Checkpoint created during training runs
@ -4165,6 +4029,9 @@ tags:
name: PostTrainingJob name: PostTrainingJob
- description: <SchemaDefinition schemaRef="#/components/schemas/HealthInfo" /> - description: <SchemaDefinition schemaRef="#/components/schemas/HealthInfo" />
name: HealthInfo name: HealthInfo
- description: <SchemaDefinition schemaRef="#/components/schemas/MemoryBankDocument"
/>
name: MemoryBankDocument
- description: <SchemaDefinition schemaRef="#/components/schemas/InsertDocumentsRequest" - description: <SchemaDefinition schemaRef="#/components/schemas/InsertDocumentsRequest"
/> />
name: InsertDocumentsRequest name: InsertDocumentsRequest
@ -4172,8 +4039,6 @@ tags:
name: ProviderInfo name: ProviderInfo
- description: <SchemaDefinition schemaRef="#/components/schemas/RouteInfo" /> - description: <SchemaDefinition schemaRef="#/components/schemas/RouteInfo" />
name: RouteInfo name: RouteInfo
- description: <SchemaDefinition schemaRef="#/components/schemas/ShieldDef" />
name: ShieldDef
- description: <SchemaDefinition schemaRef="#/components/schemas/LogSeverity" /> - description: <SchemaDefinition schemaRef="#/components/schemas/LogSeverity" />
name: LogSeverity name: LogSeverity
- description: <SchemaDefinition schemaRef="#/components/schemas/MetricEvent" /> - description: <SchemaDefinition schemaRef="#/components/schemas/MetricEvent" />
@ -4270,9 +4135,6 @@ tags:
<SchemaDefinition schemaRef="#/components/schemas/SyntheticDataGenerationResponse" <SchemaDefinition schemaRef="#/components/schemas/SyntheticDataGenerationResponse"
/>' />'
name: SyntheticDataGenerationResponse name: SyntheticDataGenerationResponse
- description: <SchemaDefinition schemaRef="#/components/schemas/UpdateDocumentsRequest"
/>
name: UpdateDocumentsRequest
x-tagGroups: x-tagGroups:
- name: Operations - name: Operations
tags: tags:
@ -4331,7 +4193,6 @@ x-tagGroups:
- DeleteAgentsRequest - DeleteAgentsRequest
- DeleteAgentsSessionRequest - DeleteAgentsSessionRequest
- DeleteDatasetRequest - DeleteDatasetRequest
- DeleteDocumentsRequest
- DialogGenerations - DialogGenerations
- DoraFinetuningConfig - DoraFinetuningConfig
- EmbeddingsRequest - EmbeddingsRequest
@ -4346,7 +4207,6 @@ x-tagGroups:
- FinetuningAlgorithm - FinetuningAlgorithm
- FunctionCallToolDefinition - FunctionCallToolDefinition
- GetAgentsSessionRequest - GetAgentsSessionRequest
- GetDocumentsRequest
- GraphMemoryBankDef - GraphMemoryBankDef
- HealthInfo - HealthInfo
- ImageMedia - ImageMedia
@ -4361,7 +4221,7 @@ x-tagGroups:
- MemoryRetrievalStep - MemoryRetrievalStep
- MemoryToolDefinition - MemoryToolDefinition
- MetricEvent - MetricEvent
- ModelDef - ModelDefWithProvider
- OptimizerConfig - OptimizerConfig
- PhotogenToolDefinition - PhotogenToolDefinition
- PostTrainingJob - PostTrainingJob
@ -4393,7 +4253,7 @@ x-tagGroups:
- SearchToolDefinition - SearchToolDefinition
- Session - Session
- ShieldCallStep - ShieldCallStep
- ShieldDef - ShieldDefWithProvider
- SpanEndPayload - SpanEndPayload
- SpanStartPayload - SpanStartPayload
- SpanStatus - SpanStatus
@ -4421,7 +4281,6 @@ x-tagGroups:
- Turn - Turn
- URL - URL
- UnstructuredLogEvent - UnstructuredLogEvent
- UpdateDocumentsRequest
- UserMessage - UserMessage
- VectorMemoryBankDef - VectorMemoryBankDef
- ViolationLevel - 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 @pytest.mark.asyncio
async def test_shield_list(safety_settings): async def test_shield_list(safety_settings):
shields_impl = safety_settings["shields_impl"] shields_impl = safety_settings["shields_impl"]