yipao.LLM.customllm.CustomLLM

class yipao.LLM.customllm.CustomLLM[source]

Base class for interacting with generative LLMs.

__init__()

Methods

__init__()

count_tokens(prompt)

Counts the number of tokens used in a string.

invoke(prompt)

Method to submit a prompt to the model for generating a response.

monitor()

Method to monitor the LLM's token usage.

validate_prompt(prompt)

Validates the prompt to ensure it is not empty.