Skip to content

Commit

Permalink
Merge branch 'main' into fix-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kelsey-wong authored Feb 18, 2025
2 parents f634d1a + 3392f0d commit eb91f44
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.0.1a7] - 2025-02-15
## [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

- Update links in documentation.

## [0.0.1a6] - 2025-02-14

### Changed
Expand Down Expand Up @@ -56,7 +62,8 @@ 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.1a7...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
Expand Down
2 changes: 1 addition & 1 deletion src/cleanlab_codex/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ def list_organizations(self) -> list[Organization]:
Returns:
list[Organization]: A list of organizations the authenticated user is a member of.
See [`Organization`](/reference/python/types.organization#class-organization) for more information.
See [`Organization`](/codex/api/python/types.organization#class-organization) for more information.
"""
return list_organizations(self._client)
22 changes: 11 additions & 11 deletions src/cleanlab_codex/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ def __str__(self) -> str:
class Project:
"""Represents a Codex project.
To integrate a Codex project into your RAG/Agentic system, we recommend using one of our abstractions such as [`CodexTool`](/reference/python/codex_tool).
To integrate a Codex project into your RAG/Agentic system, we recommend using one of our abstractions such as [`CodexTool`](/codex/api/python/codex_tool).
The [`query`](#method-query) method can also be used directly if none of our existing abstractions are sufficient for your use case.
"""

def __init__(self, sdk_client: _Codex, project_id: str, *, verify_existence: bool = True):
"""Initialize the Project. This method is not meant to be used directly.
Instead, use the [`Client.get_project()`](/reference/python/client#method-get_project),
[`Client.create_project()`](/reference/python/client#method-create_project), or [`Project.from_access_key()`](/reference/python/project#classmethod-from_access_key) methods.
Instead, use the [`Client.get_project()`](/codex/api/python/client#method-get_project),
[`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.
Expand Down Expand Up @@ -89,7 +89,7 @@ def from_access_key(cls, access_key: str) -> Project:

@classmethod
def create(cls, sdk_client: _Codex, organization_id: str, name: str, description: str | None = None) -> Project:
"""Create a new Codex project. This method is not meant to be used directly. Instead, use the [`create_project`](/reference/python/client#method-create_project) method on the `Client` class.
"""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.
Expand All @@ -114,7 +114,7 @@ def create(cls, sdk_client: _Codex, organization_id: str, name: str, description

def create_access_key(self, name: str, description: str | None = None, expiration: datetime | None = None) -> str:
"""Create a new access key for this project. Must be authenticated with a user-level API key to use this method.
See [`Client.create_project()`](/reference/python/client#method-create_project) or [`Client.get_project()`](/reference/python/client#method-get_project).
See [`Client.create_project()`](/codex/api/python/client#method-create_project) or [`Client.get_project()`](/codex/api/python/client#method-get_project).
Args:
name (str): The name of the access key.
Expand All @@ -125,7 +125,7 @@ def create_access_key(self, name: str, description: str | None = None, expiratio
str: The access key token.
Raises:
AuthenticationError: If the Project was created from a project-level access key instead of a [Client instance](/reference/python/client#class-client).
AuthenticationError: If the Project was created from a project-level access key instead of a [Client instance](/codex/api/python/client#class-client).
"""
try:
return self._sdk_client.projects.access_keys.create(
Expand All @@ -136,13 +136,13 @@ def create_access_key(self, name: str, description: str | None = None, expiratio

def add_entries(self, entries: list[EntryCreate]) -> None:
"""Add a list of entries to this Codex project. Must be authenticated with a user-level API key to use this method.
See [`Client.create_project()`](/reference/python/client#method-create_project) or [`Client.get_project()`](/reference/python/client#method-get_project).
See [`Client.create_project()`](/codex/api/python/client#method-create_project) or [`Client.get_project()`](/codex/api/python/client#method-get_project).
Args:
entries (list[EntryCreate]): The entries to add to this project. See [`EntryCreate`](/reference/python/types.entry#class-entrycreate).
entries (list[EntryCreate]): The entries to add to this project. See [`EntryCreate`](/codex/api/python/types.entry#class-entrycreate).
Raises:
AuthenticationError: If the Project was created from a project-level access key instead of a [Client instance](/reference/python/client#class-client).
AuthenticationError: If the Project was created from a project-level access key instead of a [Client instance](/codex/api/python/client#class-client).
"""
try:
# TODO: implement batch creation of entries in backend and update this function
Expand Down Expand Up @@ -170,8 +170,8 @@ def query(
Returns:
tuple[Optional[str], Optional[Entry]]: A tuple representing the answer for the query and the existing or new entry in the Codex project.
If Codex is able to answer the question, the first element will be the answer returned by Codex and the second element will be the existing [`Entry`](/reference/python/types.entry#class-entry) in the Codex project.
If Codex is unable to answer the question, the first element will be `fallback_answer` if provided, otherwise None. The second element will be a new [`Entry`](/reference/python/types.entry#class-entry) in the Codex project.
If Codex is able to answer the question, the first element will be the answer returned by Codex and the second element will be the existing [`Entry`](/codex/api/python/types.entry#class-entry) in the Codex project.
If Codex is unable to answer the question, the first element will be `fallback_answer` if provided, otherwise None. The second element will be a new [`Entry`](/codex/api/python/types.entry#class-entry) in the Codex project.
"""
return query_project(
client=self._sdk_client,
Expand Down

0 comments on commit eb91f44

Please sign in to comment.