From 8f5acc859cef51375ed2abf641c7087a36d26e02 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 19 Aug 2025 19:18:41 +0000 Subject: [PATCH 1/2] docs(api): updates to API spec --- .stats.yml | 4 +- api.md | 6 +- src/writerai/resources/graphs.py | 23 +++--- src/writerai/types/__init__.py | 3 +- .../{graph_list_response.py => graph.py} | 4 +- src/writerai/types/graph_retrieve_response.py | 76 ------------------- tests/api_resources/test_graphs.py | 31 ++++---- 7 files changed, 33 insertions(+), 114 deletions(-) rename src/writerai/types/{graph_list_response.py => graph.py} (95%) delete mode 100644 src/writerai/types/graph_retrieve_response.py diff --git a/.stats.yml b/.stats.yml index 9cd26179..cf180159 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 33 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/writerai%2Fwriter-0bbaae2a69204cb3ccf6dc4fbb0cef810a4e8c78f09ac639e253e84df0add53a.yml -openapi_spec_hash: 0a9be554ca3af860e3831bd776e50f56 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/writerai%2Fwriter-9e04c6a51c55704029c529f2917d0e2b976cb7b6595128697db031ad7bd61a63.yml +openapi_spec_hash: e8a95522dd13ffe4633cccc34bbd651d config_hash: 7a38bab086b53b43d2a719cb4d883264 diff --git a/api.md b/api.md index d2641c43..4569c139 100644 --- a/api.md +++ b/api.md @@ -123,9 +123,7 @@ from writerai.types import ( Question, QuestionResponseChunk, GraphCreateResponse, - GraphRetrieveResponse, GraphUpdateResponse, - GraphListResponse, GraphDeleteResponse, GraphRemoveFileFromGraphResponse, ) @@ -134,9 +132,9 @@ from writerai.types import ( Methods: - client.graphs.create(\*\*params) -> GraphCreateResponse -- client.graphs.retrieve(graph_id) -> GraphRetrieveResponse +- client.graphs.retrieve(graph_id) -> Graph - client.graphs.update(graph_id, \*\*params) -> GraphUpdateResponse -- client.graphs.list(\*\*params) -> SyncCursorPage[GraphListResponse] +- client.graphs.list(\*\*params) -> SyncCursorPage[Graph] - client.graphs.delete(graph_id) -> GraphDeleteResponse - client.graphs.add_file_to_graph(graph_id, \*\*params) -> File - client.graphs.question(\*\*params) -> Question diff --git a/src/writerai/resources/graphs.py b/src/writerai/resources/graphs.py index 3d806def..dc9b997d 100644 --- a/src/writerai/resources/graphs.py +++ b/src/writerai/resources/graphs.py @@ -27,13 +27,12 @@ from .._streaming import Stream, AsyncStream from ..pagination import SyncCursorPage, AsyncCursorPage from ..types.file import File +from ..types.graph import Graph from .._base_client import AsyncPaginator, make_request_options from ..types.question import Question -from ..types.graph_list_response import GraphListResponse from ..types.graph_create_response import GraphCreateResponse from ..types.graph_delete_response import GraphDeleteResponse from ..types.graph_update_response import GraphUpdateResponse -from ..types.graph_retrieve_response import GraphRetrieveResponse from ..types.question_response_chunk import QuestionResponseChunk from ..types.graph_remove_file_from_graph_response import GraphRemoveFileFromGraphResponse @@ -115,7 +114,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GraphRetrieveResponse: + ) -> Graph: """ Retrieve a Knowledge Graph. @@ -135,7 +134,7 @@ def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GraphRetrieveResponse, + cast_to=Graph, ) def update( @@ -205,7 +204,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncCursorPage[GraphListResponse]: + ) -> SyncCursorPage[Graph]: """ Retrieve a list of Knowledge Graphs. @@ -232,7 +231,7 @@ def list( """ return self._get_api_list( "/v1/graphs", - page=SyncCursorPage[GraphListResponse], + page=SyncCursorPage[Graph], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -248,7 +247,7 @@ def list( graph_list_params.GraphListParams, ), ), - model=GraphListResponse, + model=Graph, ) def delete( @@ -620,7 +619,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GraphRetrieveResponse: + ) -> Graph: """ Retrieve a Knowledge Graph. @@ -640,7 +639,7 @@ async def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GraphRetrieveResponse, + cast_to=Graph, ) async def update( @@ -710,7 +709,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[GraphListResponse, AsyncCursorPage[GraphListResponse]]: + ) -> AsyncPaginator[Graph, AsyncCursorPage[Graph]]: """ Retrieve a list of Knowledge Graphs. @@ -737,7 +736,7 @@ def list( """ return self._get_api_list( "/v1/graphs", - page=AsyncCursorPage[GraphListResponse], + page=AsyncCursorPage[Graph], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -753,7 +752,7 @@ def list( graph_list_params.GraphListParams, ), ), - model=GraphListResponse, + model=Graph, ) async def delete( diff --git a/src/writerai/types/__init__.py b/src/writerai/types/__init__.py index 84a63a36..3ded6249 100644 --- a/src/writerai/types/__init__.py +++ b/src/writerai/types/__init__.py @@ -3,6 +3,7 @@ from __future__ import annotations from .file import File as File +from .graph import Graph as Graph from .shared import ( Source as Source, Logprobs as Logprobs, @@ -30,7 +31,6 @@ from .file_upload_params import FileUploadParams as FileUploadParams from .file_retry_response import FileRetryResponse as FileRetryResponse from .graph_create_params import GraphCreateParams as GraphCreateParams -from .graph_list_response import GraphListResponse as GraphListResponse from .graph_update_params import GraphUpdateParams as GraphUpdateParams from .model_list_response import ModelListResponse as ModelListResponse from .file_delete_response import FileDeleteResponse as FileDeleteResponse @@ -48,7 +48,6 @@ from .tool_web_search_params import ToolWebSearchParams as ToolWebSearchParams from .application_list_params import ApplicationListParams as ApplicationListParams from .chat_completion_message import ChatCompletionMessage as ChatCompletionMessage -from .graph_retrieve_response import GraphRetrieveResponse as GraphRetrieveResponse from .question_response_chunk import QuestionResponseChunk as QuestionResponseChunk from .tool_ai_detect_response import ToolAIDetectResponse as ToolAIDetectResponse from .tool_parse_pdf_response import ToolParsePdfResponse as ToolParsePdfResponse diff --git a/src/writerai/types/graph_list_response.py b/src/writerai/types/graph.py similarity index 95% rename from src/writerai/types/graph_list_response.py rename to src/writerai/types/graph.py index babb4060..469c0da6 100644 --- a/src/writerai/types/graph_list_response.py +++ b/src/writerai/types/graph.py @@ -6,7 +6,7 @@ from .._models import BaseModel -__all__ = ["GraphListResponse", "FileStatus", "URL", "URLStatus"] +__all__ = ["Graph", "FileStatus", "URL", "URLStatus"] class FileStatus(BaseModel): @@ -47,7 +47,7 @@ class URL(BaseModel): """An array of URLs to exclude from processing within this web connector.""" -class GraphListResponse(BaseModel): +class Graph(BaseModel): id: str """The unique identifier of the Knowledge Graph.""" diff --git a/src/writerai/types/graph_retrieve_response.py b/src/writerai/types/graph_retrieve_response.py deleted file mode 100644 index f93f7149..00000000 --- a/src/writerai/types/graph_retrieve_response.py +++ /dev/null @@ -1,76 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["GraphRetrieveResponse", "FileStatus", "URL", "URLStatus"] - - -class FileStatus(BaseModel): - completed: int - """The number of files that have been successfully processed.""" - - failed: int - """The number of files that failed to process.""" - - in_progress: int - """The number of files currently being processed.""" - - total: int - """The total number of files associated with the Knowledge Graph.""" - - -class URLStatus(BaseModel): - status: Literal["validating", "success", "error"] - """The current status of the URL processing.""" - - error_type: Optional[ - Literal["invalid_url", "not_searchable", "not_found", "paywall_or_login_page", "unexpected_error"] - ] = None - """The type of error that occurred during processing, if any.""" - - -class URL(BaseModel): - status: URLStatus - """The current status of the URL processing.""" - - type: Literal["single_page", "sub_pages"] - """The type of web connector processing for this URL.""" - - url: str - """The URL to be processed by the web connector.""" - - exclude_urls: Optional[List[str]] = None - """An array of URLs to exclude from processing within this web connector.""" - - -class GraphRetrieveResponse(BaseModel): - id: str - """The unique identifier of the Knowledge Graph.""" - - created_at: datetime - """The timestamp when the Knowledge Graph was created.""" - - file_status: FileStatus - """The processing status of files in the Knowledge Graph.""" - - name: str - """The name of the Knowledge Graph.""" - - type: Literal["manual", "connector", "web"] - """The type of Knowledge Graph. - - - `manual`: files are uploaded via UI or API - - `connector`: files are uploaded via a data connector such as Google Drive or - Confluence - - `web`: URLs are connected to the Knowledge Graph - """ - - description: Optional[str] = None - """A description of the Knowledge Graph.""" - - urls: Optional[List[URL]] = None - """An array of web connector URLs associated with this Knowledge Graph.""" diff --git a/tests/api_resources/test_graphs.py b/tests/api_resources/test_graphs.py index 102cbb9e..005c9cab 100644 --- a/tests/api_resources/test_graphs.py +++ b/tests/api_resources/test_graphs.py @@ -11,12 +11,11 @@ from tests.utils import assert_matches_type from writerai.types import ( File, + Graph, Question, - GraphListResponse, GraphCreateResponse, GraphDeleteResponse, GraphUpdateResponse, - GraphRetrieveResponse, GraphRemoveFileFromGraphResponse, ) from writerai.pagination import SyncCursorPage, AsyncCursorPage @@ -65,7 +64,7 @@ def test_method_retrieve(self, client: Writer) -> None: graph = client.graphs.retrieve( "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) - assert_matches_type(GraphRetrieveResponse, graph, path=["response"]) + assert_matches_type(Graph, graph, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Writer) -> None: @@ -76,7 +75,7 @@ def test_raw_response_retrieve(self, client: Writer) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" graph = response.parse() - assert_matches_type(GraphRetrieveResponse, graph, path=["response"]) + assert_matches_type(Graph, graph, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: Writer) -> None: @@ -87,7 +86,7 @@ def test_streaming_response_retrieve(self, client: Writer) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" graph = response.parse() - assert_matches_type(GraphRetrieveResponse, graph, path=["response"]) + assert_matches_type(Graph, graph, path=["response"]) assert cast(Any, response.is_closed) is True @@ -155,7 +154,7 @@ def test_path_params_update(self, client: Writer) -> None: @parametrize def test_method_list(self, client: Writer) -> None: graph = client.graphs.list() - assert_matches_type(SyncCursorPage[GraphListResponse], graph, path=["response"]) + assert_matches_type(SyncCursorPage[Graph], graph, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Writer) -> None: @@ -165,7 +164,7 @@ def test_method_list_with_all_params(self, client: Writer) -> None: limit=0, order="asc", ) - assert_matches_type(SyncCursorPage[GraphListResponse], graph, path=["response"]) + assert_matches_type(SyncCursorPage[Graph], graph, path=["response"]) @parametrize def test_raw_response_list(self, client: Writer) -> None: @@ -174,7 +173,7 @@ def test_raw_response_list(self, client: Writer) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" graph = response.parse() - assert_matches_type(SyncCursorPage[GraphListResponse], graph, path=["response"]) + assert_matches_type(SyncCursorPage[Graph], graph, path=["response"]) @parametrize def test_streaming_response_list(self, client: Writer) -> None: @@ -183,7 +182,7 @@ def test_streaming_response_list(self, client: Writer) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" graph = response.parse() - assert_matches_type(SyncCursorPage[GraphListResponse], graph, path=["response"]) + assert_matches_type(SyncCursorPage[Graph], graph, path=["response"]) assert cast(Any, response.is_closed) is True @@ -449,7 +448,7 @@ async def test_method_retrieve(self, async_client: AsyncWriter) -> None: graph = await async_client.graphs.retrieve( "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) - assert_matches_type(GraphRetrieveResponse, graph, path=["response"]) + assert_matches_type(Graph, graph, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncWriter) -> None: @@ -460,7 +459,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncWriter) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" graph = await response.parse() - assert_matches_type(GraphRetrieveResponse, graph, path=["response"]) + assert_matches_type(Graph, graph, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncWriter) -> None: @@ -471,7 +470,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncWriter) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" graph = await response.parse() - assert_matches_type(GraphRetrieveResponse, graph, path=["response"]) + assert_matches_type(Graph, graph, path=["response"]) assert cast(Any, response.is_closed) is True @@ -539,7 +538,7 @@ async def test_path_params_update(self, async_client: AsyncWriter) -> None: @parametrize async def test_method_list(self, async_client: AsyncWriter) -> None: graph = await async_client.graphs.list() - assert_matches_type(AsyncCursorPage[GraphListResponse], graph, path=["response"]) + assert_matches_type(AsyncCursorPage[Graph], graph, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncWriter) -> None: @@ -549,7 +548,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncWriter) -> N limit=0, order="asc", ) - assert_matches_type(AsyncCursorPage[GraphListResponse], graph, path=["response"]) + assert_matches_type(AsyncCursorPage[Graph], graph, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncWriter) -> None: @@ -558,7 +557,7 @@ async def test_raw_response_list(self, async_client: AsyncWriter) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" graph = await response.parse() - assert_matches_type(AsyncCursorPage[GraphListResponse], graph, path=["response"]) + assert_matches_type(AsyncCursorPage[Graph], graph, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncWriter) -> None: @@ -567,7 +566,7 @@ async def test_streaming_response_list(self, async_client: AsyncWriter) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" graph = await response.parse() - assert_matches_type(AsyncCursorPage[GraphListResponse], graph, path=["response"]) + assert_matches_type(AsyncCursorPage[Graph], graph, path=["response"]) assert cast(Any, response.is_closed) is True From fa768f04a0d094023f1579d9fd45d611ce5ff0e8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 19 Aug 2025 19:19:35 +0000 Subject: [PATCH 2/2] release: 2.3.1-rc1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 4 ++-- pyproject.toml | 2 +- src/writerai/_version.py | 2 +- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 75ec52fc..97ee52d7 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.3.0" + ".": "2.3.1-rc1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c9c1396f..b549ce4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 2.3.1-rc1 (2025-08-19) + +Full Changelog: [v2.3.0...v2.3.1-rc1](https://github.com/writer/writer-python/compare/v2.3.0...v2.3.1-rc1) + +### Documentation + +* **api:** updates to API spec ([8f5acc8](https://github.com/writer/writer-python/commit/8f5acc859cef51375ed2abf641c7087a36d26e02)) + ## 2.3.0 (2025-08-14) Full Changelog: [v2.3.0-rc1...v2.3.0](https://github.com/writer/writer-python/compare/v2.3.0-rc1...v2.3.0) diff --git a/README.md b/README.md index b0ae7de7..ce698aeb 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ To install the package from PyPI, use `pip`: ```sh # install from PyPI -pip install writer-sdk +pip install --pre writer-sdk ``` ## Prequisites @@ -116,7 +116,7 @@ You can enable this by installing `aiohttp`: ```sh # install from PyPI -pip install writer-sdk[aiohttp] +pip install --pre writer-sdk[aiohttp] ``` Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`: diff --git a/pyproject.toml b/pyproject.toml index 24e4cda9..d135262a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "writer-sdk" -version = "2.3.0" +version = "2.3.1-rc1" description = "The official Python library for the writer API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/writerai/_version.py b/src/writerai/_version.py index db468bf9..b3ee468c 100644 --- a/src/writerai/_version.py +++ b/src/writerai/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "writerai" -__version__ = "2.3.0" # x-release-please-version +__version__ = "2.3.1-rc1" # x-release-please-version