Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gemini/styleguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ def render_header(header: str) -> str:
Renders a (markdown) heading.

Args:
header (str): header
header: header

Returns:
str: The rendered header
The rendered header
"""
return f"{header}\n{'=' * len(header)}\n"

Expand Down
3 changes: 3 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@ repos:
- --quiet # otherwise prints all checked files that are ok...
- --skip-checking-raises=true
- --check-class-attributes=false
- --arg-type-hints-in-docstring=False
- --check-return-types=False
- --check-yield-types=False
27 changes: 13 additions & 14 deletions cognite/client/_api/agents/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ async def upsert(self, agents: AgentUpsert | Sequence[AgentUpsert]) -> Agent | A
"""`Create or update (upsert) one or more agents. <https://api-docs.cognite.com/20230101-beta/tag/Agents/operation/main_ai_agents_post/>`_

Args:
agents (AgentUpsert | Sequence[AgentUpsert]): Agent or list of agents to create or update.
agents: Agent or list of agents to create or update.

Returns:
Agent | AgentList: The created or updated agent(s).
The created or updated agent(s).

Examples:

Expand Down Expand Up @@ -178,11 +178,11 @@ async def retrieve(
"""`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/>`_

Args:
external_ids (str | SequenceNotStr[str]): The external id of the agent(s) to retrieve.
ignore_unknown_ids (bool): Whether to ignore unknown IDs. Defaults to False.
external_ids: The external id of the agent(s) to retrieve.
ignore_unknown_ids: Whether to ignore unknown IDs. Defaults to False.

Returns:
Agent | AgentList | None: The requested agent or agent list. `None` is returned if `ignore_unknown_ids` is `True` and the external ID is not found.
The requested agent or agent list. `None` is returned if `ignore_unknown_ids` is `True` and the external ID is not found.

Examples:

Expand Down Expand Up @@ -210,8 +210,8 @@ async def delete(self, external_ids: str | SequenceNotStr[str], ignore_unknown_i
"""`Delete one or more agents. <https://api-docs.cognite.com/20230101-beta/tag/Agents/operation/agent_delete_ai_agents_delete_post/>`_

Args:
external_ids (str | SequenceNotStr[str]): External ID of the agent or a list of external ids.
ignore_unknown_ids (bool): If `True`, the call will ignore unknown external IDs. Defaults to False.
external_ids: External ID of the agent or a list of external ids.
ignore_unknown_ids: If `True`, the call will ignore unknown external IDs. Defaults to False.

Examples:

Expand All @@ -234,7 +234,7 @@ async def list(self) -> AgentList: # The API does not yet support limit or pagi
"""`List agents. <https://api-docs.cognite.com/20230101-beta/tag/Agents/operation/agent_list_ai_agents_get/>`_

Returns:
AgentList: The list of agents.
The list of agents.

Examples:

Expand Down Expand Up @@ -263,14 +263,13 @@ async def chat(
Users can ensure conversation continuity by including the cursor from the previous response in subsequent requests.

Args:
agent_external_id (str): External ID that uniquely identifies the agent.
messages (Message | ActionResult | Sequence[Message | ActionResult]): A list of one or many input messages to the agent. Can include regular messages and action results.
cursor (str | None): The cursor to use for continuation of a conversation. Use this to
create multi-turn conversations, as the cursor will keep track of the conversation state.
actions (Sequence[Action] | None): A list of client-side actions that can be called by the agent.
agent_external_id: External ID that uniquely identifies the agent.
messages: A list of one or many input messages to the agent. Can include regular messages and action results.
cursor: The cursor to use for continuation of a conversation. Use this to create multi-turn conversations, as the cursor will keep track of the conversation state.
actions: A list of client-side actions that can be called by the agent.

Returns:
AgentChatResponse: The response from the agent.
The response from the agent.

Examples:

Expand Down
24 changes: 12 additions & 12 deletions cognite/client/_api/ai/tools/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ async def summarize(
this may be extended in the future.

Args:
id (int | None): The ID of the document
external_id (str | None): The external ID of the document
instance_id (NodeId | None): The instance ID of the document
id: The ID of the document
external_id: The external ID of the document
instance_id: The instance ID of the document

Returns:
Summary: A summary of the document.
A summary of the document.

Examples:

Expand Down Expand Up @@ -85,16 +85,16 @@ async def ask_question(
Supports up to 100 documents at a time.

Args:
question (str): The question.
id (int | Sequence[int] | None): The ID(s) of the document(s)
external_id (str | Sequence[str] | None): The external ID(s) of the document(s)
instance_id (NodeId | Sequence[NodeId] | None): The instance ID(s) of the document(s)
language (AnswerLanguage | Literal['Chinese', 'Dutch', 'English', 'French', 'German', 'Italian', 'Japanese', 'Korean', 'Latvian', 'Norwegian', 'Portuguese', 'Spanish', 'Swedish']): The desired language of the answer, defaults to English.
additional_context (str | None): Additional context that you want the LLM to take into account.
ignore_unknown_ids (bool): Whether to skip documents that do not exist or that are not fully processed, instead of throwing an error. If no valid documents are found, an error will always be raised.
question: The question.
id: The ID(s) of the document(s)
external_id: The external ID(s) of the document(s)
instance_id: The instance ID(s) of the document(s)
language: The desired language of the answer, defaults to English.
additional_context: Additional context that you want the LLM to take into account.
ignore_unknown_ids: Whether to skip documents that do not exist or that are not fully processed, instead of throwing an error. If no valid documents are found, an error will always be raised.

Returns:
Answer: The answer to the question in the form of a list of multiple content objects, each consisting of a chunk of text along with a set of references.
The answer to the question in the form of a list of multiple content objects, each consisting of a chunk of text along with a set of references.

Examples:

Expand Down
36 changes: 18 additions & 18 deletions cognite/client/_api/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ async def create(
"""`Create annotations <https://developer.cognite.com/api#tag/Annotations/operation/annotationsCreate>`_

Args:
annotations (Annotation | AnnotationWrite | Sequence[Annotation | AnnotationWrite]): Annotation(s) to create
annotations: Annotation(s) to create

Returns:
Annotation | AnnotationList: Created annotation(s)
Created annotation(s)
"""
assert_type(annotations, "annotations", [AnnotationCore, Sequence])

Expand All @@ -69,10 +69,10 @@ async def suggest(
"""`Suggest annotations <https://developer.cognite.com/api#tag/Annotations/operation/annotationsSuggest>`_

Args:
annotations (Annotation | AnnotationWrite | Sequence[Annotation] | Sequence[AnnotationWrite]): annotation(s) to suggest. They must have status set to "suggested".
annotations: annotation(s) to suggest. They must have status set to "suggested".

Returns:
Annotation | AnnotationList: suggested annotation(s)
suggested annotation(s)
"""
assert_type(annotations, "annotations", [Annotation, AnnotationWrite, Sequence])
# Deal with status fields in both cases: Single item and list of items
Expand Down Expand Up @@ -141,11 +141,11 @@ async def update(
"""`Update annotations <https://developer.cognite.com/api#tag/Annotations/operation/annotationsUpdate>`_

Args:
item (Annotation | AnnotationWrite | AnnotationUpdate | Sequence[Annotation | AnnotationWrite | AnnotationUpdate]): Annotation or list of annotations to update (or patch or list of patches to apply)
mode (Literal['replace_ignore_null', 'patch', 'replace']): How to update data when a non-update object is given (Annotation or -Write). If you use 'replace_ignore_null', only the fields you have set will be used to replace existing (default). Using 'replace' will additionally clear all the fields that are not specified by you. Last option, 'patch', will update only the fields you have set and for container-like fields such as metadata or labels, add the values to the existing. For more details, see :ref:`appendix-update`.
item: Annotation or list of annotations to update (or patch or list of patches to apply)
mode: How to update data when a non-update object is given (Annotation or -Write). If you use 'replace_ignore_null', only the fields you have set will be used to replace existing (default). Using 'replace' will additionally clear all the fields that are not specified by you. Last option, 'patch', will update only the fields you have set and for container-like fields such as metadata or labels, add the values to the existing. For more details, see :ref:`appendix-update`.

Returns:
Annotation | AnnotationList: No description."""
No description."""
return await self._update_multiple(
list_cls=AnnotationList, resource_cls=Annotation, update_cls=AnnotationUpdate, items=item, mode=mode
)
Expand All @@ -154,18 +154,18 @@ async def delete(self, id: int | Sequence[int]) -> None:
"""`Delete annotations <https://developer.cognite.com/api#tag/Annotations/operation/annotationsDelete>`_

Args:
id (int | Sequence[int]): ID or list of IDs to be deleted
id: ID or list of IDs to be deleted
"""
await self._delete_multiple(identifiers=IdentifierSequence.load(ids=id), wrap_ids=True)

async def retrieve_multiple(self, ids: Sequence[int]) -> AnnotationList:
"""`Retrieve annotations by IDs <https://developer.cognite.com/api#tag/Annotations/operation/annotationsByids>`_`

Args:
ids (Sequence[int]): list of IDs to be retrieved
ids: list of IDs to be retrieved

Returns:
AnnotationList: list of annotations
list of annotations
"""
identifiers = IdentifierSequence.load(ids=ids, external_ids=None)
return await self._retrieve_multiple(list_cls=AnnotationList, resource_cls=Annotation, identifiers=identifiers)
Expand All @@ -174,10 +174,10 @@ async def retrieve(self, id: int) -> Annotation | None:
"""`Retrieve an annotation by id <https://developer.cognite.com/api#tag/Annotations/operation/annotationsGet>`_

Args:
id (int): id of the annotation to be retrieved
id: id of the annotation to be retrieved

Returns:
Annotation | None: annotation requested
annotation requested
"""
identifiers = IdentifierSequence.load(ids=id, external_ids=None).as_singleton()
return await self._retrieve_multiple(list_cls=AnnotationList, resource_cls=Annotation, identifiers=identifiers)
Expand All @@ -188,11 +188,11 @@ async def reverse_lookup(
"""Reverse lookup annotated resources based on having annotations matching the filter.

Args:
filter (AnnotationReverseLookupFilter): Filter to apply
limit (int | None): Maximum number of results to return. Defaults to None (all).
filter: Filter to apply
limit: Maximum number of results to return. Defaults to None (all).

Returns:
ResourceReferenceList: List of resource references
List of resource references

Examples:

Expand Down Expand Up @@ -225,11 +225,11 @@ async def list(self, filter: AnnotationFilter | dict, limit: int | None = DEFAUL
Passing a filter with both 'annotated_resource_type' and 'annotated_resource_ids' is always required.

Args:
filter (AnnotationFilter | dict): Return annotations with parameter values that match what is specified.
limit (int | None): Maximum number of annotations to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
filter: Return annotations with parameter values that match what is specified.
limit: Maximum number of annotations to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

Returns:
AnnotationList: list of annotations
list of annotations

Example:

Expand Down
Loading
Loading