in src/ZGOOG_DEMO_RAP_AGENT/src/zcl_goog_rap_agent_base.clas.abap [0:0]
METHOD initialize_agent.
IF mv_is_initialized = abap_true.
RETURN.
ENDIF.
DATA(lv_model_id) = get_model_id( ). " Call abstract method
DATA(lv_system_instruction) = get_system_instruction( ). " Call abstract method
DATA(lt_tools) = get_tool_definitions( ). " Call abstract method
TRY.
" 1. Create the Model Instance
me->mo_model = NEW #( iv_model_key = lv_model_id ).
" 2. Set System Instructions
mo_model->set_system_instructions( lv_system_instruction ).
" 3. Register Tools (Function Declarations) if any
IF lt_tools IS NOT INITIAL.
register_tools( lt_tools ).
mo_model->set_auto_invoke_sap_function( abap_true ).
ENDIF.
mv_is_initialized = abap_true.
CATCH /goog/cx_sdk INTO DATA(lx_sdk).
" Log exception or handle appropriately
RAISE EXCEPTION lx_sdk.
ENDTRY.