openai Derived Type

type, public :: openai


Inherited by

type~~openai~~InheritedByGraph type~openai openai type~chatcompletion ChatCompletion type~chatcompletion->type~openai type~imagegeneration ImageGeneration type~imagegeneration->type~openai type~transcription Transcription type~transcription->type~openai type~translation Translation type~translation->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'

Type-Bound Procedures

procedure, private :: deallocate_api_key

  • private pure elemental subroutine deallocate_api_key(this)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, private :: deallocate_organization

  • private pure elemental subroutine deallocate_organization(this)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, private :: deallocate_file_name

  • private pure elemental subroutine deallocate_file_name(this)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, public :: finalize => deallocate_openai

  • private pure elemental subroutine deallocate_openai(this)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, private :: load_api_key

  • private impure elemental subroutine load_api_key(this, file_name)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, private :: load_organization

  • private impure elemental subroutine load_organization(this, file_name)

    Author
    Seyed Ali Ghasemi

    Arguments

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

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, private :: set_api_key

  • private pure elemental subroutine set_api_key(this, api_key)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, private :: set_organization

  • private pure elemental subroutine set_organization(this, organization)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, private :: set_api_key_env

  • private impure elemental subroutine set_api_key_env(this, status)

    Author
    Seyed Ali Ghasemi

    Arguments

    Type IntentOptional Attributes Name
    class(openai), intent(inout) :: this
    integer, intent(out), optional :: status

procedure, private :: set_organization_env

  • private impure elemental subroutine set_organization_env(this, status)

    Author
    Seyed Ali Ghasemi

    Arguments

    Type IntentOptional Attributes Name
    class(openai), intent(inout) :: this
    integer, intent(out), optional :: status

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

Source Code

   type openai
      character(len=:), allocatable :: organization
      character(len=:), allocatable :: api_key
      character(len=:), allocatable :: file_name
      character(len=14)             :: api_key_env      = 'OPENAI_API_KEY'
      character(len=10)             :: organization_env = 'OPENAI_ORG'
   contains
      procedure, private :: deallocate_api_key
      procedure, private :: deallocate_organization
      procedure, private :: deallocate_file_name
      procedure :: finalize => deallocate_openai
      procedure, private :: load_api_key
      procedure, private :: load_organization
      procedure :: load_base_data
      procedure :: print_api_key
      procedure :: print_organization
      procedure :: print_file_name
      procedure :: set_file_name
      procedure, private :: set_api_key
      procedure, private :: set_organization
      procedure, private :: set_api_key_env
      procedure, private :: set_organization_env
      procedure :: set_base_data
   end type openai