diff --git a/pyproject.toml b/pyproject.toml index bb4f085..48c4f60 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "zep-cloud" [tool.poetry] name = "zep-cloud" -version = "3.13.0" +version = "3.14.0" description = "" readme = "README.md" authors = [] diff --git a/reference.md b/reference.md index 00ffc2f..566d51b 100644 --- a/reference.md +++ b/reference.md @@ -767,8 +767,6 @@ client = Zep( client.graph.add_fact_triple( fact="fact", fact_name="fact_name", - source_node_name="source_node_name", - target_node_name="target_node_name", ) ``` @@ -801,7 +799,7 @@ client.graph.add_fact_triple(
-**source_node_name:** `str` — The name of the source node to add +**created_at:** `typing.Optional[str]` — The timestamp of the message
@@ -809,7 +807,10 @@ client.graph.add_fact_triple(
-**target_node_name:** `str` — The name of the target node to add +**edge_attributes:** `typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]` + +Additional attributes of the edge. Values must be scalar types (string, number, boolean, or null). +Nested objects and arrays are not allowed.
@@ -817,7 +818,7 @@ client.graph.add_fact_triple(
-**created_at:** `typing.Optional[str]` — The timestamp of the message +**expired_at:** `typing.Optional[str]` — The time (if any) at which the edge expires
@@ -825,7 +826,7 @@ client.graph.add_fact_triple(
-**expired_at:** `typing.Optional[str]` — The time (if any) at which the edge expires +**fact_uuid:** `typing.Optional[str]` — The uuid of the edge to add
@@ -833,7 +834,7 @@ client.graph.add_fact_triple(
-**fact_uuid:** `typing.Optional[str]` — The uuid of the edge to add +**graph_id:** `typing.Optional[str]`
@@ -841,7 +842,7 @@ client.graph.add_fact_triple(
-**graph_id:** `typing.Optional[str]` +**invalid_at:** `typing.Optional[str]` — The time (if any) at which the fact stops being true
@@ -849,7 +850,18 @@ client.graph.add_fact_triple(
-**invalid_at:** `typing.Optional[str]` — The time (if any) at which the fact stops being true +**source_node_attributes:** `typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]` + +Additional attributes of the source node. Values must be scalar types (string, number, boolean, or null). +Nested objects and arrays are not allowed. + +
+
+ +
+
+ +**source_node_name:** `typing.Optional[str]` — The name of the source node to add
@@ -873,6 +885,25 @@ client.graph.add_fact_triple(
+**target_node_attributes:** `typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]` + +Additional attributes of the target node. Values must be scalar types (string, number, boolean, or null). +Nested objects and arrays are not allowed. + +
+
+ +
+
+ +**target_node_name:** `typing.Optional[str]` — The name of the target node to add + +
+
+ +
+
+ **target_node_summary:** `typing.Optional[str]` — The summary of the target node to add
@@ -2014,7 +2045,7 @@ client.thread.get_user_context(
-**min_rating:** `typing.Optional[float]` — The minimum rating by which to filter relevant facts. +**min_rating:** `typing.Optional[float]` — Deprecated, this field will be removed in a future release. The minimum rating by which to filter relevant facts.
@@ -2659,7 +2690,7 @@ client.user.add(
-**fact_rating_instruction:** `typing.Optional[FactRatingInstruction]` — Optional instruction to use for fact rating. +**fact_rating_instruction:** `typing.Optional[FactRatingInstruction]` — Deprecated: this field will be removed in a future release. Optional instruction to use for fact rating.
@@ -2996,7 +3027,7 @@ client.user.update(
-**fact_rating_instruction:** `typing.Optional[FactRatingInstruction]` — Optional instruction to use for fact rating. +**fact_rating_instruction:** `typing.Optional[FactRatingInstruction]` — Deprecated: this field will be removed in a future release. Optional instruction to use for fact rating.
@@ -4311,6 +4342,76 @@ client.graph.node.get(
+ + + + +
client.graph.node.delete(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a node by UUID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from zep_cloud import Zep + +client = Zep( + api_key="YOUR_API_KEY", +) +client.graph.node.delete( + uuid_="uuid", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**uuid_:** `str` — Node UUID + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ +
diff --git a/src/zep_cloud/__init__.py b/src/zep_cloud/__init__.py index 8ea45ce..9cad36c 100644 --- a/src/zep_cloud/__init__.py +++ b/src/zep_cloud/__init__.py @@ -41,6 +41,7 @@ ModelsFactRatingInstruction, ProjectInfo, ProjectInfoResponse, + PropertyFilter, Reranker, RoleType, SearchFilters, @@ -105,6 +106,7 @@ "NotFoundError", "ProjectInfo", "ProjectInfoResponse", + "PropertyFilter", "Reranker", "RoleType", "SearchFilters", diff --git a/src/zep_cloud/core/client_wrapper.py b/src/zep_cloud/core/client_wrapper.py index db6fce9..81b1aeb 100644 --- a/src/zep_cloud/core/client_wrapper.py +++ b/src/zep_cloud/core/client_wrapper.py @@ -22,10 +22,10 @@ def __init__( def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { - "User-Agent": "zep-cloud/3.13.0", + "User-Agent": "zep-cloud/3.14.0", "X-Fern-Language": "Python", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "3.13.0", + "X-Fern-SDK-Version": "3.14.0", **(self.get_custom_headers() or {}), } headers["Authorization"] = f"Api-Key {self.api_key}" diff --git a/src/zep_cloud/graph/client.py b/src/zep_cloud/graph/client.py index 429e96b..f386a6b 100644 --- a/src/zep_cloud/graph/client.py +++ b/src/zep_cloud/graph/client.py @@ -256,15 +256,18 @@ def add_fact_triple( *, fact: str, fact_name: str, - source_node_name: str, - target_node_name: str, created_at: typing.Optional[str] = OMIT, + edge_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, expired_at: typing.Optional[str] = OMIT, fact_uuid: typing.Optional[str] = OMIT, graph_id: typing.Optional[str] = OMIT, invalid_at: typing.Optional[str] = OMIT, + source_node_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + source_node_name: typing.Optional[str] = OMIT, source_node_summary: typing.Optional[str] = OMIT, source_node_uuid: typing.Optional[str] = OMIT, + target_node_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + target_node_name: typing.Optional[str] = OMIT, target_node_summary: typing.Optional[str] = OMIT, target_node_uuid: typing.Optional[str] = OMIT, user_id: typing.Optional[str] = OMIT, @@ -282,15 +285,13 @@ def add_fact_triple( fact_name : str The name of the edge to add. Should be all caps using snake case (eg RELATES_TO) - source_node_name : str - The name of the source node to add - - target_node_name : str - The name of the target node to add - created_at : typing.Optional[str] The timestamp of the message + edge_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + Additional attributes of the edge. Values must be scalar types (string, number, boolean, or null). + Nested objects and arrays are not allowed. + expired_at : typing.Optional[str] The time (if any) at which the edge expires @@ -302,12 +303,26 @@ def add_fact_triple( invalid_at : typing.Optional[str] The time (if any) at which the fact stops being true + source_node_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + Additional attributes of the source node. Values must be scalar types (string, number, boolean, or null). + Nested objects and arrays are not allowed. + + source_node_name : typing.Optional[str] + The name of the source node to add + source_node_summary : typing.Optional[str] The summary of the source node to add source_node_uuid : typing.Optional[str] The source node uuid + target_node_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + Additional attributes of the target node. Values must be scalar types (string, number, boolean, or null). + Nested objects and arrays are not allowed. + + target_node_name : typing.Optional[str] + The name of the target node to add + target_node_summary : typing.Optional[str] The summary of the target node to add @@ -337,22 +352,23 @@ def add_fact_triple( client.graph.add_fact_triple( fact="fact", fact_name="fact_name", - source_node_name="source_node_name", - target_node_name="target_node_name", ) """ _response = self._raw_client.add_fact_triple( fact=fact, fact_name=fact_name, - source_node_name=source_node_name, - target_node_name=target_node_name, created_at=created_at, + edge_attributes=edge_attributes, expired_at=expired_at, fact_uuid=fact_uuid, graph_id=graph_id, invalid_at=invalid_at, + source_node_attributes=source_node_attributes, + source_node_name=source_node_name, source_node_summary=source_node_summary, source_node_uuid=source_node_uuid, + target_node_attributes=target_node_attributes, + target_node_name=target_node_name, target_node_summary=target_node_summary, target_node_uuid=target_node_uuid, user_id=user_id, @@ -973,15 +989,18 @@ async def add_fact_triple( *, fact: str, fact_name: str, - source_node_name: str, - target_node_name: str, created_at: typing.Optional[str] = OMIT, + edge_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, expired_at: typing.Optional[str] = OMIT, fact_uuid: typing.Optional[str] = OMIT, graph_id: typing.Optional[str] = OMIT, invalid_at: typing.Optional[str] = OMIT, + source_node_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + source_node_name: typing.Optional[str] = OMIT, source_node_summary: typing.Optional[str] = OMIT, source_node_uuid: typing.Optional[str] = OMIT, + target_node_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + target_node_name: typing.Optional[str] = OMIT, target_node_summary: typing.Optional[str] = OMIT, target_node_uuid: typing.Optional[str] = OMIT, user_id: typing.Optional[str] = OMIT, @@ -999,15 +1018,13 @@ async def add_fact_triple( fact_name : str The name of the edge to add. Should be all caps using snake case (eg RELATES_TO) - source_node_name : str - The name of the source node to add - - target_node_name : str - The name of the target node to add - created_at : typing.Optional[str] The timestamp of the message + edge_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + Additional attributes of the edge. Values must be scalar types (string, number, boolean, or null). + Nested objects and arrays are not allowed. + expired_at : typing.Optional[str] The time (if any) at which the edge expires @@ -1019,12 +1036,26 @@ async def add_fact_triple( invalid_at : typing.Optional[str] The time (if any) at which the fact stops being true + source_node_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + Additional attributes of the source node. Values must be scalar types (string, number, boolean, or null). + Nested objects and arrays are not allowed. + + source_node_name : typing.Optional[str] + The name of the source node to add + source_node_summary : typing.Optional[str] The summary of the source node to add source_node_uuid : typing.Optional[str] The source node uuid + target_node_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + Additional attributes of the target node. Values must be scalar types (string, number, boolean, or null). + Nested objects and arrays are not allowed. + + target_node_name : typing.Optional[str] + The name of the target node to add + target_node_summary : typing.Optional[str] The summary of the target node to add @@ -1059,8 +1090,6 @@ async def main() -> None: await client.graph.add_fact_triple( fact="fact", fact_name="fact_name", - source_node_name="source_node_name", - target_node_name="target_node_name", ) @@ -1069,15 +1098,18 @@ async def main() -> None: _response = await self._raw_client.add_fact_triple( fact=fact, fact_name=fact_name, - source_node_name=source_node_name, - target_node_name=target_node_name, created_at=created_at, + edge_attributes=edge_attributes, expired_at=expired_at, fact_uuid=fact_uuid, graph_id=graph_id, invalid_at=invalid_at, + source_node_attributes=source_node_attributes, + source_node_name=source_node_name, source_node_summary=source_node_summary, source_node_uuid=source_node_uuid, + target_node_attributes=target_node_attributes, + target_node_name=target_node_name, target_node_summary=target_node_summary, target_node_uuid=target_node_uuid, user_id=user_id, diff --git a/src/zep_cloud/graph/node/client.py b/src/zep_cloud/graph/node/client.py index 20b476f..f49aee2 100644 --- a/src/zep_cloud/graph/node/client.py +++ b/src/zep_cloud/graph/node/client.py @@ -7,6 +7,7 @@ from ...types.entity_edge import EntityEdge from ...types.entity_node import EntityNode from ...types.episode_response import EpisodeResponse +from ...types.success_response import SuccessResponse from .raw_client import AsyncRawNodeClient, RawNodeClient # this is used as the default value for optional parameters @@ -217,6 +218,37 @@ def get(self, uuid_: str, *, request_options: typing.Optional[RequestOptions] = _response = self._raw_client.get(uuid_, request_options=request_options) return _response.data + def delete(self, uuid_: str, *, request_options: typing.Optional[RequestOptions] = None) -> SuccessResponse: + """ + Deletes a node by UUID. + + Parameters + ---------- + uuid_ : str + Node UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SuccessResponse + Node deleted + + Examples + -------- + from zep_cloud import Zep + + client = Zep( + api_key="YOUR_API_KEY", + ) + client.graph.node.delete( + uuid_="uuid", + ) + """ + _response = self._raw_client.delete(uuid_, request_options=request_options) + return _response.data + class AsyncNodeClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): @@ -461,3 +493,42 @@ async def main() -> None: """ _response = await self._raw_client.get(uuid_, request_options=request_options) return _response.data + + async def delete(self, uuid_: str, *, request_options: typing.Optional[RequestOptions] = None) -> SuccessResponse: + """ + Deletes a node by UUID. + + Parameters + ---------- + uuid_ : str + Node UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SuccessResponse + Node deleted + + Examples + -------- + import asyncio + + from zep_cloud import AsyncZep + + client = AsyncZep( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.graph.node.delete( + uuid_="uuid", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(uuid_, request_options=request_options) + return _response.data diff --git a/src/zep_cloud/graph/node/raw_client.py b/src/zep_cloud/graph/node/raw_client.py index da6abb7..7123549 100644 --- a/src/zep_cloud/graph/node/raw_client.py +++ b/src/zep_cloud/graph/node/raw_client.py @@ -16,6 +16,7 @@ from ...types.entity_edge import EntityEdge from ...types.entity_node import EntityNode from ...types.episode_response import EpisodeResponse +from ...types.success_response import SuccessResponse # this is used as the default value for optional parameters OMIT = typing.cast(typing.Any, ...) @@ -397,6 +398,71 @@ def get(self, uuid_: str, *, request_options: typing.Optional[RequestOptions] = status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) + def delete( + self, uuid_: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[SuccessResponse]: + """ + Deletes a node by UUID. + + Parameters + ---------- + uuid_ : str + Node UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SuccessResponse] + Node deleted + """ + _response = self._client_wrapper.httpx_client.request( + f"graph/node/{jsonable_encoder(uuid_)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SuccessResponse, + parse_obj_as( + type_=SuccessResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 500: + raise InternalServerError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + class AsyncRawNodeClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): @@ -775,3 +841,68 @@ async def get( raise core_api_error_ApiError( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) + + async def delete( + self, uuid_: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[SuccessResponse]: + """ + Deletes a node by UUID. + + Parameters + ---------- + uuid_ : str + Node UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SuccessResponse] + Node deleted + """ + _response = await self._client_wrapper.httpx_client.request( + f"graph/node/{jsonable_encoder(uuid_)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SuccessResponse, + parse_obj_as( + type_=SuccessResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 500: + raise InternalServerError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) diff --git a/src/zep_cloud/graph/raw_client.py b/src/zep_cloud/graph/raw_client.py index 96e4eea..73291f2 100644 --- a/src/zep_cloud/graph/raw_client.py +++ b/src/zep_cloud/graph/raw_client.py @@ -403,15 +403,18 @@ def add_fact_triple( *, fact: str, fact_name: str, - source_node_name: str, - target_node_name: str, created_at: typing.Optional[str] = OMIT, + edge_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, expired_at: typing.Optional[str] = OMIT, fact_uuid: typing.Optional[str] = OMIT, graph_id: typing.Optional[str] = OMIT, invalid_at: typing.Optional[str] = OMIT, + source_node_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + source_node_name: typing.Optional[str] = OMIT, source_node_summary: typing.Optional[str] = OMIT, source_node_uuid: typing.Optional[str] = OMIT, + target_node_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + target_node_name: typing.Optional[str] = OMIT, target_node_summary: typing.Optional[str] = OMIT, target_node_uuid: typing.Optional[str] = OMIT, user_id: typing.Optional[str] = OMIT, @@ -429,15 +432,13 @@ def add_fact_triple( fact_name : str The name of the edge to add. Should be all caps using snake case (eg RELATES_TO) - source_node_name : str - The name of the source node to add - - target_node_name : str - The name of the target node to add - created_at : typing.Optional[str] The timestamp of the message + edge_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + Additional attributes of the edge. Values must be scalar types (string, number, boolean, or null). + Nested objects and arrays are not allowed. + expired_at : typing.Optional[str] The time (if any) at which the edge expires @@ -449,12 +450,26 @@ def add_fact_triple( invalid_at : typing.Optional[str] The time (if any) at which the fact stops being true + source_node_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + Additional attributes of the source node. Values must be scalar types (string, number, boolean, or null). + Nested objects and arrays are not allowed. + + source_node_name : typing.Optional[str] + The name of the source node to add + source_node_summary : typing.Optional[str] The summary of the source node to add source_node_uuid : typing.Optional[str] The source node uuid + target_node_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + Additional attributes of the target node. Values must be scalar types (string, number, boolean, or null). + Nested objects and arrays are not allowed. + + target_node_name : typing.Optional[str] + The name of the target node to add + target_node_summary : typing.Optional[str] The summary of the target node to add @@ -479,15 +494,18 @@ def add_fact_triple( method="POST", json={ "created_at": created_at, + "edge_attributes": edge_attributes, "expired_at": expired_at, "fact": fact, "fact_name": fact_name, "fact_uuid": fact_uuid, "graph_id": graph_id, "invalid_at": invalid_at, + "source_node_attributes": source_node_attributes, "source_node_name": source_node_name, "source_node_summary": source_node_summary, "source_node_uuid": source_node_uuid, + "target_node_attributes": target_node_attributes, "target_node_name": target_node_name, "target_node_summary": target_node_summary, "target_node_uuid": target_node_uuid, @@ -1534,15 +1552,18 @@ async def add_fact_triple( *, fact: str, fact_name: str, - source_node_name: str, - target_node_name: str, created_at: typing.Optional[str] = OMIT, + edge_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, expired_at: typing.Optional[str] = OMIT, fact_uuid: typing.Optional[str] = OMIT, graph_id: typing.Optional[str] = OMIT, invalid_at: typing.Optional[str] = OMIT, + source_node_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + source_node_name: typing.Optional[str] = OMIT, source_node_summary: typing.Optional[str] = OMIT, source_node_uuid: typing.Optional[str] = OMIT, + target_node_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + target_node_name: typing.Optional[str] = OMIT, target_node_summary: typing.Optional[str] = OMIT, target_node_uuid: typing.Optional[str] = OMIT, user_id: typing.Optional[str] = OMIT, @@ -1560,15 +1581,13 @@ async def add_fact_triple( fact_name : str The name of the edge to add. Should be all caps using snake case (eg RELATES_TO) - source_node_name : str - The name of the source node to add - - target_node_name : str - The name of the target node to add - created_at : typing.Optional[str] The timestamp of the message + edge_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + Additional attributes of the edge. Values must be scalar types (string, number, boolean, or null). + Nested objects and arrays are not allowed. + expired_at : typing.Optional[str] The time (if any) at which the edge expires @@ -1580,12 +1599,26 @@ async def add_fact_triple( invalid_at : typing.Optional[str] The time (if any) at which the fact stops being true + source_node_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + Additional attributes of the source node. Values must be scalar types (string, number, boolean, or null). + Nested objects and arrays are not allowed. + + source_node_name : typing.Optional[str] + The name of the source node to add + source_node_summary : typing.Optional[str] The summary of the source node to add source_node_uuid : typing.Optional[str] The source node uuid + target_node_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + Additional attributes of the target node. Values must be scalar types (string, number, boolean, or null). + Nested objects and arrays are not allowed. + + target_node_name : typing.Optional[str] + The name of the target node to add + target_node_summary : typing.Optional[str] The summary of the target node to add @@ -1610,15 +1643,18 @@ async def add_fact_triple( method="POST", json={ "created_at": created_at, + "edge_attributes": edge_attributes, "expired_at": expired_at, "fact": fact, "fact_name": fact_name, "fact_uuid": fact_uuid, "graph_id": graph_id, "invalid_at": invalid_at, + "source_node_attributes": source_node_attributes, "source_node_name": source_node_name, "source_node_summary": source_node_summary, "source_node_uuid": source_node_uuid, + "target_node_attributes": target_node_attributes, "target_node_name": target_node_name, "target_node_summary": target_node_summary, "target_node_uuid": target_node_uuid, diff --git a/src/zep_cloud/thread/client.py b/src/zep_cloud/thread/client.py index 5f613b2..3804173 100644 --- a/src/zep_cloud/thread/client.py +++ b/src/zep_cloud/thread/client.py @@ -175,7 +175,7 @@ def get_user_context( The ID of the current thread (for which context is being retrieved). min_rating : typing.Optional[float] - The minimum rating by which to filter relevant facts. + Deprecated, this field will be removed in a future release. The minimum rating by which to filter relevant facts. template_id : typing.Optional[str] Optional template ID to use for custom context rendering. @@ -569,7 +569,7 @@ async def get_user_context( The ID of the current thread (for which context is being retrieved). min_rating : typing.Optional[float] - The minimum rating by which to filter relevant facts. + Deprecated, this field will be removed in a future release. The minimum rating by which to filter relevant facts. template_id : typing.Optional[str] Optional template ID to use for custom context rendering. diff --git a/src/zep_cloud/thread/raw_client.py b/src/zep_cloud/thread/raw_client.py index a4226ed..2512090 100644 --- a/src/zep_cloud/thread/raw_client.py +++ b/src/zep_cloud/thread/raw_client.py @@ -277,7 +277,7 @@ def get_user_context( The ID of the current thread (for which context is being retrieved). min_rating : typing.Optional[float] - The minimum rating by which to filter relevant facts. + Deprecated, this field will be removed in a future release. The minimum rating by which to filter relevant facts. template_id : typing.Optional[str] Optional template ID to use for custom context rendering. @@ -843,7 +843,7 @@ async def get_user_context( The ID of the current thread (for which context is being retrieved). min_rating : typing.Optional[float] - The minimum rating by which to filter relevant facts. + Deprecated, this field will be removed in a future release. The minimum rating by which to filter relevant facts. template_id : typing.Optional[str] Optional template ID to use for custom context rendering. diff --git a/src/zep_cloud/types/__init__.py b/src/zep_cloud/types/__init__.py index c6a4267..39ec436 100644 --- a/src/zep_cloud/types/__init__.py +++ b/src/zep_cloud/types/__init__.py @@ -40,6 +40,7 @@ from .models_fact_rating_instruction import ModelsFactRatingInstruction from .project_info import ProjectInfo from .project_info_response import ProjectInfoResponse +from .property_filter import PropertyFilter from .reranker import Reranker from .role_type import RoleType from .search_filters import SearchFilters @@ -93,6 +94,7 @@ "ModelsFactRatingInstruction", "ProjectInfo", "ProjectInfoResponse", + "PropertyFilter", "Reranker", "RoleType", "SearchFilters", diff --git a/src/zep_cloud/types/date_filter.py b/src/zep_cloud/types/date_filter.py index 9dc8e8d..e1619ed 100644 --- a/src/zep_cloud/types/date_filter.py +++ b/src/zep_cloud/types/date_filter.py @@ -13,9 +13,10 @@ class DateFilter(UniversalBaseModel): Comparison operator for date filter """ - date: str = pydantic.Field() + date: typing.Optional[str] = pydantic.Field(default=None) """ - Date to filter on + Date to filter on. Required for non-null operators (=, <>, >, <, >=, <=). + Should be omitted for IS NULL and IS NOT NULL operators. """ if IS_PYDANTIC_V2: diff --git a/src/zep_cloud/types/property_filter.py b/src/zep_cloud/types/property_filter.py new file mode 100644 index 0000000..85bbc52 --- /dev/null +++ b/src/zep_cloud/types/property_filter.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .comparison_operator import ComparisonOperator + + +class PropertyFilter(UniversalBaseModel): + comparison_operator: ComparisonOperator = pydantic.Field() + """ + Comparison operator for property filter + """ + + property_name: str = pydantic.Field() + """ + Property name to filter on + """ + + property_value: typing.Optional[typing.Optional[typing.Any]] = pydantic.Field(default=None) + """ + Property value to match on. Accepted types: string, int, float64, bool, or nil. + Invalid types (e.g., arrays, objects) will be rejected by validation. + Must be non-nil for non-null operators (=, <>, >, <, >=, <=). + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/zep_cloud/types/search_filters.py b/src/zep_cloud/types/search_filters.py index 51caa1a..a2ee892 100644 --- a/src/zep_cloud/types/search_filters.py +++ b/src/zep_cloud/types/search_filters.py @@ -5,6 +5,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from .date_filter import DateFilter +from .property_filter import PropertyFilter class SearchFilters(UniversalBaseModel): @@ -22,6 +23,11 @@ class SearchFilters(UniversalBaseModel): List of edge types to filter on """ + edge_uuids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of edge UUIDs to filter on + """ + exclude_edge_types: typing.Optional[typing.List[str]] = pydantic.Field(default=None) """ List of edge types to exclude from results @@ -55,6 +61,11 @@ class SearchFilters(UniversalBaseModel): List of node labels to filter on """ + property_filters: typing.Optional[typing.List[PropertyFilter]] = pydantic.Field(default=None) + """ + List of property filters to apply to nodes and edges + """ + valid_at: typing.Optional[typing.List[typing.List[DateFilter]]] = pydantic.Field(default=None) """ 2D array of date filters for the valid_at field. diff --git a/src/zep_cloud/user/client.py b/src/zep_cloud/user/client.py index b603f7d..ac2be95 100644 --- a/src/zep_cloud/user/client.py +++ b/src/zep_cloud/user/client.py @@ -180,7 +180,7 @@ def add( The email address of the user. fact_rating_instruction : typing.Optional[FactRatingInstruction] - Optional instruction to use for fact rating. + Deprecated: this field will be removed in a future release. Optional instruction to use for fact rating. first_name : typing.Optional[str] The first name of the user. @@ -354,7 +354,7 @@ def update( The email address of the user. fact_rating_instruction : typing.Optional[FactRatingInstruction] - Optional instruction to use for fact rating. + Deprecated: this field will be removed in a future release. Optional instruction to use for fact rating. first_name : typing.Optional[str] The first name of the user. @@ -680,7 +680,7 @@ async def add( The email address of the user. fact_rating_instruction : typing.Optional[FactRatingInstruction] - Optional instruction to use for fact rating. + Deprecated: this field will be removed in a future release. Optional instruction to use for fact rating. first_name : typing.Optional[str] The first name of the user. @@ -886,7 +886,7 @@ async def update( The email address of the user. fact_rating_instruction : typing.Optional[FactRatingInstruction] - Optional instruction to use for fact rating. + Deprecated: this field will be removed in a future release. Optional instruction to use for fact rating. first_name : typing.Optional[str] The first name of the user. diff --git a/src/zep_cloud/user/raw_client.py b/src/zep_cloud/user/raw_client.py index e0fe216..417fd40 100644 --- a/src/zep_cloud/user/raw_client.py +++ b/src/zep_cloud/user/raw_client.py @@ -288,7 +288,7 @@ def add( The email address of the user. fact_rating_instruction : typing.Optional[FactRatingInstruction] - Optional instruction to use for fact rating. + Deprecated: this field will be removed in a future release. Optional instruction to use for fact rating. first_name : typing.Optional[str] The first name of the user. @@ -599,7 +599,7 @@ def update( The email address of the user. fact_rating_instruction : typing.Optional[FactRatingInstruction] - Optional instruction to use for fact rating. + Deprecated: this field will be removed in a future release. Optional instruction to use for fact rating. first_name : typing.Optional[str] The first name of the user. @@ -1135,7 +1135,7 @@ async def add( The email address of the user. fact_rating_instruction : typing.Optional[FactRatingInstruction] - Optional instruction to use for fact rating. + Deprecated: this field will be removed in a future release. Optional instruction to use for fact rating. first_name : typing.Optional[str] The first name of the user. @@ -1448,7 +1448,7 @@ async def update( The email address of the user. fact_rating_instruction : typing.Optional[FactRatingInstruction] - Optional instruction to use for fact rating. + Deprecated: this field will be removed in a future release. Optional instruction to use for fact rating. first_name : typing.Optional[str] The first name of the user.