opto.utils.llm.AbstractModel

opto.utils.llm.AbstractModel#

class AbstractModel[source]#

A minimal abstraction of a model api that refreshes the model every reset_freq seconds (this is useful for long-running models that may require refreshing certificates or memory management).

Parameters:
  • factory โ€“ A function that takes no arguments and returns a model that is callable.

  • reset_freq โ€“ The number of seconds after which the model should be refreshed. If None, the model is never refreshed.

Attributes

model

Methods

__init__(factory: Callable, reset_freq: int | None = None) โ†’ None[source]#
Parameters:
  • factory โ€“ A function that takes no arguments and returns a model that is callable.

  • reset_freq โ€“ The number of seconds after which the model should be refreshed. If None, the model is never refreshed.

__new__(**kwargs)#