Module core.python_engine
Classes
class PythonEngine (driver: lavague.core.base_driver.BaseDriver,
llm: llama_index.core.base.llms.base.BaseLLM | None = None,
embedding: llama_index.core.base.embeddings.base.BaseEmbedding | None = None,
logger: lavague.core.logger.AgentLogger | None = None,
clean_html: Callable[[str], str] = <function extract>,
ocr_mm_llm: llama_index.core.base.llms.base.BaseLLM | None = None,
ocr_llm: llama_index.core.base.llms.base.BaseLLM | None = None,
display: bool = False,
batch_size: int = 5,
confidence_threshold: float = 0.85,
fallback_threshold: float = 0.85,
temp_screenshots_path='./tmp_screenshots',
n_search_attemps=10)-
The PythonEngine is responsible for knowledge retrieval, it extracts information from the webpage and performs RAG to complete the given instruction
Ancestors
- lavague.core.base_engine.BaseEngine
- abc.ABC
- lavague.core.logger.Loggable
- lavague.core.display.Display
Class variables
var batch_size : intvar clean_html : Callable[[str], str]var confidence_threshold : floatvar driver : lavague.core.base_driver.BaseDrivervar embedding : llama_index.core.base.embeddings.base.BaseEmbeddingvar fallback_theshold : floatvar llm : llama_index.core.base.llms.base.BaseLLMvar logger : lavague.core.logger.AgentLoggervar n_search_attempts : intvar ocr_llm : llama_index.core.base.llms.base.BaseLLMvar ocr_mm_llm : llama_index.core.base.llms.base.BaseLLMvar temp_screenshots_path : str
Static methods
def from_context(context: lavague.core.context.Context,
driver: lavague.core.base_driver.BaseDriver)
Methods
def display_screenshot(self) ‑> Nonedef execute_instruction(self, instruction: str) ‑> lavague.core.base_engine.ActionResultdef extract_structured_data(self, output: str) ‑> dict | Nonedef get_screenshots_batch(self) ‑> list[str]def perform_fallback(self, prompt, instruction) ‑> strdef set_display(self, display: bool)