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 .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 90
configured_endpoints: 92
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-bb6c8be98a7d3c5109b7def15a21653d7bade60a2b6939157361c3fe9ef049d9.yml
13 changes: 13 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,19 @@ Methods:
- <code title="get /training">client.trainings.<a href="./src/asktable/resources/trainings.py">list</a>(\*\*<a href="src/asktable/types/training_list_params.py">params</a>) -> <a href="./src/asktable/types/training_list_response.py">SyncPage[TrainingListResponse]</a></code>
- <code title="delete /training/{id}">client.trainings.<a href="./src/asktable/resources/trainings.py">delete</a>(id, \*\*<a href="src/asktable/types/training_delete_params.py">params</a>) -> <a href="./src/asktable/types/training_delete_response.py">object</a></code>

# Project

Types:

```python
from asktable.types import ProjectListModelGroupsResponse
```

Methods:

- <code title="patch /project">client.project.<a href="./src/asktable/resources/project.py">update</a>(\*\*<a href="src/asktable/types/project_update_params.py">params</a>) -> <a href="./src/asktable/types/sys/project.py">Project</a></code>
- <code title="get /project/model-groups">client.project.<a href="./src/asktable/resources/project.py">list_model_groups</a>() -> <a href="./src/asktable/types/project_list_model_groups_response.py">ProjectListModelGroupsResponse</a></code>

# Scores

Types:
Expand Down
9 changes: 9 additions & 0 deletions src/asktable/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
roles,
caches,
scores,
project,
policies,
trainings,
integration,
Expand Down Expand Up @@ -78,6 +79,7 @@ class Asktable(SyncAPIClient):
business_glossary: business_glossary.BusinessGlossaryResource
preferences: preferences.PreferencesResource
trainings: trainings.TrainingsResource
project: project.ProjectResource
scores: scores.ScoresResource
with_raw_response: AsktableWithRawResponse
with_streaming_response: AsktableWithStreamedResponse
Expand Down Expand Up @@ -151,6 +153,7 @@ def __init__(
self.business_glossary = business_glossary.BusinessGlossaryResource(self)
self.preferences = preferences.PreferencesResource(self)
self.trainings = trainings.TrainingsResource(self)
self.project = project.ProjectResource(self)
self.scores = scores.ScoresResource(self)
self.with_raw_response = AsktableWithRawResponse(self)
self.with_streaming_response = AsktableWithStreamedResponse(self)
Expand Down Expand Up @@ -276,6 +279,7 @@ class AsyncAsktable(AsyncAPIClient):
business_glossary: business_glossary.AsyncBusinessGlossaryResource
preferences: preferences.AsyncPreferencesResource
trainings: trainings.AsyncTrainingsResource
project: project.AsyncProjectResource
scores: scores.AsyncScoresResource
with_raw_response: AsyncAsktableWithRawResponse
with_streaming_response: AsyncAsktableWithStreamedResponse
Expand Down Expand Up @@ -349,6 +353,7 @@ def __init__(
self.business_glossary = business_glossary.AsyncBusinessGlossaryResource(self)
self.preferences = preferences.AsyncPreferencesResource(self)
self.trainings = trainings.AsyncTrainingsResource(self)
self.project = project.AsyncProjectResource(self)
self.scores = scores.AsyncScoresResource(self)
self.with_raw_response = AsyncAsktableWithRawResponse(self)
self.with_streaming_response = AsyncAsktableWithStreamedResponse(self)
Expand Down Expand Up @@ -475,6 +480,7 @@ def __init__(self, client: Asktable) -> None:
self.business_glossary = business_glossary.BusinessGlossaryResourceWithRawResponse(client.business_glossary)
self.preferences = preferences.PreferencesResourceWithRawResponse(client.preferences)
self.trainings = trainings.TrainingsResourceWithRawResponse(client.trainings)
self.project = project.ProjectResourceWithRawResponse(client.project)
self.scores = scores.ScoresResourceWithRawResponse(client.scores)


Expand All @@ -497,6 +503,7 @@ def __init__(self, client: AsyncAsktable) -> None:
)
self.preferences = preferences.AsyncPreferencesResourceWithRawResponse(client.preferences)
self.trainings = trainings.AsyncTrainingsResourceWithRawResponse(client.trainings)
self.project = project.AsyncProjectResourceWithRawResponse(client.project)
self.scores = scores.AsyncScoresResourceWithRawResponse(client.scores)


Expand All @@ -519,6 +526,7 @@ def __init__(self, client: Asktable) -> None:
)
self.preferences = preferences.PreferencesResourceWithStreamingResponse(client.preferences)
self.trainings = trainings.TrainingsResourceWithStreamingResponse(client.trainings)
self.project = project.ProjectResourceWithStreamingResponse(client.project)
self.scores = scores.ScoresResourceWithStreamingResponse(client.scores)


Expand All @@ -541,6 +549,7 @@ def __init__(self, client: AsyncAsktable) -> None:
)
self.preferences = preferences.AsyncPreferencesResourceWithStreamingResponse(client.preferences)
self.trainings = trainings.AsyncTrainingsResourceWithStreamingResponse(client.trainings)
self.project = project.AsyncProjectResourceWithStreamingResponse(client.project)
self.scores = scores.AsyncScoresResourceWithStreamingResponse(client.scores)


