Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ChatCompletion), | intent(inout) | :: | this | |||
character(len=*), | intent(in) | :: | file_name_base | |||
character(len=*), | intent(in) | :: | file_name_ChatCompletion | |||
character(len=*), | intent(in) | :: | input_file | |||
character(len=*), | intent(in) | :: | output_file | |||
character(len=*), | intent(in) | :: | inputfile_command | |||
character(len=*), | intent(in) | :: | exit_command |
elemental impure subroutine conversation(this, file_name_base, file_name_ChatCompletion, & input_file, output_file, inputfile_command, exit_command) class(ChatCompletion), intent(inout) :: this character(len=*), intent(in) :: file_name_base character(len=*), intent(in) :: file_name_ChatCompletion character(len=*), intent(in) :: input_file character(len=*), intent(in) :: output_file character(len=*), intent(in) :: inputfile_command character(len=*), intent(in) :: exit_command call this%set_base_data(file_name_base) call this%set(file_name_ChatCompletion) call this%init_messages(n=3) call this%messages(1)%set(role='system', content='You are a helpful assistant.') call this%messages(2)%set(role='assistant', content='') call this%messages(3)%set_role(role='user') do call this%read_user_message(file_name=trim(input_file), command=trim(inputfile_command)) if (trim(this%get_user_message()) == trim(exit_command)) exit call this%create() call this%set_asisstant_response(response=this%get_assistant_response()) call this%print_assistant_response() call this%write_history(file_name=trim(output_file)) end do call this%usage%print_prompt_tokens() call this%usage%print_completion_tokens() call this%usage%print_total_tokens() end subroutine conversation