module cleanlab_codex.client
Client for interacting with Cleanlab Codex.
class Client
Client for interacting with Cleanlab Codex. In order to use this client, make sure you have an account at codex.cleanlab.ai.
We recommend using the Web UI to set up Codex projects, but you can also use this client to programmatically set up Codex projects.
method __init__
__init__(api_key: 'str | None' = None, organization_id: 'Optional[str]' = None)
Initialize the Codex client.
Args:
api_key
(str, optional): The API key for authenticating the user. If not provided, the client will attempt to use the API key from the environment variableCODEX_API_KEY
. You can find your API key at codex.cleanlab.ai/account.organization_id
(str, optional): The ID of the organization the client should use. If not provided, the user’s default organization will be used.
Returns:
Client
: The authenticated Codex Client.
Raises:
AuthenticationError
: If the API key is invalid.
property organization_id
The organization ID the client is using.
method create_project
create_project(name: 'str', description: 'Optional[str]' = None) → Project
Create a new Codex project. Project will be created in the organization the client is using.
Args:
name
(str): The name of the project.description
(str, optional): The description of the project.
Returns:
Project
: The created project.
method get_project
get_project(project_id: 'str') → Project
Get a project by ID. Must be accessible by the authenticated user.
Args:
project_id
(str): The ID of the project to get.
Returns:
Project
: The project.
method list_organizations
list_organizations() → list[Organization]
List the organizations the authenticated user is a member of.
Returns:
list[Organization]
: A list of organizations the authenticated user is a member of. SeeOrganization
for more information.