Skip to content

Commit 8ecd22f

Browse files
authored
Merge pull request #98 from writer/release-please--branches--main--changes--next
release: 1.3.0
2 parents 762bf5c + 50d54f2 commit 8ecd22f

45 files changed

Lines changed: 2070 additions & 230 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.2.0"
2+
".": "1.3.0"
33
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 18
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/writerai%2Fwriter-4206be8170d98e1f909e4c0e34167f63952645f292b0e4fa7459ca7fcfc1b48a.yml
1+
configured_endpoints: 21
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/writerai%2Fwriter-82683f2fd5f8778a27960ebabda40d6dc4640bdfb77ac4ec7f173b8bf8076d3c.yml

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
11
# Changelog
22

3+
## 1.3.0 (2024-11-12)
4+
5+
Full Changelog: [v1.2.0...v1.3.0](https://github.com/writer/writer-python/compare/v1.2.0...v1.3.0)
6+
7+
### Features
8+
9+
* **api:** add streaming to kg question ([#109](https://github.com/writer/writer-python/issues/109)) ([cf85c8a](https://github.com/writer/writer-python/commit/cf85c8a2f569481605d16302a7ff785ae0225b9b))
10+
* **api:** api update ([#108](https://github.com/writer/writer-python/issues/108)) ([785dd02](https://github.com/writer/writer-python/commit/785dd02659bd11b983bf98fc4c10923ce5dcc2a4))
11+
* **api:** api update ([#97](https://github.com/writer/writer-python/issues/97)) ([75f6211](https://github.com/writer/writer-python/commit/75f6211064189a457b520c9dd7c7d7f9edd7d58f))
12+
* **api:** manual updates ([#102](https://github.com/writer/writer-python/issues/102)) ([25d0319](https://github.com/writer/writer-python/commit/25d031937bab3307b96cee0682967ddbe38f78b9))
13+
* **api:** manual updates ([#111](https://github.com/writer/writer-python/issues/111)) ([9f80bb4](https://github.com/writer/writer-python/commit/9f80bb43bf56789f53cec048102cc45611a734eb))
14+
* **api:** manual updates ([#114](https://github.com/writer/writer-python/issues/114)) ([b9fc454](https://github.com/writer/writer-python/commit/b9fc45415b8bda5d2e0c1f8bbf2e3e064904a0b3))
15+
* **api:** rename kg question and add text-to-graph ([#112](https://github.com/writer/writer-python/issues/112)) ([c4ac9fd](https://github.com/writer/writer-python/commit/c4ac9fd60b3d71162b179812278f6801500778c3))
16+
* **api:** update tools api methods ([#107](https://github.com/writer/writer-python/issues/107)) ([c45ab5b](https://github.com/writer/writer-python/commit/c45ab5b4e9012cfb7118d32507b836a61fb192d6))
17+
18+
19+
### Bug Fixes
20+
21+
* fix tool_choice schema ([403c875](https://github.com/writer/writer-python/commit/403c8755937a9c2744d0f0f214ab48fd2253180b))
22+
23+
24+
### Chores
25+
26+
* rebuild project due to codegen change ([#100](https://github.com/writer/writer-python/issues/100)) ([fbb3664](https://github.com/writer/writer-python/commit/fbb3664b0988352f139a30fe2d10f184f4f552a6))
27+
* rebuild project due to codegen change ([#101](https://github.com/writer/writer-python/issues/101)) ([1e0cbc1](https://github.com/writer/writer-python/commit/1e0cbc156a7f51a498f73acf006701d962ba8260))
28+
* rebuild project due to codegen change ([#103](https://github.com/writer/writer-python/issues/103)) ([dcd2402](https://github.com/writer/writer-python/commit/dcd24028b99180a638efee77a69ed2edf43d0d1c))
29+
* rebuild project due to codegen change ([#104](https://github.com/writer/writer-python/issues/104)) ([e9f2e66](https://github.com/writer/writer-python/commit/e9f2e66fbf9701c2c60f71f416cc2fd91182a3df))
30+
* rebuild project due to codegen change ([#105](https://github.com/writer/writer-python/issues/105)) ([4d1c32c](https://github.com/writer/writer-python/commit/4d1c32cbe04e030d1756be2927da0a036ffe6af7))
31+
* rebuild project due to codegen change ([#106](https://github.com/writer/writer-python/issues/106)) ([5c27b9e](https://github.com/writer/writer-python/commit/5c27b9e56736feb09c6c03790bdb0678494cff3f))
32+
* rebuild project due to codegen change ([#113](https://github.com/writer/writer-python/issues/113)) ([477b79c](https://github.com/writer/writer-python/commit/477b79c4e0ab5edd3b4593557a01313b19148f04))
33+
* rebuild project due to codegen change ([#99](https://github.com/writer/writer-python/issues/99)) ([490c02f](https://github.com/writer/writer-python/commit/490c02f05254023c7636cef86b6d234a81ee3d94))
34+
335
## 1.2.0 (2024-10-10)
436

537
Full Changelog: [v1.1.0...v1.2.0](https://github.com/writer/writer-python/compare/v1.1.0...v1.2.0)

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![PyPI version](https://img.shields.io/pypi/v/writer-sdk.svg)](https://pypi.org/project/writer-sdk/)
44

5-
The Writer Python library provides convenient access to the Writer REST API from any Python 3.7+
5+
The Writer Python library provides convenient access to the Writer REST API from any Python 3.8+
66
application. The library includes type definitions for all request params and response fields,
77
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
88

@@ -29,8 +29,7 @@ import os
2929
from writerai import Writer
3030

3131
client = Writer(
32-
# This is the default and can be omitted
33-
api_key=os.environ.get("WRITER_API_KEY"),
32+
api_key=os.environ.get("WRITER_API_KEY"), # This is the default and can be omitted
3433
)
3534

3635
chat = client.chat.chat(
@@ -55,8 +54,7 @@ import asyncio
5554
from writerai import AsyncWriter
5655

5756
client = AsyncWriter(
58-
# This is the default and can be omitted
59-
api_key=os.environ.get("WRITER_API_KEY"),
57+
api_key=os.environ.get("WRITER_API_KEY"), # This is the default and can be omitted
6058
)
6159

6260

@@ -436,7 +434,7 @@ print(writerai.__version__)
436434

437435
## Requirements
438436

439-
Python 3.7 or higher.
437+
Python 3.8 or higher.
440438

441439
## Contributing
442440

api.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Types:
5454
from writerai.types import (
5555
Graph,
5656
Question,
57+
QuestionResponseChunk,
5758
GraphCreateResponse,
5859
GraphUpdateResponse,
5960
GraphDeleteResponse,
@@ -88,3 +89,28 @@ Methods:
8889
- <code title="get /v1/files/{file_id}/download">client.files.<a href="./src/writerai/resources/files.py">download</a>(file_id) -> BinaryAPIResponse</code>
8990
- <code title="post /v1/files/retry">client.files.<a href="./src/writerai/resources/files.py">retry</a>(\*\*<a href="src/writerai/types/file_retry_params.py">params</a>) -> <a href="./src/writerai/types/file_retry_response.py">FileRetryResponse</a></code>
9091
- <code title="post /v1/files">client.files.<a href="./src/writerai/resources/files.py">upload</a>(\*\*<a href="src/writerai/types/file_upload_params.py">params</a>) -> <a href="./src/writerai/types/file.py">File</a></code>
92+
93+
# Tools
94+
95+
Types:
96+
97+
```python
98+
from writerai.types import ToolContextAwareSplittingResponse, ToolParsePdfResponse
99+
```
100+
101+
Methods:
102+
103+
- <code title="post /v1/tools/context-aware-splitting">client.tools.<a href="./src/writerai/resources/tools/tools.py">context_aware_splitting</a>(\*\*<a href="src/writerai/types/tool_context_aware_splitting_params.py">params</a>) -> <a href="./src/writerai/types/tool_context_aware_splitting_response.py">ToolContextAwareSplittingResponse</a></code>
104+
- <code title="post /v1/tools/pdf-parser/{file_id}">client.tools.<a href="./src/writerai/resources/tools/tools.py">parse_pdf</a>(file_id, \*\*<a href="src/writerai/types/tool_parse_pdf_params.py">params</a>) -> <a href="./src/writerai/types/tool_parse_pdf_response.py">ToolParsePdfResponse</a></code>
105+
106+
## Comprehend
107+
108+
Types:
109+
110+
```python
111+
from writerai.types.tools import ComprehendMedicalResponse
112+
```
113+
114+
Methods:
115+
116+
- <code title="post /v1/tools/comprehend/medical">client.tools.comprehend.<a href="./src/writerai/resources/tools/comprehend.py">medical</a>(\*\*<a href="src/writerai/types/tools/comprehend_medical_params.py">params</a>) -> <a href="./src/writerai/types/tools/comprehend_medical_response.py">ComprehendMedicalResponse</a></code>

pyproject.toml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "writer-sdk"
3-
version = "1.2.0"
3+
version = "1.3.0"
44
description = "The official Python library for the writer API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
@@ -16,11 +16,10 @@ dependencies = [
1616
"sniffio",
1717
"cached-property; python_version < '3.8'",
1818
]
19-
requires-python = ">= 3.7"
19+
requires-python = ">= 3.8"
2020
classifiers = [
2121
"Typing :: Typed",
2222
"Intended Audience :: Developers",
23-
"Programming Language :: Python :: 3.7",
2423
"Programming Language :: Python :: 3.8",
2524
"Programming Language :: Python :: 3.9",
2625
"Programming Language :: Python :: 3.10",
@@ -63,11 +62,11 @@ format = { chain = [
6362
"format:ruff",
6463
"format:docs",
6564
"fix:ruff",
65+
# run formatting again to fix any inconsistencies when imports are stripped
66+
"format:ruff",
6667
]}
67-
"format:black" = "black ."
6868
"format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md"
6969
"format:ruff" = "ruff format"
70-
"format:isort" = "isort ."
7170

7271
"lint" = { chain = [
7372
"check:ruff",
@@ -125,10 +124,6 @@ path = "README.md"
125124
pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
126125
replacement = '[\1](https://github.com/writer/writer-python/tree/main/\g<2>)'
127126

128-
[tool.black]
129-
line-length = 120
130-
target-version = ["py37"]
131-
132127
[tool.pytest.ini_options]
133128
testpaths = ["tests"]
134129
addopts = "--tb=short"
@@ -143,7 +138,7 @@ filterwarnings = [
143138
# there are a couple of flags that are still disabled by
144139
# default in strict mode as they are experimental and niche.
145140
typeCheckingMode = "strict"
146-
pythonVersion = "3.7"
141+
pythonVersion = "3.8"
147142

148143
exclude = [
149144
"_dev",

requirements-dev.lock

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ anyio==4.4.0
1717
# via writer-sdk
1818
argcomplete==3.1.2
1919
# via nox
20-
attrs==23.1.0
21-
# via pytest
2220
certifi==2023.7.22
2321
# via httpcore
2422
# via httpx
@@ -29,8 +27,9 @@ distlib==0.3.7
2927
# via virtualenv
3028
distro==1.8.0
3129
# via writer-sdk
32-
exceptiongroup==1.1.3
30+
exceptiongroup==1.2.2
3331
# via anyio
32+
# via pytest
3433
filelock==3.12.4
3534
# via virtualenv
3635
h11==0.14.0
@@ -50,7 +49,7 @@ markdown-it-py==3.0.0
5049
# via rich
5150
mdurl==0.1.2
5251
# via markdown-it-py
53-
mypy==1.11.2
52+
mypy==1.13.0
5453
mypy-extensions==1.0.0
5554
# via mypy
5655
nodeenv==1.8.0
@@ -61,27 +60,25 @@ packaging==23.2
6160
# via pytest
6261
platformdirs==3.11.0
6362
# via virtualenv
64-
pluggy==1.3.0
65-
# via pytest
66-
py==1.11.0
63+
pluggy==1.5.0
6764
# via pytest
68-
pydantic==2.7.1
65+
pydantic==2.9.2
6966
# via writer-sdk
70-
pydantic-core==2.18.2
67+
pydantic-core==2.23.4
7168
# via pydantic
7269
pygments==2.18.0
7370
# via rich
7471
pyright==1.1.380
75-
pytest==7.1.1
72+
pytest==8.3.3
7673
# via pytest-asyncio
77-
pytest-asyncio==0.21.1
74+
pytest-asyncio==0.24.0
7875
python-dateutil==2.8.2
7976
# via time-machine
8077
pytz==2023.3.post1
8178
# via dirty-equals
8279
respx==0.20.2
8380
rich==13.7.1
84-
ruff==0.6.5
81+
ruff==0.6.9
8582
setuptools==68.2.2
8683
# via nodeenv
8784
six==1.16.0
@@ -91,10 +88,10 @@ sniffio==1.3.0
9188
# via httpx
9289
# via writer-sdk
9390
time-machine==2.9.0
94-
tomli==2.0.1
91+
tomli==2.0.2
9592
# via mypy
9693
# via pytest
97-
typing-extensions==4.8.0
94+
typing-extensions==4.12.2
9895
# via anyio
9996
# via mypy
10097
# via pydantic

requirements.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ certifi==2023.7.22
2020
# via httpx
2121
distro==1.8.0
2222
# via writer-sdk
23-
exceptiongroup==1.1.3
23+
exceptiongroup==1.2.2
2424
# via anyio
2525
h11==0.14.0
2626
# via httpcore
@@ -31,15 +31,15 @@ httpx==0.25.2
3131
idna==3.4
3232
# via anyio
3333
# via httpx
34-
pydantic==2.7.1
34+
pydantic==2.9.2
3535
# via writer-sdk
36-
pydantic-core==2.18.2
36+
pydantic-core==2.23.4
3737
# via pydantic
3838
sniffio==1.3.0
3939
# via anyio
4040
# via httpx
4141
# via writer-sdk
42-
typing-extensions==4.8.0
42+
typing-extensions==4.12.2
4343
# via anyio
4444
# via pydantic
4545
# via pydantic-core

src/writerai/_base_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1587,7 +1587,7 @@ async def _request(
15871587
except Exception as err:
15881588
log.debug("Encountered Exception", exc_info=True)
15891589

1590-
if retries_taken > 0:
1590+
if remaining_retries > 0:
15911591
return await self._retry_request(
15921592
input_options,
15931593
cast_to,

src/writerai/_client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class Writer(SyncAPIClient):
5252
models: resources.ModelsResource
5353
graphs: resources.GraphsResource
5454
files: resources.FilesResource
55+
tools: resources.ToolsResource
5556
with_raw_response: WriterWithRawResponse
5657
with_streaming_response: WriterWithStreamedResponse
5758

@@ -117,6 +118,7 @@ def __init__(
117118
self.models = resources.ModelsResource(self)
118119
self.graphs = resources.GraphsResource(self)
119120
self.files = resources.FilesResource(self)
121+
self.tools = resources.ToolsResource(self)
120122
self.with_raw_response = WriterWithRawResponse(self)
121123
self.with_streaming_response = WriterWithStreamedResponse(self)
122124

@@ -232,6 +234,7 @@ class AsyncWriter(AsyncAPIClient):
232234
models: resources.AsyncModelsResource
233235
graphs: resources.AsyncGraphsResource
234236
files: resources.AsyncFilesResource
237+
tools: resources.AsyncToolsResource
235238
with_raw_response: AsyncWriterWithRawResponse
236239
with_streaming_response: AsyncWriterWithStreamedResponse
237240

@@ -297,6 +300,7 @@ def __init__(
297300
self.models = resources.AsyncModelsResource(self)
298301
self.graphs = resources.AsyncGraphsResource(self)
299302
self.files = resources.AsyncFilesResource(self)
303+
self.tools = resources.AsyncToolsResource(self)
300304
self.with_raw_response = AsyncWriterWithRawResponse(self)
301305
self.with_streaming_response = AsyncWriterWithStreamedResponse(self)
302306

@@ -413,6 +417,7 @@ def __init__(self, client: Writer) -> None:
413417
self.models = resources.ModelsResourceWithRawResponse(client.models)
414418
self.graphs = resources.GraphsResourceWithRawResponse(client.graphs)
415419
self.files = resources.FilesResourceWithRawResponse(client.files)
420+
self.tools = resources.ToolsResourceWithRawResponse(client.tools)
416421

417422

418423
class AsyncWriterWithRawResponse:
@@ -423,6 +428,7 @@ def __init__(self, client: AsyncWriter) -> None:
423428
self.models = resources.AsyncModelsResourceWithRawResponse(client.models)
424429
self.graphs = resources.AsyncGraphsResourceWithRawResponse(client.graphs)
425430
self.files = resources.AsyncFilesResourceWithRawResponse(client.files)
431+
self.tools = resources.AsyncToolsResourceWithRawResponse(client.tools)
426432

427433

428434
class WriterWithStreamedResponse:
@@ -433,6 +439,7 @@ def __init__(self, client: Writer) -> None:
433439
self.models = resources.ModelsResourceWithStreamingResponse(client.models)
434440
self.graphs = resources.GraphsResourceWithStreamingResponse(client.graphs)
435441
self.files = resources.FilesResourceWithStreamingResponse(client.files)
442+
self.tools = resources.ToolsResourceWithStreamingResponse(client.tools)
436443

437444

438445
class AsyncWriterWithStreamedResponse:
@@ -443,6 +450,7 @@ def __init__(self, client: AsyncWriter) -> None:
443450
self.models = resources.AsyncModelsResourceWithStreamingResponse(client.models)
444451
self.graphs = resources.AsyncGraphsResourceWithStreamingResponse(client.graphs)
445452
self.files = resources.AsyncFilesResourceWithStreamingResponse(client.files)
453+
self.tools = resources.AsyncToolsResourceWithStreamingResponse(client.tools)
446454

447455

448456
Client = Writer

0 commit comments

Comments
 (0)