Skip to content

Commit f530906

Browse files
stainless-app[bot]RobertCraigiesarahcstringer
authored
release: 2.2.0 (#238)
* docs: swap examples used in readme (#231) * chore(internal): slight transform perf improvement (#233) * chore(internal): expand CI branch coverage (#235) * chore(internal): reduce CI branch coverage * fix(perf): skip traversing types for NotGiven values * fix(perf): optimize some hot paths * chore(internal): update pyright settings * chore(client): minor internal fixes * chore(internal): bump pyright version * chore(internal): base client updates * chore(internal): update models test * docs(api): updates to API spec * feat(api): add translation endpoint * codegen metadata * chore(ci): add timeout thresholds for CI jobs * chore(internal): import reformatting * chore(internal): fix list file params * chore(internal): refactor retries to not use recursion * docs(api): updates to API spec * fix(pydantic v1): more robust ModelField.annotation check * feat(api): add ai detect tool endpoint * chore(internal): minor formatting changes * chore(ci): run on more branches and use depot runners * chore(ci): only use depot for staging repos * chore: broadly detect json family of content-type headers * docs(api): updates to API spec * docs(api): updates to API spec * feat(chat): add parse method (#237) Co-authored-by: Robert Craigie <robert@craigie.dev> * docs(api): updates to API spec * test: Add translation_data to chat completions data. (#239) * docs: README updates * docs: Update models in README. * release: 2.2.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> Co-authored-by: Robert Craigie <robert@craigie.dev> Co-authored-by: Sarah Deaton <sarah.deaton@writer.com>
1 parent 719311b commit f530906

16 files changed

Lines changed: 281 additions & 108 deletions

.release-please-manifest.json

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

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 32
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/writerai%2Fwriter-a0e83ebfd81856b538d16c7a41ccdc11687ee558e1435a40f3bb7e0d6e1ab7c8.yml
3-
openapi_spec_hash: 8ac62303a9158c13f344975cb0786bc6
4-
config_hash: b1d3b26784527ee46af49c1bb9e93193
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/writerai%2Fwriter-07dea48ea85e600712dcdfd99a688f6a9cb8dd1f56d0a06e0ab54fc8a98a89b1.yml
3+
openapi_spec_hash: 0d30ab04c227bf53f3109dc4d861e5dc
4+
config_hash: c0c9f57ab19252f82cf765939edc61de

CHANGELOG.md

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

3+
## 2.2.0 (2025-04-30)
4+
5+
Full Changelog: [v2.2.0-rc1...v2.2.0](https://github.com/writer/writer-python/compare/v2.2.0-rc1...v2.2.0)
6+
7+
### Documentation
8+
9+
* **api:** updates to API spec ([0236e86](https://github.com/writer/writer-python/commit/0236e8698e48b393dbb711f91e76fef66007d724))
10+
* README updates ([c85f8b5](https://github.com/writer/writer-python/commit/c85f8b591d27e4f0b2ff1ff01532aa31c4b62f7b))
11+
* Update models in README. ([da7e11a](https://github.com/writer/writer-python/commit/da7e11a9c62d971253efc83550557be37864fabb))
12+
313
## 2.2.0-rc1 (2025-04-25)
414

515
Full Changelog: [v2.1.0...v2.2.0-rc1](https://github.com/writer/writer-python/compare/v2.1.0...v2.2.0-rc1)

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ To install the package from PyPI, use `pip`:
1818

1919
```sh
2020
# install from PyPI
21-
pip install --pre writer-sdk
21+
pip install writer-sdk
2222
```
2323

2424
## Prequisites
@@ -75,7 +75,7 @@ chat_completion = client.chat.chat(
7575
"role": "user",
7676
}
7777
],
78-
model="palmyra-x-004",
78+
model="palmyra-x5",
7979
)
8080
print(chat_completion.choices[0].message.content)
8181
```
@@ -97,7 +97,7 @@ async def main() -> None:
9797
"role": "user",
9898
}
9999
],
100-
model="palmyra-x-004",
100+
model="palmyra-x5",
101101
)
102102
print(chat_completion.choices[0].message.content)
103103

@@ -125,7 +125,7 @@ stream = client.chat.chat(
125125
"role": "user",
126126
}
127127
],
128-
model="palmyra-x-004",
128+
model="palmyra-x5",
129129
stream=True,
130130
)
131131

@@ -153,7 +153,7 @@ stream = await client.chat.chat(
153153
"role": "user",
154154
}
155155
],
156-
model="palmyra-x-004",
156+
model="palmyra-x5",
157157
stream=True,
158158
)
159159

@@ -174,7 +174,7 @@ The SDK also includes helpers to process streams and handle incoming events.
174174

175175
```python
176176
with client.chat.stream(
177-
model="palmyra-x-004",
177+
model="palmyra-x5",
178178
messages=[{"role": "user", "content": prompt}],
179179
) as stream:
180180
for event in stream:
@@ -308,7 +308,7 @@ try:
308308
"role": "user",
309309
}
310310
],
311-
model="palmyra-x-004",
311+
model="palmyra-x5",
312312
)
313313
except writerai.APIConnectionError as e:
314314
print("The server could not be reached")
@@ -359,7 +359,7 @@ client.with_options(max_retries=5).chat.chat(
359359
"role": "user",
360360
}
361361
],
362-
model="palmyra-x-004",
362+
model="palmyra-x5",
363363
)
364364
```
365365

@@ -391,7 +391,7 @@ client.with_options(timeout=5.0).chat.chat(
391391
"role": "user",
392392
}
393393
],
394-
model="palmyra-x-004",
394+
model="palmyra-x5",
395395
)
396396
```
397397

@@ -440,7 +440,7 @@ response = client.chat.with_raw_response.chat(
440440
"content": "Write a haiku about programming",
441441
"role": "user",
442442
}],
443-
model="palmyra-x-004",
443+
model="palmyra-x5",
444444
)
445445
print(response.headers.get('X-My-Header'))
446446

@@ -464,7 +464,7 @@ with client.chat.with_streaming_response.chat(
464464
"role": "user",
465465
}
466466
],
467-
model="palmyra-x-004",
467+
model="palmyra-x5",
468468
) as response:
469469
print(response.headers.get("X-My-Header"))
470470

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "writer-sdk"
3-
version = "2.2.0-rc1"
3+
version = "2.2.0"
44
description = "The official Python library for the writer API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/writerai/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "writerai"
4-
__version__ = "2.2.0-rc1" # x-release-please-version
4+
__version__ = "2.2.0" # x-release-please-version

