Skip to content

Commit 85dbad7

Browse files
authored
update comments and types for generating python API reference (#38)
1 parent 3392f0d commit 85dbad7

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.0.1a8] - 2025-02-18
11+
12+
### Changed
13+
14+
- Added and edited docstrings to make the auto-generated API reference more clear.
15+
1016
## [0.0.1a7] - 2025-02-18
1117

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

5763
- Pre-release of the Cleanlab Codex Python client.
5864

59-
[Unreleased]: https://github.com/cleanlab/cleanlab-codex/compare/v0.0.1a6...HEAD
65+
[Unreleased]: https://github.com/cleanlab/cleanlab-codex/compare/v0.0.1a8...HEAD
66+
[0.0.1a8]: https://github.com/cleanlab/cleanlab-codex/compare/v0.0.1a7...v0.0.1a8
67+
[0.0.1a7]: https://github.com/cleanlab/cleanlab-codex/compare/v0.0.1a6...v0.0.1a7
6068
[0.0.1a6]: https://github.com/cleanlab/cleanlab-codex/compare/v0.0.1a5...v0.0.1a6
6169
[0.0.1a5]: https://github.com/cleanlab/cleanlab-codex/compare/v0.0.1a4...v0.0.1a5
6270
[0.0.1a4]: https://github.com/cleanlab/cleanlab-codex/compare/v0.0.1a3...v0.0.1a4

src/cleanlab_codex/codex_tool.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ def __init__(
2727
*,
2828
fallback_answer: Optional[str] = DEFAULT_FALLBACK_ANSWER,
2929
):
30+
"""Initialize a CodexTool.
31+
32+
Args:
33+
project (Project): The Codex project to use for this tool.
34+
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.
35+
"""
3036
self._project = project
3137
self._fallback_answer = fallback_answer
3238
self._tool_function_schema = pydantic_model_from_function(self._tool_name, self.query)
@@ -40,7 +46,7 @@ def from_access_key(
4046
*,
4147
fallback_answer: Optional[str] = DEFAULT_FALLBACK_ANSWER,
4248
) -> CodexTool:
43-
"""Creates a CodexTool from an access key. The CodexTool will use the project ID associated with the access key provided.
49+
"""Creates a CodexTool from an access key. The CodexTool will use the project associated with the access key provided.
4450
4551
Args:
4652
access_key (str): The access key for the Codex project.

src/cleanlab_codex/project.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434

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

3838
def __str__(self) -> str:
3939
return "valid project ID or access key is required to authenticate access"
@@ -52,7 +52,7 @@ def __init__(self, sdk_client: _Codex, project_id: str, *, verify_existence: boo
5252
[`Client.create_project()`](/codex/api/python/client#method-create_project), or [`Project.from_access_key()`](/codex/api/python/project#classmethod-from_access_key) methods.
5353
5454
Args:
55-
sdk_client (_Codex): The Codex SDK client to use to interact with the project.
55+
sdk_client (Codex): The Codex SDK client to use to interact with the project.
5656
project_id (str): The ID of the project.
5757
verify_existence (bool, optional): Whether to verify that the project exists.
5858
"""
@@ -92,10 +92,10 @@ def create(cls, sdk_client: _Codex, organization_id: str, name: str, description
9292
"""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.
9393
9494
Args:
95-
sdk_client (_Codex): The Codex SDK client to use to create the project. This client must be authenticated with a user-level API key.
95+
sdk_client (Codex): The Codex SDK client to use to create the project. This client must be authenticated with a user-level API key.
9696
organization_id (str): The ID of the organization to create the project in.
9797
name (str): The name of the project.
98-
description (:obj:`str`, optional): The description of the project.
98+
description (str, optional): The description of the project.
9999
100100
Returns:
101101
Project: The created project.
@@ -118,8 +118,8 @@ def create_access_key(self, name: str, description: str | None = None, expiratio
118118
119119
Args:
120120
name (str): The name of the access key.
121-
description (:obj:`str`, optional): The description of the access key.
122-
expiration (:obj:`datetime`, optional): The expiration date of the access key. If not provided, the access key will not expire.
121+
description (str, optional): The description of the access key.
122+
expiration (datetime, optional): The expiration date of the access key. If not provided, the access key will not expire.
123123
124124
Returns:
125125
str: The access key token.

0 commit comments

Comments
 (0)