print_assistant_response Subroutine

private impure elemental subroutine print_assistant_response(this)

Uses

    • face
  • proc~~print_assistant_response~2~~UsesGraph proc~print_assistant_response~2 foropenai_ChatCompletion::ChatCompletion%print_assistant_response face face proc~print_assistant_response~2->face

Type Bound

ChatCompletion

Arguments

Type IntentOptional Attributes Name
class(ChatCompletion), intent(inout) :: this

Calls

proc~~print_assistant_response~2~~CallsGraph proc~print_assistant_response~2 foropenai_ChatCompletion::ChatCompletion%print_assistant_response colorize colorize proc~print_assistant_response~2->colorize

Called by

proc~~print_assistant_response~2~~CalledByGraph proc~print_assistant_response~2 foropenai_ChatCompletion::ChatCompletion%print_assistant_response proc~conversation foropenai_ChatCompletion::ChatCompletion%conversation proc~conversation->proc~print_assistant_response~2 program~test_chatcompletion test_ChatCompletion program~test_chatcompletion->proc~print_assistant_response~2

Source Code

   elemental impure subroutine print_assistant_response(this)
      use face, only: colorize
      class(ChatCompletion), intent(inout) :: this
      integer                              :: i
      do i = 1, size(this%messages)
         if (this%messages(i)%role == 'assistant') then
            print "(A,': ',A)", colorize("ChatGPT", color_bg='blue'), this%messages(i)%content
         end if
      end do
   end subroutine print_assistant_response