Skip to content

Commit a780648

Browse files
docs(api): updates to API spec
1 parent 8874173 commit a780648

22 files changed

Lines changed: 466 additions & 170 deletions

.stats.yml

Lines changed: 2 additions & 2 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-fab7a71148b6f413a4425ca9f2ce3d42557b65d35ab28c6f64daa7fce6d0ffe2.yml
3-
openapi_spec_hash: 0ead6944545bc40172176e15cc704633
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/writerai%2Fwriter-994b51f2c7c776c2cd3d4e3c6900cc6291da87296cea27921ec709a459a41034.yml
3+
openapi_spec_hash: 1fdc6bb31a5464cebb4c579370764907
44
config_hash: c0c9f57ab19252f82cf765939edc61de

api.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ from writerai.types import (
123123
Question,
124124
QuestionResponseChunk,
125125
GraphCreateResponse,
126+
GraphRetrieveResponse,
126127
GraphUpdateResponse,
128+
GraphListResponse,
127129
GraphDeleteResponse,
128130
GraphRemoveFileFromGraphResponse,
129131
)
@@ -132,9 +134,9 @@ from writerai.types import (
132134
Methods:
133135

134136
- <code title="post /v1/graphs">client.graphs.<a href="./src/writerai/resources/graphs.py">create</a>(\*\*<a href="src/writerai/types/graph_create_params.py">params</a>) -> <a href="./src/writerai/types/graph_create_response.py">GraphCreateResponse</a></code>
135-
- <code title="get /v1/graphs/{graph_id}">client.graphs.<a href="./src/writerai/resources/graphs.py">retrieve</a>(graph_id) -> <a href="./src/writerai/types/graph.py">Graph</a></code>
137+
- <code title="get /v1/graphs/{graph_id}">client.graphs.<a href="./src/writerai/resources/graphs.py">retrieve</a>(graph_id) -> <a href="./src/writerai/types/graph_retrieve_response.py">GraphRetrieveResponse</a></code>
136138
- <code title="put /v1/graphs/{graph_id}">client.graphs.<a href="./src/writerai/resources/graphs.py">update</a>(graph_id, \*\*<a href="src/writerai/types/graph_update_params.py">params</a>) -> <a href="./src/writerai/types/graph_update_response.py">GraphUpdateResponse</a></code>
137-
- <code title="get /v1/graphs">client.graphs.<a href="./src/writerai/resources/graphs.py">list</a>(\*\*<a href="src/writerai/types/graph_list_params.py">params</a>) -> <a href="./src/writerai/types/graph.py">SyncCursorPage[Graph]</a></code>
139+
- <code title="get /v1/graphs">client.graphs.<a href="./src/writerai/resources/graphs.py">list</a>(\*\*<a href="src/writerai/types/graph_list_params.py">params</a>) -> <a href="./src/writerai/types/graph_list_response.py">SyncCursorPage[GraphListResponse]</a></code>
138140
- <code title="delete /v1/graphs/{graph_id}">client.graphs.<a href="./src/writerai/resources/graphs.py">delete</a>(graph_id) -> <a href="./src/writerai/types/graph_delete_response.py">GraphDeleteResponse</a></code>
139141
- <code title="post /v1/graphs/{graph_id}/file">client.graphs.<a href="./src/writerai/resources/graphs.py">add_file_to_graph</a>(graph_id, \*\*<a href="src/writerai/types/graph_add_file_to_graph_params.py">params</a>) -> <a href="./src/writerai/types/file.py">File</a></code>
140142
- <code title="post /v1/graphs/question">client.graphs.<a href="./src/writerai/resources/graphs.py">question</a>(\*\*<a href="src/writerai/types/graph_question_params.py">params</a>) -> <a href="./src/writerai/types/question.py">Question</a></code>

src/writerai/resources/applications/graphs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def update(
5656
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
5757
) -> ApplicationGraphsResponse:
5858
"""
59-
Updates the Knowledge Graphs listed and associates them with the no-code agent.
59+
Updates the list of Knowledge Graphs associated with a no-code chat agent.
6060
6161
Args:
6262
graph_ids: A list of Knowledge Graph IDs to associate with the application. Note that this
@@ -150,7 +150,7 @@ async def update(
150150
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
151151
) -> ApplicationGraphsResponse:
152152
"""
153-
Updates the Knowledge Graphs listed and associates them with the no-code agent.
153+
Updates the list of Knowledge Graphs associated with a no-code chat agent.
154154
155155
Args:
156156
graph_ids: A list of Knowledge Graph IDs to associate with the application. Note that this

src/writerai/resources/chat.py

Lines changed: 114 additions & 48 deletions
Large diffs are not rendered by default.

src/writerai/resources/graphs.py

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

33
from __future__ import annotations
44

5-
from typing import List
5+
from typing import List, Iterable
66
from typing_extensions import Literal, overload
77

88
import httpx
@@ -27,12 +27,13 @@
2727
from .._streaming import Stream, AsyncStream
2828
from ..pagination import SyncCursorPage, AsyncCursorPage
2929
from ..types.file import File
30-
from ..types.graph import Graph
3130
from .._base_client import AsyncPaginator, make_request_options
3231
from ..types.question import Question
32+
from ..types.graph_list_response import GraphListResponse
3333
from ..types.graph_create_response import GraphCreateResponse
3434
from ..types.graph_delete_response import GraphDeleteResponse
3535
from ..types.graph_update_response import GraphUpdateResponse
36+
from ..types.graph_retrieve_response import GraphRetrieveResponse
3637
from ..types.question_response_chunk import QuestionResponseChunk
3738
from ..types.graph_remove_file_from_graph_response import GraphRemoveFileFromGraphResponse
3839

@@ -114,7 +115,7 @@ def retrieve(
114115
extra_query: Query | None = None,
115116
extra_body: Body | None = None,
116117
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
117-
) -> Graph:
118+
) -> GraphRetrieveResponse:
118119
"""
119120
Retrieve a Knowledge Graph.
120121
@@ -134,7 +135,7 @@ def retrieve(
134135
options=make_request_options(
135136
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
136137
),
137-
cast_to=Graph,
138+
cast_to=GraphRetrieveResponse,
138139
)
139140

140141
def update(
@@ -143,6 +144,7 @@ def update(
143144
*,
144145
description: str | NotGiven = NOT_GIVEN,
145146
name: str | NotGiven = NOT_GIVEN,
147+
urls: Iterable[graph_update_params.URL] | NotGiven = NOT_GIVEN,
146148
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
147149
# The extra values given here take precedence over values defined on the client or passed to this method.
148150
extra_headers: Headers | None = None,
@@ -160,6 +162,10 @@ def update(
160162
name: The name of the Knowledge Graph (max 255 characters). Omitting this field leaves
161163
the name unchanged.
162164
165+
urls: An array of web connector URLs to update for this Knowledge Graph. You can only
166+
connect URLs to Knowledge Graphs with the type `web`. To clear the list of URLs,
167+
set this field to an empty array.
168+
163169
extra_headers: Send extra headers
164170
165171
extra_query: Add additional query parameters to the request
@@ -176,6 +182,7 @@ def update(
176182
{
177183
"description": description,
178184
"name": name,
185+
"urls": urls,
179186
},
180187
graph_update_params.GraphUpdateParams,
181188
),
@@ -198,7 +205,7 @@ def list(
198205
extra_query: Query | None = None,
199206
extra_body: Body | None = None,
200207
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
201-
) -> SyncCursorPage[Graph]:
208+
) -> SyncCursorPage[GraphListResponse]:
202209
"""
203210
Retrieve a list of Knowledge Graphs.
204211
@@ -225,7 +232,7 @@ def list(
225232
"""
226233
return self._get_api_list(
227234
"/v1/graphs",
228-
page=SyncCursorPage[Graph],
235+
page=SyncCursorPage[GraphListResponse],
229236
options=make_request_options(
230237
extra_headers=extra_headers,
231238
extra_query=extra_query,
@@ -241,7 +248,7 @@ def list(
241248
graph_list_params.GraphListParams,
242249
),
243250
),
244-
model=Graph,
251+
model=GraphListResponse,
245252
)
246253

247254
def delete(
@@ -613,7 +620,7 @@ async def retrieve(
613620
extra_query: Query | None = None,
614621
extra_body: Body | None = None,
615622
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
616-
) -> Graph:
623+
) -> GraphRetrieveResponse:
617624
"""
618625
Retrieve a Knowledge Graph.
619626
@@ -633,7 +640,7 @@ async def retrieve(
633640
options=make_request_options(
634641
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
635642
),
636-
cast_to=Graph,
643+
cast_to=GraphRetrieveResponse,
637644
)
638645

639646
async def update(
@@ -642,6 +649,7 @@ async def update(
642649
*,
643650
description: str | NotGiven = NOT_GIVEN,
644651
name: str | NotGiven = NOT_GIVEN,
652+
urls: Iterable[graph_update_params.URL] | NotGiven = NOT_GIVEN,
645653
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
646654
# The extra values given here take precedence over values defined on the client or passed to this method.
647655
extra_headers: Headers | None = None,
@@ -659,6 +667,10 @@ async def update(
659667
name: The name of the Knowledge Graph (max 255 characters). Omitting this field leaves
660668
the name unchanged.
661669
670+
urls: An array of web connector URLs to update for this Knowledge Graph. You can only
671+
connect URLs to Knowledge Graphs with the type `web`. To clear the list of URLs,
672+
set this field to an empty array.
673+
662674
extra_headers: Send extra headers
663675
664676
extra_query: Add additional query parameters to the request
@@ -675,6 +687,7 @@ async def update(
675687
{
676688
"description": description,
677689
"name": name,
690+
"urls": urls,
678691
},
679692
graph_update_params.GraphUpdateParams,
680693
),
@@ -697,7 +710,7 @@ def list(
697710
extra_query: Query | None = None,
698711
extra_body: Body | None = None,
699712
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
700-
) -> AsyncPaginator[Graph, AsyncCursorPage[Graph]]:
713+
) -> AsyncPaginator[GraphListResponse, AsyncCursorPage[GraphListResponse]]:
701714
"""
702715
Retrieve a list of Knowledge Graphs.
703716
@@ -724,7 +737,7 @@ def list(
724737
"""
725738
return self._get_api_list(
726739
"/v1/graphs",
727-
page=AsyncCursorPage[Graph],
740+
page=AsyncCursorPage[GraphListResponse],
728741
options=make_request_options(
729742
extra_headers=extra_headers,
730743
extra_query=extra_query,
@@ -740,7 +753,7 @@ def list(
740753
graph_list_params.GraphListParams,
741754
),
742755
),
743-
model=Graph,
756+
model=GraphListResponse,
744757
)
745758

746759
async def delete(

src/writerai/resources/translation.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ def translate(
6565
6666
Args:
6767
formality: Whether to use formal or informal language in the translation. See the
68-
[list of languages that support formality](https://dev.writer.com/api-guides/api-reference/translation-api/language-support#formality).
68+
[list of languages that support formality](https://dev.writer.com/api-reference/translation-api/language-support#formality).
6969
If the language does not support formality, this parameter is ignored.
7070
7171
length_control: Whether to control the length of the translated text. See the
72-
[list of languages that support length control](https://dev.writer.com/api-guides/api-reference/translation-api/language-support#length-control).
72+
[list of languages that support length control](https://dev.writer.com/api-reference/translation-api/language-support#length-control).
7373
If the language does not support length control, this parameter is ignored.
7474
7575
mask_profanity: Whether to mask profane words in the translated text. See the
76-
[list of languages that do not support profanity masking](https://dev.writer.com/api-guides/api-reference/translation-api/language-support#profanity-masking).
76+
[list of languages that do not support profanity masking](https://dev.writer.com/api-reference/translation-api/language-support#profanity-masking).
7777
If the language does not support profanity masking, this parameter is ignored.
7878
7979
model: The model to use for translation.
@@ -84,15 +84,15 @@ def translate(
8484
variant, the code appends the two-digit
8585
[ISO-3166 country code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes).
8686
For example, Mexican Spanish is `es-MX`. See the
87-
[list of supported languages and language codes](https://dev.writer.com/api-guides/api-reference/translation-api/language-support).
87+
[list of supported languages and language codes](https://dev.writer.com/api-reference/translation-api/language-support).
8888
8989
target_language_code: The [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes)
9090
language code of the target language for the translation. For example, `en` for
9191
English, `zh` for Chinese, `fr` for French, `es` for Spanish. If the language
9292
has a variant, the code appends the two-digit
9393
[ISO-3166 country code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes).
9494
For example, Mexican Spanish is `es-MX`. See the
95-
[list of supported languages and language codes](https://dev.writer.com/api-guides/api-reference/translation-api/language-support).
95+
[list of supported languages and language codes](https://dev.writer.com/api-reference/translation-api/language-support).
9696
9797
text: The text to translate. Maximum of 100,000 words.
9898
@@ -167,15 +167,15 @@ async def translate(
167167
168168
Args:
169169
formality: Whether to use formal or informal language in the translation. See the
170-
[list of languages that support formality](https://dev.writer.com/api-guides/api-reference/translation-api/language-support#formality).
170+
[list of languages that support formality](https://dev.writer.com/api-reference/translation-api/language-support#formality).
171171
If the language does not support formality, this parameter is ignored.
172172
173173
length_control: Whether to control the length of the translated text. See the
174-
[list of languages that support length control](https://dev.writer.com/api-guides/api-reference/translation-api/language-support#length-control).
174+
[list of languages that support length control](https://dev.writer.com/api-reference/translation-api/language-support#length-control).
175175
If the language does not support length control, this parameter is ignored.
176176
177177
mask_profanity: Whether to mask profane words in the translated text. See the
178-
[list of languages that do not support profanity masking](https://dev.writer.com/api-guides/api-reference/translation-api/language-support#profanity-masking).
178+
[list of languages that do not support profanity masking](https://dev.writer.com/api-reference/translation-api/language-support#profanity-masking).
179179
If the language does not support profanity masking, this parameter is ignored.
180180
181181
model: The model to use for translation.
@@ -186,15 +186,15 @@ async def translate(
186186
variant, the code appends the two-digit
187187
[ISO-3166 country code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes).
188188
For example, Mexican Spanish is `es-MX`. See the
189-
[list of supported languages and language codes](https://dev.writer.com/api-guides/api-reference/translation-api/language-support).
189+
[list of supported languages and language codes](https://dev.writer.com/api-reference/translation-api/language-support).
190190
191191
target_language_code: The [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes)
192192
language code of the target language for the translation. For example, `en` for
193193
English, `zh` for Chinese, `fr` for French, `es` for Spanish. If the language
194194
has a variant, the code appends the two-digit
195195
[ISO-3166 country code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes).
196196
For example, Mexican Spanish is `es-MX`. See the
197-
[list of supported languages and language codes](https://dev.writer.com/api-guides/api-reference/translation-api/language-support).
197+
[list of supported languages and language codes](https://dev.writer.com/api-reference/translation-api/language-support).
198198
199199
text: The text to translate. Maximum of 100,000 words.
200200

src/writerai/types/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from __future__ import annotations
44

55
from .file import File as File
6-
from .graph import Graph as Graph
76
from .shared import (
87
Source as Source,
98
Logprobs as Logprobs,
@@ -31,6 +30,7 @@
3130
from .file_upload_params import FileUploadParams as FileUploadParams
3231
from .file_retry_response import FileRetryResponse as FileRetryResponse
3332
from .graph_create_params import GraphCreateParams as GraphCreateParams
33+
from .graph_list_response import GraphListResponse as GraphListResponse
3434
from .graph_update_params import GraphUpdateParams as GraphUpdateParams
3535
from .model_list_response import ModelListResponse as ModelListResponse
3636
from .file_delete_response import FileDeleteResponse as FileDeleteResponse
@@ -47,6 +47,7 @@
4747
from .chat_completion_choice import ChatCompletionChoice as ChatCompletionChoice
4848
from .application_list_params import ApplicationListParams as ApplicationListParams
4949
from .chat_completion_message import ChatCompletionMessage as ChatCompletionMessage
50+
from .graph_retrieve_response import GraphRetrieveResponse as GraphRetrieveResponse
5051
from .question_response_chunk import QuestionResponseChunk as QuestionResponseChunk
5152
from .tool_ai_detect_response import ToolAIDetectResponse as ToolAIDetectResponse
5253
from .tool_parse_pdf_response import ToolParsePdfResponse as ToolParsePdfResponse

src/writerai/types/application_generate_content_params.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ class Input(TypedDict, total=False):
3131
3232
If the input type is "File upload", you must pass the `file_id` of an uploaded
3333
file. You cannot pass a file object directly. See the
34-
[file upload endpoint](https://dev.writer.com/api-guides/api-reference/file-api/upload-files)
34+
[file upload endpoint](https://dev.writer.com/api-reference/file-api/upload-files)
3535
for instructions on uploading files or the
36-
[list files endpoint](https://dev.writer.com/api-guides/api-reference/file-api/get-all-files)
36+
[list files endpoint](https://dev.writer.com/api-reference/file-api/get-all-files)
3737
for how to see a list of uploaded files and their IDs.
3838
"""
3939

src/writerai/types/applications/job_create_params.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class Input(TypedDict, total=False):
2727
2828
If the input type is "File upload", you must pass the `file_id` of an uploaded
2929
file. You cannot pass a file object directly. See the
30-
[file upload endpoint](https://dev.writer.com/api-guides/api-reference/file-api/upload-files)
30+
[file upload endpoint](https://dev.writer.com/api-reference/file-api/upload-files)
3131
for instructions on uploading files or the
32-
[list files endpoint](https://dev.writer.com/api-guides/api-reference/file-api/get-all-files)
32+
[list files endpoint](https://dev.writer.com/api-reference/file-api/get-all-files)
3333
for how to see a list of uploaded files and their IDs.
3434
"""

0 commit comments

Comments
 (0)