load_api_key Subroutine

private impure elemental subroutine load_api_key(this, file_name)

Uses

    • json_module
  • proc~~load_api_key~~UsesGraph proc~load_api_key foropenai_base::openai%load_api_key json_module json_module proc~load_api_key->json_module

Type Bound

openai

Arguments

Type IntentOptional Attributes Name
class(openai), intent(inout) :: this
character(len=*), intent(in), optional :: file_name

Calls

proc~~load_api_key~~CallsGraph proc~load_api_key foropenai_base::openai%load_api_key destroy destroy proc~load_api_key->destroy get get proc~load_api_key->get initialize initialize proc~load_api_key->initialize load_file load_file proc~load_api_key->load_file proc~set_file_name foropenai_base::openai%set_file_name proc~load_api_key->proc~set_file_name

Called by

proc~~load_api_key~~CalledByGraph proc~load_api_key foropenai_base::openai%load_api_key proc~load_base_data foropenai_base::openai%load_base_data proc~load_base_data->proc~load_api_key proc~set_base_data foropenai_base::openai%set_base_data proc~set_base_data->proc~load_api_key proc~conversation foropenai_ChatCompletion::ChatCompletion%conversation proc~conversation->proc~set_base_data program~test_base test_base program~test_base->proc~set_base_data program~test_chatcompletion test_ChatCompletion program~test_chatcompletion->proc~set_base_data program~test_imagegeneration test_ImageGeneration program~test_imagegeneration->proc~set_base_data program~test_transcription test_Transcription program~test_transcription->proc~set_base_data program~test_translation test_Translation program~test_translation->proc~set_base_data

Source Code

   elemental impure subroutine load_api_key(this, file_name)
      use json_module, only: json_file
      class(openai),    intent(inout)        :: this
      character(len=*), intent(in), optional :: file_name
      type(json_file)                        :: json
      if (present(file_name)) call this%set_file_name(file_name)
      call json%initialize()
      call json%load_file(trim(this%file_name))
      call json%get("base.api_key", this%api_key)
      call json%destroy()
   end subroutine load_api_key