(
self,
prompt: str,
config: dict,
source: Optional[str] = None,
schema: Optional[Type[BaseModel]] = None,
)
| 54 | """ |
| 55 | |
| 56 | def __init__( |
| 57 | self, |
| 58 | prompt: str, |
| 59 | config: dict, |
| 60 | source: Optional[str] = None, |
| 61 | schema: Optional[Type[BaseModel]] = None, |
| 62 | ): |
| 63 | self.prompt = prompt |
| 64 | self.source = source |
| 65 | self.config = config |
| 66 | self.schema = schema |
| 67 | self.llm_model = self._create_llm(config["llm"]) |
| 68 | self.verbose = False if config is None else config.get("verbose", False) |
| 69 | self.headless = True if self.config is None else config.get("headless", True) |
| 70 | self.loader_kwargs = self.config.get("loader_kwargs", {}) |
| 71 | self.cache_path = self.config.get("cache_path", False) |
| 72 | self.browser_base = self.config.get("browser_base") |
| 73 | self.scrape_do = self.config.get("scrape_do") |
| 74 | self.storage_state = self.config.get("storage_state") |
| 75 | self.timeout = self.config.get("timeout", 480) |
| 76 | |
| 77 | self.graph = self._create_graph() |
| 78 | self.final_state = None |
| 79 | self.execution_info = None |
| 80 | |
| 81 | verbose = bool(config and config.get("verbose")) |
| 82 | |
| 83 | if verbose: |
| 84 | set_verbosity_info() |
| 85 | else: |
| 86 | set_verbosity_warning() |
| 87 | |
| 88 | common_params = { |
| 89 | "headless": self.headless, |
| 90 | "verbose": self.verbose, |
| 91 | "loader_kwargs": self.loader_kwargs, |
| 92 | "llm_model": self.llm_model, |
| 93 | "cache_path": self.cache_path, |
| 94 | "timeout": self.timeout, |
| 95 | } |
| 96 | |
| 97 | self.set_common_params(common_params, overwrite=True) |
| 98 | |
| 99 | self.burr_kwargs = config.get("burr_kwargs", None) |
| 100 | if self.burr_kwargs is not None: |
| 101 | self.graph.use_burr = True |
| 102 | if "app_instance_id" not in self.burr_kwargs: |
| 103 | self.burr_kwargs["app_instance_id"] = str(uuid.uuid4()) |
| 104 | |
| 105 | self.graph.burr_config = self.burr_kwargs |
| 106 | |
| 107 | def set_common_params(self, params: dict, overwrite=False): |
| 108 | """ |
nothing calls this directly
no test coverage detected