test_ChatCompletion Program

Uses

  • program~~test_chatcompletion~~UsesGraph program~test_chatcompletion test_ChatCompletion module~foropenai foropenai program~test_chatcompletion->module~foropenai module~foropenai_base foropenai_base module~foropenai->module~foropenai_base module~foropenai_chatcompletion foropenai_ChatCompletion module~foropenai->module~foropenai_chatcompletion module~foropenai_imagegeneration foropenai_ImageGeneration module~foropenai->module~foropenai_imagegeneration module~foropenai_transcription foropenai_Transcription module~foropenai->module~foropenai_transcription module~foropenai_translation foropenai_Translation module~foropenai->module~foropenai_translation module~foropenai_chatcompletion->module~foropenai_base module~foropenai_imagegeneration->module~foropenai_base module~foropenai_transcription->module~foropenai_base module~foropenai_translation->module~foropenai_base

Calls

program~~test_chatcompletion~~CallsGraph program~test_chatcompletion test_ChatCompletion proc~create_chat_completion foropenai_ChatCompletion::ChatCompletion%create_chat_completion program~test_chatcompletion->proc~create_chat_completion proc~deallocate_chatcompletion foropenai_ChatCompletion::ChatCompletion%deallocate_ChatCompletion program~test_chatcompletion->proc~deallocate_chatcompletion proc~init_messages foropenai_ChatCompletion::ChatCompletion%init_messages program~test_chatcompletion->proc~init_messages proc~print_assistant_response~2 foropenai_ChatCompletion::ChatCompletion%print_assistant_response program~test_chatcompletion->proc~print_assistant_response~2 proc~print_user_message foropenai_ChatCompletion::ChatCompletion%print_user_message program~test_chatcompletion->proc~print_user_message proc~set_base_data foropenai_base::openai%set_base_data program~test_chatcompletion->proc~set_base_data proc~set_chatcompletion_data foropenai_ChatCompletion::ChatCompletion%set_ChatCompletion_data program~test_chatcompletion->proc~set_chatcompletion_data add add proc~create_chat_completion->add deserialize deserialize proc~create_chat_completion->deserialize destroy destroy proc~create_chat_completion->destroy get get proc~create_chat_completion->get initialize initialize proc~create_chat_completion->initialize pair_type pair_type proc~create_chat_completion->pair_type print_to_string print_to_string proc~create_chat_completion->print_to_string proc~check_chat_completion foropenai_ChatCompletion::ChatCompletion%check_chat_completion proc~create_chat_completion->proc~check_chat_completion proc~set_asisstant_response foropenai_ChatCompletion::ChatCompletion%set_asisstant_response proc~create_chat_completion->proc~set_asisstant_response request request proc~create_chat_completion->request proc~deallocate_finish_reason foropenai_ChatCompletion::ChatCompletion%deallocate_finish_reason proc~deallocate_chatcompletion->proc~deallocate_finish_reason proc~deallocate_messages foropenai_ChatCompletion::ChatCompletion%deallocate_messages proc~deallocate_chatcompletion->proc~deallocate_messages proc~deallocate_model_list foropenai_ChatCompletion::ChatCompletion%deallocate_model_list proc~deallocate_chatcompletion->proc~deallocate_model_list proc~deallocate_model~2 foropenai_ChatCompletion::ChatCompletion%deallocate_model proc~deallocate_chatcompletion->proc~deallocate_model~2 proc~deallocate_url~2 foropenai_ChatCompletion::ChatCompletion%deallocate_url proc~deallocate_chatcompletion->proc~deallocate_url~2 proc~deallocate_user_name foropenai_ChatCompletion::ChatCompletion%deallocate_user_name proc~deallocate_chatcompletion->proc~deallocate_user_name colorize colorize proc~print_assistant_response~2->colorize proc~print_user_message->colorize proc~load_api_key foropenai_base::openai%load_api_key proc~set_base_data->proc~load_api_key proc~load_organization foropenai_base::openai%load_organization proc~set_base_data->proc~load_organization proc~set_api_key foropenai_base::openai%set_api_key proc~set_base_data->proc~set_api_key proc~set_api_key_env foropenai_base::openai%set_api_key_env proc~set_base_data->proc~set_api_key_env proc~set_file_name foropenai_base::openai%set_file_name proc~set_base_data->proc~set_file_name proc~set_organization foropenai_base::openai%set_organization proc~set_base_data->proc~set_organization proc~set_organization_env foropenai_base::openai%set_organization_env proc~set_base_data->proc~set_organization_env proc~load_chatcompletion_data foropenai_ChatCompletion::ChatCompletion%load_ChatCompletion_data proc~set_chatcompletion_data->proc~load_chatcompletion_data proc~set_chatcompletion_data->proc~set_file_name proc~set_frequency_penalty foropenai_ChatCompletion::ChatCompletion%set_frequency_penalty proc~set_chatcompletion_data->proc~set_frequency_penalty proc~set_max_tokens foropenai_ChatCompletion::ChatCompletion%set_max_tokens proc~set_chatcompletion_data->proc~set_max_tokens proc~set_model~2 foropenai_ChatCompletion::ChatCompletion%set_model proc~set_chatcompletion_data->proc~set_model~2 proc~set_n foropenai_ChatCompletion::ChatCompletion%set_n proc~set_chatcompletion_data->proc~set_n proc~set_presence_penalty foropenai_ChatCompletion::ChatCompletion%set_presence_penalty proc~set_chatcompletion_data->proc~set_presence_penalty proc~set_stream foropenai_ChatCompletion::ChatCompletion%set_stream proc~set_chatcompletion_data->proc~set_stream proc~set_temperature~2 foropenai_ChatCompletion::ChatCompletion%set_temperature proc~set_chatcompletion_data->proc~set_temperature~2 proc~set_top_p foropenai_ChatCompletion::ChatCompletion%set_top_p proc~set_chatcompletion_data->proc~set_top_p proc~set_url~2 foropenai_ChatCompletion::ChatCompletion%set_url proc~set_chatcompletion_data->proc~set_url~2 proc~set_user_name foropenai_ChatCompletion::ChatCompletion%set_user_name proc~set_chatcompletion_data->proc~set_user_name proc~load_api_key->destroy proc~load_api_key->get proc~load_api_key->initialize proc~load_api_key->proc~set_file_name load_file load_file proc~load_api_key->load_file proc~load_chatcompletion_data->proc~set_file_name proc~load_frequency_penalty foropenai_ChatCompletion::ChatCompletion%load_frequency_penalty proc~load_chatcompletion_data->proc~load_frequency_penalty proc~load_max_tokens foropenai_ChatCompletion::ChatCompletion%load_max_tokens proc~load_chatcompletion_data->proc~load_max_tokens proc~load_model~2 foropenai_ChatCompletion::ChatCompletion%load_model proc~load_chatcompletion_data->proc~load_model~2 proc~load_n foropenai_ChatCompletion::ChatCompletion%load_n proc~load_chatcompletion_data->proc~load_n proc~load_presence_penalty foropenai_ChatCompletion::ChatCompletion%load_presence_penalty proc~load_chatcompletion_data->proc~load_presence_penalty proc~load_stream foropenai_ChatCompletion::ChatCompletion%load_stream proc~load_chatcompletion_data->proc~load_stream proc~load_temperature~2 foropenai_ChatCompletion::ChatCompletion%load_temperature proc~load_chatcompletion_data->proc~load_temperature~2 proc~load_top_p foropenai_ChatCompletion::ChatCompletion%load_top_p proc~load_chatcompletion_data->proc~load_top_p proc~load_url~2 foropenai_ChatCompletion::ChatCompletion%load_url proc~load_chatcompletion_data->proc~load_url~2 proc~load_user_name foropenai_ChatCompletion::ChatCompletion%load_user_name proc~load_chatcompletion_data->proc~load_user_name proc~load_organization->destroy proc~load_organization->get proc~load_organization->initialize proc~load_organization->proc~set_file_name proc~load_organization->load_file proc~set_api_key_env->proc~set_api_key proc~set_content foropenai_ChatCompletion::ChatCompletion_messages%set_content proc~set_asisstant_response->proc~set_content proc~set_organization_env->proc~set_organization proc~load_frequency_penalty->destroy proc~load_frequency_penalty->get proc~load_frequency_penalty->initialize proc~load_frequency_penalty->load_file proc~load_max_tokens->destroy proc~load_max_tokens->get proc~load_max_tokens->initialize proc~load_max_tokens->load_file proc~load_model~2->destroy proc~load_model~2->get proc~load_model~2->initialize proc~load_model~2->load_file proc~load_n->destroy proc~load_n->get proc~load_n->initialize proc~load_n->load_file proc~load_presence_penalty->destroy proc~load_presence_penalty->get proc~load_presence_penalty->initialize proc~load_presence_penalty->load_file proc~load_stream->destroy proc~load_stream->get proc~load_stream->initialize proc~load_stream->load_file proc~load_temperature~2->destroy proc~load_temperature~2->get proc~load_temperature~2->initialize proc~load_temperature~2->load_file proc~load_top_p->destroy proc~load_top_p->get proc~load_top_p->initialize proc~load_top_p->load_file proc~load_url~2->destroy proc~load_url~2->get proc~load_url~2->initialize proc~load_url~2->load_file proc~load_user_name->destroy proc~load_user_name->get proc~load_user_name->initialize proc~load_user_name->load_file

Variables

Type Attributes Name Initial
type(ChatCompletion) :: chat

Source Code

program test_ChatCompletion

   use foropenai, only: ChatCompletion

   implicit none

   type(ChatCompletion) :: chat

   call chat%set_base_data(file_name='foropenai.json')
   call chat%set(file_name='foropenai.json')

   call chat%init_messages(n=3)
   call chat%messages(1)%set(role='system', content='You are a helpful assistant.')
   call chat%messages(2)%set(role='user', content='Hello?')
   call chat%messages(3)%set(role='assistant', content='')

   call chat%print_user_message()
   call chat%create()
   call chat%print_assistant_response()

   call chat%usage%print()

   call chat%finalize()

end program test_ChatCompletion