EmbeddedIPythonCodeExecutor

EmbeddedIPythonCodeExecutor(**kwargs)

(Experimental) A code executor class that executes code statefully using an embedded IPython kernel managed by this class.

This will execute LLM generated code on the local machine.

Each execution is stateful and can access variables created from previous executions in the same session. The kernel must be installed before using this class. The kernel can be installed using the following command: python -m ipykernel install --user --name \{kernel_name} where kernel_name is the name of the kernel to install.

Parameters:
NameDescription
**kwargs

Class Attributes

construct



copy



dict



execute_code_blocks



from_orm



json



kernel_name



model_config



model_construct



model_copy



model_dump



model_dump_json



model_json_schema



model_parametrized_name



model_post_init



model_rebuild



model_validate



model_validate_json



model_validate_strings



output_dir



parse_file



parse_obj



parse_raw



restart



schema



schema_json



timeout



update_forward_refs



validate



Instance Attributes

code_extractor


(Experimental) Export a code extractor that can be used by an agent.

model_extra


Get extra fields set during validation.

Returns: A dictionary of extra fields, or None if config.extra is not set to "allow".

model_fields_set


Returns the set of fields that have been explicitly set on this model instance.

Returns: A set of strings representing the fields that have been set, i.e. that were not filled from defaults.