kikocis/llama-stack public
Changesets · Branches · Tags · Compare
| Changeset | 32ac8e99b31df7a5f477fa884ef0a333675798953f3e41f54ac4976345cb9d14 |
|---|---|
| Author | Xi Yan <xiyan@meta.com> · 2024-09-10 17:47 -07:00 |
| Committer | GitHub <noreply@github.com> · 2024-09-10 17:47 -07:00 |
| Parents | 5ec25afa3bd5 |
3 files changed
modified llama_toolchain/stack.py +2 −0
| @@ -15,6 +15,7 @@ | ||
| 15 | 15 | from llama_toolchain.post_training.api import * # noqa: F403 |
| 16 | 16 | from llama_toolchain.reward_scoring.api import * # noqa: F403 |
| 17 | 17 | from llama_toolchain.synthetic_data_generation.api import * # noqa: F403 |
| 18 | +from llama_toolchain.safety.api import * # noqa: F403 | |
| 18 | 19 | |
| 19 | 20 | |
| 20 | 21 | class LlamaStack( |
| @@ -22,6 +23,7 @@ | ||
| 22 | 23 | BatchInference, |
| 23 | 24 | AgenticSystem, |
| 24 | 25 | RewardScoring, |
| 26 | + Safety, | |
| 25 | 27 | SyntheticDataGeneration, |
| 26 | 28 | Datasets, |
| 27 | 29 | Telemetry, |
modified rfcs/RFC-0001-llama-stack-assets/llama-stack-spec.html +0 −0
Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.
modified rfcs/RFC-0001-llama-stack-assets/llama-stack-spec.yaml +129 −36
| @@ -25,7 +25,7 @@ | ||
| 25 | 25 | tools: |
| 26 | 26 | items: |
| 27 | 27 | oneOf: |
| 28 | - - $ref: '#/components/schemas/BraveSearchToolDefinition' | |
| 28 | + - $ref: '#/components/schemas/SearchToolDefinition' | |
| 29 | 29 | - $ref: '#/components/schemas/WolframAlphaToolDefinition' |
| 30 | 30 | - $ref: '#/components/schemas/PhotogenToolDefinition' |
| 31 | 31 | - $ref: '#/components/schemas/CodeInterpreterToolDefinition' |
| @@ -218,7 +218,7 @@ | ||
| 218 | 218 | tools: |
| 219 | 219 | items: |
| 220 | 220 | oneOf: |
| 221 | - - $ref: '#/components/schemas/BraveSearchToolDefinition' | |
| 221 | + - $ref: '#/components/schemas/SearchToolDefinition' | |
| 222 | 222 | - $ref: '#/components/schemas/WolframAlphaToolDefinition' |
| 223 | 223 | - $ref: '#/components/schemas/PhotogenToolDefinition' |
| 224 | 224 | - $ref: '#/components/schemas/CodeInterpreterToolDefinition' |
| @@ -635,25 +635,6 @@ | ||
| 635 | 635 | required: |
| 636 | 636 | - completion_message_batch |
| 637 | 637 | type: object |
| 638 | - BraveSearchToolDefinition: | |
| 639 | - additionalProperties: false | |
| 640 | - properties: | |
| 641 | - input_shields: | |
| 642 | - items: | |
| 643 | - $ref: '#/components/schemas/ShieldDefinition' | |
| 644 | - type: array | |
| 645 | - output_shields: | |
| 646 | - items: | |
| 647 | - $ref: '#/components/schemas/ShieldDefinition' | |
| 648 | - type: array | |
| 649 | - remote_execution: | |
| 650 | - $ref: '#/components/schemas/RestAPIExecutionConfig' | |
| 651 | - type: | |
| 652 | - const: brave_search | |
| 653 | - type: string | |
| 654 | - required: | |
| 655 | - - type | |
| 656 | - type: object | |
| 657 | 638 | BuiltinShield: |
| 658 | 639 | enum: |
| 659 | 640 | - llama_guard |
| @@ -2011,17 +1992,35 @@ | ||
| 2011 | 1992 | properties: |
| 2012 | 1993 | body: |
| 2013 | 1994 | additionalProperties: |
| 2014 | - type: string | |
| 1995 | + oneOf: | |
| 1996 | + - type: 'null' | |
| 1997 | + - type: boolean | |
| 1998 | + - type: number | |
| 1999 | + - type: string | |
| 2000 | + - type: array | |
| 2001 | + - type: object | |
| 2015 | 2002 | type: object |
| 2016 | 2003 | headers: |
| 2017 | 2004 | additionalProperties: |
| 2018 | - type: string | |
| 2005 | + oneOf: | |
| 2006 | + - type: 'null' | |
| 2007 | + - type: boolean | |
| 2008 | + - type: number | |
| 2009 | + - type: string | |
| 2010 | + - type: array | |
| 2011 | + - type: object | |
| 2019 | 2012 | type: object |
| 2020 | 2013 | method: |
| 2021 | 2014 | $ref: '#/components/schemas/RestAPIMethod' |
| 2022 | 2015 | params: |
| 2023 | 2016 | additionalProperties: |
| 2024 | - type: string | |
| 2017 | + oneOf: | |
| 2018 | + - type: 'null' | |
| 2019 | + - type: boolean | |
| 2020 | + - type: number | |
| 2021 | + - type: string | |
| 2022 | + - type: array | |
| 2023 | + - type: object | |
| 2025 | 2024 | type: object |
| 2026 | 2025 | url: |
| 2027 | 2026 | $ref: '#/components/schemas/URL' |
| @@ -2103,6 +2102,43 @@ | ||
| 2103 | 2102 | - started_at |
| 2104 | 2103 | - metadata |
| 2105 | 2104 | type: object |
| 2105 | + RunShieldRequest: | |
| 2106 | + additionalProperties: false | |
| 2107 | + properties: | |
| 2108 | + messages: | |
| 2109 | + items: | |
| 2110 | + oneOf: | |
| 2111 | + - $ref: '#/components/schemas/UserMessage' | |
| 2112 | + - $ref: '#/components/schemas/SystemMessage' | |
| 2113 | + - $ref: '#/components/schemas/ToolResponseMessage' | |
| 2114 | + - $ref: '#/components/schemas/CompletionMessage' | |
| 2115 | + type: array | |
| 2116 | + shields: | |
| 2117 | + items: | |
| 2118 | + $ref: '#/components/schemas/ShieldDefinition' | |
| 2119 | + type: array | |
| 2120 | + required: | |
| 2121 | + - messages | |
| 2122 | + - shields | |
| 2123 | + type: object | |
| 2124 | + RunShieldRequestWrapper: | |
| 2125 | + additionalProperties: false | |
| 2126 | + properties: | |
| 2127 | + request: | |
| 2128 | + $ref: '#/components/schemas/RunShieldRequest' | |
| 2129 | + required: | |
| 2130 | + - request | |
| 2131 | + type: object | |
| 2132 | + RunShieldResponse: | |
| 2133 | + additionalProperties: false | |
| 2134 | + properties: | |
| 2135 | + responses: | |
| 2136 | + items: | |
| 2137 | + $ref: '#/components/schemas/ShieldResponse' | |
| 2138 | + type: array | |
| 2139 | + required: | |
| 2140 | + - responses | |
| 2141 | + type: object | |
| 2106 | 2142 | SamplingParams: |
| 2107 | 2143 | additionalProperties: false |
| 2108 | 2144 | properties: |
| @@ -2161,6 +2197,31 @@ | ||
| 2161 | 2197 | - message |
| 2162 | 2198 | - score |
| 2163 | 2199 | type: object |
| 2200 | + SearchToolDefinition: | |
| 2201 | + additionalProperties: false | |
| 2202 | + properties: | |
| 2203 | + engine: | |
| 2204 | + enum: | |
| 2205 | + - bing | |
| 2206 | + - brave | |
| 2207 | + type: string | |
| 2208 | + input_shields: | |
| 2209 | + items: | |
| 2210 | + $ref: '#/components/schemas/ShieldDefinition' | |
| 2211 | + type: array | |
| 2212 | + output_shields: | |
| 2213 | + items: | |
| 2214 | + $ref: '#/components/schemas/ShieldDefinition' | |
| 2215 | + type: array | |
| 2216 | + remote_execution: | |
| 2217 | + $ref: '#/components/schemas/RestAPIExecutionConfig' | |
| 2218 | + type: | |
| 2219 | + const: brave_search | |
| 2220 | + type: string | |
| 2221 | + required: | |
| 2222 | + - type | |
| 2223 | + - engine | |
| 2224 | + type: object | |
| 2164 | 2225 | Session: |
| 2165 | 2226 | additionalProperties: false |
| 2166 | 2227 | properties: |
| @@ -2777,7 +2838,7 @@ | ||
| 2777 | 2838 | description: "This is the specification of the llama stack that provides\n \ |
| 2778 | 2839 | \ a set of endpoints and their corresponding interfaces that are tailored\ |
| 2779 | 2840 | \ to\n best leverage Llama Models. The specification is still in\ |
| 2780 | - \ draft and subject to change.\n Generated at 2024-09-10 01:13:08.531639" | |
| 2841 | + \ draft and subject to change.\n Generated at 2024-09-10 16:42:15.870336" | |
| 2781 | 2842 | title: '[DRAFT] Llama Stack Specification' |
| 2782 | 2843 | version: 0.0.1 |
| 2783 | 2844 | jsonSchemaDialect: https://json-schema.org/draft/2020-12/schema |
| @@ -3706,6 +3767,24 @@ | ||
| 3706 | 3767 | description: OK |
| 3707 | 3768 | tags: |
| 3708 | 3769 | - Telemetry |
| 3770 | + /safety/run_shields: | |
| 3771 | + post: | |
| 3772 | + parameters: [] | |
| 3773 | + requestBody: | |
| 3774 | + content: | |
| 3775 | + application/json: | |
| 3776 | + schema: | |
| 3777 | + $ref: '#/components/schemas/RunShieldRequestWrapper' | |
| 3778 | + required: true | |
| 3779 | + responses: | |
| 3780 | + '200': | |
| 3781 | + content: | |
| 3782 | + application/json: | |
| 3783 | + schema: | |
| 3784 | + $ref: '#/components/schemas/RunShieldResponse' | |
| 3785 | + description: OK | |
| 3786 | + tags: | |
| 3787 | + - Safety | |
| 3709 | 3788 | /synthetic_data_generation/generate: |
| 3710 | 3789 | post: |
| 3711 | 3790 | parameters: [] |
| @@ -3729,16 +3808,17 @@ | ||
| 3729 | 3808 | servers: |
| 3730 | 3809 | - url: http://any-hosted-llama-stack.com |
| 3731 | 3810 | tags: |
| 3732 | -- name: SyntheticDataGeneration | |
| 3733 | -- name: RewardScoring | |
| 3734 | -- name: Datasets | |
| 3735 | -- name: Memory | |
| 3736 | -- name: AgenticSystem | |
| 3737 | 3811 | - name: BatchInference |
| 3738 | -- name: PostTraining | |
| 3739 | -- name: Evaluations | |
| 3812 | +- name: Safety | |
| 3740 | 3813 | - name: Telemetry |
| 3814 | +- name: RewardScoring | |
| 3815 | +- name: Memory | |
| 3816 | +- name: SyntheticDataGeneration | |
| 3741 | 3817 | - name: Inference |
| 3818 | +- name: Evaluations | |
| 3819 | +- name: PostTraining | |
| 3820 | +- name: Datasets | |
| 3821 | +- name: AgenticSystem | |
| 3742 | 3822 | - description: <SchemaDefinition schemaRef="#/components/schemas/BatchChatCompletionRequest" |
| 3743 | 3823 | /> |
| 3744 | 3824 | name: BatchChatCompletionRequest |
| @@ -3844,9 +3924,6 @@ | ||
| 3844 | 3924 | name: CompletionResponseStreamChunk |
| 3845 | 3925 | - description: <SchemaDefinition schemaRef="#/components/schemas/AgentConfig" /> |
| 3846 | 3926 | name: AgentConfig |
| 3847 | -- description: <SchemaDefinition schemaRef="#/components/schemas/BraveSearchToolDefinition" | |
| 3848 | - /> | |
| 3849 | - name: BraveSearchToolDefinition | |
| 3850 | 3927 | - description: <SchemaDefinition schemaRef="#/components/schemas/BuiltinShield" /> |
| 3851 | 3928 | name: BuiltinShield |
| 3852 | 3929 | - description: <SchemaDefinition schemaRef="#/components/schemas/CodeInterpreterToolDefinition" |
| @@ -3866,6 +3943,9 @@ | ||
| 3866 | 3943 | name: RestAPIExecutionConfig |
| 3867 | 3944 | - description: <SchemaDefinition schemaRef="#/components/schemas/RestAPIMethod" /> |
| 3868 | 3945 | name: RestAPIMethod |
| 3946 | +- description: <SchemaDefinition schemaRef="#/components/schemas/SearchToolDefinition" | |
| 3947 | + /> | |
| 3948 | + name: SearchToolDefinition | |
| 3869 | 3949 | - description: <SchemaDefinition schemaRef="#/components/schemas/ShieldDefinition" |
| 3870 | 3950 | /> |
| 3871 | 3951 | name: ShieldDefinition |
| @@ -4163,6 +4243,15 @@ | ||
| 4163 | 4243 | name: ScoredDialogGenerations |
| 4164 | 4244 | - description: <SchemaDefinition schemaRef="#/components/schemas/ScoredMessage" /> |
| 4165 | 4245 | name: ScoredMessage |
| 4246 | +- description: <SchemaDefinition schemaRef="#/components/schemas/RunShieldRequest" | |
| 4247 | + /> | |
| 4248 | + name: RunShieldRequest | |
| 4249 | +- description: <SchemaDefinition schemaRef="#/components/schemas/RunShieldRequestWrapper" | |
| 4250 | + /> | |
| 4251 | + name: RunShieldRequestWrapper | |
| 4252 | +- description: <SchemaDefinition schemaRef="#/components/schemas/RunShieldResponse" | |
| 4253 | + /> | |
| 4254 | + name: RunShieldResponse | |
| 4166 | 4255 | - description: <SchemaDefinition schemaRef="#/components/schemas/DoraFinetuningConfig" |
| 4167 | 4256 | /> |
| 4168 | 4257 | name: DoraFinetuningConfig |
| @@ -4232,6 +4321,7 @@ | ||
| 4232 | 4321 | - Memory |
| 4233 | 4322 | - PostTraining |
| 4234 | 4323 | - RewardScoring |
| 4324 | + - Safety | |
| 4235 | 4325 | - SyntheticDataGeneration |
| 4236 | 4326 | - Telemetry |
| 4237 | 4327 | - name: Types |
| @@ -4258,7 +4348,6 @@ | ||
| 4258 | 4348 | - BatchCompletionRequest |
| 4259 | 4349 | - BatchCompletionRequestWrapper |
| 4260 | 4350 | - BatchCompletionResponse |
| 4261 | - - BraveSearchToolDefinition | |
| 4262 | 4351 | - BuiltinShield |
| 4263 | 4352 | - BuiltinTool |
| 4264 | 4353 | - CancelEvaluationJobRequest |
| @@ -4346,10 +4435,14 @@ | ||
| 4346 | 4435 | - RewardScoringRequestWrapper |
| 4347 | 4436 | - RewardScoringResponse |
| 4348 | 4437 | - Run |
| 4438 | + - RunShieldRequest | |
| 4439 | + - RunShieldRequestWrapper | |
| 4440 | + - RunShieldResponse | |
| 4349 | 4441 | - SamplingParams |
| 4350 | 4442 | - SamplingStrategy |
| 4351 | 4443 | - ScoredDialogGenerations |
| 4352 | 4444 | - ScoredMessage |
| 4445 | + - SearchToolDefinition | |
| 4353 | 4446 | - Session |
| 4354 | 4447 | - ShieldCallStep |
| 4355 | 4448 | - ShieldDefinition |