Elffuss BraidHub

kikocis/llama-stack public

update getting started guide
Changeset30e129e4a270cf26e0c87d6b7d1ca88a8521f797a8f9419f3bb4f4005b4c70b7
AuthorXi Yan <xiyan@meta.com> · 2024-09-18 15:35 -07:00
CommitterXi Yan <xiyan@meta.com> · 2024-09-18 15:35 -07:00
Parents6abed3f4fe33

Browse the files at this changeset

2 files changed

modified docs/getting_started.md +52 −41
@@ -28,6 +28,7 @@
2828 ```
2929
3030 **`llama stack configure`**
31+- Run `llama stack configure <name>` with the name you have previously defined in `build` step.
3132 ```
3233 llama stack configure my-local-llama-stack
3334
@@ -61,6 +62,7 @@
6162 ```
6263
6364 **`llama stack run`**
65+- Run `llama stack run <name>` with the name you have previously defined.
6466 ```
6567 llama stack run my-local-llama-stack
6668
@@ -110,74 +112,83 @@
110112 - `providers`: specifies the underlying implementation for serving each API endpoint
111113 - `image_type`: `conda` | `docker` to specify whether to build the distribution in the form of Docker image or Conda environment.
112114
113-#### Build a local distribution with conda
114-The following command and specifications allows you to get started with building.
115+
116+At the end of build command, we will generate `<name>-build.yaml` file storing the build configurations.
117+
118+#### Building from scratch
119+- For a new user, we could start off with running `llama stack build` which will allow you to a interactively enter wizard where you will be prompted to enter build configurations.
115120 ```
116-llama stack build <path/to/config>
121+llama stack build
117122 ```
118-- You will be required to pass in a file path to the build.config file (e.g. `./llama_stack/distribution/example_configs/conda/local-conda-example-build.yaml`). We provide some example build config files for configuring different types of distributions in the `./llama_stack/distribution/example_configs/` folder.
119123
120-The file will be of the contents
124+Running the command above will allow you to fill in the configuration to build your Llama Stack distribution, you will see the following outputs.
125+
121126 ```
122-$ cat ./llama_stack/distribution/example_configs/conda/local-conda-example-build.yaml
127+> Enter an unique name for identifying your Llama Stack build distribution (e.g. my-local-stack): my-local-llama-stack
128+> Enter the image type you want your distribution to be built with (docker or conda): conda
123129
124-name: 8b-instruct
125-distribution_spec:
126- distribution_type: local
127- description: Use code from `llama_stack` itself to serve all llama stack APIs
128- docker_image: null
129- providers:
130- inference: meta-reference
131- memory: meta-reference-faiss
132- safety: meta-reference
133- agentic_system: meta-reference
134- telemetry: console
135-image_type: conda
130+ Llama Stack is composed of several APIs working together. Let's configure the providers (implementations) you want to use for these APIs.
131+> Enter the API provider for the inference API: (default=meta-reference): meta-reference
132+> Enter the API provider for the safety API: (default=meta-reference): meta-reference
133+> Enter the API provider for the agents API: (default=meta-reference): meta-reference
134+> Enter the API provider for the memory API: (default=meta-reference): meta-reference
135+> Enter the API provider for the telemetry API: (default=meta-reference): meta-reference
136+
137+ > (Optional) Enter a short description for your Llama Stack distribution:
138+
139+Build spec configuration saved at ~/.conda/envs/llamastack-my-local-llama-stack/my-local-llama-stack-build.yaml
140+```
141+
142+#### Building from templates
143+- To build from alternative API providers, we provide distribution templates for users to get started building a distribution backed by different providers.
144+
145+The following command will allow you to see the available templates and their corresponding providers.
136146 ```
147+llama stack build --list-templates
148+```
149+
150+![alt text](list-templates.png)
151+
152+You may then pick a template to build your distribution with providers fitted to your liking.
137153
138-You may run the `llama stack build` command to generate your distribution with `--name` to override the name for your distribution.
139154 ```
140-$ llama stack build ~/.llama/distributions/conda/8b-instruct-build.yaml --name 8b-instruct
141-...
142-...
143-Build spec configuration saved at ~/.llama/distributions/conda/8b-instruct-build.yaml
155+llama stack build --template local-tgi --name my-tgi-stack
144156 ```
145157
146-After this step is complete, a file named `8b-instruct-build.yaml` will be generated and saved at `~/.llama/distributions/conda/8b-instruct-build.yaml`.
158+```
159+
160+```
147161
162+#### Building from config file
163+- In addition to templates, you may customize the build to your liking through editing config files and build from config files with the following command.
148164
149-#### How to build distribution with different API providers using configs
150-To specify a different API provider, we can change the `distribution_spec` in our `<name>-build.yaml` config. For example, the following build spec allows you to build a distribution using TGI as the inference API provider.
165+- The config file will be of contents like the ones in `llama_stack/distributions/templates/`.
151166
152167 ```
153-$ cat ./llama_stack/distribution/example_configs/conda/local-tgi-conda-example-build.yaml
168+$ cat llama_stack/distribution/templates/local-ollama-build.yaml
154169
155-name: local-tgi-conda-example
170+name: local-ollama
156171 distribution_spec:
157- description: Use TGI (local or with Hugging Face Inference Endpoints for running LLM inference. When using HF Inference Endpoints, you must provide the name of the endpoint).
158- docker_image: null
172+ description: Like local, but use ollama for running LLM inference
159173 providers:
160- inference: remote::tgi
161- memory: meta-reference-faiss
174+ inference: remote::ollama
175+ memory: meta-reference
162176 safety: meta-reference
163- agentic_system: meta-reference
164- telemetry: console
177+ agents: meta-reference
178+ telemetry: meta-reference
165179 image_type: conda
166180 ```
167181
168-The following command allows you to build a distribution with TGI as the inference API provider, with the name `tgi`.
169182 ```
170-llama stack build ./llama_stack/distribution/example_configs/conda/local-tgi-conda-example-build.yaml --name tgi
183+llama stack build --config llama_stack/distribution/templates/local-ollama-build.yaml
171184 ```
172185
173-We provide some example build configs to help you get started with building with different API providers.
186+After this step is complete, a file named `8b-instruct-build.yaml` will be generated and saved at `~/.llama/distributions/conda/8b-instruct-build.yaml`.
174187
175188 #### How to build distribution with Docker image
176189 To build a docker image, simply change the `image_type` to `docker` in our `<name>-build.yaml` file, and run `llama stack build <name>-build.yaml`.
177190
178191 ```
179-$ cat ./llama_stack/distribution/example_configs/docker/local-docker-example-build.yaml
180-
181192 name: local-docker-example
182193 distribution_spec:
183194 description: Use code from `llama_stack` itself to serve all llama stack APIs
@@ -206,7 +217,7 @@
206217 ## Step 2. Configure
207218 After our distribution is built (either in form of docker or conda environment), we will run the following command to
208219 ```
209-llama stack configure [<path/to/name.build.yaml> | <docker-image-name>]
220+llama stack configure [ <name> | <docker-image-name> | <path/to/name.build.yaml>]
210221 ```
211222 - For `conda` environments: <path/to/name.build.yaml> would be the generated build spec saved from Step 1.
212223 - For `docker` images downloaded from Dockerhub, you could also use <docker-image-name> as the argument.
@@ -298,7 +309,7 @@
298309 ```
299310
300311 > [!NOTE]
301-> Configuration is in `~/.llama/builds/local/conda/8b-instruct.yaml`. Feel free to increase `max_seq_len`.
312+> Configuration is in `~/.llama/builds/local/conda/8b-instruct-run.yaml`. Feel free to increase `max_seq_len`.
302313
303314 > [!IMPORTANT]
304315 > The "local" distribution inference server currently only supports CUDA. It will not work on Apple Silicon machines.
added docs/list-templates.png +0 −0

Binary content is not shown. View the file.