Skip to content
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
2 changes: 1 addition & 1 deletion kagglesdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.1.22"
__version__ = "0.1.23"

from kagglesdk.kaggle_client import KaggleClient
from kagglesdk.kaggle_creds import KaggleCredentials
Expand Down
7 changes: 6 additions & 1 deletion kagglesdk/benchmarks/types/benchmark_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ class BenchmarkModelImportanceLevel(enum.Enum):
"""

class BenchmarkTaskVersionCreationState(enum.Enum):
"""Saved to the DB. Do not modify existing values."""
r"""
Saved to the DB. Do not modify existing values.
LINT.IfChange(BenchmarkTaskVersionCreationState)
"""
BENCHMARK_TASK_VERSION_CREATION_STATE_UNSPECIFIED = 0
BENCHMARK_TASK_VERSION_CREATION_STATE_QUEUED = 1
BENCHMARK_TASK_VERSION_CREATION_STATE_RUNNING = 2
BENCHMARK_TASK_VERSION_CREATION_STATE_COMPLETED = 3
BENCHMARK_TASK_VERSION_CREATION_STATE_ERRORED = 4
BENCHMARK_TASK_VERSION_CREATION_STATE_KERNEL_WITHOUT_RUN = 5
BENCHMARK_TASK_VERSION_CREATION_STATE_VALIDATION_FAILED = 6
BENCHMARK_TASK_VERSION_CREATION_STATE_NO_MODEL_SPECIFIED = 7

class Modality(enum.Enum):
"""Modality types supported by a benchmark model version."""
Expand Down
44 changes: 42 additions & 2 deletions kagglesdk/benchmarks/types/benchmark_tasks_api_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class ApiBatchScheduleBenchmarkTaskRunsRequest(KaggleObject):
Attributes:
task_slugs (ApiBenchmarkTaskSlug)
model_version_slugs (str)
Canonical BenchmarkModelVersion.Slug values (e.g.
'claude-sonnet-4-6-default').
"""

