From de791b3e4f8c485d7c832b5e2aa2b385889ef974 Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Tue, 29 Oct 2024 16:58:44 -0700 Subject: [PATCH] copy button --- docs/requirements.txt | 1 + docs/source/api_providers/memory_api.md | 2 +- docs/source/conf.py | 14 +++++++++++++- docs/source/getting_started/index.md | 14 +++++++------- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 962fb3002..f3cc9ecb7 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -4,3 +4,4 @@ linkify -e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme sphinx-rtd-theme>=1.0.0 sphinx-pdj-theme +sphinx-copybutton diff --git a/docs/source/api_providers/memory_api.md b/docs/source/api_providers/memory_api.md index 255891f87..be486ae8f 100644 --- a/docs/source/api_providers/memory_api.md +++ b/docs/source/api_providers/memory_api.md @@ -6,7 +6,7 @@ This guide gives you references to switch between different memory API providers 1. Start running the pgvector server: ``` -docker run --network host --name mypostgres -it -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -e POSTGRES_USER=postgres -e POSTGRES_DB=postgres pgvector/pgvector:pg16 +$ docker run --network host --name mypostgres -it -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -e POSTGRES_USER=postgres -e POSTGRES_DB=postgres pgvector/pgvector:pg16 ``` 2. Edit the `run.yaml` file to point to the pgvector server. diff --git a/docs/source/conf.py b/docs/source/conf.py index a5d1ca4b4..0acd96f08 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -19,7 +19,7 @@ author = "Meta" # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration -extensions = ["myst_parser", "sphinx_rtd_theme"] +extensions = ["myst_parser", "sphinx_rtd_theme", "sphinx_copybutton"] html_theme = "sphinx_rtd_theme" @@ -50,6 +50,18 @@ myst_enable_extensions = [ "tasklist", ] +# Copy button settings +copybutton_prompt_text = "$ " # for bash prompts +copybutton_prompt_is_regexp = True +copybutton_remove_prompts = True +copybutton_line_continuation_character = "\\" + +# Source suffix +source_suffix = { + ".rst": "restructuredtext", + ".md": "markdown", +} + # -- Options for HTML output ------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output diff --git a/docs/source/getting_started/index.md b/docs/source/getting_started/index.md index eb1d404ce..775c11729 100644 --- a/docs/source/getting_started/index.md +++ b/docs/source/getting_started/index.md @@ -61,8 +61,8 @@ If so, we suggest: ### chat_completion sanity test Once the server is setup, we can test it with a client to see the example outputs by . This will run the chat completion client and query the distribution’s `/inference/chat_completion` API. Send a POST request to the server: -``` -curl http://localhost:5000/inference/chat_completion \ +```bash +$ curl http://localhost:5000/inference/chat_completion \ -H "Content-Type: application/json" \ -d '{ "model": "Llama3.1-8B-Instruct", @@ -86,12 +86,12 @@ Output: To run an agent app, check out examples demo scripts with client SDKs to talk with the Llama Stack server in our [llama-stack-apps](https://github.com/meta-llama/llama-stack-apps/tree/main/examples) repo. To run a simple agent app: -``` -git clone git@github.com:meta-llama/llama-stack-apps.git -cd llama-stack-apps -pip install -r requirements.txt +```bash +$ git clone git@github.com:meta-llama/llama-stack-apps.git +$ cd llama-stack-apps +$ pip install -r requirements.txt -python -m examples.agents.client +$ python -m examples.agents.client ``` You will see outputs of the form --