Elffuss BraidHub

kikocis/llama-stack public

rename observability -> Telemetry; regen Spec
Changeset7d178b9d269ac7934eb0a5a42b680343c8b3169cdde99b92e4bcfba4fdde984e
AuthorAshwin Bharambe <ashwin@meta.com> · 2024-09-07 15:23 -07:00
CommitterAshwin Bharambe <ashwin@meta.com> · 2024-09-07 15:23 -07:00
Parentsfb896ea47ba7

Browse the files at this changeset

10 files changed

deleted llama_toolchain/observability/__init__.py +0 −5
@@ -1,5 +0,0 @@
1-# Copyright (c) Meta Platforms, Inc. and affiliates.
2-# All rights reserved.
3-#
4-# This source code is licensed under the terms described in the LICENSE file in
5-# the root directory of this source tree.
deleted llama_toolchain/observability/api/__init__.py +0 −7
@@ -1,7 +0,0 @@
1-# Copyright (c) Meta Platforms, Inc. and affiliates.
2-# All rights reserved.
3-#
4-# This source code is licensed under the terms described in the LICENSE file in
5-# the root directory of this source tree.
6-
7-from .api import * # noqa: F401 F403
deleted llama_toolchain/observability/api/api.py +0 −175
@@ -1,175 +0,0 @@
1-# Copyright (c) Meta Platforms, Inc. and affiliates.
2-# All rights reserved.
3-#
4-# This source code is licensed under the terms described in the LICENSE file in
5-# the root directory of this source tree.
6-
7-from datetime import datetime
8-from enum import Enum
9-
10-from typing import Any, Dict, List, Optional, Protocol, Union
11-
12-from llama_models.schema_utils import json_schema_type, webmethod
13-
14-from pydantic import BaseModel
15-
16-
17-@json_schema_type
18-class ExperimentStatus(Enum):
19- NOT_STARTED = "not_started"
20- RUNNING = "running"
21- COMPLETED = "completed"
22- FAILED = "failed"
23-
24-
25-@json_schema_type
26-class Experiment(BaseModel):
27- id: str
28- name: str
29- status: ExperimentStatus
30- created_at: datetime
31- updated_at: datetime
32- metadata: Dict[str, Any]
33-
34-
35-@json_schema_type
36-class Run(BaseModel):
37- id: str
38- experiment_id: str
39- status: str
40- started_at: datetime
41- ended_at: Optional[datetime]
42- metadata: Dict[str, Any]
43-
44-
45-@json_schema_type
46-class Metric(BaseModel):
47- name: str
48- value: Union[float, int, str, bool]
49- timestamp: datetime
50- run_id: str
51-
52-
53-@json_schema_type
54-class Log(BaseModel):
55- message: str
56- level: str
57- timestamp: datetime
58- additional_info: Dict[str, Any]
59-
60-
61-@json_schema_type
62-class ArtifactType(Enum):
63- MODEL = "model"
64- DATASET = "dataset"
65- CHECKPOINT = "checkpoint"
66- PLOT = "plot"
67- METRIC = "metric"
68- CONFIG = "config"
69- CODE = "code"
70- OTHER = "other"
71-
72-
73-@json_schema_type
74-class Artifact(BaseModel):
75- id: str
76- name: str
77- type: ArtifactType
78- size: int
79- created_at: datetime
80- metadata: Dict[str, Any]
81-
82-
83-@json_schema_type
84-class CreateExperimentRequest(BaseModel):
85- name: str
86- metadata: Optional[Dict[str, Any]] = None
87-
88-
89-@json_schema_type
90-class UpdateExperimentRequest(BaseModel):
91- experiment_id: str
92- status: Optional[ExperimentStatus] = None
93- metadata: Optional[Dict[str, Any]] = None
94-
95-
96-@json_schema_type
97-class CreateRunRequest(BaseModel):
98- experiment_id: str
99- metadata: Optional[Dict[str, Any]] = None
100-
101-
102-@json_schema_type
103-class UpdateRunRequest(BaseModel):
104- run_id: str
105- status: Optional[str] = None
106- ended_at: Optional[datetime] = None
107- metadata: Optional[Dict[str, Any]] = None
108-
109-
110-@json_schema_type
111-class LogMetricsRequest(BaseModel):
112- run_id: str
113- metrics: List[Metric]
114-
115-
116-@json_schema_type
117-class LogMessagesRequest(BaseModel):
118- logs: List[Log]
119- run_id: Optional[str] = None
120-
121-
122-@json_schema_type
123-class UploadArtifactRequest(BaseModel):
124- experiment_id: str
125- name: str
126- artifact_type: str
127- content: bytes
128- metadata: Optional[Dict[str, Any]] = None
129-
130-
131-@json_schema_type
132-class LogSearchRequest(BaseModel):
133- query: str
134- filters: Optional[Dict[str, Any]] = None
135-
136-
137-class Observability(Protocol):
138- @webmethod(route="/experiments/create")
139- def create_experiment(self, request: CreateExperimentRequest) -> Experiment: ...
140-
141- @webmethod(route="/experiments/list")
142- def list_experiments(self) -> List[Experiment]: ...
143-
144- @webmethod(route="/experiments/get")
145- def get_experiment(self, experiment_id: str) -> Experiment: ...
146-
147- @webmethod(route="/experiments/update")
148- def update_experiment(self, request: UpdateExperimentRequest) -> Experiment: ...
149-
150- @webmethod(route="/experiments/create_run")
151- def create_run(self, request: CreateRunRequest) -> Run: ...
152-
153- @webmethod(route="/runs/update")
154- def update_run(self, request: UpdateRunRequest) -> Run: ...
155-
156- @webmethod(route="/runs/log_metrics")
157- def log_metrics(self, request: LogMetricsRequest) -> None: ...
158-
159- @webmethod(route="/runs/metrics", method="GET")
160- def get_metrics(self, run_id: str) -> List[Metric]: ...
161-
162- @webmethod(route="/logging/log_messages")
163- def log_messages(self, request: LogMessagesRequest) -> None: ...
164-
165- @webmethod(route="/logging/get_logs")
166- def get_logs(self, request: LogSearchRequest) -> List[Log]: ...
167-
168- @webmethod(route="/experiments/artifacts/upload")
169- def upload_artifact(self, request: UploadArtifactRequest) -> Artifact: ...
170-
171- @webmethod(route="/experiments/artifacts/get")
172- def list_artifacts(self, experiment_id: str) -> List[Artifact]: ...
173-
174- @webmethod(route="/artifacts/get")
175- def get_artifact(self, artifact_id: str) -> Artifact: ...
modified llama_toolchain/stack.py +2 −2
@@ -11,7 +11,7 @@
1111 from llama_toolchain.inference.api import * # noqa: F403
1212 from llama_toolchain.batch_inference.api import * # noqa: F403
1313 from llama_toolchain.memory.api import * # noqa: F403
14-from llama_toolchain.observability.api import * # noqa: F403
14+from llama_toolchain.telemetry.api import * # noqa: F403
1515 from llama_toolchain.post_training.api import * # noqa: F403
1616 from llama_toolchain.reward_scoring.api import * # noqa: F403
1717 from llama_toolchain.synthetic_data_generation.api import * # noqa: F403
@@ -24,7 +24,7 @@
2424 RewardScoring,
2525 SyntheticDataGeneration,
2626 Datasets,
27- Observability,
27+ Telemetry,
2828 PostTraining,
2929 Memory,
3030 Evaluations,
added llama_toolchain/telemetry/__init__.py +5 −0
@@ -0,0 +1,5 @@
1+# Copyright (c) Meta Platforms, Inc. and affiliates.
2+# All rights reserved.
3+#
4+# This source code is licensed under the terms described in the LICENSE file in
5+# the root directory of this source tree.
added llama_toolchain/telemetry/api/__init__.py +7 −0
@@ -0,0 +1,7 @@
1+# Copyright (c) Meta Platforms, Inc. and affiliates.
2+# All rights reserved.
3+#
4+# This source code is licensed under the terms described in the LICENSE file in
5+# the root directory of this source tree.
6+
7+from .api import * # noqa: F401 F403
added llama_toolchain/telemetry/api/api.py +175 −0
@@ -0,0 +1,175 @@
1+# Copyright (c) Meta Platforms, Inc. and affiliates.
2+# All rights reserved.
3+#
4+# This source code is licensed under the terms described in the LICENSE file in
5+# the root directory of this source tree.
6+
7+from datetime import datetime
8+from enum import Enum
9+
10+from typing import Any, Dict, List, Optional, Protocol, Union
11+
12+from llama_models.schema_utils import json_schema_type, webmethod
13+
14+from pydantic import BaseModel
15+
16+
17+@json_schema_type
18+class ExperimentStatus(Enum):
19+ NOT_STARTED = "not_started"
20+ RUNNING = "running"
21+ COMPLETED = "completed"
22+ FAILED = "failed"
23+
24+
25+@json_schema_type
26+class Experiment(BaseModel):
27+ id: str
28+ name: str
29+ status: ExperimentStatus
30+ created_at: datetime
31+ updated_at: datetime
32+ metadata: Dict[str, Any]
33+
34+
35+@json_schema_type
36+class Run(BaseModel):
37+ id: str
38+ experiment_id: str
39+ status: str
40+ started_at: datetime
41+ ended_at: Optional[datetime]
42+ metadata: Dict[str, Any]
43+
44+
45+@json_schema_type
46+class Metric(BaseModel):
47+ name: str
48+ value: Union[float, int, str, bool]
49+ timestamp: datetime
50+ run_id: str
51+
52+
53+@json_schema_type
54+class Log(BaseModel):
55+ message: str
56+ level: str
57+ timestamp: datetime
58+ additional_info: Dict[str, Any]
59+
60+
61+@json_schema_type
62+class ArtifactType(Enum):
63+ MODEL = "model"
64+ DATASET = "dataset"
65+ CHECKPOINT = "checkpoint"
66+ PLOT = "plot"
67+ METRIC = "metric"
68+ CONFIG = "config"
69+ CODE = "code"
70+ OTHER = "other"
71+
72+
73+@json_schema_type
74+class Artifact(BaseModel):
75+ id: str
76+ name: str
77+ type: ArtifactType
78+ size: int
79+ created_at: datetime
80+ metadata: Dict[str, Any]
81+
82+
83+@json_schema_type
84+class CreateExperimentRequest(BaseModel):
85+ name: str
86+ metadata: Optional[Dict[str, Any]] = None
87+
88+
89+@json_schema_type
90+class UpdateExperimentRequest(BaseModel):
91+ experiment_id: str
92+ status: Optional[ExperimentStatus] = None
93+ metadata: Optional[Dict[str, Any]] = None
94+
95+
96+@json_schema_type
97+class CreateRunRequest(BaseModel):
98+ experiment_id: str
99+ metadata: Optional[Dict[str, Any]] = None
100+
101+
102+@json_schema_type
103+class UpdateRunRequest(BaseModel):
104+ run_id: str
105+ status: Optional[str] = None
106+ ended_at: Optional[datetime] = None
107+ metadata: Optional[Dict[str, Any]] = None
108+
109+
110+@json_schema_type
111+class LogMetricsRequest(BaseModel):
112+ run_id: str
113+ metrics: List[Metric]
114+
115+
116+@json_schema_type
117+class LogMessagesRequest(BaseModel):
118+ logs: List[Log]
119+ run_id: Optional[str] = None
120+
121+
122+@json_schema_type
123+class UploadArtifactRequest(BaseModel):
124+ experiment_id: str
125+ name: str
126+ artifact_type: str
127+ content: bytes
128+ metadata: Optional[Dict[str, Any]] = None
129+
130+
131+@json_schema_type
132+class LogSearchRequest(BaseModel):
133+ query: str
134+ filters: Optional[Dict[str, Any]] = None
135+
136+
137+class Telemetry(Protocol):
138+ @webmethod(route="/experiments/create")
139+ def create_experiment(self, request: CreateExperimentRequest) -> Experiment: ...
140+
141+ @webmethod(route="/experiments/list")
142+ def list_experiments(self) -> List[Experiment]: ...
143+
144+ @webmethod(route="/experiments/get")
145+ def get_experiment(self, experiment_id: str) -> Experiment: ...
146+
147+ @webmethod(route="/experiments/update")
148+ def update_experiment(self, request: UpdateExperimentRequest) -> Experiment: ...
149+
150+ @webmethod(route="/experiments/create_run")
151+ def create_run(self, request: CreateRunRequest) -> Run: ...
152+
153+ @webmethod(route="/runs/update")
154+ def update_run(self, request: UpdateRunRequest) -> Run: ...
155+
156+ @webmethod(route="/runs/log_metrics")
157+ def log_metrics(self, request: LogMetricsRequest) -> None: ...
158+
159+ @webmethod(route="/runs/metrics", method="GET")
160+ def get_metrics(self, run_id: str) -> List[Metric]: ...
161+
162+ @webmethod(route="/logging/log_messages")
163+ def log_messages(self, request: LogMessagesRequest) -> None: ...
164+
165+ @webmethod(route="/logging/get_logs")
166+ def get_logs(self, request: LogSearchRequest) -> List[Log]: ...
167+
168+ @webmethod(route="/experiments/artifacts/upload")
169+ def upload_artifact(self, request: UploadArtifactRequest) -> Artifact: ...
170+
171+ @webmethod(route="/experiments/artifacts/get")
172+ def list_artifacts(self, experiment_id: str) -> List[Artifact]: ...
173+
174+ @webmethod(route="/artifacts/get")
175+ def get_artifact(self, artifact_id: str) -> Artifact: ...
modified rfcs/RFC-0001-llama-stack-assets/llama-stack-spec.html +380 −156
@@ -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-04 10:28:38.779789"
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-07 15:23:29.488676"
2525 },
2626 "servers": [
2727 {
@@ -323,7 +323,7 @@
323323 }
324324 },
325325 "tags": [
326- "Observability"
326+ "Telemetry"
327327 ],
328328 "parameters": [],
329329 "requestBody": {
@@ -383,7 +383,7 @@
383383 }
384384 },
385385 "tags": [
386- "Observability"
386+ "Telemetry"
387387 ],
388388 "parameters": [],
389389 "requestBody": {
@@ -784,7 +784,7 @@
784784 }
785785 },
786786 "tags": [
787- "Observability"
787+ "Telemetry"
788788 ],
789789 "parameters": [
790790 {
@@ -988,7 +988,7 @@
988988 }
989989 },
990990 "tags": [
991- "Observability"
991+ "Telemetry"
992992 ],
993993 "parameters": [
994994 {
@@ -1017,7 +1017,7 @@
10171017 }
10181018 },
10191019 "tags": [
1020- "Observability"
1020+ "Telemetry"
10211021 ],
10221022 "parameters": [],
10231023 "requestBody": {
@@ -1083,7 +1083,7 @@
10831083 }
10841084 },
10851085 "tags": [
1086- "Observability"
1086+ "Telemetry"
10871087 ],
10881088 "parameters": [
10891089 {
@@ -1242,7 +1242,7 @@
12421242 }
12431243 },
12441244 "tags": [
1245- "Observability"
1245+ "Telemetry"
12461246 ],
12471247 "parameters": [],
12481248 "requestBody": {
@@ -1272,7 +1272,7 @@
12721272 }
12731273 },
12741274 "tags": [
1275- "Observability"
1275+ "Telemetry"
12761276 ],
12771277 "parameters": []
12781278 }
@@ -1305,7 +1305,7 @@
13051305 }
13061306 },
13071307 "tags": [
1308- "Observability"
1308+ "Telemetry"
13091309 ],
13101310 "parameters": [],
13111311 "requestBody": {
@@ -1328,7 +1328,7 @@
13281328 }
13291329 },
13301330 "tags": [
1331- "Observability"
1331+ "Telemetry"
13321332 ],
13331333 "parameters": [],
13341334 "requestBody": {
@@ -1531,7 +1531,7 @@
15311531 }
15321532 },
15331533 "tags": [
1534- "Observability"
1534+ "Telemetry"
15351535 ],
15361536 "parameters": [],
15371537 "requestBody": {
@@ -1561,7 +1561,7 @@
15611561 }
15621562 },
15631563 "tags": [
1564- "Observability"
1564+ "Telemetry"
15651565 ],
15661566 "parameters": [],
15671567 "requestBody": {
@@ -1591,7 +1591,7 @@
15911591 }
15921592 },
15931593 "tags": [
1594- "Observability"
1594+ "Telemetry"
15951595 ],
15961596 "parameters": [],
15971597 "requestBody": {
@@ -2376,7 +2376,183 @@
23762376 "$ref": "#/components/schemas/FunctionCallToolDefinition"
23772377 },
23782378 {
2379- "$ref": "#/components/schemas/MemoryToolDefinition"
2379+ "type": "object",
2380+ "properties": {
2381+ "input_shields": {
2382+ "type": "array",
2383+ "items": {
2384+ "$ref": "#/components/schemas/ShieldDefinition"
2385+ }
2386+ },
2387+ "output_shields": {
2388+ "type": "array",
2389+ "items": {
2390+ "$ref": "#/components/schemas/ShieldDefinition"
2391+ }
2392+ },
2393+ "type": {
2394+ "type": "string",
2395+ "const": "memory"
2396+ },
2397+ "memory_bank_configs": {
2398+ "type": "array",
2399+ "items": {
2400+ "oneOf": [
2401+ {
2402+ "type": "object",
2403+ "properties": {
2404+ "bank_id": {
2405+ "type": "string"
2406+ },
2407+ "type": {
2408+ "type": "string",
2409+ "const": "vector"
2410+ }
2411+ },
2412+ "additionalProperties": false,
2413+ "required": [
2414+ "bank_id",
2415+ "type"
2416+ ]
2417+ },
2418+ {
2419+ "type": "object",
2420+ "properties": {
2421+ "bank_id": {
2422+ "type": "string"
2423+ },
2424+ "type": {
2425+ "type": "string",
2426+ "const": "keyvalue"
2427+ },
2428+ "keys": {
2429+ "type": "array",
2430+ "items": {
2431+ "type": "string"
2432+ }
2433+ }
2434+ },
2435+ "additionalProperties": false,
2436+ "required": [
2437+ "bank_id",
2438+ "type",
2439+ "keys"
2440+ ]
2441+ },
2442+ {
2443+ "type": "object",
2444+ "properties": {
2445+ "bank_id": {
2446+ "type": "string"
2447+ },
2448+ "type": {
2449+ "type": "string",
2450+ "const": "keyword"
2451+ }
2452+ },
2453+ "additionalProperties": false,
2454+ "required": [
2455+ "bank_id",
2456+ "type"
2457+ ]
2458+ },
2459+ {
2460+ "type": "object",
2461+ "properties": {
2462+ "bank_id": {
2463+ "type": "string"
2464+ },
2465+ "type": {
2466+ "type": "string",
2467+ "const": "graph"
2468+ },
2469+ "entities": {
2470+ "type": "array",
2471+ "items": {
2472+ "type": "string"
2473+ }
2474+ }
2475+ },
2476+ "additionalProperties": false,
2477+ "required": [
2478+ "bank_id",
2479+ "type",
2480+ "entities"
2481+ ]
2482+ }
2483+ ]
2484+ }
2485+ },
2486+ "query_generator_config": {
2487+ "oneOf": [
2488+ {
2489+ "type": "object",
2490+ "properties": {
2491+ "type": {
2492+ "type": "string",
2493+ "const": "default"
2494+ },
2495+ "sep": {
2496+ "type": "string"
2497+ }
2498+ },
2499+ "additionalProperties": false,
2500+ "required": [
2501+ "type",
2502+ "sep"
2503+ ]
2504+ },
2505+ {
2506+ "type": "object",
2507+ "properties": {
2508+ "type": {
2509+ "type": "string",
2510+ "const": "llm"
2511+ },
2512+ "model": {
2513+ "type": "string"
2514+ },
2515+ "template": {
2516+ "type": "string"
2517+ }
2518+ },
2519+ "additionalProperties": false,
2520+ "required": [
2521+ "type",
2522+ "model",
2523+ "template"
2524+ ]
2525+ },
2526+ {
2527+ "type": "object",
2528+ "properties": {
2529+ "type": {
2530+ "type": "string",
2531+ "const": "custom"
2532+ }
2533+ },
2534+ "additionalProperties": false,
2535+ "required": [
2536+ "type"
2537+ ]
2538+ }
2539+ ]
2540+ },
2541+ "max_tokens_in_context": {
2542+ "type": "integer"
2543+ },
2544+ "max_chunks": {
2545+ "type": "integer"
2546+ }
2547+ },
2548+ "additionalProperties": false,
2549+ "required": [
2550+ "type",
2551+ "memory_bank_configs",
2552+ "query_generator_config",
2553+ "max_tokens_in_context",
2554+ "max_chunks"
2555+ ]
23802556 }
23812557 ]
23822558 }
@@ -2513,129 +2689,6 @@
25132689 "parameters"
25142690 ]
25152691 },
2516- "MemoryToolDefinition": {
2517- "type": "object",
2518- "properties": {
2519- "input_shields": {
2520- "type": "array",
2521- "items": {
2522- "$ref": "#/components/schemas/ShieldDefinition"
2523- }
2524- },
2525- "output_shields": {
2526- "type": "array",
2527- "items": {
2528- "$ref": "#/components/schemas/ShieldDefinition"
2529- }
2530- },
2531- "type": {
2532- "type": "string",
2533- "const": "memory"
2534- },
2535- "memory_bank_configs": {
2536- "type": "array",
2537- "items": {
2538- "oneOf": [
2539- {
2540- "type": "object",
2541- "properties": {
2542- "bank_id": {
2543- "type": "string"
2544- },
2545- "type": {
2546- "type": "string",
2547- "const": "vector"
2548- }
2549- },
2550- "additionalProperties": false,
2551- "required": [
2552- "bank_id",
2553- "type"
2554- ]
2555- },
2556- {
2557- "type": "object",
2558- "properties": {
2559- "bank_id": {
2560- "type": "string"
2561- },
2562- "type": {
2563- "type": "string",
2564- "const": "keyvalue"
2565- },
2566- "keys": {
2567- "type": "array",
2568- "items": {
2569- "type": "string"
2570- }
2571- }
2572- },
2573- "additionalProperties": false,
2574- "required": [
2575- "bank_id",
2576- "type",
2577- "keys"
2578- ]
2579- },
2580- {
2581- "type": "object",
2582- "properties": {
2583- "bank_id": {
2584- "type": "string"
2585- },
2586- "type": {
2587- "type": "string",
2588- "const": "keyword"
2589- }
2590- },
2591- "additionalProperties": false,
2592- "required": [
2593- "bank_id",
2594- "type"
2595- ]
2596- },
2597- {
2598- "type": "object",
2599- "properties": {
2600- "bank_id": {
2601- "type": "string"
2602- },
2603- "type": {
2604- "type": "string",
2605- "const": "graph"
2606- },
2607- "entities": {
2608- "type": "array",
2609- "items": {
2610- "type": "string"
2611- }
2612- }
2613- },
2614- "additionalProperties": false,
2615- "required": [
2616- "bank_id",
2617- "type",
2618- "entities"
2619- ]
2620- }
2621- ]
2622- }
2623- },
2624- "max_tokens_in_context": {
2625- "type": "integer"
2626- },
2627- "max_chunks": {
2628- "type": "integer"
2629- }
2630- },
2631- "additionalProperties": false,
2632- "required": [
2633- "type",
2634- "memory_bank_configs",
2635- "max_tokens_in_context",
2636- "max_chunks"
2637- ]
2638- },
26392692 "OnViolationAction": {
26402693 "type": "integer",
26412694 "enum": [
@@ -2873,7 +2926,183 @@
28732926 "$ref": "#/components/schemas/FunctionCallToolDefinition"
28742927 },
28752928 {
2876- "$ref": "#/components/schemas/MemoryToolDefinition"
2929+ "type": "object",
2930+ "properties": {
2931+ "input_shields": {
2932+ "type": "array",
2933+ "items": {
2934+ "$ref": "#/components/schemas/ShieldDefinition"
2935+ }
2936+ },
2937+ "output_shields": {
2938+ "type": "array",
2939+ "items": {
2940+ "$ref": "#/components/schemas/ShieldDefinition"
2941+ }
2942+ },
2943+ "type": {
2944+ "type": "string",
2945+ "const": "memory"
2946+ },
2947+ "memory_bank_configs": {
2948+ "type": "array",
2949+ "items": {
2950+ "oneOf": [
2951+ {
2952+ "type": "object",
2953+ "properties": {
2954+ "bank_id": {
2955+ "type": "string"
2956+ },
2957+ "type": {
2958+ "type": "string",
2959+ "const": "vector"
2960+ }
2961+ },
2962+ "additionalProperties": false,
2963+ "required": [
2964+ "bank_id",
2965+ "type"
2966+ ]
2967+ },
2968+ {
2969+ "type": "object",
2970+ "properties": {
2971+ "bank_id": {
2972+ "type": "string"
2973+ },
2974+ "type": {
2975+ "type": "string",
2976+ "const": "keyvalue"
2977+ },
2978+ "keys": {
2979+ "type": "array",
2980+ "items": {
2981+ "type": "string"
2982+ }
2983+ }
2984+ },
2985+ "additionalProperties": false,
2986+ "required": [
2987+ "bank_id",
2988+ "type",
2989+ "keys"
2990+ ]
2991+ },
2992+ {
2993+ "type": "object",
2994+ "properties": {
2995+ "bank_id": {
2996+ "type": "string"
2997+ },
2998+ "type": {
2999+ "type": "string",
3000+ "const": "keyword"
3001+ }
3002+ },
3003+ "additionalProperties": false,
3004+ "required": [
3005+ "bank_id",
3006+ "type"
3007+ ]
3008+ },
3009+ {
3010+ "type": "object",
3011+ "properties": {
3012+ "bank_id": {
3013+ "type": "string"
3014+ },
3015+ "type": {
3016+ "type": "string",
3017+ "const": "graph"
3018+ },
3019+ "entities": {
3020+ "type": "array",
3021+ "items": {
3022+ "type": "string"
3023+ }
3024+ }
3025+ },
3026+ "additionalProperties": false,
3027+ "required": [
3028+ "bank_id",
3029+ "type",
3030+ "entities"
3031+ ]
3032+ }
3033+ ]
3034+ }
3035+ },
3036+ "query_generator_config": {
3037+ "oneOf": [
3038+ {
3039+ "type": "object",
3040+ "properties": {
3041+ "type": {
3042+ "type": "string",
3043+ "const": "default"
3044+ },
3045+ "sep": {
3046+ "type": "string"
3047+ }
3048+ },
3049+ "additionalProperties": false,
3050+ "required": [
3051+ "type",
3052+ "sep"
3053+ ]
3054+ },
3055+ {
3056+ "type": "object",
3057+ "properties": {
3058+ "type": {
3059+ "type": "string",
3060+ "const": "llm"
3061+ },
3062+ "model": {
3063+ "type": "string"
3064+ },
3065+ "template": {
3066+ "type": "string"
3067+ }
3068+ },
3069+ "additionalProperties": false,
3070+ "required": [
3071+ "type",
3072+ "model",
3073+ "template"
3074+ ]
3075+ },
3076+ {
3077+ "type": "object",
3078+ "properties": {
3079+ "type": {
3080+ "type": "string",
3081+ "const": "custom"
3082+ }
3083+ },
3084+ "additionalProperties": false,
3085+ "required": [
3086+ "type"
3087+ ]
3088+ }
3089+ ]
3090+ },
3091+ "max_tokens_in_context": {
3092+ "type": "integer"
3093+ },
3094+ "max_chunks": {
3095+ "type": "integer"
3096+ }
3097+ },
3098+ "additionalProperties": false,
3099+ "required": [
3100+ "type",
3101+ "memory_bank_configs",
3102+ "query_generator_config",
3103+ "max_tokens_in_context",
3104+ "max_chunks"
3105+ ]
28773106 }
28783107 ]
28793108 }
@@ -5582,34 +5811,34 @@
55825811 ],
55835812 "tags": [
55845813 {
5585- "name": "Observability"
5814+ "name": "Telemetry"
55865815 },
55875816 {
5588- "name": "Inference"
5817+ "name": "Evaluations"
55895818 },
55905819 {
5591- "name": "Datasets"
5820+ "name": "AgenticSystem"
55925821 },
55935822 {
5594- "name": "Memory"
5823+ "name": "Inference"
55955824 },
55965825 {
5597- "name": "AgenticSystem"
5826+ "name": "BatchInference"
55985827 },
55995828 {
5600- "name": "Evaluations"
5829+ "name": "PostTraining"
56015830 },
56025831 {
5603- "name": "SyntheticDataGeneration"
5832+ "name": "Datasets"
56045833 },
56055834 {
5606- "name": "RewardScoring"
5835+ "name": "Memory"
56075836 },
56085837 {
5609- "name": "PostTraining"
5838+ "name": "SyntheticDataGeneration"
56105839 },
56115840 {
5612- "name": "BatchInference"
5841+ "name": "RewardScoring"
56135842 },
56145843 {
56155844 "name": "BatchChatCompletionRequest",
@@ -5743,10 +5972,6 @@
57435972 "name": "FunctionCallToolDefinition",
57445973 "description": "<SchemaDefinition schemaRef=\"#/components/schemas/FunctionCallToolDefinition\" />"
57455974 },
5746- {
5747- "name": "MemoryToolDefinition",
5748- "description": "<SchemaDefinition schemaRef=\"#/components/schemas/MemoryToolDefinition\" />"
5749- },
57505975 {
57515976 "name": "OnViolationAction",
57525977 "description": "<SchemaDefinition schemaRef=\"#/components/schemas/OnViolationAction\" />"
@@ -6134,10 +6359,10 @@
61346359 "Evaluations",
61356360 "Inference",
61366361 "Memory",
6137- "Observability",
61386362 "PostTraining",
61396363 "RewardScoring",
6140- "SyntheticDataGeneration"
6364+ "SyntheticDataGeneration",
6365+ "Telemetry"
61416366 ]
61426367 },
61436368 {
@@ -6216,7 +6441,6 @@
62166441 "MemoryBank",
62176442 "MemoryBankDocument",
62186443 "MemoryRetrievalStep",
6219- "MemoryToolDefinition",
62206444 "Metric",
62216445 "OnViolationAction",
62226446 "OptimizerConfig",
modified rfcs/RFC-0001-llama-stack-assets/llama-stack-spec.yaml +254 −108
@@ -30,7 +30,123 @@
3030 - $ref: '#/components/schemas/PhotogenToolDefinition'
3131 - $ref: '#/components/schemas/CodeInterpreterToolDefinition'
3232 - $ref: '#/components/schemas/FunctionCallToolDefinition'
33- - $ref: '#/components/schemas/MemoryToolDefinition'
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
34150 type: array
35151 required:
36152 - model
@@ -107,7 +223,123 @@
107223 - $ref: '#/components/schemas/PhotogenToolDefinition'
108224 - $ref: '#/components/schemas/CodeInterpreterToolDefinition'
109225 - $ref: '#/components/schemas/FunctionCallToolDefinition'
110- - $ref: '#/components/schemas/MemoryToolDefinition'
226+ - additionalProperties: false
227+ properties:
228+ input_shields:
229+ items:
230+ $ref: '#/components/schemas/ShieldDefinition'
231+ type: array
232+ max_chunks:
233+ type: integer
234+ max_tokens_in_context:
235+ type: integer
236+ memory_bank_configs:
237+ items:
238+ oneOf:
239+ - additionalProperties: false
240+ properties:
241+ bank_id:
242+ type: string
243+ type:
244+ const: vector
245+ type: string
246+ required:
247+ - bank_id
248+ - type
249+ type: object
250+ - additionalProperties: false
251+ properties:
252+ bank_id:
253+ type: string
254+ keys:
255+ items:
256+ type: string
257+ type: array
258+ type:
259+ const: keyvalue
260+ type: string
261+ required:
262+ - bank_id
263+ - type
264+ - keys
265+ type: object
266+ - additionalProperties: false
267+ properties:
268+ bank_id:
269+ type: string
270+ type:
271+ const: keyword
272+ type: string
273+ required:
274+ - bank_id
275+ - type
276+ type: object
277+ - additionalProperties: false
278+ properties:
279+ bank_id:
280+ type: string
281+ entities:
282+ items:
283+ type: string
284+ type: array
285+ type:
286+ const: graph
287+ type: string
288+ required:
289+ - bank_id
290+ - type
291+ - entities
292+ type: object
293+ type: array
294+ output_shields:
295+ items:
296+ $ref: '#/components/schemas/ShieldDefinition'
297+ type: array
298+ query_generator_config:
299+ oneOf:
300+ - additionalProperties: false
301+ properties:
302+ sep:
303+ type: string
304+ type:
305+ const: default
306+ type: string
307+ required:
308+ - type
309+ - sep
310+ type: object
311+ - additionalProperties: false
312+ properties:
313+ model:
314+ type: string
315+ template:
316+ type: string
317+ type:
318+ const: llm
319+ type: string
320+ required:
321+ - type
322+ - model
323+ - template
324+ type: object
325+ - additionalProperties: false
326+ properties:
327+ type:
328+ const: custom
329+ type: string
330+ required:
331+ - type
332+ type: object
333+ type:
334+ const: memory
335+ type: string
336+ required:
337+ - type
338+ - memory_bank_configs
339+ - query_generator_config
340+ - max_tokens_in_context
341+ - max_chunks
342+ type: object
111343 type: array
112344 required:
113345 - agent_id
@@ -1310,88 +1542,6 @@
13101542 - memory_bank_ids
13111543 - inserted_context
13121544 type: object
1313- MemoryToolDefinition:
1314- additionalProperties: false
1315- properties:
1316- input_shields:
1317- items:
1318- $ref: '#/components/schemas/ShieldDefinition'
1319- type: array
1320- max_chunks:
1321- type: integer
1322- max_tokens_in_context:
1323- type: integer
1324- memory_bank_configs:
1325- items:
1326- oneOf:
1327- - additionalProperties: false
1328- properties:
1329- bank_id:
1330- type: string
1331- type:
1332- const: vector
1333- type: string
1334- required:
1335- - bank_id
1336- - type
1337- type: object
1338- - additionalProperties: false
1339- properties:
1340- bank_id:
1341- type: string
1342- keys:
1343- items:
1344- type: string
1345- type: array
1346- type:
1347- const: keyvalue
1348- type: string
1349- required:
1350- - bank_id
1351- - type
1352- - keys
1353- type: object
1354- - additionalProperties: false
1355- properties:
1356- bank_id:
1357- type: string
1358- type:
1359- const: keyword
1360- type: string
1361- required:
1362- - bank_id
1363- - type
1364- type: object
1365- - additionalProperties: false
1366- properties:
1367- bank_id:
1368- type: string
1369- entities:
1370- items:
1371- type: string
1372- type: array
1373- type:
1374- const: graph
1375- type: string
1376- required:
1377- - bank_id
1378- - type
1379- - entities
1380- type: object
1381- type: array
1382- output_shields:
1383- items:
1384- $ref: '#/components/schemas/ShieldDefinition'
1385- type: array
1386- type:
1387- const: memory
1388- type: string
1389- required:
1390- - type
1391- - memory_bank_configs
1392- - max_tokens_in_context
1393- - max_chunks
1394- type: object
13951545 Metric:
13961546 additionalProperties: false
13971547 properties:
@@ -2459,7 +2609,7 @@
24592609 description: "This is the specification of the llama stack that provides\n \
24602610 \ a set of endpoints and their corresponding interfaces that are tailored\
24612611 \ to\n best leverage Llama Models. The specification is still in\
2462- \ draft and subject to change.\n Generated at 2024-09-04 10:28:38.779789"
2612+ \ draft and subject to change.\n Generated at 2024-09-07 15:23:29.488676"
24632613 title: '[DRAFT] Llama Stack Specification'
24642614 version: 0.0.1
24652615 jsonSchemaDialect: https://json-schema.org/draft/2020-12/schema
@@ -2640,7 +2790,7 @@
26402790 $ref: '#/components/schemas/Artifact'
26412791 description: OK
26422792 tags:
2643- - Observability
2793+ - Telemetry
26442794 /batch_inference/chat_completion:
26452795 post:
26462796 parameters: []
@@ -2870,7 +3020,7 @@
28703020 $ref: '#/components/schemas/Artifact'
28713021 description: OK
28723022 tags:
2873- - Observability
3023+ - Telemetry
28743024 /experiments/artifacts/upload:
28753025 post:
28763026 parameters: []
@@ -2888,7 +3038,7 @@
28883038 $ref: '#/components/schemas/Artifact'
28893039 description: OK
28903040 tags:
2891- - Observability
3041+ - Telemetry
28923042 /experiments/create:
28933043 post:
28943044 parameters: []
@@ -2906,7 +3056,7 @@
29063056 $ref: '#/components/schemas/Experiment'
29073057 description: OK
29083058 tags:
2909- - Observability
3059+ - Telemetry
29103060 /experiments/create_run:
29113061 post:
29123062 parameters: []
@@ -2924,7 +3074,7 @@
29243074 $ref: '#/components/schemas/Run'
29253075 description: OK
29263076 tags:
2927- - Observability
3077+ - Telemetry
29283078 /experiments/get:
29293079 get:
29303080 parameters:
@@ -2941,7 +3091,7 @@
29413091 $ref: '#/components/schemas/Experiment'
29423092 description: OK
29433093 tags:
2944- - Observability
3094+ - Telemetry
29453095 /experiments/list:
29463096 get:
29473097 parameters: []
@@ -2953,7 +3103,7 @@
29533103 $ref: '#/components/schemas/Experiment'
29543104 description: OK
29553105 tags:
2956- - Observability
3106+ - Telemetry
29573107 /experiments/update:
29583108 post:
29593109 parameters: []
@@ -2971,7 +3121,7 @@
29713121 $ref: '#/components/schemas/Experiment'
29723122 description: OK
29733123 tags:
2974- - Observability
3124+ - Telemetry
29753125 /inference/chat_completion:
29763126 post:
29773127 parameters: []
@@ -3043,7 +3193,7 @@
30433193 $ref: '#/components/schemas/Log'
30443194 description: OK
30453195 tags:
3046- - Observability
3196+ - Telemetry
30473197 /logging/log_messages:
30483198 post:
30493199 parameters: []
@@ -3057,7 +3207,7 @@
30573207 '200':
30583208 description: OK
30593209 tags:
3060- - Observability
3210+ - Telemetry
30613211 /memory_bank/documents/delete:
30623212 post:
30633213 parameters: []
@@ -3352,7 +3502,7 @@
33523502 '200':
33533503 description: OK
33543504 tags:
3355- - Observability
3505+ - Telemetry
33563506 /runs/metrics:
33573507 get:
33583508 parameters:
@@ -3369,7 +3519,7 @@
33693519 $ref: '#/components/schemas/Metric'
33703520 description: OK
33713521 tags:
3372- - Observability
3522+ - Telemetry
33733523 /runs/update:
33743524 post:
33753525 parameters: []
@@ -3387,7 +3537,7 @@
33873537 $ref: '#/components/schemas/Run'
33883538 description: OK
33893539 tags:
3390- - Observability
3540+ - Telemetry
33913541 /synthetic_data_generation/generate:
33923542 post:
33933543 parameters: []
@@ -3411,16 +3561,16 @@
34113561 servers:
34123562 - url: http://any-hosted-llama-stack.com
34133563 tags:
3414-- name: Observability
3564+- name: Telemetry
3565+- name: Evaluations
3566+- name: AgenticSystem
34153567 - name: Inference
3568+- name: BatchInference
3569+- name: PostTraining
34163570 - name: Datasets
34173571 - name: Memory
3418-- name: AgenticSystem
3419-- name: Evaluations
34203572 - name: SyntheticDataGeneration
34213573 - name: RewardScoring
3422-- name: PostTraining
3423-- name: BatchInference
34243574 - description: <SchemaDefinition schemaRef="#/components/schemas/BatchChatCompletionRequest"
34253575 />
34263576 name: BatchChatCompletionRequest
@@ -3525,9 +3675,6 @@
35253675 - description: <SchemaDefinition schemaRef="#/components/schemas/FunctionCallToolDefinition"
35263676 />
35273677 name: FunctionCallToolDefinition
3528-- description: <SchemaDefinition schemaRef="#/components/schemas/MemoryToolDefinition"
3529- />
3530- name: MemoryToolDefinition
35313678 - description: <SchemaDefinition schemaRef="#/components/schemas/OnViolationAction"
35323679 />
35333680 name: OnViolationAction
@@ -3852,10 +3999,10 @@
38523999 - Evaluations
38534000 - Inference
38544001 - Memory
3855- - Observability
38564002 - PostTraining
38574003 - RewardScoring
38584004 - SyntheticDataGeneration
4005+ - Telemetry
38594006 - name: Types
38604007 tags:
38614008 - AgentConfig
@@ -3931,7 +4078,6 @@
39314078 - MemoryBank
39324079 - MemoryBankDocument
39334080 - MemoryRetrievalStep
3934- - MemoryToolDefinition
39354081 - Metric
39364082 - OnViolationAction
39374083 - OptimizerConfig
modified rfcs/openapi_generator/run_openapi_generator.sh +1 −1
@@ -28,4 +28,4 @@
2828 exit 1
2929 fi
3030
31-PYTHONPATH=$PYTHONPATH:../.. python3 -m rfcs.openapi_generator.generate $*
31+PYTHONPATH=$PYTHONPATH:../.. python -m rfcs.openapi_generator.generate $*