def __init__(self):
Expand All @@ -33,6 +35,10 @@ def task_slugs(self, task_slugs: Optional[List[Optional['ApiBenchmarkTaskSlug']]

@property
def model_version_slugs(self) -> Optional[List[str]]:
r"""
Canonical BenchmarkModelVersion.Slug values (e.g.
'claude-sonnet-4-6-default').
"""
return self._model_version_slugs

@model_version_slugs.setter
Expand Down Expand Up @@ -103,6 +109,8 @@ class ApiBenchmarkTask(KaggleObject):
underlying kernel session (SourceKernelSessionId).
create_time (datetime)
When this task version was created.
creation_error_message (str)
Error message from task version creation, if it failed.
"""

def __init__(self):
Expand All @@ -111,6 +119,7 @@ def __init__(self):
self._error = None
self._creation_state = BenchmarkTaskVersionCreationState.BENCHMARK_TASK_VERSION_CREATION_STATE_UNSPECIFIED
self._create_time = None
self._creation_error_message = None
self._freeze()

@property
Expand Down Expand Up @@ -186,6 +195,20 @@ def create_time(self, create_time: datetime):
raise TypeError('create_time must be of type datetime')
self._create_time = create_time

@property
def creation_error_message(self) -> str:
"""Error message from task version creation, if it failed."""
return self._creation_error_message or ""

@creation_error_message.setter
def creation_error_message(self, creation_error_message: Optional[str]):
if creation_error_message is None:
del self.creation_error_message
return
if not isinstance(creation_error_message, str):
raise TypeError('creation_error_message must be of type str')
self._creation_error_message = creation_error_message


class ApiBenchmarkTaskRun(KaggleObject):
r"""
Expand All @@ -195,7 +218,9 @@ class ApiBenchmarkTaskRun(KaggleObject):
task_slug (ApiBenchmarkTaskSlug)
Task that was invoked.
model_version_slug (str)
Model candidate against the task.
Model candidate against the task. This is the canonical
BenchmarkModelVersion.Slug (e.g. 'claude-sonnet-4-6-default'), matching
the format produced by BatchScheduleBenchmarkTaskRuns.
id (int)
Run identifier.
state (BenchmarkTaskRunState)
Expand Down Expand Up @@ -234,7 +259,11 @@ def task_slug(self, task_slug: Optional['ApiBenchmarkTaskSlug']):

@property
def model_version_slug(self) -> str:
"""Model candidate against the task."""
r"""
Model candidate against the task. This is the canonical
BenchmarkModelVersion.Slug (e.g. 'claude-sonnet-4-6-default'), matching
the format produced by BatchScheduleBenchmarkTaskRuns.
"""
return self._model_version_slug

@model_version_slug.setter
Expand Down Expand Up @@ -579,6 +608,10 @@ class ApiListBenchmarkTaskRunsRequest(KaggleObject):
Attributes:
task_slug (ApiBenchmarkTaskSlug)
model_version_slugs (str)
Filter to runs for these model versions. Accepts the canonical
BenchmarkModelVersion.Slug (preferred, e.g. 'claude-sonnet-4-6-default')
or the legacy ModelProxySlug (e.g. 'anthropic/claude-sonnet-4-6@default')
for backward compatibility.
page_size (int)
page_token (str)
skip (int)
Expand Down Expand Up @@ -607,6 +640,12 @@ def task_slug(self, task_slug: Optional['ApiBenchmarkTaskSlug']):

@property
def model_version_slugs(self) -> Optional[List[str]]:
r"""
Filter to runs for these model versions. Accepts the canonical
BenchmarkModelVersion.Slug (preferred, e.g. 'claude-sonnet-4-6-default')
or the legacy ModelProxySlug (e.g. 'anthropic/claude-sonnet-4-6@default')
for backward compatibility.
"""
return self._model_version_slugs

@model_version_slugs.setter
Expand Down Expand Up @@ -899,6 +938,7 @@ def nextPageToken(self):
FieldMetadata("error", "error", "_error", str, None, PredefinedSerializer(), optional=True),
FieldMetadata("creationState", "creation_state", "_creation_state", BenchmarkTaskVersionCreationState, BenchmarkTaskVersionCreationState.BENCHMARK_TASK_VERSION_CREATION_STATE_UNSPECIFIED, EnumSerializer()),
FieldMetadata("createTime", "create_time", "_create_time", datetime, None, DateTimeSerializer()),
FieldMetadata("creationErrorMessage", "creation_error_message", "_creation_error_message", str, None, PredefinedSerializer(), optional=True),
]

ApiBenchmarkTaskRun._fields = [
Expand Down
Empty file.
63 changes: 63 additions & 0 deletions kagglesdk/discussions/services/discussions_api_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
from kagglesdk.discussions.types.discussions_api_service import ApiGetTopicRequest, ApiGetTopicResponse, ApiListCommentsRequest, ApiListCommentsResponse, ApiListForumsRequest, ApiListForumsResponse, ApiListTopicsRequest, ApiListTopicsResponse
from kagglesdk.kaggle_http_client import KaggleHttpClient

class DiscussionApiClient(object):

def __init__(self, client: KaggleHttpClient):
self._client = client

def list_forums(self, request: ApiListForumsRequest = None) -> ApiListForumsResponse:
r"""
List all top-level discussion forums on Kaggle.

Args:
request (ApiListForumsRequest):
The request object; initialized to empty instance if not specified.
"""

if request is None:
request = ApiListForumsRequest()

return self._client.call("discussions.DiscussionApiService", "ListForums", request, ApiListForumsResponse)

def list_topics(self, request: ApiListTopicsRequest = None) -> ApiListTopicsResponse:
r"""
List and search discussion topics, optionally filtered by forum.

Args:
request (ApiListTopicsRequest):
The request object; initialized to empty instance if not specified.
"""

if request is None:
request = ApiListTopicsRequest()

return self._client.call("discussions.DiscussionApiService", "ListTopics", request, ApiListTopicsResponse)

def get_topic(self, request: ApiGetTopicRequest = None) -> ApiGetTopicResponse:
r"""
Get a single discussion topic by ID.

Args:
request (ApiGetTopicRequest):
The request object; initialized to empty instance if not specified.
"""

if request is None:
request = ApiGetTopicRequest()

return self._client.call("discussions.DiscussionApiService", "GetTopic", request, ApiGetTopicResponse)

def list_comments(self, request: ApiListCommentsRequest = None) -> ApiListCommentsResponse:
r"""
List comments for a discussion topic, with pagination.

Args:
request (ApiListCommentsRequest):
The request object; initialized to empty instance if not specified.
"""

if request is None:
request = ApiListCommentsRequest()

return self._client.call("discussions.DiscussionApiService", "ListComments", request, ApiListCommentsResponse)
Loading