Skip to content

Commit

Permalink
Merge branch 'main' into jyi/spec-dec-interface
Browse files Browse the repository at this point in the history
  • Loading branch information
joostinyi committed Nov 19, 2024
2 parents d1907e1 + 3460217 commit 76fe148
Show file tree
Hide file tree
Showing 53 changed files with 1,990 additions and 1,232 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ __diff_output__
/env/
/output/
/cache/
/dist/
dist/

# Spritesmith
spritesmith-generated/
Expand Down
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](#class-truss-chains-basetenimage)\|[CustomImage](#class-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
3 changes: 1 addition & 2 deletions docs/chains/doc_gen/generate_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,10 @@
"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",
"truss_chains.ServiceDescriptor",
"truss_chains.DeployedServiceDescriptor",
"truss_chains.StubBase",
"truss_chains.RemoteErrorDetail",
# "truss_chains.ChainsRuntimeError",
Expand Down
Loading

0 comments on commit 76fe148

Please sign in to comment.