Llama 7B example
Use theEngineBuilderLLMChainlet baseclass to configure an LLM engine. The additional engine_builder_config field specifies model architecture, repository, engine parameters, and more; the full options are detailed in the Engine-Builder configuration guide.
Define the engine-backed Chainlet:
llama_7b_chainlet.py
Differences from standard Chainlets
- No
run_remoteimplementation: Unlike regular Chainlets,EngineBuilderLLMChainletdoesn’t require users to implementrun_remote(). Instead, it automatically wires into the deployed engine’s API. All LLM Chainlets have the same function signature:chains.EngineBuilderLLMInputas input and a stream (AsyncIterator) of strings as output. Likewise,EngineBuilderLLMChainlets can only be used as dependencies, but can’t have dependencies themselves. - No
run_local(guide) orwatch(guide). Standard Chains support a local debugging mode and watch; however, when usingEngineBuilderLLMChainlet, local execution isn’t available, and testing must be done after deployment. For a faster dev loop of the rest of your chain (everything except the engine-builder Chainlet), you can substitute those Chainlets with stubs, as you can for an already-deployed Truss model (guide).
Integrate the Engine-Builder chainlet
After defining anEngineBuilderLLMChainlet like Llama7BChainlet above, you can use it as a dependency in other conventional Chainlets:
controller.py