ImageGeneration Derived Type

type, public, extends(openai) :: ImageGeneration


Inherits

type~~imagegeneration~~InheritsGraph type~imagegeneration ImageGeneration type~openai openai type~imagegeneration->type~openai

Components

Type Visibility Attributes Name Initial
character(len=:), public, allocatable :: organization
character(len=:), public, allocatable :: api_key
character(len=:), public, allocatable :: file_name
character(len=14), public :: api_key_env = 'OPENAI_API_KEY'
character(len=10), public :: organization_env = 'OPENAI_ORG'
character(len=:), public, allocatable :: url
character(len=9), public :: size = '1024x1024'
character(len=1000), public :: prompt
character(len=4), public :: response_format = 'url'
integer, public :: n = 1
character(len=:), public, allocatable :: user_name
character(len=1024), public, allocatable :: assistant_response(:)

Type-Bound Procedures

procedure, public :: load_base_data

  • private impure elemental subroutine load_base_data(this, file_name)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, public :: print_api_key

  • private impure elemental subroutine print_api_key(this)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, public :: print_organization

  • private impure elemental subroutine print_organization(this)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, public :: print_file_name

  • private impure elemental subroutine print_file_name(this)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, public :: set_file_name

  • private pure elemental subroutine set_file_name(this, file_name)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, public :: set_base_data

  • private impure elemental subroutine set_base_data(this, file_name, api_key, organization)

    Author
    Seyed Ali Ghasemi

    Arguments

    Type IntentOptional Attributes Name
    class(openai), intent(inout) :: this
    character(len=*), intent(in), optional :: file_name
    character(len=*), intent(in), optional :: api_key
    character(len=*), intent(in), optional :: organization

procedure, public :: create => create_image

  • private impure elemental subroutine create_image(this, prompt, n, size, response_format, user_name)

    Author
    Seyed Ali Ghasemi

    Arguments

    Type IntentOptional Attributes Name
    class(ImageGeneration), intent(inout) :: this
    character(len=*), intent(in) :: prompt
    integer, intent(in), optional :: n
    character(len=*), intent(in), optional :: size
    character(len=*), intent(in), optional :: response_format
    character(len=*), intent(in), optional :: user_name

procedure, private :: deallocate_url

  • private pure elemental subroutine deallocate_url(this)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, private :: deallocate_user_name

  • private pure elemental subroutine deallocate_user_name(this)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, private :: deallocate_assistant_response

procedure, public :: finalize => deallocate_ImageGeneration

procedure, private :: load_url

  • private impure elemental subroutine load_url(this)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, private :: load_size

  • private impure elemental subroutine load_size(this)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, private :: load_response_format

  • private impure elemental subroutine load_response_format(this)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, private :: load_n

  • private impure elemental subroutine load_n(this)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, private :: load_user_name

  • private impure elemental subroutine load_user_name(this)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, private :: load => load_ImageGeneration_data

  • private impure elemental subroutine load_ImageGeneration_data(this, file_name)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, private :: print_url

  • private impure elemental subroutine print_url(this)

    Author
    Seyed Ali Ghasemi

    Arguments

    Type IntentOptional Attributes Name
    class(ImageGeneration), intent(in) :: this

procedure, private :: print_size

  • private impure elemental subroutine print_size(this)

    Author
    Seyed Ali Ghasemi

    Arguments

    Type IntentOptional Attributes Name
    class(ImageGeneration), intent(in) :: this

procedure, public :: print_prompt

  • private impure elemental subroutine print_prompt(this)

    Author
    Seyed Ali Ghasemi

    Arguments

    Type IntentOptional Attributes Name
    class(ImageGeneration), intent(in) :: this

procedure, private :: print_response_format

procedure, private :: print_n

  • private impure elemental subroutine print_n(this)

    Author
    Seyed Ali Ghasemi

    Arguments

    Type IntentOptional Attributes Name
    class(ImageGeneration), intent(in) :: this

procedure, private :: print_user_name

  • private impure elemental subroutine print_user_name(this)

    Author
    Seyed Ali Ghasemi

    Arguments

    Type IntentOptional Attributes Name
    class(ImageGeneration), intent(in) :: this

procedure, public :: print_assistant_response

procedure, private :: set_url

  • private pure elemental subroutine set_url(this, url)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, private :: set_size

  • private pure elemental subroutine set_size(this, size)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, private :: set_prompt

  • private pure elemental subroutine set_prompt(this, prompt)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, private :: set_response_format

  • private pure elemental subroutine set_response_format(this, response_format)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, private :: set_n

  • private pure elemental subroutine set_n(this, n)

    Author
    Seyed Ali Ghasemi

    Arguments

    Type IntentOptional Attributes Name
    class(ImageGeneration), intent(inout) :: this
    integer, intent(in) :: n

procedure, private :: set_user_name

  • private pure elemental subroutine set_user_name(this, user_name)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, private :: set_assistant_response

  • private pure elemental subroutine set_assistant_response(this, assistant_response, i)

    Author
    Seyed Ali Ghasemi

    Arguments

    Type IntentOptional Attributes Name
    class(ImageGeneration), intent(inout) :: this
    character(len=*), intent(in) :: assistant_response
    integer, intent(in) :: i

procedure, public :: set => set_ImageGeneration_data

  • private impure elemental subroutine set_ImageGeneration_data(this, file_name, url, size, prompt, response_format, n, user_name)

    Author
    Seyed Ali Ghasemi

    Arguments

    Type IntentOptional Attributes Name
    class(ImageGeneration), intent(inout) :: this
    character(len=*), intent(in), optional :: file_name
    character(len=*), intent(in), optional :: url
    character(len=*), intent(in), optional :: size
    character(len=*), intent(in), optional :: prompt
    character(len=*), intent(in), optional :: response_format
    integer, intent(in), optional :: n
    character(len=*), intent(in), optional :: user_name

Source Code

   type, extends(openai) :: ImageGeneration
      character(len=:),    allocatable :: url
      character(len=9)                 :: size='1024x1024'
      character(len=1000)              :: prompt
      character(len=4)                 :: response_format='url'
      integer                          :: n=1
      character(len=:),    allocatable :: user_name
      character(len=1024), allocatable :: assistant_response(:)
   contains
      procedure :: create => create_image
      procedure, private :: deallocate_url
      procedure, private :: deallocate_user_name
      procedure, private :: deallocate_assistant_response
      procedure :: finalize => deallocate_ImageGeneration
      procedure, private :: load_url
      procedure, private :: load_size
      procedure, private :: load_response_format
      procedure, private :: load_n
      procedure, private :: load_user_name
      procedure, private :: load => load_ImageGeneration_data
      procedure, private :: print_url
      procedure, private :: print_size
      procedure :: print_prompt
      procedure, private :: print_response_format
      procedure, private :: print_n
      procedure, private :: print_user_name
      procedure :: print_assistant_response
      procedure, private :: set_url
      procedure, private :: set_size
      procedure, private :: set_prompt
      procedure, private :: set_response_format
      procedure, private :: set_n
      procedure, private :: set_user_name
      procedure, private :: set_assistant_response
      procedure :: set => set_ImageGeneration_data
   end type ImageGeneration