set_user_message Subroutine

private pure elemental subroutine set_user_message(this, message)

Type Bound

ChatCompletion

Arguments

Type IntentOptional Attributes Name
class(ChatCompletion), intent(inout) :: this
character(len=*), intent(in) :: message

Calls

proc~~set_user_message~~CallsGraph proc~set_user_message foropenai_ChatCompletion::ChatCompletion%set_user_message proc~set_content foropenai_ChatCompletion::ChatCompletion_messages%set_content proc~set_user_message->proc~set_content

Called by

proc~~set_user_message~~CalledByGraph proc~set_user_message foropenai_ChatCompletion::ChatCompletion%set_user_message proc~read_user_message foropenai_ChatCompletion::ChatCompletion%read_user_message proc~read_user_message->proc~set_user_message proc~conversation foropenai_ChatCompletion::ChatCompletion%conversation proc~conversation->proc~read_user_message

Source Code

   elemental pure subroutine set_user_message(this, message)
      class(ChatCompletion), intent(inout) :: this
      character(len=*),      intent(in)    :: message
      integer                              :: i
      do i = 1, size(this%messages)
         if (this%messages(i)%role == 'user') then
            call this%messages(i)%set_content(content=message)
         end if
      end do
   end subroutine set_user_message