From 5950250795ee6711600fe7d31c7b1def095284a6 Mon Sep 17 00:00:00 2001 From: Mahmoud Mabrouk Date: Fri, 8 Dec 2023 19:54:40 +0100 Subject: [PATCH 1/2] CLI docs updated --- docs/cli/init.mdx | 53 +++++++++++++++++++++++++++++++++++ docs/cli/install.mdx | 24 ++++++++++++++++ docs/cli/quick-usage.mdx | 46 ++++++++++++++++++++++++++++++ docs/cli/variant_list.mdx | 14 +++++++++ docs/cli/variant_remove.mdx | 15 ++++++++++ docs/cli/variant_serve.mdx | 31 ++++++++++++++++++++ docs/mint.json | 20 +++++++++++-- docs/reference/agenta-cli.mdx | 44 ----------------------------- 8 files changed, 200 insertions(+), 47 deletions(-) create mode 100644 docs/cli/init.mdx create mode 100644 docs/cli/install.mdx create mode 100644 docs/cli/quick-usage.mdx create mode 100644 docs/cli/variant_list.mdx create mode 100644 docs/cli/variant_remove.mdx create mode 100644 docs/cli/variant_serve.mdx delete mode 100644 docs/reference/agenta-cli.mdx diff --git a/docs/cli/init.mdx b/docs/cli/init.mdx new file mode 100644 index 0000000000..8cd93f7e6c --- /dev/null +++ b/docs/cli/init.mdx @@ -0,0 +1,53 @@ +--- +title: "agenta init" +description: "Initialize a new project" +--- + + +```bash +agenta init +``` + +# Description + + +The init command initializes a new agenta project. Users can define the application's name and select the agenta platform host (either local or cloud). + +This command creates a blank project in the backend and generates a config.toml file for configuration settings. + +This command creates a `project.toml` file containing all the information about your project + +# Usage + +When running `agenta init` you will prompted the following questions: + +### Project name +```bash +? Please enter the app name +``` + +Enter the app/project name + +### Agenta host +```bash +? Where are you running agenta? (Use arrow keys) + » On agenta cloud + On my local machine + On a remote machine +``` + +Here you can select where the agenta platform is hosted. +- Select cloud, in case you are using agenta cloud ([https://cloud.agenta.ai](https://cloud.agenta.ai)). In that case you will prompted to enter your API key. You can get these from the [agenta cloud configuration](https://cloud.agenta.ai/settings?tab=apiKeys). +- Select local machine if you are running the OSS version of agenta on your local machine ([http://localhost](http://localhost)) +- Select remote machine, in case you are running the OSS version of agenta on a remote machine. In that case you will prompted to enter the remote machine URL. + + In case you are running agenta enterprise, please refer to the enterprise documentation on how to set up your agenta project + +### Start from scratch or from a template +```bash +? How do you want to initialize your app? (Use arrow keys) + » Blank App + Start from template +``` + +Chose blank app to start from scratch (write your own code) or start from template to use one of the agenta templates. diff --git a/docs/cli/install.mdx b/docs/cli/install.mdx new file mode 100644 index 0000000000..5611bb8911 --- /dev/null +++ b/docs/cli/install.mdx @@ -0,0 +1,24 @@ +--- +title: "Install" +description: "Agenta's CLI enables developers to easily create, evaluate, and deploy LLM apps from code. Install it here" +--- + +# Installation + +The agenta CLI can be easily installed through pip: + +```bash +pip install -U agenta +``` + +# Quick usage guide + + + + Get an overview of the main commands and capabilities of agenta CLI + + + Jump into a tutorial deploying an LLM app from code using agenta CLI + + + \ No newline at end of file diff --git a/docs/cli/quick-usage.mdx b/docs/cli/quick-usage.mdx new file mode 100644 index 0000000000..0c48f77afa --- /dev/null +++ b/docs/cli/quick-usage.mdx @@ -0,0 +1,46 @@ +--- +title: "Quick usage" +description: "Deploy and test LLM apps using agenta CLI" +--- + + +The Agenta CLI is a tool used to manage LLM app variants used in Agenta. It allows you to create new apps and deploy variants to the Agenta platform. + +## Create an application / project + +To use the agenta CLI, first create a new folder for each project / application. + +```bash +mkdir my_app +``` + +Next, initialize the project in agenta by running + +```bash +agenta init +``` + +agenta init creates an empty project in the agenta platform (or populates it on one of the templates). + +## Write the code [optional] +Depending whether you initialized the project with a template or not, you may need to write the code for your variant. +The code for your new variant in a .py file. The file should contain a function marked with the `@ag.entrypoint` decorator. + +Here is an example +```python + +import agenta as ag + +ag.config.register_default(prompt="Translate {sentence} to {language}) + +@ag.entrypoint +def translate(sentence:str, language:str): + ### add here openai call logic +``` +## Serve the application + +```bash +agenta variant serve myapp.py +``` + +This command deploys a new variant to the Agenta platform. It processes the code in the specified folder, with `myapp.py` as the entrypoint. This command builds a Docker image and deploys a container based on it. As a result, the variant becomes accessible in the web UI, allowing for prediction generation and API calls. The variant is named as `myapp.default` in the UI. diff --git a/docs/cli/variant_list.mdx b/docs/cli/variant_list.mdx new file mode 100644 index 0000000000..22d3b9d122 --- /dev/null +++ b/docs/cli/variant_list.mdx @@ -0,0 +1,14 @@ +--- +title: "agenta variant list" +description: "List the variants for an application" +--- + +```bash +agenta variant list +``` + +# Description +The `list` command displays all the variants of your app that are currently available in the backend. + + The `variant list` command can only be run in a directory where the `config.toml` generated by `agenta init` is present. + diff --git a/docs/cli/variant_remove.mdx b/docs/cli/variant_remove.mdx new file mode 100644 index 0000000000..2cf1ca84d7 --- /dev/null +++ b/docs/cli/variant_remove.mdx @@ -0,0 +1,15 @@ +--- +title: "agenta variant remove" +description: "Removes a variant from an app/project" +--- + +```bash +agenta variant remove +``` + +# Description + +`variant remove` removes a variant from an app/project. It is called without any argument. The list of variants in the app/project is displayed and the user is prompted to select one of them to remove. + + + The `variant remove` command can only be run in a directory where the `config.toml` generated by `agenta init` is present. diff --git a/docs/cli/variant_serve.mdx b/docs/cli/variant_serve.mdx new file mode 100644 index 0000000000..40fb445a64 --- /dev/null +++ b/docs/cli/variant_serve.mdx @@ -0,0 +1,31 @@ +--- +title: "agenta variant serve" +description: "Serve an application to the agenta platform" +--- + +```bash +agenta variant serve app_name.py +``` + +# Description +The `serve` command deploys the code of an app to the agenta platform. The command packages the code in the .py file along with any additional files in the same directory and deploy them on the agenta platform. Once deployed, the variant becomes accessible the web UI. It can ehtn be further deployed to a staging or production environment as an API endpoint. + +In the agenta UI, the deployed variant is initially named `app_name.default` where `app_name` is the name of the python file deployed and `default` the default configuration. Creating a new configuration `someconfig` (either from the UI or from CLI), will result in the creation of corresponding new variant, named `app_name.someconfig`. + + + The code in `app_name.py` needs to include an entrypoint function. This function should be marked with the `@agenta.entrypoint` decorator. + +Below is a brief example of a valid `app_name.py` file: + +```python + +import agenta as ag + +ag.config.register_default(prompt="Translate {sentence} to {language}) + +@ag.entrypoint +def translate(sentence:str, language:str): + ### add here openai call logic +``` + + The `variant serve` command can only be run in a directory where the `config.toml` generated by `agenta init` is present. diff --git a/docs/mint.json b/docs/mint.json index e7db2c00f2..773b39aa03 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -91,8 +91,23 @@ "self-host/host-locally", "self-host/host-remotely", "self-host/host-on-aws", - "self-host/host-on-gcp", - "self-host/host-on-kubernetes" + "self-host/host-on-gcp" + ] + }, + { + "group": "Command Line", + "pages": [ + "cli/install", + "cli/quick-usage", + { + "group": "Core commands", + "pages": [ + "cli/init", + "cli/variant_serve", + "cli/variant_list", + "cli/variant_remove" + ] + } ] }, { @@ -106,7 +121,6 @@ { "group": "Reference", "pages": [ - "reference/agenta-cli", "reference/sdk", { "group": "Backend API", diff --git a/docs/reference/agenta-cli.mdx b/docs/reference/agenta-cli.mdx deleted file mode 100644 index 0e40658a96..0000000000 --- a/docs/reference/agenta-cli.mdx +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: "Command Line Interface" -description: "Overview of the Agenta CLI" ---- - - -The Agenta CLI is a tool used to manage LLM app variants used in Agenta. It allows you to create new apps and deploy variants to the Agenta platform. - -## Commands - -### 1. `agenta init` - -```bash -agenta init -``` - -The init command initializes a new Agenta app. Users can define the application's name and select the Agenta platform host (either local or cloud). - -This command creates a blank application in the backend and generates a config.toml file for configuration settings. - -### 2. `agenta variant serve` - -```bash -agenta variant serve variant_name.py -``` - -The `serve` command deploys a new variant to the Agenta platform. It processes the code in the specified folder, with `variant_name.py` as the entrypoint. This command builds a Docker image and deploys a container based on it. As a result, the variant becomes accessible in the web UI, allowing for prediction generation and API calls. The variant is named as `variant_name.default` in the UI. - -### 3. `agenta variant list` - -```bash -agenta variant list -``` - -The `list` command displays all the variants of your app that are currently available in the backend. - -### 4. `agenta variant remove` - -```bash -agenta variant remove -``` - -The `remove` command allows you to delete an existing variant from the platform. - From caa7ea314e9914585f76cb8084935088260d37a7 Mon Sep 17 00:00:00 2001 From: Mahmoud Mabrouk Date: Fri, 8 Dec 2023 19:55:54 +0100 Subject: [PATCH 2/2] k8 --- docs/mint.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/mint.json b/docs/mint.json index 773b39aa03..470fe75b9d 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -91,7 +91,8 @@ "self-host/host-locally", "self-host/host-remotely", "self-host/host-on-aws", - "self-host/host-on-gcp" + "self-host/host-on-gcp", + "self-host/host-on-kubernetes" ] }, {