add memory_banks

This commit is contained in:
Xi Yan 2024-09-23 10:09:46 -07:00
parent 9210ee2c84
commit 21b844c155
3 changed files with 199 additions and 94 deletions

View file

@ -49,6 +49,7 @@ from llama_stack.apis.shields import * # noqa: F403
class LlamaStack( class LlamaStack(
MemoryBanks,
Inference, Inference,
BatchInference, BatchInference,
Agents, Agents,
@ -61,7 +62,6 @@ class LlamaStack(
Memory, Memory,
Evaluations, Evaluations,
Models, Models,
MemoryBanks,
Shields, Shields,
): ):
pass pass

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-23 09:14:46.697401" "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-23 10:08:50.987103"
}, },
"servers": [ "servers": [
{ {
@ -1180,7 +1180,7 @@
] ]
} }
}, },
"/memory/get": { "/memory_banks/get": {
"get": { "get": {
"responses": { "responses": {
"200": { "200": {
@ -1190,7 +1190,7 @@
"schema": { "schema": {
"oneOf": [ "oneOf": [
{ {
"$ref": "#/components/schemas/MemoryBank" "$ref": "#/components/schemas/MemoryBankSpec"
}, },
{ {
"type": "null" "type": "null"
@ -1202,15 +1202,15 @@
} }
}, },
"tags": [ "tags": [
"MemoryBanks" "Memory"
], ],
"parameters": [ "parameters": [
{ {
"name": "bank_id", "name": "bank_type",
"in": "query", "in": "query",
"required": true, "required": true,
"schema": { "schema": {
"type": "string" "$ref": "#/components/schemas/MemoryBankType"
} }
}, },
{ {
@ -1530,7 +1530,7 @@
} }
} }
}, },
"/memory/list": { "/memory_banks/list": {
"get": { "get": {
"responses": { "responses": {
"200": { "200": {
@ -1538,14 +1538,14 @@
"content": { "content": {
"application/jsonl": { "application/jsonl": {
"schema": { "schema": {
"$ref": "#/components/schemas/MemoryBank" "$ref": "#/components/schemas/MemoryBankSpec"
} }
} }
} }
} }
}, },
"tags": [ "tags": [
"MemoryBanks" "Memory"
], ],
"parameters": [ "parameters": [
{ {
@ -4471,6 +4471,66 @@
"job_uuid" "job_uuid"
] ]
}, },
"MemoryBankType": {
"type": "string",
"enum": [
"vector",
"keyvalue",
"keyword",
"graph"
]
},
"MemoryBankSpec": {
"type": "object",
"properties": {
"bank_type": {
"$ref": "#/components/schemas/MemoryBankType"
},
"provider_config": {
"type": "object",
"properties": {
"provider_id": {
"type": "string"
},
"config": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
}
}
},
"additionalProperties": false,
"required": [
"provider_id",
"config"
]
}
},
"additionalProperties": false,
"required": [
"bank_type",
"provider_config"
]
},
"Model": { "Model": {
"description": "The model family and SKU of the model along with other parameters corresponding to the model." "description": "The model family and SKU of the model along with other parameters corresponding to the model."
}, },
@ -5834,35 +5894,11 @@
} }
], ],
"tags": [ "tags": [
{
"name": "Evaluations"
},
{
"name": "MemoryBanks"
},
{
"name": "Memory"
},
{ {
"name": "Datasets" "name": "Datasets"
}, },
{ {
"name": "Inference" "name": "Safety"
},
{
"name": "BatchInference"
},
{
"name": "PostTraining"
},
{
"name": "SyntheticDataGeneration"
},
{
"name": "Models"
},
{
"name": "RewardScoring"
}, },
{ {
"name": "Telemetry" "name": "Telemetry"
@ -5871,11 +5907,32 @@
"name": "Agents" "name": "Agents"
}, },
{ {
"name": "Safety" "name": "BatchInference"
},
{
"name": "Models"
},
{
"name": "SyntheticDataGeneration"
},
{
"name": "Evaluations"
}, },
{ {
"name": "Shields" "name": "Shields"
}, },
{
"name": "Memory"
},
{
"name": "PostTraining"
},
{
"name": "RewardScoring"
},
{
"name": "Inference"
},
{ {
"name": "BuiltinTool", "name": "BuiltinTool",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/BuiltinTool\" />" "description": "<SchemaDefinition schemaRef=\"#/components/schemas/BuiltinTool\" />"
@ -6216,6 +6273,14 @@
"name": "EvaluationJobStatusResponse", "name": "EvaluationJobStatusResponse",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/EvaluationJobStatusResponse\" />" "description": "<SchemaDefinition schemaRef=\"#/components/schemas/EvaluationJobStatusResponse\" />"
}, },
{
"name": "MemoryBankType",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/MemoryBankType\" />"
},
{
"name": "MemoryBankSpec",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/MemoryBankSpec\" />"
},
{ {
"name": "Model", "name": "Model",
"description": "The model family and SKU of the model along with other parameters corresponding to the model.\n\n<SchemaDefinition schemaRef=\"#/components/schemas/Model\" />" "description": "The model family and SKU of the model along with other parameters corresponding to the model.\n\n<SchemaDefinition schemaRef=\"#/components/schemas/Model\" />"
@ -6391,7 +6456,6 @@
"Evaluations", "Evaluations",
"Inference", "Inference",
"Memory", "Memory",
"MemoryBanks",
"Models", "Models",
"PostTraining", "PostTraining",
"RewardScoring", "RewardScoring",
@ -6467,6 +6531,8 @@
"LoraFinetuningConfig", "LoraFinetuningConfig",
"MemoryBank", "MemoryBank",
"MemoryBankDocument", "MemoryBankDocument",
"MemoryBankSpec",
"MemoryBankType",
"MemoryRetrievalStep", "MemoryRetrievalStep",
"MemoryToolDefinition", "MemoryToolDefinition",
"MetricEvent", "MetricEvent",

View file

@ -1039,6 +1039,41 @@ components:
- content - content
- metadata - metadata
type: object type: object
MemoryBankSpec:
additionalProperties: false
properties:
bank_type:
$ref: '#/components/schemas/MemoryBankType'
provider_config:
additionalProperties: false
properties:
config:
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
type: object
provider_id:
type: string
required:
- provider_id
- config
type: object
required:
- bank_type
- provider_config
type: object
MemoryBankType:
enum:
- vector
- keyvalue
- keyword
- graph
type: string
MemoryRetrievalStep: MemoryRetrievalStep:
additionalProperties: false additionalProperties: false
properties: properties:
@ -2408,7 +2443,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-23 09:14:46.697401" \ draft and subject to change.\n Generated at 2024-09-23 10:08:50.987103"
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
@ -3112,32 +3147,6 @@ paths:
description: OK description: OK
tags: tags:
- Memory - Memory
/memory/get:
get:
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
responses:
'200':
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/MemoryBank'
- type: 'null'
description: OK
tags:
- MemoryBanks
/memory/insert: /memory/insert:
post: post:
parameters: parameters:
@ -3159,25 +3168,6 @@ paths:
description: OK description: OK
tags: tags:
- Memory - Memory
/memory/list:
get:
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
responses:
'200':
content:
application/jsonl:
schema:
$ref: '#/components/schemas/MemoryBank'
description: OK
tags:
- MemoryBanks
/memory/query: /memory/query:
post: post:
parameters: parameters:
@ -3224,6 +3214,51 @@ paths:
description: OK description: OK
tags: tags:
- Memory - Memory
/memory_banks/get:
get:
parameters:
- in: query
name: bank_type
required: true
schema:
$ref: '#/components/schemas/MemoryBankType'
- 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
responses:
'200':
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/MemoryBankSpec'
- type: 'null'
description: OK
tags:
- Memory
/memory_banks/list:
get:
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
responses:
'200':
content:
application/jsonl:
schema:
$ref: '#/components/schemas/MemoryBankSpec'
description: OK
tags:
- Memory
/models/get: /models/get:
get: get:
parameters: parameters:
@ -3601,20 +3636,19 @@ security:
servers: servers:
- url: http://any-hosted-llama-stack.com - url: http://any-hosted-llama-stack.com
tags: tags:
- name: Evaluations
- name: MemoryBanks
- name: Memory
- name: Datasets - name: Datasets
- name: Inference - name: Safety
- name: BatchInference
- name: PostTraining
- name: SyntheticDataGeneration
- name: Models
- name: RewardScoring
- name: Telemetry - name: Telemetry
- name: Agents - name: Agents
- name: Safety - name: BatchInference
- name: Models
- name: SyntheticDataGeneration
- name: Evaluations
- name: Shields - name: Shields
- name: Memory
- name: PostTraining
- name: RewardScoring
- 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"
@ -3882,6 +3916,10 @@ tags:
- description: <SchemaDefinition schemaRef="#/components/schemas/EvaluationJobStatusResponse" - description: <SchemaDefinition schemaRef="#/components/schemas/EvaluationJobStatusResponse"
/> />
name: EvaluationJobStatusResponse name: EvaluationJobStatusResponse
- description: <SchemaDefinition schemaRef="#/components/schemas/MemoryBankType" />
name: MemoryBankType
- description: <SchemaDefinition schemaRef="#/components/schemas/MemoryBankSpec" />
name: MemoryBankSpec
- description: 'The model family and SKU of the model along with other parameters - description: 'The model family and SKU of the model along with other parameters
corresponding to the model. corresponding to the model.
@ -4025,7 +4063,6 @@ x-tagGroups:
- Evaluations - Evaluations
- Inference - Inference
- Memory - Memory
- MemoryBanks
- Models - Models
- PostTraining - PostTraining
- RewardScoring - RewardScoring
@ -4098,6 +4135,8 @@ x-tagGroups:
- LoraFinetuningConfig - LoraFinetuningConfig
- MemoryBank - MemoryBank
- MemoryBankDocument - MemoryBankDocument
- MemoryBankSpec
- MemoryBankType
- MemoryRetrievalStep - MemoryRetrievalStep
- MemoryToolDefinition - MemoryToolDefinition
- MetricEvent - MetricEvent