update MemoryToolDefinition

This commit is contained in:
Xi Yan 2024-09-20 17:51:53 -07:00
parent 942cb87a3c
commit 06abd7e6c8
3 changed files with 333 additions and 318 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-09-18 19:27:39.955190" "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-09-20 17:50:36.257743"
}, },
"servers": [ "servers": [
{ {
@ -2147,183 +2147,7 @@
"$ref": "#/components/schemas/FunctionCallToolDefinition" "$ref": "#/components/schemas/FunctionCallToolDefinition"
}, },
{ {
"type": "object", "$ref": "#/components/schemas/MemoryToolDefinition"
"properties": {
"input_shields": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ShieldDefinition"
}
},
"output_shields": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ShieldDefinition"
}
},
"type": {
"type": "string",
"const": "memory"
},
"memory_bank_configs": {
"type": "array",
"items": {
"oneOf": [
{
"type": "object",
"properties": {
"bank_id": {
"type": "string"
},
"type": {
"type": "string",
"const": "vector"
}
},
"additionalProperties": false,
"required": [
"bank_id",
"type"
]
},
{
"type": "object",
"properties": {
"bank_id": {
"type": "string"
},
"type": {
"type": "string",
"const": "keyvalue"
},
"keys": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false,
"required": [
"bank_id",
"type",
"keys"
]
},
{
"type": "object",
"properties": {
"bank_id": {
"type": "string"
},
"type": {
"type": "string",
"const": "keyword"
}
},
"additionalProperties": false,
"required": [
"bank_id",
"type"
]
},
{
"type": "object",
"properties": {
"bank_id": {
"type": "string"
},
"type": {
"type": "string",
"const": "graph"
},
"entities": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false,
"required": [
"bank_id",
"type",
"entities"
]
}
]
}
},
"query_generator_config": {
"oneOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "default"
},
"sep": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"type",
"sep"
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "llm"
},
"model": {
"type": "string"
},
"template": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"type",
"model",
"template"
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "custom"
}
},
"additionalProperties": false,
"required": [
"type"
]
}
]
},
"max_tokens_in_context": {
"type": "integer"
},
"max_chunks": {
"type": "integer"
}
},
"additionalProperties": false,
"required": [
"type",
"memory_bank_configs",
"query_generator_config",
"max_tokens_in_context",
"max_chunks"
]
} }
] ]
} }
@ -2432,6 +2256,185 @@
"parameters" "parameters"
] ]
}, },
"MemoryToolDefinition": {
"type": "object",
"properties": {
"input_shields": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ShieldDefinition"
}
},
"output_shields": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ShieldDefinition"
}
},
"type": {
"type": "string",
"const": "memory"
},
"memory_bank_configs": {
"type": "array",
"items": {
"oneOf": [
{
"type": "object",
"properties": {
"bank_id": {
"type": "string"
},
"type": {
"type": "string",
"const": "vector"
}
},
"additionalProperties": false,
"required": [
"bank_id",
"type"
]
},
{
"type": "object",
"properties": {
"bank_id": {
"type": "string"
},
"type": {
"type": "string",
"const": "keyvalue"
},
"keys": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false,
"required": [
"bank_id",
"type",
"keys"
]
},
{
"type": "object",
"properties": {
"bank_id": {
"type": "string"
},
"type": {
"type": "string",
"const": "keyword"
}
},
"additionalProperties": false,
"required": [
"bank_id",
"type"
]
},
{
"type": "object",
"properties": {
"bank_id": {
"type": "string"
},
"type": {
"type": "string",
"const": "graph"
},
"entities": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false,
"required": [
"bank_id",
"type",
"entities"
]
}
]
}
},
"query_generator_config": {
"oneOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "default"
},
"sep": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"type",
"sep"
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "llm"
},
"model": {
"type": "string"
},
"template": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"type",
"model",
"template"
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "custom"
}
},
"additionalProperties": false,
"required": [
"type"
]
}
]
},
"max_tokens_in_context": {
"type": "integer"
},
"max_chunks": {
"type": "integer"
}
},
"additionalProperties": false,
"required": [
"type",
"memory_bank_configs",
"query_generator_config",
"max_tokens_in_context",
"max_chunks"
]
},
"OnViolationAction": { "OnViolationAction": {
"type": "integer", "type": "integer",
"enum": [ "enum": [
@ -5149,37 +5152,37 @@
], ],
"tags": [ "tags": [
{ {
"name": "BatchInference" "name": "Safety"
},
{
"name": "PostTraining"
}, },
{ {
"name": "Inference" "name": "Inference"
}, },
{
"name": "Safety"
},
{
"name": "RewardScoring"
},
{
"name": "Telemetry"
},
{ {
"name": "Evaluations" "name": "Evaluations"
}, },
{ {
"name": "SyntheticDataGeneration" "name": "PostTraining"
},
{
"name": "BatchInference"
}, },
{ {
"name": "Memory" "name": "Memory"
}, },
{
"name": "Datasets"
},
{
"name": "RewardScoring"
},
{ {
"name": "Agents" "name": "Agents"
}, },
{ {
"name": "Datasets" "name": "Telemetry"
},
{
"name": "SyntheticDataGeneration"
}, },
{ {
"name": "BuiltinTool", "name": "BuiltinTool",
@ -5317,6 +5320,10 @@
"name": "FunctionCallToolDefinition", "name": "FunctionCallToolDefinition",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/FunctionCallToolDefinition\" />" "description": "<SchemaDefinition schemaRef=\"#/components/schemas/FunctionCallToolDefinition\" />"
}, },
{
"name": "MemoryToolDefinition",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/MemoryToolDefinition\" />"
},
{ {
"name": "OnViolationAction", "name": "OnViolationAction",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/OnViolationAction\" />" "description": "<SchemaDefinition schemaRef=\"#/components/schemas/OnViolationAction\" />"
@ -5763,6 +5770,7 @@
"MemoryBank", "MemoryBank",
"MemoryBankDocument", "MemoryBankDocument",
"MemoryRetrievalStep", "MemoryRetrievalStep",
"MemoryToolDefinition",
"MetricEvent", "MetricEvent",
"OnViolationAction", "OnViolationAction",
"OptimizerConfig", "OptimizerConfig",

View file

@ -30,123 +30,7 @@ components:
- $ref: '#/components/schemas/PhotogenToolDefinition' - $ref: '#/components/schemas/PhotogenToolDefinition'
- $ref: '#/components/schemas/CodeInterpreterToolDefinition' - $ref: '#/components/schemas/CodeInterpreterToolDefinition'
- $ref: '#/components/schemas/FunctionCallToolDefinition' - $ref: '#/components/schemas/FunctionCallToolDefinition'
- additionalProperties: false - $ref: '#/components/schemas/MemoryToolDefinition'
properties:
input_shields:
items:
$ref: '#/components/schemas/ShieldDefinition'
type: array
max_chunks:
type: integer
max_tokens_in_context:
type: integer
memory_bank_configs:
items:
oneOf:
- additionalProperties: false
properties:
bank_id:
type: string
type:
const: vector
type: string
required:
- bank_id
- type
type: object
- additionalProperties: false
properties:
bank_id:
type: string
keys:
items:
type: string
type: array
type:
const: keyvalue
type: string
required:
- bank_id
- type
- keys
type: object
- additionalProperties: false
properties:
bank_id:
type: string
type:
const: keyword
type: string
required:
- bank_id
- type
type: object
- additionalProperties: false
properties:
bank_id:
type: string
entities:
items:
type: string
type: array
type:
const: graph
type: string
required:
- bank_id
- type
- entities
type: object
type: array
output_shields:
items:
$ref: '#/components/schemas/ShieldDefinition'
type: array
query_generator_config:
oneOf:
- additionalProperties: false
properties:
sep:
type: string
type:
const: default
type: string
required:
- type
- sep
type: object
- additionalProperties: false
properties:
model:
type: string
template:
type: string
type:
const: llm
type: string
required:
- type
- model
- template
type: object
- additionalProperties: false
properties:
type:
const: custom
type: string
required:
- type
type: object
type:
const: memory
type: string
required:
- type
- memory_bank_configs
- query_generator_config
- max_tokens_in_context
- max_chunks
type: object
type: array type: array
required: required:
- model - model
@ -1190,6 +1074,124 @@ components:
- memory_bank_ids - memory_bank_ids
- inserted_context - inserted_context
type: object type: object
MemoryToolDefinition:
additionalProperties: false
properties:
input_shields:
items:
$ref: '#/components/schemas/ShieldDefinition'
type: array
max_chunks:
type: integer
max_tokens_in_context:
type: integer
memory_bank_configs:
items:
oneOf:
- additionalProperties: false
properties:
bank_id:
type: string
type:
const: vector
type: string
required:
- bank_id
- type
type: object
- additionalProperties: false
properties:
bank_id:
type: string
keys:
items:
type: string
type: array
type:
const: keyvalue
type: string
required:
- bank_id
- type
- keys
type: object
- additionalProperties: false
properties:
bank_id:
type: string
type:
const: keyword
type: string
required:
- bank_id
- type
type: object
- additionalProperties: false
properties:
bank_id:
type: string
entities:
items:
type: string
type: array
type:
const: graph
type: string
required:
- bank_id
- type
- entities
type: object
type: array
output_shields:
items:
$ref: '#/components/schemas/ShieldDefinition'
type: array
query_generator_config:
oneOf:
- additionalProperties: false
properties:
sep:
type: string
type:
const: default
type: string
required:
- type
- sep
type: object
- additionalProperties: false
properties:
model:
type: string
template:
type: string
type:
const: llm
type: string
required:
- type
- model
- template
type: object
- additionalProperties: false
properties:
type:
const: custom
type: string
required:
- type
type: object
type:
const: memory
type: string
required:
- type
- memory_bank_configs
- query_generator_config
- max_tokens_in_context
- max_chunks
type: object
MetricEvent: MetricEvent:
additionalProperties: false additionalProperties: false
properties: properties:
@ -2362,7 +2364,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-09-18 19:27:39.955190" \ draft and subject to change.\n Generated at 2024-09-20 17:50:36.257743"
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
@ -3150,17 +3152,17 @@ security:
servers: servers:
- url: http://any-hosted-llama-stack.com - url: http://any-hosted-llama-stack.com
tags: tags:
- name: BatchInference
- name: PostTraining
- name: Inference
- name: Safety - name: Safety
- name: RewardScoring - name: Inference
- name: Telemetry
- name: Evaluations - name: Evaluations
- name: SyntheticDataGeneration - name: PostTraining
- name: BatchInference
- name: Memory - name: Memory
- name: Agents
- name: Datasets - name: Datasets
- name: RewardScoring
- name: Agents
- name: Telemetry
- name: SyntheticDataGeneration
- 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"
@ -3272,6 +3274,9 @@ tags:
- description: <SchemaDefinition schemaRef="#/components/schemas/FunctionCallToolDefinition" - description: <SchemaDefinition schemaRef="#/components/schemas/FunctionCallToolDefinition"
/> />
name: FunctionCallToolDefinition name: FunctionCallToolDefinition
- description: <SchemaDefinition schemaRef="#/components/schemas/MemoryToolDefinition"
/>
name: MemoryToolDefinition
- description: <SchemaDefinition schemaRef="#/components/schemas/OnViolationAction" - description: <SchemaDefinition schemaRef="#/components/schemas/OnViolationAction"
/> />
name: OnViolationAction name: OnViolationAction
@ -3634,6 +3639,7 @@ x-tagGroups:
- MemoryBank - MemoryBank
- MemoryBankDocument - MemoryBankDocument
- MemoryRetrievalStep - MemoryRetrievalStep
- MemoryToolDefinition
- MetricEvent - MetricEvent
- OnViolationAction - OnViolationAction
- OptimizerConfig - OptimizerConfig

View file

@ -151,6 +151,7 @@ MemoryQueryGeneratorConfig = Annotated[
] ]
@json_schema_type
class MemoryToolDefinition(ToolDefinitionCommon): class MemoryToolDefinition(ToolDefinitionCommon):
type: Literal[AgentTool.memory.value] = AgentTool.memory.value type: Literal[AgentTool.memory.value] = AgentTool.memory.value
memory_bank_configs: List[MemoryBankConfig] = Field(default_factory=list) memory_bank_configs: List[MemoryBankConfig] = Field(default_factory=list)