Elffuss BraidHub

kikocis/llama-stack public

update MemoryToolDefinition
Changeseta143779f5cb8cd0c4af71056f0a087a3af4dd5d143273368ab39e61b1cb8f6ef
AuthorXi Yan <xiyan@meta.com> · 2024-09-20 17:51 -07:00
CommitterXi Yan <xiyan@meta.com> · 2024-09-20 17:51 -07:00
Parents3fc339af16ee

Browse the files at this changeset

3 files changed

modified docs/llama-stack-spec.html +197 −189
@@ -21,7 +21,7 @@
2121 "info": {
2222 "title": "[DRAFT] Llama Stack Specification",
2323 "version": "0.0.1",
24- "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"
24+ "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"
2525 },
2626 "servers": [
2727 {
@@ -2147,183 +2147,7 @@
21472147 "$ref": "#/components/schemas/FunctionCallToolDefinition"
21482148 },
21492149 {
2150- "type": "object",
2151- "properties": {
2152- "input_shields": {
2153- "type": "array",
2154- "items": {
2155- "$ref": "#/components/schemas/ShieldDefinition"
2156- }
2157- },
2158- "output_shields": {
2159- "type": "array",
2160- "items": {
2161- "$ref": "#/components/schemas/ShieldDefinition"
2162- }
2163- },
2164- "type": {
2165- "type": "string",
2166- "const": "memory"
2167- },
2168- "memory_bank_configs": {
2169- "type": "array",
2170- "items": {
2171- "oneOf": [
2172- {
2173- "type": "object",
2174- "properties": {
2175- "bank_id": {
2176- "type": "string"
2177- },
2178- "type": {
2179- "type": "string",
2180- "const": "vector"
2181- }
2182- },
2183- "additionalProperties": false,
2184- "required": [
2185- "bank_id",
2186- "type"
2187- ]
2188- },
2189- {
2190- "type": "object",
2191- "properties": {
2192- "bank_id": {
2193- "type": "string"
2194- },
2195- "type": {
2196- "type": "string",
2197- "const": "keyvalue"
2198- },
2199- "keys": {
2200- "type": "array",
2201- "items": {
2202- "type": "string"
2203- }
2204- }
2205- },
2206- "additionalProperties": false,
2207- "required": [
2208- "bank_id",
2209- "type",
2210- "keys"
2211- ]
2212- },
2213- {
2214- "type": "object",
2215- "properties": {
2216- "bank_id": {
2217- "type": "string"
2218- },
2219- "type": {
2220- "type": "string",
2221- "const": "keyword"
2222- }
2223- },
2224- "additionalProperties": false,
2225- "required": [
2226- "bank_id",
2227- "type"
2228- ]
2229- },
2230- {
2231- "type": "object",
2232- "properties": {
2233- "bank_id": {
2234- "type": "string"
2235- },
2236- "type": {
2237- "type": "string",
2238- "const": "graph"
2239- },
2240- "entities": {
2241- "type": "array",
2242- "items": {
2243- "type": "string"
2244- }
2245- }
2246- },
2247- "additionalProperties": false,
2248- "required": [
2249- "bank_id",
2250- "type",
2251- "entities"
2252- ]
2253- }
2254- ]
2255- }
2256- },
2257- "query_generator_config": {
2258- "oneOf": [
2259- {
2260- "type": "object",
2261- "properties": {
2262- "type": {
2263- "type": "string",
2264- "const": "default"
2265- },
2266- "sep": {
2267- "type": "string"
2268- }
2269- },
2270- "additionalProperties": false,
2271- "required": [
2272- "type",
2273- "sep"
2274- ]
2275- },
2276- {
2277- "type": "object",
2278- "properties": {
2279- "type": {
2280- "type": "string",
2281- "const": "llm"
2282- },
2283- "model": {
2284- "type": "string"
2285- },
2286- "template": {
2287- "type": "string"
2288- }
2289- },
2290- "additionalProperties": false,
2291- "required": [
2292- "type",
2293- "model",
2294- "template"
2295- ]
2296- },
2297- {
2298- "type": "object",
2299- "properties": {
2300- "type": {
2301- "type": "string",
2302- "const": "custom"
2303- }
2304- },
2305- "additionalProperties": false,
2306- "required": [
2307- "type"
2308- ]
2309- }
2310- ]
2311- },
2312- "max_tokens_in_context": {
2313- "type": "integer"
2314- },
2315- "max_chunks": {
2316- "type": "integer"
2317- }
2318- },
2319- "additionalProperties": false,
2320- "required": [
2321- "type",
2322- "memory_bank_configs",
2323- "query_generator_config",
2324- "max_tokens_in_context",
2325- "max_chunks"
2326- ]
2150+ "$ref": "#/components/schemas/MemoryToolDefinition"
23272151 }
23282152 ]
23292153 }
@@ -2432,6 +2256,185 @@
24322256 "parameters"
24332257 ]
24342258 },
2259+ "MemoryToolDefinition": {
2260+ "type": "object",
2261+ "properties": {
2262+ "input_shields": {
2263+ "type": "array",
2264+ "items": {
2265+ "$ref": "#/components/schemas/ShieldDefinition"
2266+ }
2267+ },
2268+ "output_shields": {
2269+ "type": "array",
2270+ "items": {
2271+ "$ref": "#/components/schemas/ShieldDefinition"
2272+ }
2273+ },
2274+ "type": {
2275+ "type": "string",
2276+ "const": "memory"
2277+ },
2278+ "memory_bank_configs": {
2279+ "type": "array",
2280+ "items": {
2281+ "oneOf": [
2282+ {
2283+ "type": "object",
2284+ "properties": {
2285+ "bank_id": {
2286+ "type": "string"
2287+ },
2288+ "type": {
2289+ "type": "string",
2290+ "const": "vector"
2291+ }
2292+ },
2293+ "additionalProperties": false,
2294+ "required": [
2295+ "bank_id",
2296+ "type"
2297+ ]
2298+ },
2299+ {
2300+ "type": "object",
2301+ "properties": {
2302+ "bank_id": {
2303+ "type": "string"
2304+ },
2305+ "type": {
2306+ "type": "string",
2307+ "const": "keyvalue"
2308+ },
2309+ "keys": {
2310+ "type": "array",
2311+ "items": {
2312+ "type": "string"
2313+ }
2314+ }
2315+ },
2316+ "additionalProperties": false,
2317+ "required": [
2318+ "bank_id",
2319+ "type",
2320+ "keys"
2321+ ]
2322+ },
2323+ {
2324+ "type": "object",
2325+ "properties": {
2326+ "bank_id": {
2327+ "type": "string"
2328+ },
2329+ "type": {
2330+ "type": "string",
2331+ "const": "keyword"
2332+ }
2333+ },
2334+ "additionalProperties": false,
2335+ "required": [
2336+ "bank_id",
2337+ "type"
2338+ ]
2339+ },
2340+ {
2341+ "type": "object",
2342+ "properties": {
2343+ "bank_id": {
2344+ "type": "string"
2345+ },
2346+ "type": {
2347+ "type": "string",
2348+ "const": "graph"
2349+ },
2350+ "entities": {
2351+ "type": "array",
2352+ "items": {
2353+ "type": "string"
2354+ }
2355+ }
2356+ },
2357+ "additionalProperties": false,
2358+ "required": [
2359+ "bank_id",
2360+ "type",
2361+ "entities"
2362+ ]
2363+ }
2364+ ]
2365+ }
2366+ },
2367+ "query_generator_config": {
2368+ "oneOf": [
2369+ {
2370+ "type": "object",
2371+ "properties": {
2372+ "type": {
2373+ "type": "string",
2374+ "const": "default"
2375+ },
2376+ "sep": {
2377+ "type": "string"
2378+ }
2379+ },
2380+ "additionalProperties": false,
2381+ "required": [
2382+ "type",
2383+ "sep"
2384+ ]
2385+ },
2386+ {
2387+ "type": "object",
2388+ "properties": {
2389+ "type": {
2390+ "type": "string",
2391+ "const": "llm"
2392+ },
2393+ "model": {
2394+ "type": "string"
2395+ },
2396+ "template": {
2397+ "type": "string"
2398+ }
2399+ },
2400+ "additionalProperties": false,
2401+ "required": [
2402+ "type",
2403+ "model",
2404+ "template"
2405+ ]
2406+ },
2407+ {
2408+ "type": "object",
2409+ "properties": {
2410+ "type": {
2411+ "type": "string",
2412+ "const": "custom"
2413+ }
2414+ },
2415+ "additionalProperties": false,
2416+ "required": [
2417+ "type"
2418+ ]
2419+ }
2420+ ]
2421+ },
2422+ "max_tokens_in_context": {
2423+ "type": "integer"
2424+ },
2425+ "max_chunks": {
2426+ "type": "integer"
2427+ }
2428+ },
2429+ "additionalProperties": false,
2430+ "required": [
2431+ "type",
2432+ "memory_bank_configs",
2433+ "query_generator_config",
2434+ "max_tokens_in_context",
2435+ "max_chunks"
2436+ ]
2437+ },
24352438 "OnViolationAction": {
24362439 "type": "integer",
24372440 "enum": [
@@ -5149,37 +5152,37 @@
51495152 ],
51505153 "tags": [
51515154 {
5152- "name": "BatchInference"
5153- },
5154- {
5155- "name": "PostTraining"
5155+ "name": "Safety"
51565156 },
51575157 {
51585158 "name": "Inference"
51595159 },
51605160 {
5161- "name": "Safety"
5161+ "name": "Evaluations"
51625162 },
51635163 {
5164- "name": "RewardScoring"
5164+ "name": "PostTraining"
51655165 },
51665166 {
5167- "name": "Telemetry"
5167+ "name": "BatchInference"
51685168 },
51695169 {
5170- "name": "Evaluations"
5170+ "name": "Memory"
51715171 },
51725172 {
5173- "name": "SyntheticDataGeneration"
5173+ "name": "Datasets"
51745174 },
51755175 {
5176- "name": "Memory"
5176+ "name": "RewardScoring"
51775177 },
51785178 {
51795179 "name": "Agents"
51805180 },
51815181 {
5182- "name": "Datasets"
5182+ "name": "Telemetry"
5183+ },
5184+ {
5185+ "name": "SyntheticDataGeneration"
51835186 },
51845187 {
51855188 "name": "BuiltinTool",
@@ -5317,6 +5320,10 @@
53175320 "name": "FunctionCallToolDefinition",
53185321 "description": "<SchemaDefinition schemaRef=\"#/components/schemas/FunctionCallToolDefinition\" />"
53195322 },
5323+ {
5324+ "name": "MemoryToolDefinition",
5325+ "description": "<SchemaDefinition schemaRef=\"#/components/schemas/MemoryToolDefinition\" />"
5326+ },
53205327 {
53215328 "name": "OnViolationAction",
53225329 "description": "<SchemaDefinition schemaRef=\"#/components/schemas/OnViolationAction\" />"
@@ -5763,6 +5770,7 @@
57635770 "MemoryBank",
57645771 "MemoryBankDocument",
57655772 "MemoryRetrievalStep",
5773+ "MemoryToolDefinition",
57665774 "MetricEvent",
57675775 "OnViolationAction",
57685776 "OptimizerConfig",
modified docs/llama-stack-spec.yaml +131 −125
@@ -30,123 +30,7 @@
3030 - $ref: '#/components/schemas/PhotogenToolDefinition'
3131 - $ref: '#/components/schemas/CodeInterpreterToolDefinition'
3232 - $ref: '#/components/schemas/FunctionCallToolDefinition'
33- - additionalProperties: false
34- properties:
35- input_shields:
36- items:
37- $ref: '#/components/schemas/ShieldDefinition'
38- type: array
39- max_chunks:
40- type: integer
41- max_tokens_in_context:
42- type: integer
43- memory_bank_configs:
44- items:
45- oneOf:
46- - additionalProperties: false
47- properties:
48- bank_id:
49- type: string
50- type:
51- const: vector
52- type: string
53- required:
54- - bank_id
55- - type
56- type: object
57- - additionalProperties: false
58- properties:
59- bank_id:
60- type: string
61- keys:
62- items:
63- type: string
64- type: array
65- type:
66- const: keyvalue
67- type: string
68- required:
69- - bank_id
70- - type
71- - keys
72- type: object
73- - additionalProperties: false
74- properties:
75- bank_id:
76- type: string
77- type:
78- const: keyword
79- type: string
80- required:
81- - bank_id
82- - type
83- type: object
84- - additionalProperties: false
85- properties:
86- bank_id:
87- type: string
88- entities:
89- items:
90- type: string
91- type: array
92- type:
93- const: graph
94- type: string
95- required:
96- - bank_id
97- - type
98- - entities
99- type: object
100- type: array
101- output_shields:
102- items:
103- $ref: '#/components/schemas/ShieldDefinition'
104- type: array
105- query_generator_config:
106- oneOf:
107- - additionalProperties: false
108- properties:
109- sep:
110- type: string
111- type:
112- const: default
113- type: string
114- required:
115- - type
116- - sep
117- type: object
118- - additionalProperties: false
119- properties:
120- model:
121- type: string
122- template:
123- type: string
124- type:
125- const: llm
126- type: string
127- required:
128- - type
129- - model
130- - template
131- type: object
132- - additionalProperties: false
133- properties:
134- type:
135- const: custom
136- type: string
137- required:
138- - type
139- type: object
140- type:
141- const: memory
142- type: string
143- required:
144- - type
145- - memory_bank_configs
146- - query_generator_config
147- - max_tokens_in_context
148- - max_chunks
149- type: object
33+ - $ref: '#/components/schemas/MemoryToolDefinition'
15034 type: array
15135 required:
15236 - model
@@ -1190,6 +1074,124 @@
11901074 - memory_bank_ids
11911075 - inserted_context
11921076 type: object
1077+ MemoryToolDefinition:
1078+ additionalProperties: false
1079+ properties:
1080+ input_shields:
1081+ items:
1082+ $ref: '#/components/schemas/ShieldDefinition'
1083+ type: array
1084+ max_chunks:
1085+ type: integer
1086+ max_tokens_in_context:
1087+ type: integer
1088+ memory_bank_configs:
1089+ items:
1090+ oneOf:
1091+ - additionalProperties: false
1092+ properties:
1093+ bank_id:
1094+ type: string
1095+ type:
1096+ const: vector
1097+ type: string
1098+ required:
1099+ - bank_id
1100+ - type
1101+ type: object
1102+ - additionalProperties: false
1103+ properties:
1104+ bank_id:
1105+ type: string
1106+ keys:
1107+ items:
1108+ type: string
1109+ type: array
1110+ type:
1111+ const: keyvalue
1112+ type: string
1113+ required:
1114+ - bank_id
1115+ - type
1116+ - keys
1117+ type: object
1118+ - additionalProperties: false
1119+ properties:
1120+ bank_id:
1121+ type: string
1122+ type:
1123+ const: keyword
1124+ type: string
1125+ required:
1126+ - bank_id
1127+ - type
1128+ type: object
1129+ - additionalProperties: false
1130+ properties:
1131+ bank_id:
1132+ type: string
1133+ entities:
1134+ items:
1135+ type: string
1136+ type: array
1137+ type:
1138+ const: graph
1139+ type: string
1140+ required:
1141+ - bank_id
1142+ - type
1143+ - entities
1144+ type: object
1145+ type: array
1146+ output_shields:
1147+ items:
1148+ $ref: '#/components/schemas/ShieldDefinition'
1149+ type: array
1150+ query_generator_config:
1151+ oneOf:
1152+ - additionalProperties: false
1153+ properties:
1154+ sep:
1155+ type: string
1156+ type:
1157+ const: default
1158+ type: string
1159+ required:
1160+ - type
1161+ - sep
1162+ type: object
1163+ - additionalProperties: false
1164+ properties:
1165+ model:
1166+ type: string
1167+ template:
1168+ type: string
1169+ type:
1170+ const: llm
1171+ type: string
1172+ required:
1173+ - type
1174+ - model
1175+ - template
1176+ type: object
1177+ - additionalProperties: false
1178+ properties:
1179+ type:
1180+ const: custom
1181+ type: string
1182+ required:
1183+ - type
1184+ type: object
1185+ type:
1186+ const: memory
1187+ type: string
1188+ required:
1189+ - type
1190+ - memory_bank_configs
1191+ - query_generator_config
1192+ - max_tokens_in_context
1193+ - max_chunks
1194+ type: object
11931195 MetricEvent:
11941196 additionalProperties: false
11951197 properties:
@@ -2362,7 +2364,7 @@
23622364 description: "This is the specification of the llama stack that provides\n \
23632365 \ a set of endpoints and their corresponding interfaces that are tailored\
23642366 \ to\n best leverage Llama Models. The specification is still in\
2365- \ draft and subject to change.\n Generated at 2024-09-18 19:27:39.955190"
2367+ \ draft and subject to change.\n Generated at 2024-09-20 17:50:36.257743"
23662368 title: '[DRAFT] Llama Stack Specification'
23672369 version: 0.0.1
23682370 jsonSchemaDialect: https://json-schema.org/draft/2020-12/schema
@@ -3150,17 +3152,17 @@
31503152 servers:
31513153 - url: http://any-hosted-llama-stack.com
31523154 tags:
3153-- name: BatchInference
3154-- name: PostTraining
3155-- name: Inference
31563155 - name: Safety
3157-- name: RewardScoring
3158-- name: Telemetry
3156+- name: Inference
31593157 - name: Evaluations
3160-- name: SyntheticDataGeneration
3158+- name: PostTraining
3159+- name: BatchInference
31613160 - name: Memory
3162-- name: Agents
31633161 - name: Datasets
3162+- name: RewardScoring
3163+- name: Agents
3164+- name: Telemetry
3165+- name: SyntheticDataGeneration
31643166 - description: <SchemaDefinition schemaRef="#/components/schemas/BuiltinTool" />
31653167 name: BuiltinTool
31663168 - description: <SchemaDefinition schemaRef="#/components/schemas/CompletionMessage"
@@ -3272,6 +3274,9 @@
32723274 - description: <SchemaDefinition schemaRef="#/components/schemas/FunctionCallToolDefinition"
32733275 />
32743276 name: FunctionCallToolDefinition
3277+- description: <SchemaDefinition schemaRef="#/components/schemas/MemoryToolDefinition"
3278+ />
3279+ name: MemoryToolDefinition
32753280 - description: <SchemaDefinition schemaRef="#/components/schemas/OnViolationAction"
32763281 />
32773282 name: OnViolationAction
@@ -3634,6 +3639,7 @@
36343639 - MemoryBank
36353640 - MemoryBankDocument
36363641 - MemoryRetrievalStep
3642+ - MemoryToolDefinition
36373643 - MetricEvent
36383644 - OnViolationAction
36393645 - OptimizerConfig
modified llama_stack/apis/agents/agents.py +1 −0
@@ -151,6 +151,7 @@
151151 ]
152152
153153
154+@json_schema_type
154155 class MemoryToolDefinition(ToolDefinitionCommon):
155156 type: Literal[AgentTool.memory.value] = AgentTool.memory.value
156157 memory_bank_configs: List[MemoryBankConfig] = Field(default_factory=list)