MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / LLM

Class LLM

bmtools/tools/database/utils/llm.py:28–51  ·  view source on GitHub ↗

Abstract base class for large language models.

Source from the content-addressed store, hash-verified

26
27
28class LLM(ABC):
29 """Abstract base class for large language models."""
30
31 @abstractmethod
32 def generate_text(self, prompt):
33 """Generates text from the model.
34 Parameters:
35 prompt: The prompt to use. This can be a string or a list of strings.
36 Returns:
37 A list of strings.
38 """
39 pass
40
41 @abstractmethod
42 def log_probs(self, text, log_prob_range):
43 """Returns the log probs of the text.
44 Parameters:
45 text: The text to get the log probs of. This can be a string or a list of strings.
46 log_prob_range: The range of characters within each string to get the log_probs of.
47 This is a list of tuples of the form (start, end).
48 Returns:
49 A list of log probs.
50 """
51 pass
52
53
54class GPT_Forward(LLM):

Callers 1

script.pyFile · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected