Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
marius-baseten committed Nov 12, 2024
1 parent 6326019 commit 6c5a37b
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 132 deletions.
20 changes: 8 additions & 12 deletions docs/chains/doc_gen/API-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,8 @@ an access token for downloading model weights).
| Name | Type | Description |
|-----------------------|---------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `data_dir` | *Path\|None* | The directory where the chainlet can store and access data, e.g. for downloading model weights. |
| `user_config` | *UserConfigT* | User-defined configuration for the chainlet. |
| `chainlet_to_service` | *Mapping[str,[ServiceDescriptor](#class-truss-chains-servicedescriptor)]* | A mapping from chainlet names to service descriptors. This is used create RPCs sessions to dependency chainlets. It contains only the chainlet services that are dependencies of the current chainlet. |
| `secrets` | *Mapping[str,str]* | A mapping from secret names to secret values. It contains only the secrets that are listed in `remote_config.assets.secret_keys` of the current chainlet. |
| `user_env` | *Mapping[str,str]* | These values can be provided to the deploy command and customize the behavior of deployed chainlets. E.g. for differentiating between prod and dev version of the same chain. |
| `environment` | *[Environment](#class-truss-chains-definitions-environment)\|None* | The environment that the chainlet is deployed in. None if the chainlet is not associated with an environment. |

#### get_baseten_api_key()
Expand Down Expand Up @@ -216,14 +214,14 @@ modules and keep their requirement files right next their python source files.

**Parameters:**

| Name | Type | Description |
|-------------------------|----------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `base_image` | *[BasetenImage](#truss-chains-basetenimage)\|[CustomImage](#truss-chains-customimage)* | The base image used by the chainlet. Other dependencies and assets are included as additional layers on top of that image. You can choose a baseten default image for a supported python version (e.g. `BasetenImage.PY311`), this will also include GPU drivers if needed, or provide a custom image (e.g. `CustomImage(image="python:3.11-slim")`). Specification by string is deprecated. |
| `pip_requirements_file` | *AbsPath\|None* | Path to a file containing pip requirements. The file content is naively concatenated with `pip_requirements`. |
| `pip_requirements` | *list[str]* | A list of pip requirements to install. The items are naively concatenated with the content of the `pip_requirements_file`. |
| `apt_requirements` | *list[str]* | A list of apt requirements to install. |
| `data_dir` | *AbsPath\|None* | Data from this directory is copied into the docker image and accessible to the remote chainlet at runtime. |
| `external_package_dirs` | *list[AbsPath]\|None* | A list of directories containing additional python packages outside the chain’s workspace dir, e.g. a shared library. This code is copied into the docker image and importable at runtime. |
| Name | Type | Description |
|-------------------------|----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `base_image` | *[BasetenImage](#truss-chains-basetenimage)\|[CustomImage](#truss-chains-customimage)* | The base image used by the chainlet. Other dependencies and assets are included as additional layers on top of that image. You can choose a baseten default image for a supported python version (e.g. `BasetenImage.PY311`), this will also include GPU drivers if needed, or provide a custom image (e.g. `CustomImage(image="python:3.11-slim")`). |
| `pip_requirements_file` | *AbsPath\|None* | Path to a file containing pip requirements. The file content is naively concatenated with `pip_requirements`. |
| `pip_requirements` | *list[str]* | A list of pip requirements to install. The items are naively concatenated with the content of the `pip_requirements_file`. |
| `apt_requirements` | *list[str]* | A list of apt requirements to install. |
| `data_dir` | *AbsPath\|None* | Data from this directory is copied into the docker image and accessible to the remote chainlet at runtime. |
| `external_package_dirs` | *list[AbsPath]\|None* | A list of directories containing additional python packages outside the chain’s workspace dir, e.g. a shared library. This code is copied into the docker image and importable at runtime. |

### *class* `truss_chains.BasetenImage`

Expand Down Expand Up @@ -331,7 +329,6 @@ Deploys a chain remotely (with all dependent chainlets).
| `chain_name` | *str* | The name of the chain. |
| `publish` | *bool* | Whether to publish the chain as a published deployment (it is a draft deployment otherwise) |
| `promote` | *bool* | Whether to promote the chain to be the production deployment (this implies publishing as well). |
| `user_env` | *Mapping[str,str]\|None* | These values can be provided to the push command and customize the behavior of deployed chainlets. E.g. for differentiating between prod and dev version of the same chain. |
| `only_generate_trusses` | *bool* | Used for debugging purposes. If set to True, only the the underlying truss models for the chainlets are generated in `/tmp/.chains_generated`. |
| `remote` | *str\|None* | name of a remote config in .trussrc. If not provided, it will be inquired. |
| `environment` | *str\|None* | The name of an environment to promote deployment into. |
Expand Down Expand Up @@ -465,7 +462,6 @@ corresponding fields of
| `secrets` | *Mapping[str,str]\|None* | A dict of secrets keys and values to provide to the chainlets. |
| `data_dir` | *Path\|str\|None* | Path to a directory with data files. |
| `chainlet_to_service` | *Mapping[str,[ServiceDescriptor](#class-truss-chains-servicedescriptor)* | A dict of chainlet names to service descriptors. |
| `user_env` | *Mapping[str,str]\|None* | see [`push`](#truss-chains-push). |

* **Return type:**
*ContextManager*[None]
Expand Down
6 changes: 3 additions & 3 deletions docs/chains/doc_gen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Extra deps required:
The general process is:
1. Document as much as possible in the code, including usage examples, links
etc.
2. Auto-generate `generated-API-reference.mdx` with `poetry run python
docs/chains/doc_gen/generate_reference.py`. This applies the patch file and
launches meld to resolve conflicts.
2. Auto-generate `generated-API-reference.mdx` with
`poetry run python docs/chains/doc_gen/generate_reference.py`.
This applies the patch file and launches meld to resolve conflicts.
4. Proofread `docs/chains/doc_gen/API-reference.mdx`.
5. If proofreading leads to edits or the upstream docstrings changed lot,
update the patch file: `diff -u \
Expand Down
1 change: 0 additions & 1 deletion docs/chains/doc_gen/generate_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
"General framework and helper functions.",
[
"truss_chains.push",
"truss_chains.deploy_remotely",
"truss_chains.remote.ChainService",
"truss_chains.make_abs_path_here",
"truss_chains.run_local",
Expand Down
37 changes: 5 additions & 32 deletions docs/chains/doc_gen/generated-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ context instance is provided.

### *class* `truss_chains.DeploymentContext`

Bases: `pydantic.BaseModel`, `Generic`[`UserConfigT`]
Bases: `pydantic.BaseModel`

Bundles config values and resources needed to instantiate Chainlets.

Expand All @@ -85,10 +85,9 @@ an access token for downloading model weights).
| Name | Type | Description |
|------|------|-------------|
| `data_dir` | *Path\|None* | The directory where the chainlet can store and access data, e.g. for downloading model weights. |
| `user_config` | *UserConfigT* | User-defined configuration for the chainlet. |
| `user_config` | ** | User-defined configuration for the chainlet. |
| `chainlet_to_service` | *Mapping[str,[ServiceDescriptor](#truss_chains.ServiceDescriptor* | A mapping from chainlet names to service descriptors. This is used create RPCs sessions to dependency chainlets. It contains only the chainlet services that are dependencies of the current chainlet. |
| `secrets` | *MappingNoIter[str,str]* | A mapping from secret names to secret values. It contains only the secrets that are listed in `remote_config.assets.secret_keys` of the current chainlet. |
| `user_env` | *Mapping[str,str]* | These values can be provided to the deploy command and customize the behavior of deployed chainlets. E.g. for differentiating between prod and dev version of the same chain. |
| `environment` | *[Environment](#truss_chains.definitions.Environment* | The environment that the chainlet is deployed in. None if the chainlet is not associated with an environment. |

#### chainlet_to_service *: Mapping[str, [ServiceDescriptor](#truss_chains.ServiceDescriptor)]*
Expand All @@ -111,10 +110,6 @@ an access token for downloading model weights).

#### secrets *: MappingNoIter[str, str]*

#### user_config *: UserConfigT*

#### user_env *: Mapping[str, str]*

### *class* `truss_chains.definitions.Environment`

Bases: `pydantic.BaseModel`
Expand Down Expand Up @@ -256,7 +251,7 @@ modules and keep their requirement files right next their python source files.

| Name | Type | Description |
|------|------|-------------|
| `base_image` | *[BasetenImage](#truss_chains.BasetenImage* | The base image used by the chainlet. Other dependencies and assets are included as additional layers on top of that image. You can choose a Baseten default image for a supported python version (e.g. `BasetenImage.PY311`), this will also include GPU drivers if needed, or provide a custom image (e.g. `CustomImage(image="python:3.11-slim")`). Specification by string is deprecated. |
| `base_image` | *[BasetenImage](#truss_chains.BasetenImage* | The base image used by the chainlet. Other dependencies and assets are included as additional layers on top of that image. You can choose a Baseten default image for a supported python version (e.g. `BasetenImage.PY311`), this will also include GPU drivers if needed, or provide a custom image (e.g. `CustomImage(image="python:3.11-slim")`).. |
| `pip_requirements_file` | *AbsPath\|None* | Path to a file containing pip requirements. The file content is naively concatenated with `pip_requirements`. |
| `pip_requirements` | *list[str]* | A list of pip requirements to install. The items are naively concatenated with the content of the `pip_requirements_file`. |
| `apt_requirements` | *list[str]* | A list of apt requirements to install. |
Expand All @@ -265,7 +260,7 @@ modules and keep their requirement files right next their python source files.

#### apt_requirements *: list[str]*

#### base_image *: [BasetenImage](#truss_chains.BasetenImage) | [CustomImage](#truss_chains.CustomImage) | str*
#### base_image *: [BasetenImage](#truss_chains.BasetenImage) | [CustomImage](#truss_chains.CustomImage)*

#### data_dir *: AbsPath | None*

Expand Down Expand Up @@ -355,7 +350,7 @@ For example, model weight caching can be used like this:

```default
import truss_chains as chains
from truss import truss_config
from truss.base import truss_config
mistral_cache = truss_config.ModelRepo(
repo_id="mistralai/Mistral-7B-Instruct-v0.2",
Expand Down Expand Up @@ -406,7 +401,6 @@ Deploys a chain remotely (with all dependent chainlets).
| `chain_name` | *str* | The name of the chain. |
| `publish` | *bool* | Whether to publish the chain as a published deployment (it is a draft deployment otherwise) |
| `promote` | *bool* | Whether to promote the chain to be the production deployment (this implies publishing as well). |
| `user_env` | *Mapping[str,str]\|None* | These values can be provided to the push command and customize the behavior of deployed chainlets. E.g. for differentiating between prod and dev version of the same chain. |
| `only_generate_trusses` | *bool* | Used for debugging purposes. If set to True, only the the underlying truss models for the chainlets are generated in `/tmp/.chains_generated`. |
| `remote` | *str\|None* | name of a remote config in .trussrc. If not provided, it will be inquired. |
| `environment` | *str\|None* | The name of an environment to promote deployment into. |
Expand All @@ -416,26 +410,6 @@ Deploys a chain remotely (with all dependent chainlets).
* **Return type:**
*BasetenChainService*

### `truss_chains.deploy_remotely`

Deprecated, use `push` instead.


**Parameters:**

| Name | Type | Description |
|------|------|-------------|
| `entrypoint` | *Type[ABCChainlet]* | |
| `chain_name` | *str* | |
| `publish` | *bool* | |
| `promote` | *bool* | |
| `user_env` | *Mapping[str,str]\|None* | |
| `only_generate_trusses` | *bool* | |
| `remote` | *str\|None* | |

* **Return type:**
*BasetenChainService*

### *class* `truss_chains.remote.ChainService`

Bases: `ABC`
Expand Down Expand Up @@ -562,7 +536,6 @@ corresponding fields of `DeploymentContext`.
| `secrets` | *Mapping[str,str]\|None* | A dict of secrets keys and values to provide to the chainlets. |
| `data_dir` | *Path\|str\|None* | Path to a directory with data files. |
| `chainlet_to_service` | *Mapping[str,[ServiceDescriptor](#truss_chains.ServiceDescriptor* | A dict of chainlet names to service descriptors. |
| `user_env` | *Mapping[str,str]\|None* | see `deploy_remotely`. |

* **Return type:**
*ContextManager*[None]
Expand Down
Loading

0 comments on commit 6c5a37b

Please sign in to comment.