class documentation

class ModelActivity: (source)

Constructor: ModelActivity(model_provider)

View In Hierarchy

Class wrapper for model invocation activities to allow model customization. By default, we use an OpenAIProvider with retries disabled. Disabling retries in your model of choice is recommended to allow activity retries to define the retry model.

Method __init__ Initialize the activity with a model provider.
Async Method invoke_model_activity Activity that invokes a model with the given input.
Instance Variable _model_provider Undocumented
def __init__(self, model_provider: ModelProvider | None = None): (source)

Initialize the activity with a model provider.

@activity.defn
@_auto_heartbeater
async def invoke_model_activity(self, input: ActivityModelInput) -> ModelResponse: (source)

Activity that invokes a model with the given input.

_model_provider = (source)

Undocumented