User Guides
Incovation
Call your deployed Chain
Once your Chain is deployed, you can call it via its API endpoint. Chains use the same inference API as models:
Hereβs an example which calls the development deployment:
call_chain.py
How to pass chain input
The data schema of the inference request corresponds to the function
signature of run_remote()
in your entrypoint Chainlet.
For example, for the Hello Chain, HelloAll.run_remote()
:
Youβd pass the following JSON payload:
I.e. the keys in the JSON record, match the argument names and values
match the types ofrun_remote.
Async chain inference
Like Truss models, Chains support async invocation. The guide for models applies largely - in particular for how to wrap the input and set up the webhook to process results.
The following additional points are chains specific:
- Use chain-based URLS:
https://chain-{chain}.api.baseten.co/production/async_run_remote
https://chain-{chain}.api.baseten.co/development/async_run_remote
https://chain-{chain}.api.baseten.co/deployment/{deployment}/async_run_remote
.https://chain-{chain}.api.baseten.co/environments/{env_name}/async_run_remote
.
- Only the entrypoint is invoked asynchronously. Internal Chainlet-Chainlet calls run synchronously.