phasellm.configurations#

Module Contents#

Classes#

APIConfiguration

Helper class that provides a standard way to create an ABC using

OpenAIConfiguration

Initializes the OpenAI API configuration.

AzureAPIConfiguration

Initializes the Azure API configuration.

AzureActiveDirectoryConfiguration

Initializes the Azure Active Directory API configuration.

VertexAIConfiguration

Initializes the VertexAI API configuration.

class phasellm.configurations.APIConfiguration(model: str = 'gpt-3.5-turbo')#

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

abstract __call__()#

Abstract method to initialize the API configuration. Should set the client attribute.

Returns:

abstract get_base_api_kwargs()#

Abstract method for the base API kwargs for the API configuration.

Returns:

class phasellm.configurations.OpenAIConfiguration(api_key: str, organization: str = None, model: str = 'gpt-3.5-turbo')#

Bases: APIConfiguration

Initializes the OpenAI API configuration.

Parameters:
  • api_key – The OpenAI API key.

  • organization – The OpenAI organization.

  • model – The model to use.

name = 'openai'#
__call__()#

Calls the OpenAI API configuration to initialize the OpenAI API.

Returns:

get_base_api_kwargs()#

Returns the base API kwargs for the OpenAI API configuration.

Returns:

A Dict of the base API kwargs for the OpenAI API configuration.

class phasellm.configurations.AzureAPIConfiguration(api_key: str, base_url: str = None, api_version: str = '2023-05-15', deployment_id: str = 'gpt-3.5-turbo', api_base: str = None)#

Bases: APIConfiguration

Initializes the Azure API configuration.

Parameters:
  • api_key – The Azure API key.

  • base_url – The Azure API base URL.

  • api_version – The Azure API version.

  • deployment_id – The model deployment ID.

  • api_base – (DEPRECATED) The Azure API base.

name = 'azure'#
__call__()#

Calls the Azure API configuration to initialize the Azure API.

Returns:

get_base_api_kwargs()#

Returns the base API kwargs for the Azure API configuration.

Returns:

A Dict of the base API kwargs for the Azure API configuration.

class phasellm.configurations.AzureActiveDirectoryConfiguration(base_url: str, api_version: str = '2023-05-15', deployment_id: str = 'gpt-3.5-turbo', api_base: str = None)#

Initializes the Azure Active Directory API configuration.

Learn more: https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/switching-endpoints#azure-active-directory-authentication

Parameters:
name = 'azure_ad'#
__call__()#

Calls the Azure Active Directory API configuration to initialize the Azure Active Directory API.

Returns:

get_base_api_kwargs()#

Returns the base API kwargs for the Azure Active Directory API configuration.

Returns:

A Dict containing the base API kwargs for the Azure Active Directory API configuration.

class phasellm.configurations.VertexAIConfiguration(model: str, project: str | None = None, location: str | None = None, experiment: str | None = None, experiment_description: str | None = None, credentials: str | None = None)#

Bases: APIConfiguration

Initializes the VertexAI API configuration.

Parameters:
  • model – The model to use.

  • project – Google Cloud project ID or number. Environment default used if not provided.

  • location – Vertext AI region. Defaults to us-central1.

  • experiment – The VertexAI experiment.

  • experiment_description – The VertexAI experiment description.

  • credentials – Custom google.auth.credentials.Credentials. Defaults to environment default credentials.

name = 'vertex_ai'#
__call__()#

Calls the VertexAI API configuration to initialize the VertexAI API.

get_base_api_kwargs()#

Abstract method for the base API kwargs for the API configuration.

Returns: