(llmConfig: LLMConfig, engineOptions: PythonEngineOptions = {})
| 37 | private readonly executor: ReturnType<typeof createPythonExecutor>; |
| 38 | |
| 39 | constructor(llmConfig: LLMConfig, engineOptions: PythonEngineOptions = {}) { |
| 40 | if (engineOptions.execute !== undefined && typeof engineOptions.execute !== 'function') { |
| 41 | throw new Error('Python execute must be a function'); |
| 42 | } |
| 43 | this.timeoutMs = z |
| 44 | .number() |
| 45 | .int() |
| 46 | .positive() |
| 47 | .max(2_147_483_647) |
| 48 | .parse(engineOptions.queryTimeoutMs ?? DEFAULT_QUERY_TIMEOUT_MS); |
| 49 | this.executor = engineOptions.execute ?? createPythonExecutor(this.timeoutMs); |
| 50 | this.dialect = new PythonDialect(llmConfig, (script) => |
| 51 | runWithTimeout(this.executor(script, 64 * 1024), this.timeoutMs, { |
| 52 | onTimeout: () => new Error(`Python validation timed out after ${this.timeoutMs}ms`), |
| 53 | }) |
| 54 | ); |
| 55 | } |
| 56 | |
| 57 | async load(configs: DataSourceConfig | DataSourceConfig[]): Promise<void> { |
| 58 | const sources = Array.isArray(configs) ? configs : [configs]; |
nothing calls this directly
no test coverage detected