Skip to content

Commit

Permalink
update comments and types for generating python API reference (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
kelsey-wong authored Feb 18, 2025
1 parent 3392f0d commit 85dbad7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.0.1a8] - 2025-02-18

### Changed

- Added and edited docstrings to make the auto-generated API reference more clear.

## [0.0.1a7] - 2025-02-18

### Changed
Expand Down Expand Up @@ -56,7 +62,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Pre-release of the Cleanlab Codex Python client.

[Unreleased]: https://github.com/cleanlab/cleanlab-codex/compare/v0.0.1a6...HEAD
[Unreleased]: https://github.com/cleanlab/cleanlab-codex/compare/v0.0.1a8...HEAD
[0.0.1a8]: https://github.com/cleanlab/cleanlab-codex/compare/v0.0.1a7...v0.0.1a8
[0.0.1a7]: https://github.com/cleanlab/cleanlab-codex/compare/v0.0.1a6...v0.0.1a7
[0.0.1a6]: https://github.com/cleanlab/cleanlab-codex/compare/v0.0.1a5...v0.0.1a6
[0.0.1a5]: https://github.com/cleanlab/cleanlab-codex/compare/v0.0.1a4...v0.0.1a5
[0.0.1a4]: https://github.com/cleanlab/cleanlab-codex/compare/v0.0.1a3...v0.0.1a4
Expand Down
8 changes: 7 additions & 1 deletion src/cleanlab_codex/codex_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ def __init__(
*,
fallback_answer: Optional[str] = DEFAULT_FALLBACK_ANSWER,
):
"""Initialize a CodexTool.
Args:
project (Project): The Codex project to use for this tool.
fallback_answer (str, optional): The fallback answer to use if the Codex project cannot answer the question. A default will be used if not provided.
"""
self._project = project
self._fallback_answer = fallback_answer
self._tool_function_schema = pydantic_model_from_function(self._tool_name, self.query)
Expand All @@ -40,7 +46,7 @@ def from_access_key(
*,
fallback_answer: Optional[str] = DEFAULT_FALLBACK_ANSWER,
) -> CodexTool:
"""Creates a CodexTool from an access key. The CodexTool will use the project ID associated with the access key provided.
"""Creates a CodexTool from an access key. The CodexTool will use the project associated with the access key provided.
Args:
access_key (str): The access key for the Codex project.
Expand Down
12 changes: 6 additions & 6 deletions src/cleanlab_codex/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@


class MissingProjectError(Exception):
"""Raised when the project ID does not match any existing project."""
"""Raised when the project ID or access key does not match any existing project."""

def __str__(self) -> str:
return "valid project ID or access key is required to authenticate access"
Expand All @@ -52,7 +52,7 @@ def __init__(self, sdk_client: _Codex, project_id: str, *, verify_existence: boo
[`Client.create_project()`](/codex/api/python/client#method-create_project), or [`Project.from_access_key()`](/codex/api/python/project#classmethod-from_access_key) methods.
Args:
sdk_client (_Codex): The Codex SDK client to use to interact with the project.
sdk_client (Codex): The Codex SDK client to use to interact with the project.
project_id (str): The ID of the project.
verify_existence (bool, optional): Whether to verify that the project exists.
"""
Expand Down Expand Up @@ -92,10 +92,10 @@ def create(cls, sdk_client: _Codex, organization_id: str, name: str, description
"""Create a new Codex project. This method is not meant to be used directly. Instead, use the [`create_project`](/codex/api/python/client#method-create_project) method on the `Client` class.
Args:
sdk_client (_Codex): The Codex SDK client to use to create the project. This client must be authenticated with a user-level API key.
sdk_client (Codex): The Codex SDK client to use to create the project. This client must be authenticated with a user-level API key.
organization_id (str): The ID of the organization to create the project in.
name (str): The name of the project.
description (:obj:`str`, optional): The description of the project.
description (str, optional): The description of the project.
Returns:
Project: The created project.
Expand All @@ -118,8 +118,8 @@ def create_access_key(self, name: str, description: str | None = None, expiratio
Args:
name (str): The name of the access key.
description (:obj:`str`, optional): The description of the access key.
expiration (:obj:`datetime`, optional): The expiration date of the access key. If not provided, the access key will not expire.
description (str, optional): The description of the access key.
expiration (datetime, optional): The expiration date of the access key. If not provided, the access key will not expire.
Returns:
str: The access key token.
Expand Down

0 comments on commit 85dbad7

Please sign in to comment.