Expand Down
14 changes: 14 additions & 0 deletions src/asktable/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@
ExtapisResourceWithStreamingResponse,
AsyncExtapisResourceWithStreamingResponse,
)
from .project import (
ProjectResource,
AsyncProjectResource,
ProjectResourceWithRawResponse,
AsyncProjectResourceWithRawResponse,
ProjectResourceWithStreamingResponse,
AsyncProjectResourceWithStreamingResponse,
)
from .policies import (
PoliciesResource,
AsyncPoliciesResource,
Expand Down Expand Up @@ -220,6 +228,12 @@
"AsyncTrainingsResourceWithRawResponse",
"TrainingsResourceWithStreamingResponse",
"AsyncTrainingsResourceWithStreamingResponse",
"ProjectResource",
"AsyncProjectResource",
"ProjectResourceWithRawResponse",
"AsyncProjectResourceWithRawResponse",
"ProjectResourceWithStreamingResponse",
"AsyncProjectResourceWithStreamingResponse",
"ScoresResource",
"AsyncScoresResource",
"ScoresResourceWithRawResponse",
Expand Down
241 changes: 241 additions & 0 deletions src/asktable/resources/project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import Optional

import httpx

from ..types import project_update_params
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._utils import (
maybe_transform,
async_maybe_transform,
)
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import (
to_raw_response_wrapper,
to_streamed_response_wrapper,
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from .._base_client import make_request_options
from ..types.sys.project import Project
from ..types.project_list_model_groups_response import ProjectListModelGroupsResponse

__all__ = ["ProjectResource", "AsyncProjectResource"]


class ProjectResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> ProjectResourceWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
the raw response object instead of the parsed content.

For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
"""
return ProjectResourceWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> ProjectResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/DataMini/asktable-python#with_streaming_response
"""
return ProjectResourceWithStreamingResponse(self)

def update(
self,
*,
llm_model_group: Optional[str] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Project:
"""
Update Project Name And Model Group

Args:
llm_model_group: 模型组

name: 项目名称

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
return self._patch(
"/project",
body=maybe_transform(
{
"llm_model_group": llm_model_group,
"name": name,
},
project_update_params.ProjectUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=Project,
)

def list_model_groups(
self,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> ProjectListModelGroupsResponse:
"""Get Llm Model Groups"""
return self._get(
"/project/model-groups",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=ProjectListModelGroupsResponse,
)


class AsyncProjectResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncProjectResourceWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
the raw response object instead of the parsed content.

For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers
"""
return AsyncProjectResourceWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> AsyncProjectResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/DataMini/asktable-python#with_streaming_response
"""
return AsyncProjectResourceWithStreamingResponse(self)

async def update(
self,
*,
llm_model_group: Optional[str] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Project:
"""
Update Project Name And Model Group

Args:
llm_model_group: 模型组

name: 项目名称

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._patch(
"/project",
body=await async_maybe_transform(
{
"llm_model_group": llm_model_group,
"name": name,
},
project_update_params.ProjectUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=Project,
)

async def list_model_groups(
self,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> ProjectListModelGroupsResponse:
"""Get Llm Model Groups"""
return await self._get(
"/project/model-groups",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=ProjectListModelGroupsResponse,
)


class ProjectResourceWithRawResponse:
def __init__(self, project: ProjectResource) -> None:
self._project = project

self.update = to_raw_response_wrapper(
project.update,
)
self.list_model_groups = to_raw_response_wrapper(
project.list_model_groups,
)


class AsyncProjectResourceWithRawResponse:
def __init__(self, project: AsyncProjectResource) -> None:
self._project = project

self.update = async_to_raw_response_wrapper(
project.update,
)
self.list_model_groups = async_to_raw_response_wrapper(
project.list_model_groups,
)


class ProjectResourceWithStreamingResponse:
def __init__(self, project: ProjectResource) -> None:
self._project = project

self.update = to_streamed_response_wrapper(
project.update,
)
self.list_model_groups = to_streamed_response_wrapper(
project.list_model_groups,
)


class AsyncProjectResourceWithStreamingResponse:
def __init__(self, project: AsyncProjectResource) -> None:
self._project = project

self.update = async_to_streamed_response_wrapper(
project.update,
)
self.list_model_groups = async_to_streamed_response_wrapper(
project.list_model_groups,
)
2 changes: 2 additions & 0 deletions src/asktable/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams
from .training_list_params import TrainingListParams as TrainingListParams
from .entry_with_definition import EntryWithDefinition as EntryWithDefinition
from .project_update_params import ProjectUpdateParams as ProjectUpdateParams
from .score_create_response import ScoreCreateResponse as ScoreCreateResponse
from .chat_retrieve_response import ChatRetrieveResponse as ChatRetrieveResponse
from .datasource_list_params import DatasourceListParams as DatasourceListParams
Expand Down Expand Up @@ -65,3 +66,4 @@
from .business_glossary_create_response import BusinessGlossaryCreateResponse as BusinessGlossaryCreateResponse
from .datasource_create_from_file_params import DatasourceCreateFromFileParams as DatasourceCreateFromFileParams
from .integration_create_excel_ds_params import IntegrationCreateExcelDsParams as IntegrationCreateExcelDsParams
from .project_list_model_groups_response import ProjectListModelGroupsResponse as ProjectListModelGroupsResponse
10 changes: 10 additions & 0 deletions src/asktable/types/project_list_model_groups_response.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List
from typing_extensions import TypeAlias

from .sys.model_group import ModelGroup

__all__ = ["ProjectListModelGroupsResponse"]

ProjectListModelGroupsResponse: TypeAlias = List[ModelGroup]
Loading