satif_ai.transform
atransform
async def atransform(
    sdif: SDIFPath,
    output_target_files: Dict[FilePath, str] | List[FilePath] | FilePath,
    instructions: Optional[str] = None,
    output_path: FilePath = Path("."),
    *,
    transformation_code: Optional[str] = None,
    transformation_builder: Optional[AsyncTransformationBuilder] = None,
    code_executor: Optional[CodeExecutor] = None,
    mcp_server: Optional[FastMCP] = None,
    mcp_client: Optional[Client] = None,
    llm_model: str = "o4-mini",
    schema_only: bool = False,
    representer_kwargs: Optional[Dict[str,
                                      Any]] = None) -> TransformationResult
Asynchronously transforms an SDIF (Standard Data Interchange Format) input using an AI-generated or provided transformation code.
This function orchestrates the process of:
- Optionally generating transformation code using an AI model via a
 TransformationBuilderiftransformation_codeis not provided. explicitly passed.- Executing the transformation code using a
 CodeTransformerand aCodeExecutor.- Exporting the results to the specified output.
 Arguments:
sdif- Path to the input SDIF file or anSDIFDatabaseobject.
output_target_files- A dictionary mapping original example file paths (or string identifiers) to their desired agent-facing filenames, or a list of output example file paths, or a single output file path. These are used by the AI to understand the target format and structure, and also by theCodeTransformerto determine output filenames if the transformation result keys match.
instructions- Optional. Natural language instructions for the AI to generate the transformation code. Used iftransformation_codeis None.
transformation_code0 - Path to the directory where transformation outputs will be saved.
transformation_code- Optional. Pre-existing Python code for the transformation. If None, code will be generated by thetransformation_code2.
transformation_code2 - Optional. Antransformation_code4 instance responsible for generating the transformation code iftransformation_codeis not provided. If None, atransformation_code6 is instantiated.
transformation_code7 - Optional. ACodeExecutorinstance for running the transformation code. If None, atransformation_code9 is used.
CodeTransformer0 - Optional. ACodeTransformer1 server instance for the AI code builder. Defaults to the globalCodeTransformer2 instance iftransformation_code2 is None and a newtransformation_code6 is being created.
CodeTransformer5 - Optional. A user-providedCodeTransformer6 instance. If provided whentransformation_code2 is None, it will be used by the internally createdtransformation_code6. The caller is responsible for managing the lifecycle of a provided client.
CodeTransformer9 - The language model to use for code generation (e.g., "o4-mini"). Used iftransformation_code2 is None.
CodeExecutor1 - If True, the transformation aims to match only the schema (headers) of theoutput_target_files, and input samples may be omitted or marked as empty for the AI. This is useful for structural transformations without processing actual data rows.
CodeExecutor3 - Optional dictionary of keyword arguments to pass to the representer when analyzingoutput_target_files.Returns:
A
CodeExecutor5 object containing the path to the output and the transformation code used.