Skip to content

Commit 46babc5

Browse files
MortGronhaakonvt
andauthored
docs: Show correct accessors in the documentation (#2563)
Co-authored-by: Håkon V. Treider <haakonvt@gmail.com>
1 parent 2219c53 commit 46babc5

164 files changed

Lines changed: 2040 additions & 2228 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,6 @@ my_file.txt
6262
*.env
6363
.envrc
6464
.ropeproject
65+
66+
# docs
67+
docs/source/generated/

cognite/client/_api/agents/agents.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ async def upsert(self, agents: AgentUpsert) -> Agent: ...
3737
async def upsert(self, agents: Sequence[AgentUpsert]) -> AgentList: ...
3838

3939
async def upsert(self, agents: AgentUpsert | Sequence[AgentUpsert]) -> Agent | AgentList:
40-
"""`Create or update (upsert) one or more agents. <https://api-docs.cognite.com/20230101-beta/tag/Agents/operation/main_ai_agents_post/>`_
40+
"""`Create or update (upsert) one or more agents <https://api-docs.cognite.com/20230101-beta/tag/Agents/operation/main_ai_agents_post/>`_.
4141
4242
Args:
4343
agents (AgentUpsert | Sequence[AgentUpsert]): Agent or list of agents to create or update.
@@ -180,7 +180,7 @@ async def retrieve(self, external_ids: SequenceNotStr[str], ignore_unknown_ids:
180180
async def retrieve(
181181
self, external_ids: str | SequenceNotStr[str], ignore_unknown_ids: bool = False
182182
) -> Agent | AgentList | None:
183-
"""`Retrieve one or more agents by external ID. <https://api-docs.cognite.com/20230101-beta/tag/Agents/operation/get_agents_by_ids_ai_agents_byids_post/>`_
183+
"""`Retrieve one or more agents by external ID <https://api-docs.cognite.com/20230101-beta/tag/Agents/operation/get_agents_by_ids_ai_agents_byids_post/>`_.
184184
185185
Args:
186186
external_ids (str | SequenceNotStr[str]): The external id of the agent(s) to retrieve.
@@ -212,7 +212,7 @@ async def retrieve(
212212
)
213213

214214
async def delete(self, external_ids: str | SequenceNotStr[str], ignore_unknown_ids: bool = False) -> None:
215-
"""`Delete one or more agents. <https://api-docs.cognite.com/20230101-beta/tag/Agents/operation/agent_delete_ai_agents_delete_post/>`_
215+
"""`Delete one or more agents <https://api-docs.cognite.com/20230101-beta/tag/Agents/operation/agent_delete_ai_agents_delete_post/>`_.
216216
217217
Args:
218218
external_ids (str | SequenceNotStr[str]): External ID of the agent or a list of external ids.
@@ -236,7 +236,7 @@ async def delete(self, external_ids: str | SequenceNotStr[str], ignore_unknown_i
236236
)
237237

238238
async def list(self) -> AgentList: # The API does not yet support limit or pagination
239-
"""`List agents. <https://api-docs.cognite.com/20230101-beta/tag/Agents/operation/agent_list_ai_agents_get/>`_
239+
"""`List agents <https://api-docs.cognite.com/20230101-beta/tag/Agents/operation/agent_list_ai_agents_get/>`_.
240240
241241
Returns:
242242
AgentList: The list of agents.
@@ -262,7 +262,7 @@ async def chat(
262262
cursor: str | None = None,
263263
actions: Sequence[Action] | None = None,
264264
) -> AgentChatResponse:
265-
"""`Chat with an agent. <https://api-docs.cognite.com/20230101-beta/tag/Agents/operation/agent_session_ai_agents_chat_post/>`_
265+
"""`Chat with an agent <https://api-docs.cognite.com/20230101-beta/tag/Agents/operation/agent_session_ai_agents_chat_post/>`_.
266266
267267
Given a user query, the Atlas AI agent responds by reasoning and using the tools associated with it.
268268
Users can ensure conversation continuity by including the cursor from the previous response in subsequent requests.

cognite/client/_api/ai/tools/documents.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ async def summarize(
1818
external_id: str | None = None,
1919
instance_id: NodeId | None = None,
2020
) -> Summary:
21-
"""`Summarize a document using a Large Language Model. <https://api-docs.cognite.com/20230101/tag/Document-AI/operation/document_questioning_ai_tools_documents_ask_post>`_
21+
"""`Summarize a document using a Large Language Model <https://api-docs.cognite.com/20230101/tag/Document-AI/operation/document_questioning_ai_tools_documents_ask_post>`_.
2222
2323
Note:
2424
Currently only supports summarizing a single document at a time, but
@@ -78,7 +78,7 @@ async def ask_question(
7878
additional_context: str | None = None,
7979
ignore_unknown_ids: bool = False,
8080
) -> Answer:
81-
"""`Ask a question about one or more documents using a Large Language Model. <https://api-docs.cognite.com/20230101/tag/Document-AI/operation/documents_summary_api_v1_projects__projectName__ai_tools_documents_summarize_post>`_
81+
"""`Ask a question about one or more documents using a Large Language Model <https://api-docs.cognite.com/20230101/tag/Document-AI/operation/documents_summary_api_v1_projects__projectName__ai_tools_documents_summarize_post>`_.
8282
8383
Supports up to 100 documents at a time.
8484

cognite/client/_api/annotations.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async def create(self, annotations: Sequence[Annotation | AnnotationWrite]) -> A
3939
async def create(
4040
self, annotations: Annotation | AnnotationWrite | Sequence[Annotation | AnnotationWrite]
4141
) -> Annotation | AnnotationList:
42-
"""`Create annotations <https://api-docs.cognite.com/20230101/tag/Annotations/operation/annotationsCreate>`_
42+
"""`Create annotations <https://api-docs.cognite.com/20230101/tag/Annotations/operation/annotationsCreate>`_.
4343
4444
Args:
4545
annotations (Annotation | AnnotationWrite | Sequence[Annotation | AnnotationWrite]): Annotation(s) to create
@@ -66,7 +66,7 @@ async def suggest(self, annotations: Sequence[Annotation] | Sequence[AnnotationW
6666
async def suggest(
6767
self, annotations: Annotation | AnnotationWrite | Sequence[Annotation] | Sequence[AnnotationWrite]
6868
) -> Annotation | AnnotationList:
69-
"""`Suggest annotations <https://api-docs.cognite.com/20230101/tag/Annotations/operation/annotationsSuggest>`_
69+
"""`Suggest annotations <https://api-docs.cognite.com/20230101/tag/Annotations/operation/annotationsSuggest>`_.
7070
7171
Args:
7272
annotations (Annotation | AnnotationWrite | Sequence[Annotation] | Sequence[AnnotationWrite]): annotation(s) to suggest. They must have status set to "suggested".
@@ -138,7 +138,7 @@ async def update(
138138
| Sequence[Annotation | AnnotationWrite | AnnotationUpdate],
139139
mode: Literal["replace_ignore_null", "patch", "replace"] = "replace_ignore_null",
140140
) -> Annotation | AnnotationList:
141-
"""`Update annotations <https://api-docs.cognite.com/20230101/tag/Annotations/operation/annotationsUpdate>`_
141+
"""`Update annotations <https://api-docs.cognite.com/20230101/tag/Annotations/operation/annotationsUpdate>`_.
142142
143143
Args:
144144
item (Annotation | AnnotationWrite | AnnotationUpdate | Sequence[Annotation | AnnotationWrite | AnnotationUpdate]): Annotation or list of annotations to update (or patch or list of patches to apply)
@@ -151,15 +151,15 @@ async def update(
151151
)
152152

153153
async def delete(self, id: int | Sequence[int]) -> None:
154-
"""`Delete annotations <https://api-docs.cognite.com/20230101/tag/Annotations/operation/annotationsDelete>`_
154+
"""`Delete annotations <https://api-docs.cognite.com/20230101/tag/Annotations/operation/annotationsDelete>`_.
155155
156156
Args:
157157
id (int | Sequence[int]): ID or list of IDs to be deleted
158158
"""
159159
await self._delete_multiple(identifiers=IdentifierSequence.load(ids=id), wrap_ids=True)
160160

161161
async def retrieve_multiple(self, ids: Sequence[int]) -> AnnotationList:
162-
"""`Retrieve annotations by IDs <https://api-docs.cognite.com/20230101/tag/Annotations/operation/annotationsByids>`_`
162+
"""`Retrieve annotations by IDs <https://api-docs.cognite.com/20230101/tag/Annotations/operation/annotationsByids>`_.
163163
164164
Args:
165165
ids (Sequence[int]): list of IDs to be retrieved
@@ -171,7 +171,7 @@ async def retrieve_multiple(self, ids: Sequence[int]) -> AnnotationList:
171171
return await self._retrieve_multiple(list_cls=AnnotationList, resource_cls=Annotation, identifiers=identifiers)
172172

173173
async def retrieve(self, id: int) -> Annotation | None:
174-
"""`Retrieve an annotation by id <https://api-docs.cognite.com/20230101/tag/Annotations/operation/annotationsGet>`_
174+
"""`Retrieve an annotation by id <https://api-docs.cognite.com/20230101/tag/Annotations/operation/annotationsGet>`_.
175175
176176
Args:
177177
id (int): id of the annotation to be retrieved
@@ -219,7 +219,7 @@ async def reverse_lookup(
219219
)
220220

221221
async def list(self, filter: AnnotationFilter | dict, limit: int | None = DEFAULT_LIMIT_READ) -> AnnotationList:
222-
"""`List annotations. <https://api-docs.cognite.com/20230101/tag/Annotations/operation/annotationsFilter>`_
222+
"""`List annotations <https://api-docs.cognite.com/20230101/tag/Annotations/operation/annotationsFilter>`_.
223223
224224
Note:
225225
Passing a filter with both 'annotated_resource_type' and 'annotated_resource_ids' is always required.

cognite/client/_api/assets.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ async def __call__(
210210
yield item
211211

212212
async def retrieve(self, id: int | None = None, external_id: str | None = None) -> Asset | None:
213-
"""`Retrieve a single asset by id. <https://api-docs.cognite.com/20230101/tag/Assets/operation/getAsset>`_
213+
"""`Retrieve a single asset by id <https://api-docs.cognite.com/20230101/tag/Assets/operation/getAsset>`_.
214214
215215
Args:
216216
id (int | None): ID
@@ -241,7 +241,7 @@ async def retrieve_multiple(
241241
external_ids: SequenceNotStr[str] | None = None,
242242
ignore_unknown_ids: bool = False,
243243
) -> AssetList:
244-
"""`Retrieve multiple assets by id. <https://api-docs.cognite.com/20230101/tag/Assets/operation/byIdsAssets>`_
244+
"""`Retrieve multiple assets by id <https://api-docs.cognite.com/20230101/tag/Assets/operation/byIdsAssets>`_.
245245
246246
Args:
247247
ids (Sequence[int] | None): IDs
@@ -277,7 +277,7 @@ async def aggregate_count(
277277
advanced_filter: Filter | dict[str, Any] | None = None,
278278
filter: AssetFilter | dict[str, Any] | None = None,
279279
) -> int:
280-
"""`Count of assets matching the specified filters. <https://api-docs.cognite.com/20230101/tag/Assets/operation/aggregateAssets>`_
280+
"""`Count of assets matching the specified filters <https://api-docs.cognite.com/20230101/tag/Assets/operation/aggregateAssets>`_.
281281
282282
Args:
283283
property (AssetPropertyLike | None): If specified, get an approximate number of asset with a specific property (property is not null) and matching the filters.
@@ -319,7 +319,7 @@ async def aggregate_cardinality_values(
319319
aggregate_filter: AggregationFilter | dict[str, Any] | None = None,
320320
filter: AssetFilter | dict[str, Any] | None = None,
321321
) -> int:
322-
"""`Find approximate property count for assets. <https://api-docs.cognite.com/20230101/tag/Assets/operation/aggregateAssets>`_
322+
"""`Find approximate property count for assets <https://api-docs.cognite.com/20230101/tag/Assets/operation/aggregateAssets>`_.
323323
324324
Args:
325325
property (AssetPropertyLike): The property to count the cardinality of.
@@ -364,7 +364,7 @@ async def aggregate_cardinality_properties(
364364
aggregate_filter: AggregationFilter | dict[str, Any] | None = None,
365365
filter: AssetFilter | dict[str, Any] | None = None,
366366
) -> int:
367-
"""`Find approximate paths count for assets. <https://api-docs.cognite.com/20230101/tag/Assets/operation/aggregateAssets>`_
367+
"""`Find approximate paths count for assets <https://api-docs.cognite.com/20230101/tag/Assets/operation/aggregateAssets>`_.
368368
369369
Args:
370370
path (AssetPropertyLike): The scope in every document to aggregate properties. The only value allowed now is ["metadata"].
@@ -401,7 +401,7 @@ async def aggregate_unique_values(
401401
aggregate_filter: AggregationFilter | dict[str, Any] | None = None,
402402
filter: AssetFilter | dict[str, Any] | None = None,
403403
) -> UniqueResultList:
404-
"""`Get unique properties with counts for assets. <https://api-docs.cognite.com/20230101/tag/Assets/operation/aggregateAssets>`_
404+
"""`Get unique properties with counts for assets <https://api-docs.cognite.com/20230101/tag/Assets/operation/aggregateAssets>`_.
405405
406406
Note:
407407
In the case of text fields, the values are aggregated in a case-insensitive manner.
@@ -476,7 +476,7 @@ async def aggregate_unique_properties(
476476
aggregate_filter: AggregationFilter | dict[str, Any] | None = None,
477477
filter: AssetFilter | dict[str, Any] | None = None,
478478
) -> UniqueResultList:
479-
"""`Get unique paths with counts for assets. <https://api-docs.cognite.com/20230101/tag/Assets/operation/aggregateAssets>`_
479+
"""`Get unique paths with counts for assets <https://api-docs.cognite.com/20230101/tag/Assets/operation/aggregateAssets>`_.
480480
481481
Note:
482482
In the case of text fields, the values are aggregated in a case-insensitive manner.
@@ -517,7 +517,7 @@ async def create(self, asset: Sequence[Asset] | Sequence[AssetWrite]) -> AssetLi
517517
async def create(self, asset: Asset | AssetWrite) -> Asset: ...
518518

519519
async def create(self, asset: Asset | AssetWrite | Sequence[Asset] | Sequence[AssetWrite]) -> Asset | AssetList:
520-
"""`Create one or more assets. <https://api-docs.cognite.com/20230101/tag/Assets/operation/createAssets>`_
520+
"""`Create one or more assets <https://api-docs.cognite.com/20230101/tag/Assets/operation/createAssets>`_.
521521
522522
You can create an arbitrary number of assets, and the SDK will split the request into multiple requests.
523523
When specifying parent-child relation between assets using `parentExternalId` the link will be resvoled into an internal ID and stored as `parentId`.
@@ -692,7 +692,7 @@ async def delete(
692692
recursive: bool = False,
693693
ignore_unknown_ids: bool = False,
694694
) -> None:
695-
"""`Delete one or more assets <https://api-docs.cognite.com/20230101/tag/Assets/operation/deleteAssets>`_
695+
"""`Delete one or more assets <https://api-docs.cognite.com/20230101/tag/Assets/operation/deleteAssets>`_.
696696
697697
Args:
698698
id (int | Sequence[int] | None): Id or list of ids
@@ -734,7 +734,8 @@ async def update(
734734
item: Asset | AssetWrite | AssetUpdate | Sequence[Asset | AssetWrite | AssetUpdate],
735735
mode: Literal["replace_ignore_null", "patch", "replace"] = "replace_ignore_null",
736736
) -> Asset | AssetList:
737-
"""`Update one or more assets <https://api-docs.cognite.com/20230101/tag/Assets/operation/updateAssets>`_
737+
"""`Update one or more assets <https://api-docs.cognite.com/20230101/tag/Assets/operation/updateAssets>`_.
738+
738739
Labels can be added, removed or replaced (set). Note that set operation deletes all the existing labels and adds the new specified labels.
739740
740741
Args:
@@ -804,6 +805,7 @@ async def upsert(
804805
self, item: Asset | AssetWrite | Sequence[Asset | AssetWrite], mode: Literal["patch", "replace"] = "patch"
805806
) -> Asset | AssetList:
806807
"""Upsert assets, i.e., update if it exists, and create if it does not exist.
808+
807809
Note this is a convenience method that handles the upserting for you by first calling update on all items,
808810
and if any of them fail because they do not exist, it will create them instead.
809811
@@ -851,7 +853,8 @@ async def search(
851853
filter: AssetFilter | dict[str, Any] | None = None,
852854
limit: int = DEFAULT_LIMIT_READ,
853855
) -> AssetList:
854-
"""`Search for assets <https://api-docs.cognite.com/20230101/tag/Assets/operation/searchAssets>`_
856+
"""`Search for assets <https://api-docs.cognite.com/20230101/tag/Assets/operation/searchAssets>`_.
857+
855858
Primarily meant for human-centric use-cases and data exploration, not for programs, since matching and ordering may change over time. Use the `list` function if stable or exact matches are required.
856859
857860
Args:
@@ -961,7 +964,7 @@ async def list(
961964
advanced_filter: Filter | dict[str, Any] | None = None,
962965
sort: SortSpec | list[SortSpec] | None = None,
963966
) -> AssetList:
964-
"""`List assets <https://api-docs.cognite.com/20230101/tag/Assets/operation/listAssets>`_
967+
"""`List assets <https://api-docs.cognite.com/20230101/tag/Assets/operation/listAssets>`_.
965968
966969
Args:
967970
name (str | None): Name of asset. Often referred to as tag.

cognite/client/_api/data_modeling/containers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ async def retrieve(self, ids: Sequence[ContainerIdentifier]) -> ContainerList: .
101101
async def retrieve(
102102
self, ids: ContainerIdentifier | Sequence[ContainerIdentifier]
103103
) -> Container | ContainerList | None:
104-
"""`Retrieve one or more container by id(s). <https://api-docs.cognite.com/20230101/tag/Containers/operation/byExternalIdsContainers>`_
104+
"""`Retrieve one or more container by id(s) <https://api-docs.cognite.com/20230101/tag/Containers/operation/byExternalIdsContainers>`_.
105105
106106
Args:
107107
ids (ContainerIdentifier | Sequence[ContainerIdentifier]): Identifier for container(s).
@@ -132,7 +132,7 @@ async def retrieve(
132132
)
133133

134134
async def delete(self, ids: ContainerIdentifier | Sequence[ContainerIdentifier]) -> list[ContainerId]:
135-
"""`Delete one or more containers <https://api-docs.cognite.com/20230101/tag/Containers/operation/deleteContainers>`_
135+
"""`Delete one or more containers <https://api-docs.cognite.com/20230101/tag/Containers/operation/deleteContainers>`_.
136136
137137
Args:
138138
ids (ContainerIdentifier | Sequence[ContainerIdentifier]): The container identifier(s).
@@ -159,7 +159,7 @@ async def delete(self, ids: ContainerIdentifier | Sequence[ContainerIdentifier])
159159
return [ContainerId(space=item["space"], external_id=item["externalId"]) for item in deleted_containers]
160160

161161
async def delete_constraints(self, ids: Sequence[ConstraintIdentifier]) -> list[ConstraintIdentifier]:
162-
"""`Delete one or more constraints <https://api-docs.cognite.com/20230101/tag/Containers/operation/deleteContainerConstraints>`_
162+
"""`Delete one or more constraints <https://api-docs.cognite.com/20230101/tag/Containers/operation/deleteContainerConstraints>`_.
163163
164164
Args:
165165
ids (Sequence[ConstraintIdentifier]): The constraint identifier(s).
@@ -179,7 +179,7 @@ async def delete_constraints(self, ids: Sequence[ConstraintIdentifier]) -> list[
179179
return await self._delete_constraints_or_indexes(ids, "constraints")
180180

181181
async def delete_indexes(self, ids: Sequence[IndexIdentifier]) -> list[IndexIdentifier]:
182-
"""`Delete one or more indexes <https://api-docs.cognite.com/20230101/tag/Containers/operation/deleteContainerIndexes>`_
182+
"""`Delete one or more indexes <https://api-docs.cognite.com/20230101/tag/Containers/operation/deleteContainerIndexes>`_.
183183
184184
Args:
185185
ids (Sequence[IndexIdentifier]): The index identifier(s).
@@ -227,7 +227,7 @@ async def list(
227227
limit: int | None = DATA_MODELING_DEFAULT_LIMIT_READ,
228228
include_global: bool = False,
229229
) -> ContainerList:
230-
"""`List containers <https://api-docs.cognite.com/20230101/tag/Containers/operation/listContainers>`_
230+
"""`List containers <https://api-docs.cognite.com/20230101/tag/Containers/operation/listContainers>`_.
231231
232232
Args:
233233
space (str | None): The space to query
@@ -273,7 +273,7 @@ async def apply(self, container: Sequence[ContainerApply]) -> ContainerList: ...
273273
async def apply(self, container: ContainerApply) -> Container: ...
274274

275275
async def apply(self, container: ContainerApply | Sequence[ContainerApply]) -> Container | ContainerList:
276-
"""`Add or update (upsert) containers. <https://api-docs.cognite.com/20230101/tag/Containers/operation/ApplyContainers>`_
276+
"""`Add or update (upsert) containers <https://api-docs.cognite.com/20230101/tag/Containers/operation/ApplyContainers>`_.
277277
278278
Args:
279279
container (ContainerApply | Sequence[ContainerApply]): Container(s) to create or update.

0 commit comments

Comments
 (0)