class documentation

Mixin for Model classes that can generate prompt embeddings.

This mixin allows for the possibility that only some instances of a class are capable of generating prompt embeddings, per the value of the can_embed_prompts property.

Method embed_prompt Generates an embedding for the given prompt.
Method embed_prompts Generates embeddings for the given prompts.
Property can_embed_prompts Whether this instance can generate prompt embeddings.
def embed_prompt(self, arg): (source)

Generates an embedding for the given prompt.

Parameters
argthe prompt
Returns
a numpy array containing the embedding
def embed_prompts(self, args): (source)

Generates embeddings for the given prompts.

Subclasses can override this method to increase efficiency, but, by default, this method simply iterates over the data and applies embed_prompt to each.

Parameters
argsan iterable of prompts
Returns
a numpy array containing the embeddings stacked along axis 0