src/writerai/resources/chat.py

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ def chat(
9393
the model to respond to. The array must contain at least one message.
9494
9595
model: The [ID of the model](https://dev.writer.com/home/models) to use for creating
96-
the chat completion. Supports `palmyra-x-004`, `palmyra-fin`, `palmyra-med`,
97-
`palmyra-creative`, and `palmyra-x-003-instruct`.
96+
the chat completion. Supports `palmyra-x5`, `palmyra-x4`, `palmyra-fin`,
97+
`palmyra-med`, `palmyra-creative`, and `palmyra-x-003-instruct`.
9898
9999
logprobs: Specifies whether to return log probabilities of the output tokens.
100100
@@ -106,8 +106,8 @@ def chat(
106106
single request. This parameter allows for generating multiple responses,
107107
offering a variety of potential replies from which to choose.
108108
109-
response_format: The response format to use for the chat completion, available with
110-
`palmyra-x-004`.
109+
response_format: The response format to use for the chat completion, available with `palmyra-x4`
110+
and `palmyra-x5`.
111111
112112
`text` is the default response format. [JSON Schema](https://json-schema.org/)
113113
is supported for structured responses. If you specify `json_schema`, you must
@@ -133,11 +133,11 @@ def chat(
133133
134134
tools: An array containing tool definitions for tools that the model can use to
135135
generate responses. The tool definitions use JSON schema. You can define your
136-
own functions or use one of the built-in `graph`, `llm`, or `vision` tools. Note
137-
that you can only use one built-in tool type in the array (only one of `graph`,
138-
`llm`, or `vision`). You can pass multiple custom
139-
tools](https://dev.writer.com/api-guides/tool-calling) of type `function` in the
140-
same request.
136+
own functions or use one of the built-in `graph`, `llm`, `translation`, or
137+
`vision` tools. Note that you can only use one built-in tool type in the array
138+
(only one of `graph`, `llm`, `translation`, or `vision`). You can pass multiple
139+
[custom tools](https://dev.writer.com/api-guides/tool-calling) of type
140+
`function` in the same request.
141141
142142
top_p: Sets the threshold for "nucleus sampling," a technique to focus the model's
143143
token generation on the most likely subset of tokens. Only tokens with
@@ -189,8 +189,8 @@ def chat(
189189
the model to respond to. The array must contain at least one message.
190190
191191
model: The [ID of the model](https://dev.writer.com/home/models) to use for creating
192-
the chat completion. Supports `palmyra-x-004`, `palmyra-fin`, `palmyra-med`,
193-
`palmyra-creative`, and `palmyra-x-003-instruct`.
192+
the chat completion. Supports `palmyra-x5`, `palmyra-x4`, `palmyra-fin`,
193+
`palmyra-med`, `palmyra-creative`, and `palmyra-x-003-instruct`.
194194
195195
stream: Indicates whether the response should be streamed incrementally as it is
196196
generated or only returned once fully complete. Streaming can be useful for
@@ -206,8 +206,8 @@ def chat(
206206
single request. This parameter allows for generating multiple responses,
207207
offering a variety of potential replies from which to choose.
208208
209-
response_format: The response format to use for the chat completion, available with
210-
`palmyra-x-004`.
209+
response_format: The response format to use for the chat completion, available with `palmyra-x4`
210+
and `palmyra-x5`.
211211
212212
`text` is the default response format. [JSON Schema](https://json-schema.org/)
213213
is supported for structured responses. If you specify `json_schema`, you must
@@ -229,11 +229,11 @@ def chat(
229229
230230
tools: An array containing tool definitions for tools that the model can use to
231231
generate responses. The tool definitions use JSON schema. You can define your
232-
own functions or use one of the built-in `graph`, `llm`, or `vision` tools. Note
233-
that you can only use one built-in tool type in the array (only one of `graph`,
234-
`llm`, or `vision`). You can pass multiple custom
235-
tools](https://dev.writer.com/api-guides/tool-calling) of type `function` in the
236-
same request.
232+
own functions or use one of the built-in `graph`, `llm`, `translation`, or
233+
`vision` tools. Note that you can only use one built-in tool type in the array
234+
(only one of `graph`, `llm`, `translation`, or `vision`). You can pass multiple
235+
[custom tools](https://dev.writer.com/api-guides/tool-calling) of type
236+
`function` in the same request.
237237
238238
top_p: Sets the threshold for "nucleus sampling," a technique to focus the model's
239239
token generation on the most likely subset of tokens. Only tokens with
@@ -285,8 +285,8 @@ def chat(
285285
the model to respond to. The array must contain at least one message.
286286
287287
model: The [ID of the model](https://dev.writer.com/home/models) to use for creating
288-
the chat completion. Supports `palmyra-x-004`, `palmyra-fin`, `palmyra-med`,
289-
`palmyra-creative`, and `palmyra-x-003-instruct`.
288+
the chat completion. Supports `palmyra-x5`, `palmyra-x4`, `palmyra-fin`,
289+
`palmyra-med`, `palmyra-creative`, and `palmyra-x-003-instruct`.
290290
291291
stream: Indicates whether the response should be streamed incrementally as it is
292292
generated or only returned once fully complete. Streaming can be useful for
@@ -302,8 +302,8 @@ def chat(
302302
single request. This parameter allows for generating multiple responses,
303303
offering a variety of potential replies from which to choose.
304304
305-
response_format: The response format to use for the chat completion, available with
306-
`palmyra-x-004`.
305+
response_format: The response format to use for the chat completion, available with `palmyra-x4`
306+
and `palmyra-x5`.
307307
308308
`text` is the default response format. [JSON Schema](https://json-schema.org/)
309309
is supported for structured responses. If you specify `json_schema`, you must
@@ -325,11 +325,11 @@ def chat(
325325
326326
tools: An array containing tool definitions for tools that the model can use to
327327
generate responses. The tool definitions use JSON schema. You can define your
328-
own functions or use one of the built-in `graph`, `llm`, or `vision` tools. Note
329-
that you can only use one built-in tool type in the array (only one of `graph`,
330-
`llm`, or `vision`). You can pass multiple custom
331-
tools](https://dev.writer.com/api-guides/tool-calling) of type `function` in the
332-
same request.
328+
own functions or use one of the built-in `graph`, `llm`, `translation`, or
329+
`vision` tools. Note that you can only use one built-in tool type in the array
330+
(only one of `graph`, `llm`, `translation`, or `vision`). You can pass multiple
331+
[custom tools](https://dev.writer.com/api-guides/tool-calling) of type
332+
`function` in the same request.
333333
334334
top_p: Sets the threshold for "nucleus sampling," a technique to focus the model's
335335
token generation on the most likely subset of tokens. Only tokens with
@@ -634,8 +634,8 @@ async def chat(
634634
the model to respond to. The array must contain at least one message.
635635
636636
model: The [ID of the model](https://dev.writer.com/home/models) to use for creating
637-
the chat completion. Supports `palmyra-x-004`, `palmyra-fin`, `palmyra-med`,
638-
`palmyra-creative`, and `palmyra-x-003-instruct`.
637+
the chat completion. Supports `palmyra-x5`, `palmyra-x4`, `palmyra-fin`,
638+
`palmyra-med`, `palmyra-creative`, and `palmyra-x-003-instruct`.
639639
640640
logprobs: Specifies whether to return log probabilities of the output tokens.
641641
@@ -647,8 +647,8 @@ async def chat(
647647
single request. This parameter allows for generating multiple responses,
648648
offering a variety of potential replies from which to choose.
649649
650-
response_format: The response format to use for the chat completion, available with
651-
`palmyra-x-004`.
650+
response_format: The response format to use for the chat completion, available with `palmyra-x4`
651+
and `palmyra-x5`.
652652
653653
`text` is the default response format. [JSON Schema](https://json-schema.org/)
654654
is supported for structured responses. If you specify `json_schema`, you must
@@ -674,11 +674,11 @@ async def chat(
674674
675675
tools: An array containing tool definitions for tools that the model can use to
676676
generate responses. The tool definitions use JSON schema. You can define your
677-
own functions or use one of the built-in `graph`, `llm`, or `vision` tools. Note
678-
that you can only use one built-in tool type in the array (only one of `graph`,
679-
`llm`, or `vision`). You can pass multiple custom
680-
tools](https://dev.writer.com/api-guides/tool-calling) of type `function` in the
681-
same request.
677+
own functions or use one of the built-in `graph`, `llm`, `translation`, or
678+
`vision` tools. Note that you can only use one built-in tool type in the array
679+
(only one of `graph`, `llm`, `translation`, or `vision`). You can pass multiple
680+
[custom tools](https://dev.writer.com/api-guides/tool-calling) of type
681+
`function` in the same request.
682682
683683
top_p: Sets the threshold for "nucleus sampling," a technique to focus the model's
684684
token generation on the most likely subset of tokens. Only tokens with
@@ -730,8 +730,8 @@ async def chat(
730730
the model to respond to. The array must contain at least one message.
731731
732732
model: The [ID of the model](https://dev.writer.com/home/models) to use for creating
733-
the chat completion. Supports `palmyra-x-004`, `palmyra-fin`, `palmyra-med`,
734-
`palmyra-creative`, and `palmyra-x-003-instruct`.
733+
the chat completion. Supports `palmyra-x5`, `palmyra-x4`, `palmyra-fin`,
734+
`palmyra-med`, `palmyra-creative`, and `palmyra-x-003-instruct`.
735735
736736
stream: Indicates whether the response should be streamed incrementally as it is
737737
generated or only returned once fully complete. Streaming can be useful for
@@ -747,8 +747,8 @@ async def chat(
747747
single request. This parameter allows for generating multiple responses,
748748
offering a variety of potential replies from which to choose.
749749
750-
response_format: The response format to use for the chat completion, available with
751-
`palmyra-x-004`.
750+
response_format: The response format to use for the chat completion, available with `palmyra-x4`
751+
and `palmyra-x5`.
752752
753753
`text` is the default response format. [JSON Schema](https://json-schema.org/)
754754
is supported for structured responses. If you specify `json_schema`, you must
@@ -770,11 +770,11 @@ async def chat(
770770
771771
tools: An array containing tool definitions for tools that the model can use to
772772
generate responses. The tool definitions use JSON schema. You can define your
773-
own functions or use one of the built-in `graph`, `llm`, or `vision` tools. Note
774-
that you can only use one built-in tool type in the array (only one of `graph`,
775-
`llm`, or `vision`). You can pass multiple custom
776-
tools](https://dev.writer.com/api-guides/tool-calling) of type `function` in the
777-
same request.
773+
own functions or use one of the built-in `graph`, `llm`, `translation`, or
774+
`vision` tools. Note that you can only use one built-in tool type in the array
775+
(only one of `graph`, `llm`, `translation`, or `vision`). You can pass multiple
776+
[custom tools](https://dev.writer.com/api-guides/tool-calling) of type
777+
`function` in the same request.
778778
779779
top_p: Sets the threshold for "nucleus sampling," a technique to focus the model's
780780
token generation on the most likely subset of tokens. Only tokens with
@@ -826,8 +826,8 @@ async def chat(
826826
the model to respond to. The array must contain at least one message.
827827
828828
model: The [ID of the model](https://dev.writer.com/home/models) to use for creating
829-
the chat completion. Supports `palmyra-x-004`, `palmyra-fin`, `palmyra-med`,
830-
`palmyra-creative`, and `palmyra-x-003-instruct`.
829+
the chat completion. Supports `palmyra-x5`, `palmyra-x4`, `palmyra-fin`,
830+
`palmyra-med`, `palmyra-creative`, and `palmyra-x-003-instruct`.
831831
832832
stream: Indicates whether the response should be streamed incrementally as it is
833833
generated or only returned once fully complete. Streaming can be useful for
@@ -843,8 +843,8 @@ async def chat(
843843
single request. This parameter allows for generating multiple responses,
844844
offering a variety of potential replies from which to choose.
845845
846-
response_format: The response format to use for the chat completion, available with
847-
`palmyra-x-004`.
846+
response_format: The response format to use for the chat completion, available with `palmyra-x4`
847+
and `palmyra-x5`.
848848
849849
`text` is the default response format. [JSON Schema](https://json-schema.org/)
850850
is supported for structured responses. If you specify `json_schema`, you must
@@ -866,11 +866,11 @@ async def chat(
866866
867867
tools: An array containing tool definitions for tools that the model can use to
868868
generate responses. The tool definitions use JSON schema. You can define your
869-
own functions or use one of the built-in `graph`, `llm`, or `vision` tools. Note
870-
that you can only use one built-in tool type in the array (only one of `graph`,
871-
`llm`, or `vision`). You can pass multiple custom
872-
tools](https://dev.writer.com/api-guides/tool-calling) of type `function` in the
873-
same request.
869+
own functions or use one of the built-in `graph`, `llm`, `translation`, or
870+
`vision` tools. Note that you can only use one built-in tool type in the array
871+
(only one of `graph`, `llm`, `translation`, or `vision`). You can pass multiple
872+
[custom tools](https://dev.writer.com/api-guides/tool-calling) of type
873+
`function` in the same request.
874874
875875
top_p: Sets the threshold for "nucleus sampling," a technique to focus the model's
876876
token generation on the most likely subset of tokens. Only tokens with

0 commit comments

Comments
 (0)