Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update comments and types for generating python API reference #38

Merged
merged 6 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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