Merge branch 'main' into docs_improvement

This commit is contained in:
Kai Wu 2024-11-04 12:40:18 -08:00
commit 1422d631a8
15 changed files with 554 additions and 340 deletions

View file

@ -315,7 +315,20 @@ def get_endpoint_operations(
)
else:
event_type = None
response_type = return_type
def process_type(t):
if typing.get_origin(t) is collections.abc.AsyncIterator:
# NOTE(ashwin): this is SSE and there is no way to represent it. either we make it a List
# or the item type. I am choosing it to be the latter
args = typing.get_args(t)
return args[0]
elif typing.get_origin(t) is typing.Union:
types = [process_type(a) for a in typing.get_args(t)]
return typing._UnionGenericAlias(typing.Union, tuple(types))
else:
return t
response_type = process_type(return_type)
# set HTTP request method based on type of request and presence of payload
if not request_params:

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-24 17:40:59.576117"
"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-31 14:28:52.128905"
},
"servers": [
{
@ -320,11 +320,18 @@
"post": {
"responses": {
"200": {
"description": "OK",
"description": "A single turn in an interaction with an Agentic System. **OR** streamed agent turn completion response.",
"content": {
"text/event-stream": {
"schema": {
"$ref": "#/components/schemas/AgentTurnResponseStreamChunk"
"oneOf": [
{
"$ref": "#/components/schemas/Turn"
},
{
"$ref": "#/components/schemas/AgentTurnResponseStreamChunk"
}
]
}
}
}
@ -934,7 +941,7 @@
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/ScoringFunctionDefWithProvider"
"$ref": "#/components/schemas/ScoringFnDefWithProvider"
},
{
"type": "null"
@ -1555,7 +1562,7 @@
"content": {
"application/jsonl": {
"schema": {
"$ref": "#/components/schemas/ScoringFunctionDefWithProvider"
"$ref": "#/components/schemas/ScoringFnDefWithProvider"
}
}
}
@ -2762,7 +2769,7 @@
"const": "json_schema",
"default": "json_schema"
},
"schema": {
"json_schema": {
"type": "object",
"additionalProperties": {
"oneOf": [
@ -2791,7 +2798,7 @@
"additionalProperties": false,
"required": [
"type",
"schema"
"json_schema"
]
},
{
@ -3018,7 +3025,7 @@
"const": "json_schema",
"default": "json_schema"
},
"schema": {
"json_schema": {
"type": "object",
"additionalProperties": {
"oneOf": [
@ -3047,7 +3054,7 @@
"additionalProperties": false,
"required": [
"type",
"schema"
"json_schema"
]
},
{
@ -4002,7 +4009,8 @@
"additionalProperties": false,
"required": [
"event"
]
],
"title": "streamed agent turn completion response."
},
"AgentTurnResponseTurnCompletePayload": {
"type": "object",
@ -5004,24 +5012,6 @@
"type"
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "custom",
"default": "custom"
},
"validator_class": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"type",
"validator_class"
]
},
{
"type": "object",
"properties": {
@ -5304,24 +5294,6 @@
"type"
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "custom",
"default": "custom"
},
"validator_class": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"type",
"validator_class"
]
},
{
"type": "object",
"properties": {
@ -5376,7 +5348,7 @@
"type"
]
},
"ScoringFunctionDefWithProvider": {
"ScoringFnDefWithProvider": {
"type": "object",
"properties": {
"identifier": {
@ -5516,24 +5488,6 @@
"type"
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "custom",
"default": "custom"
},
"validator_class": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"type",
"validator_class"
]
},
{
"type": "object",
"properties": {
@ -5586,6 +5540,12 @@
},
"prompt_template": {
"type": "string"
},
"judge_score_regex": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false,
@ -6339,10 +6299,10 @@
"finetuned_model": {
"$ref": "#/components/schemas/URL"
},
"dataset": {
"dataset_id": {
"type": "string"
},
"validation_dataset": {
"validation_dataset_id": {
"type": "string"
},
"algorithm": {
@ -6412,8 +6372,8 @@
"required": [
"job_uuid",
"finetuned_model",
"dataset",
"validation_dataset",
"dataset_id",
"validation_dataset_id",
"algorithm",
"algorithm_config",
"optimizer_config",
@ -6595,7 +6555,7 @@
"type": "object",
"properties": {
"function_def": {
"$ref": "#/components/schemas/ScoringFunctionDefWithProvider"
"$ref": "#/components/schemas/ScoringFnDefWithProvider"
}
},
"additionalProperties": false,
@ -6893,10 +6853,10 @@
"model": {
"type": "string"
},
"dataset": {
"dataset_id": {
"type": "string"
},
"validation_dataset": {
"validation_dataset_id": {
"type": "string"
},
"algorithm": {
@ -6976,8 +6936,8 @@
"required": [
"job_uuid",
"model",
"dataset",
"validation_dataset",
"dataset_id",
"validation_dataset_id",
"algorithm",
"algorithm_config",
"optimizer_config",
@ -7102,57 +7062,57 @@
}
],
"tags": [
{
"name": "Eval"
},
{
"name": "ScoringFunctions"
},
{
"name": "SyntheticDataGeneration"
},
{
"name": "Inspect"
},
{
"name": "PostTraining"
},
{
"name": "Models"
},
{
"name": "Safety"
},
{
"name": "MemoryBanks"
},
{
"name": "DatasetIO"
},
{
"name": "Memory"
},
{
"name": "Scoring"
},
{
"name": "Shields"
},
{
"name": "Datasets"
},
{
"name": "Inference"
},
{
"name": "Telemetry"
"name": "Eval"
},
{
"name": "MemoryBanks"
},
{
"name": "Models"
},
{
"name": "BatchInference"
},
{
"name": "PostTraining"
},
{
"name": "Agents"
},
{
"name": "Shields"
},
{
"name": "Telemetry"
},
{
"name": "Inspect"
},
{
"name": "DatasetIO"
},
{
"name": "SyntheticDataGeneration"
},
{
"name": "Datasets"
},
{
"name": "Scoring"
},
{
"name": "ScoringFunctions"
},
{
"name": "Safety"
},
{
"name": "BuiltinTool",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/BuiltinTool\" />"
@ -7355,7 +7315,7 @@
},
{
"name": "AgentTurnResponseStreamChunk",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/AgentTurnResponseStreamChunk\" />"
"description": "streamed agent turn completion response.\n\n<SchemaDefinition schemaRef=\"#/components/schemas/AgentTurnResponseStreamChunk\" />"
},
{
"name": "AgentTurnResponseTurnCompletePayload",
@ -7486,8 +7446,8 @@
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/Parameter\" />"
},
{
"name": "ScoringFunctionDefWithProvider",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/ScoringFunctionDefWithProvider\" />"
"name": "ScoringFnDefWithProvider",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/ScoringFnDefWithProvider\" />"
},
{
"name": "ShieldDefWithProvider",
@ -7805,7 +7765,7 @@
"ScoreBatchResponse",
"ScoreRequest",
"ScoreResponse",
"ScoringFunctionDefWithProvider",
"ScoringFnDefWithProvider",
"ScoringResult",
"SearchToolDefinition",
"Session",

View file

@ -190,6 +190,7 @@ components:
$ref: '#/components/schemas/AgentTurnResponseEvent'
required:
- event
title: streamed agent turn completion response.
type: object
AgentTurnResponseTurnCompletePayload:
additionalProperties: false
@ -360,7 +361,7 @@ components:
oneOf:
- additionalProperties: false
properties:
schema:
json_schema:
additionalProperties:
oneOf:
- type: 'null'
@ -376,7 +377,7 @@ components:
type: string
required:
- type
- schema
- json_schema
type: object
- additionalProperties: false
properties:
@ -541,7 +542,7 @@ components:
oneOf:
- additionalProperties: false
properties:
schema:
json_schema:
additionalProperties:
oneOf:
- type: 'null'
@ -557,7 +558,7 @@ components:
type: string
required:
- type
- schema
- json_schema
type: object
- additionalProperties: false
properties:
@ -747,18 +748,6 @@ components:
required:
- type
type: object
- additionalProperties: false
properties:
type:
const: custom
default: custom
type: string
validator_class:
type: string
required:
- type
- validator_class
type: object
- additionalProperties: false
properties:
type:
@ -1575,18 +1564,6 @@ components:
required:
- type
type: object
- additionalProperties: false
properties:
type:
const: custom
default: custom
type: string
validator_class:
type: string
required:
- type
- validator_class
type: object
- additionalProperties: false
properties:
type:
@ -1724,7 +1701,7 @@ components:
$ref: '#/components/schemas/RLHFAlgorithm'
algorithm_config:
$ref: '#/components/schemas/DPOAlignmentConfig'
dataset:
dataset_id:
type: string
finetuned_model:
$ref: '#/components/schemas/URL'
@ -1754,13 +1731,13 @@ components:
$ref: '#/components/schemas/OptimizerConfig'
training_config:
$ref: '#/components/schemas/TrainingConfig'
validation_dataset:
validation_dataset_id:
type: string
required:
- job_uuid
- finetuned_model
- dataset
- validation_dataset
- dataset_id
- validation_dataset_id
- algorithm
- algorithm_config
- optimizer_config
@ -1899,7 +1876,7 @@ components:
additionalProperties: false
properties:
function_def:
$ref: '#/components/schemas/ScoringFunctionDefWithProvider'
$ref: '#/components/schemas/ScoringFnDefWithProvider'
required:
- function_def
type: object
@ -2121,7 +2098,7 @@ components:
required:
- results
type: object
ScoringFunctionDefWithProvider:
ScoringFnDefWithProvider:
additionalProperties: false
properties:
context:
@ -2129,6 +2106,10 @@ components:
properties:
judge_model:
type: string
judge_score_regex:
items:
type: string
type: array
prompt_template:
type: string
required:
@ -2219,18 +2200,6 @@ components:
required:
- type
type: object
- additionalProperties: false
properties:
type:
const: custom
default: custom
type: string
validator_class:
type: string
required:
- type
- validator_class
type: object
- additionalProperties: false
properties:
type:
@ -2484,7 +2453,7 @@ components:
- $ref: '#/components/schemas/LoraFinetuningConfig'
- $ref: '#/components/schemas/QLoraFinetuningConfig'
- $ref: '#/components/schemas/DoraFinetuningConfig'
dataset:
dataset_id:
type: string
hyperparam_search_config:
additionalProperties:
@ -2514,13 +2483,13 @@ components:
$ref: '#/components/schemas/OptimizerConfig'
training_config:
$ref: '#/components/schemas/TrainingConfig'
validation_dataset:
validation_dataset_id:
type: string
required:
- job_uuid
- model
- dataset
- validation_dataset
- dataset_id
- validation_dataset_id
- algorithm
- algorithm_config
- optimizer_config
@ -3029,7 +2998,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-24 17:40:59.576117"
\ draft and subject to change.\n Generated at 2024-10-31 14:28:52.128905"
title: '[DRAFT] Llama Stack Specification'
version: 0.0.1
jsonSchemaDialect: https://json-schema.org/draft/2020-12/schema
@ -3222,8 +3191,11 @@ paths:
content:
text/event-stream:
schema:
$ref: '#/components/schemas/AgentTurnResponseStreamChunk'
description: OK
oneOf:
- $ref: '#/components/schemas/Turn'
- $ref: '#/components/schemas/AgentTurnResponseStreamChunk'
description: A single turn in an interaction with an Agentic System. **OR**
streamed agent turn completion response.
tags:
- Agents
/agents/turn/get:
@ -4122,7 +4094,7 @@ paths:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/ScoringFunctionDefWithProvider'
- $ref: '#/components/schemas/ScoringFnDefWithProvider'
- type: 'null'
description: OK
tags:
@ -4142,7 +4114,7 @@ paths:
content:
application/jsonl:
schema:
$ref: '#/components/schemas/ScoringFunctionDefWithProvider'
$ref: '#/components/schemas/ScoringFnDefWithProvider'
description: OK
tags:
- ScoringFunctions
@ -4308,23 +4280,23 @@ security:
servers:
- url: http://any-hosted-llama-stack.com
tags:
- name: Eval
- name: ScoringFunctions
- name: SyntheticDataGeneration
- name: Inspect
- name: PostTraining
- name: Models
- name: Safety
- name: MemoryBanks
- name: DatasetIO
- name: Memory
- name: Scoring
- name: Shields
- name: Datasets
- name: Inference
- name: Telemetry
- name: Eval
- name: MemoryBanks
- name: Models
- name: BatchInference
- name: PostTraining
- name: Agents
- name: Shields
- name: Telemetry
- name: Inspect
- name: DatasetIO
- name: SyntheticDataGeneration
- name: Datasets
- name: Scoring
- name: ScoringFunctions
- name: Safety
- description: <SchemaDefinition schemaRef="#/components/schemas/BuiltinTool" />
name: BuiltinTool
- description: <SchemaDefinition schemaRef="#/components/schemas/CompletionMessage"
@ -4483,8 +4455,11 @@ tags:
- description: <SchemaDefinition schemaRef="#/components/schemas/AgentTurnResponseStepStartPayload"
/>
name: AgentTurnResponseStepStartPayload
- description: <SchemaDefinition schemaRef="#/components/schemas/AgentTurnResponseStreamChunk"
/>
- description: 'streamed agent turn completion response.
<SchemaDefinition schemaRef="#/components/schemas/AgentTurnResponseStreamChunk"
/>'
name: AgentTurnResponseStreamChunk
- description: <SchemaDefinition schemaRef="#/components/schemas/AgentTurnResponseTurnCompletePayload"
/>
@ -4577,9 +4552,9 @@ tags:
name: PaginatedRowsResult
- description: <SchemaDefinition schemaRef="#/components/schemas/Parameter" />
name: Parameter
- description: <SchemaDefinition schemaRef="#/components/schemas/ScoringFunctionDefWithProvider"
- description: <SchemaDefinition schemaRef="#/components/schemas/ScoringFnDefWithProvider"
/>
name: ScoringFunctionDefWithProvider
name: ScoringFnDefWithProvider
- description: <SchemaDefinition schemaRef="#/components/schemas/ShieldDefWithProvider"
/>
name: ShieldDefWithProvider
@ -4844,7 +4819,7 @@ x-tagGroups:
- ScoreBatchResponse
- ScoreRequest
- ScoreResponse
- ScoringFunctionDefWithProvider
- ScoringFnDefWithProvider
- ScoringResult
- SearchToolDefinition
- Session