|
1 |
| ---- docs/chains/doc_gen/generated-reference.mdx 2025-03-07 14:07:59.058967543 -0800 |
2 |
| -+++ docs/chains/doc_gen/API-reference.mdx 2025-03-07 14:06:58.765143669 -0800 |
| 1 | +--- docs/chains/doc_gen/generated-reference.mdx 2025-03-11 11:50:41.420102369 -0700 |
| 2 | ++++ docs/chains/doc_gen/API-reference.mdx 2025-03-11 11:45:47.101215413 -0700 |
3 | 3 | @@ -30,13 +30,15 @@
|
4 | 4 |
|
5 | 5 | ### *class* `truss_chains.EngineBuilderLLMChainlet`
|
|
29 | 29 | +its place. In [`run_local`](#truss-chains-run-local) mode an instance of a local chainlet is injected.
|
30 | 30 |
|
31 | 31 | Refer to [the docs](https://docs.baseten.co/chains/getting-started) and this
|
32 |
| - [example chainlet](https://github.com/basetenlabs/truss/blob/main/truss-chains/truss_chains/example_chainlet.py) |
| 32 | + [example chainlet](https://github.com/basetenlabs/truss/blob/main/truss-chains/truss_chains/reference_code/reference_chainlet.py) |
33 | 33 | for more guidance on how make one chainlet depend on another chainlet.
|
34 | 34 |
|
35 | 35 | -#### WARNING
|
|
65 | 65 | ### `truss_chains.depends_context`
|
66 | 66 |
|
67 | 67 | @@ -80,16 +81,15 @@
|
68 |
| - [example chainlet](https://github.com/basetenlabs/truss/blob/main/truss-chains/truss_chains/example_chainlet.py) |
| 68 | + [example chainlet](https://github.com/basetenlabs/truss/blob/main/truss-chains/truss_chains/reference_code/reference_chainlet.py) |
69 | 69 | for more guidance on the `__init__`-signature of chainlets.
|
70 | 70 |
|
71 | 71 | -#### WARNING
|
|
173 | 173 | -| `use_binary` | *bool* | Whether to send data in binary format. This can give a parsing speedup and message size reduction (~25%) for numpy arrays. Use `NumpyArrayField` as a field type on pydantic models for integration and set this option to `True`. For simple text data, there is no significant benefit. |
|
174 | 174 | -
|
175 | 175 | -#### retries *: int*
|
| 176 | +- |
| 177 | +-#### timeout_sec *: float* |
176 | 178 | +| Name | Type | Description |
|
177 | 179 | +|---------------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
178 | 180 | +| `retries` | *int* | The number of times to retry the remote chainlet in case of failures (e.g. due to transient network issues). For streaming, retries are only made if the request fails before streaming any results back. Failures mid-stream not retried. |
|
179 | 181 | +| `timeout_sec` | *float* | Timeout for the HTTP request to this chainlet. |
|
180 | 182 | +| `use_binary` | *bool* | Whether to send data in binary format. This can give a parsing speedup and message size reduction (~25%) for numpy arrays. Use `NumpyArrayField` as a field type on pydantic models for integration and set this option to `True`. For simple text data, there is no significant benefit. |
|
181 | 183 |
|
182 |
| --#### timeout_sec *: float* |
183 |
| -- |
184 | 184 | -#### use_binary *: bool*
|
185 | 185 |
|
186 | 186 | ### `truss_chains.mark_entrypoint`
|
|
582 | 582 | -* **Parameters:**
|
583 | 583 | - **file_path** (*str*)
|
584 | 584 | -* **Return type:**
|
585 |
| -- public_types.AbsPath |
586 | 585 | +</Warning>
|
587 | 586 | +
|
588 | 587 | +**Parameters:**
|
|
593 | 592 | +
|
594 | 593 | +
|
595 | 594 | +* **Returns:**
|
596 |
| -+ *AbsPath* |
597 |
| -+ |
| 595 | + *AbsPath* |
598 | 596 |
|
| 597 | ++ |
599 | 598 | ### `truss_chains.run_local`
|
600 | 599 |
|
601 | 600 | Context manager local debug execution of a chain.
|
|
628 | 627 | import os
|
629 | 628 | import truss_chains as chains
|
630 | 629 |
|
631 |
| -@@ -627,21 +536,12 @@ |
| 630 | +@@ -627,47 +536,12 @@ |
632 | 631 |
|
633 | 632 | **Parameters:**
|
634 | 633 |
|
|
637 | 636 | -| `name` | *str* | |
|
638 | 637 | -| `display_name` | *str* | |
|
639 | 638 | -| `options` | *[RPCOptions](#truss_chains.RPCOptions* | |
|
640 |
| --| `predict_url` | *str* | | |
| 639 | +-| `predict_url` | *str\|None* | | |
| 640 | +-| `internal_url` | *[InternalURL](#truss_chains.DeployedServiceDescriptor.InternalURL* | | |
641 | 641 | -
|
642 | 642 | -
|
| 643 | +-#### *class* InternalURL(, gateway_run_remote_url, hostname) |
| 644 | +- |
| 645 | +-Bases: `pydantic.BaseModel` |
| 646 | +- |
| 647 | +-**Parameters:** |
| 648 | +- |
| 649 | +-| Name | Type | Description | |
| 650 | +-|------|------|-------------| |
| 651 | +-| `gateway_run_remote_url` | *str* | | |
| 652 | +-| `hostname` | *str* | | |
| 653 | +- |
| 654 | +- |
| 655 | +-#### gateway_run_remote_url *: str* |
| 656 | +- |
| 657 | +-#### hostname *: str* |
| 658 | +- |
| 659 | +-#### check_at_least_one_url() |
| 660 | +- |
| 661 | +-* **Parameters:** |
| 662 | +- **self** ([*DeployedServiceDescriptor*](#truss_chains.DeployedServiceDescriptor)) |
| 663 | +-* **Return type:** |
| 664 | +- [*DeployedServiceDescriptor*](#truss_chains.DeployedServiceDescriptor) |
| 665 | +- |
643 | 666 | -#### display_name *: str*
|
644 | 667 | -
|
| 668 | +-#### internal_url *: [InternalURL](#truss_chains.DeployedServiceDescriptor.InternalURL) | None* |
| 669 | +- |
645 | 670 | -#### name *: str*
|
646 | 671 | -
|
647 | 672 | -#### options *: [RPCOptions](#truss_chains.RPCOptions)*
|
648 | 673 | -
|
649 |
| --#### predict_url *: str* |
| 674 | +-#### predict_url *: str | None* |
650 | 675 | +| Name | Type | Description |
|
651 | 676 | +|----------------|------------------------------------------------|-------------|
|
652 | 677 | +| `name` | *str* | |
|
|
656 | 681 |
|
657 | 682 |
|
658 | 683 | ### *class* `truss_chains.StubBase`
|
659 |
| -@@ -657,7 +557,7 @@ |
| 684 | +@@ -683,7 +557,7 @@ |
660 | 685 | in user-code for wrapping a deployed truss model into the Chains framework. It
|
661 | 686 | flexibly supports JSON and pydantic inputs and output. Example usage:
|
662 | 687 |
|
|
665 | 690 | import pydantic
|
666 | 691 | import truss_chains as chains
|
667 | 692 |
|
668 |
| -@@ -668,18 +568,18 @@ |
| 693 | +@@ -694,18 +568,18 @@ |
669 | 694 |
|
670 | 695 | class DeployedWhisper(chains.StubBase):
|
671 | 696 | # Input JSON, output JSON.
|
|
687 | 712 | return await self.predict_async(data, output_model=WhisperOutput)
|
688 | 713 |
|
689 | 714 |
|
690 |
| -@@ -700,10 +600,10 @@ |
| 715 | +@@ -726,10 +600,10 @@ |
691 | 716 |
|
692 | 717 | **Parameters:**
|
693 | 718 |
|
|
701 | 726 | +| `api_key` | *str* | A baseten API key to authorize requests. |
|
702 | 727 |
|
703 | 728 |
|
704 |
| - #### *classmethod* from_url(predict_url, context, options=None) |
705 |
| -@@ -713,27 +613,25 @@ |
| 729 | + #### *classmethod* from_url(predict_url, context_or_api_key, options=None) |
| 730 | +@@ -739,27 +613,25 @@ |
706 | 731 |
|
707 | 732 | **Parameters:**
|
708 | 733 |
|
709 | 734 | -| Name | Type | Description |
|
710 | 735 | -|------|------|-------------|
|
711 | 736 | -| `predict_url` | *str* | URL to predict endpoint of another chain / truss model. |
|
712 |
| --| `context` | *[DeploymentContext](#truss_chains.DeploymentContext* | Deployment context object, obtained in the chainlet’s `__init__`. | |
| 737 | +-| `context_or_api_key` | *[DeploymentContext](#truss_chains.DeploymentContext* | Deployment context object, obtained in the chainlet’s `__init__` or Baseten API key. | |
713 | 738 | -| `options` | *[RPCOptions](#truss_chains.RPCOptions* | RPC options, e.g. retries. |
|
714 | 739 | -
|
715 | 740 | -
|
|
727 | 752 | -#### predict_sync(inputs: InputT, output_model: Type[OutputModelT]) → OutputModelT
|
728 | 753 | -
|
729 | 754 | -#### predict_sync(inputs: InputT, output_model: None = None) → Any
|
730 |
| -+| Name | Type | Description | |
731 |
| -+|---------------|--------------------------------------------------------------|-------------------------------------------------------------------| |
732 |
| -+| `predict_url` | *str* | URL to predict endpoint of another chain / truss model. | |
733 |
| -+| `context` | *[DeploymentContext](#class-truss-chains-deploymentcontext)* | Deployment context object, obtained in the chainlet’s `__init__`. | |
734 |
| -+| `options` | *[RPCOptions](#class-truss-chains-rpcoptions)* | RPC options, e.g. retries. | |
| 755 | ++| Name | Type | Description | |
| 756 | ++|----------------------|--------------------------------------------------------------|--------------------------------------------------------------------------------------| |
| 757 | ++| `predict_url` | *str* | URL to predict endpoint of another chain / truss model. | |
| 758 | ++| `context_or_api_key` | *[DeploymentContext](#class-truss-chains-deploymentcontext)* | Deployment context object, obtained in the chainlet’s `__init__` or Baseten API key. | |
| 759 | ++| `options` | *[RPCOptions](#class-truss-chains-rpcoptions)* | RPC options, e.g. retries. | |
735 | 760 | +
|
736 | 761 | +#### Invocation Methods
|
737 | 762 | +
|
|
749 | 774 |
|
750 | 775 |
|
751 | 776 | ### *class* `truss_chains.RemoteErrorDetail`
|
752 |
| -@@ -746,62 +644,21 @@ |
| 777 | +@@ -772,62 +644,21 @@ |
753 | 778 |
|
754 | 779 | **Parameters:**
|
755 | 780 |
|
|
0 commit comments