set_api_key_env Subroutine

private impure elemental subroutine set_api_key_env(this, status)

Type Bound

openai

Arguments

Type IntentOptional Attributes Name
class(openai), intent(inout) :: this
integer, intent(out), optional :: status

Calls

proc~~set_api_key_env~~CallsGraph proc~set_api_key_env foropenai_base::openai%set_api_key_env proc~set_api_key foropenai_base::openai%set_api_key proc~set_api_key_env->proc~set_api_key

Called by

proc~~set_api_key_env~~CalledByGraph proc~set_api_key_env foropenai_base::openai%set_api_key_env proc~set_base_data foropenai_base::openai%set_base_data proc~set_base_data->proc~set_api_key_env 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 set_api_key_env(this, status)
      class(openai), intent(inout)         :: this
      integer,       intent(out), optional :: status
      character(len=1024)                  :: tmp
      call get_environment_variable(this%api_key_env, tmp, status = status)
      if (status==0) call this%set_api_key(trim(tmp))
   end subroutine set_api_key_env