Class ZCL_LLM_TOOL_PARSER
AI Generated documentation.
Overview
The zcl_llm_tool_parser
is a JSON schema generator for ABAP data structures, implementing the zif_llm_tool_parser
interface. Its primary purpose is to convert ABAP data types into a JSON schema representation, supporting various data types including:
- Elementary types (integers, strings, booleans)
- Structures
- Tables
- Nested structures and tables
The main public method is parse()
, which generates a JSON schema for a given data structure, handling type detection, descriptions, and enum values.
Dependencies
zif_llm_tool_parser
interfacezcx_llm_validation
exception class- ABAP type descriptor classes (cl_abap_typedescr, cl_abap_structdescr, cl_abap_elemdescr, cl_abap_tabledescr)
Details
The class uses a recursive parsing approach to generate JSON schemas:
Key parsing strategies:
- Supports nested structures and tables
- Generates titles and descriptions
- Handles enum values
- Validates and raises exceptions for unsupported types
- Converts field names to lowercase
- Generates a "required" array for structure components
- Disables additional properties in objects
The parsing process involves several method calls:
pre_schema()
process_type()
(recursive type handling)process_structure()
/process_table()
/process_element()
post_schema()
The class is designed to be extensible, with empty hook methods like pre_object()
, post_array()
that can be overridden in subclasses for custom behavior.