diff --git a/pyproject.toml b/pyproject.toml index eb2f99f..b87cb91 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [project] name = "zep-cloud" -version = "3.24.0" +version = "3.25.0" [tool.poetry] name = "zep-cloud" -version = "3.24.0" +version = "3.25.0" description = "" readme = "README.md" authors = [] diff --git a/reference.md b/reference.md index 68af66e..da5c671 100644 --- a/reference.md +++ b/reference.md @@ -1443,6 +1443,14 @@ client.graph.add(
+**strict_ontology:** `typing.Optional[bool]` — When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + +
+
+ +
+
+ **user_id:** `typing.Optional[str]` — User ID is the ID of the user to which the data will be added. If not adding to a user graph, please use graph_id field instead.
@@ -1536,6 +1544,14 @@ client.graph.add_batch(
+**strict_ontology:** `typing.Optional[bool]` — When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + +
+
+ +
+
+ **user_id:** `typing.Optional[str]` — User ID is the ID of the user to which the data will be added. If not adding to a user graph, please use graph_id field instead.
@@ -1977,6 +1993,14 @@ client.graph.create(
+**time_zone:** `typing.Optional[str]` — The graph's IANA time zone. Stored on its group-backed subject. + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -2091,6 +2115,96 @@ client.graph.list_all(
+ +
+ + +
client.graph.add_nodes(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Add entity nodes to a user or graph directly, without episode ingestion. Up to 100 nodes per request. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from zep_cloud import AddNodeItem, Zep + +client = Zep( + api_key="YOUR_API_KEY", +) +client.graph.add_nodes( + nodes=[ + AddNodeItem( + name="name", + ) + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**nodes:** `typing.Sequence[AddNodeItem]` — The nodes to add. 1 to 100 items. + +
+
+ +
+
+ +**graph_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**user_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ +
@@ -2638,6 +2752,14 @@ client.graph.update(
+**time_zone:** `typing.Optional[str]` — The graph's IANA time zone. Stored on its group-backed subject. + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -2777,6 +2899,248 @@ client.project.get()
+ +
+ + +
client.project.update(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Sets or clears the project-level fallback time zone for the API key's project. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from zep_cloud import Zep + +client = Zep( + api_key="YOUR_API_KEY", +) +client.project.update() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**default_time_zone:** `typing.Optional[str]` — The project's IANA fallback time zone. Null clears the existing value. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.project.get_observation_steering(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns project steering or the effective user/graph steering with project fallback. This API is experimental and may change in future releases. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from zep_cloud import Zep + +client = Zep( + api_key="YOUR_API_KEY", +) +client.project.get_observation_steering( + user_id="user_id", + graph_id="graph_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**user_id:** `typing.Optional[str]` — User ID for user-specific steering + +
+
+ +
+
+ +**graph_id:** `typing.Optional[str]` — Graph ID for graph-specific steering + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.project.set_observation_steering(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Replaces project, user, or graph steering. An empty configuration clears the project default or removes the user/graph override. Changes affect later materializer runs only. This API is experimental and may change in future releases. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from zep_cloud import Zep + +client = Zep( + api_key="YOUR_API_KEY", +) +client.project.set_observation_steering( + user_id="user_id", + graph_id="graph_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**user_id:** `typing.Optional[str]` — User ID for user-specific steering + +
+
+ +
+
+ +**graph_id:** `typing.Optional[str]` — Graph ID for graph-specific steering + +
+
+ +
+
+ +**instruction:** `typing.Optional[str]` + +
+
+ +
+
+ +**types:** `typing.Optional[typing.Sequence[ObservationType]]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ +
@@ -3213,7 +3577,7 @@ client = Zep( client.thread.get( thread_id="threadId", limit=1, - cursor=1000000, + cursor=1, lastn=1, ) @@ -3367,6 +3731,14 @@ that are added to a user's graph.
+**strict_ontology:** `typing.Optional[bool]` — When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -3473,6 +3845,14 @@ that are added to a user's graph.
+**strict_ontology:** `typing.Optional[bool]` — When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -3883,6 +4263,14 @@ client.user.add(
+**time_zone:** `typing.Optional[str]` — The user's IANA time zone. Null or omission leaves it unset at creation. + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -4239,6 +4627,14 @@ client.user.update(
+**time_zone:** `typing.Optional[str]` — The user's IANA time zone. Null clears the existing value. + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
diff --git a/src/zep_cloud/__init__.py b/src/zep_cloud/__init__.py index a4ab26a..5ab7c53 100644 --- a/src/zep_cloud/__init__.py +++ b/src/zep_cloud/__init__.py @@ -3,6 +3,8 @@ # isort: skip_file from .types import ( + AddNodeItem, + AddNodesResponse, AddThreadMessagesRequest, AddThreadMessagesResponse, AddTripleResponse, @@ -61,6 +63,8 @@ Message, MessageListResponse, MetadataFilterGroup, + ObservationSteeringConfig, + ObservationType, PathDetectConfig, PatternMetadata, PatternResult, @@ -92,6 +96,8 @@ from .version import __version__ __all__ = [ + "AddNodeItem", + "AddNodesResponse", "AddThreadMessagesRequest", "AddThreadMessagesResponse", "AddTripleResponse", @@ -156,6 +162,8 @@ "MessageListResponse", "MetadataFilterGroup", "NotFoundError", + "ObservationSteeringConfig", + "ObservationType", "PathDetectConfig", "PatternMetadata", "PatternResult", diff --git a/src/zep_cloud/core/client_wrapper.py b/src/zep_cloud/core/client_wrapper.py index 2ed04aa..72f2295 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.24.0", + "User-Agent": "zep-cloud/3.25.0", "X-Fern-Language": "Python", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "3.24.0", + "X-Fern-SDK-Version": "3.25.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 b9f72dd..2f6a567 100644 --- a/src/zep_cloud/graph/client.py +++ b/src/zep_cloud/graph/client.py @@ -4,6 +4,8 @@ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from ..core.request_options import RequestOptions +from ..types.add_node_item import AddNodeItem +from ..types.add_nodes_response import AddNodesResponse from ..types.add_triple_response import AddTripleResponse from ..types.clone_graph_response import CloneGraphResponse from ..types.custom_instruction import CustomInstruction @@ -298,6 +300,7 @@ def add( graph_id: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, source_description: typing.Optional[str] = OMIT, + strict_ontology: typing.Optional[bool] = OMIT, user_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> Episode: @@ -320,6 +323,9 @@ def add( source_description : typing.Optional[str] + strict_ontology : typing.Optional[bool] + When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + user_id : typing.Optional[str] User ID is the ID of the user to which the data will be added. If not adding to a user graph, please use graph_id field instead. @@ -350,6 +356,7 @@ def add( graph_id=graph_id, metadata=metadata, source_description=source_description, + strict_ontology=strict_ontology, user_id=user_id, request_options=request_options, ) @@ -360,6 +367,7 @@ def add_batch( *, episodes: typing.Sequence[EpisodeData], graph_id: typing.Optional[str] = OMIT, + strict_ontology: typing.Optional[bool] = OMIT, user_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.List[Episode]: @@ -375,6 +383,9 @@ def add_batch( graph_id : typing.Optional[str] graph_id is the ID of the graph to which the data will be added. If adding to the user graph, please use user_id field instead. + strict_ontology : typing.Optional[bool] + When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + user_id : typing.Optional[str] User ID is the ID of the user to which the data will be added. If not adding to a user graph, please use graph_id field instead. @@ -403,7 +414,11 @@ def add_batch( ) """ _response = self._raw_client.add_batch( - episodes=episodes, graph_id=graph_id, user_id=user_id, request_options=request_options + episodes=episodes, + graph_id=graph_id, + strict_ontology=strict_ontology, + user_id=user_id, + request_options=request_options, ) return _response.data @@ -615,6 +630,7 @@ def create( graph_id: str, description: typing.Optional[str] = OMIT, name: typing.Optional[str] = OMIT, + time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> Graph: """ @@ -628,6 +644,9 @@ def create( name : typing.Optional[str] + time_zone : typing.Optional[str] + The graph's IANA time zone. Stored on its group-backed subject. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -648,7 +667,7 @@ def create( ) """ _response = self._raw_client.create( - graph_id=graph_id, description=description, name=name, request_options=request_options + graph_id=graph_id, description=description, name=name, time_zone=time_zone, request_options=request_options ) return _response.data @@ -715,6 +734,54 @@ def list_all( ) return _response.data + def add_nodes( + self, + *, + nodes: typing.Sequence[AddNodeItem], + graph_id: typing.Optional[str] = OMIT, + user_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddNodesResponse: + """ + Add entity nodes to a user or graph directly, without episode ingestion. Up to 100 nodes per request. + + Parameters + ---------- + nodes : typing.Sequence[AddNodeItem] + The nodes to add. 1 to 100 items. + + graph_id : typing.Optional[str] + + user_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddNodesResponse + Accepted + + Examples + -------- + from zep_cloud import AddNodeItem, Zep + + client = Zep( + api_key="YOUR_API_KEY", + ) + client.graph.add_nodes( + nodes=[ + AddNodeItem( + name="name", + ) + ], + ) + """ + _response = self._raw_client.add_nodes( + nodes=nodes, graph_id=graph_id, user_id=user_id, request_options=request_options + ) + return _response.data + def detect_patterns( self, *, @@ -975,6 +1042,7 @@ def update( *, description: typing.Optional[str] = OMIT, name: typing.Optional[str] = OMIT, + time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> Graph: """ @@ -989,6 +1057,9 @@ def update( name : typing.Optional[str] + time_zone : typing.Optional[str] + The graph's IANA time zone. Stored on its group-backed subject. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1009,7 +1080,7 @@ def update( ) """ _response = self._raw_client.update( - graph_id, description=description, name=name, request_options=request_options + graph_id, description=description, name=name, time_zone=time_zone, request_options=request_options ) return _response.data @@ -1347,6 +1418,7 @@ async def add( graph_id: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, source_description: typing.Optional[str] = OMIT, + strict_ontology: typing.Optional[bool] = OMIT, user_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> Episode: @@ -1369,6 +1441,9 @@ async def add( source_description : typing.Optional[str] + strict_ontology : typing.Optional[bool] + When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + user_id : typing.Optional[str] User ID is the ID of the user to which the data will be added. If not adding to a user graph, please use graph_id field instead. @@ -1407,6 +1482,7 @@ async def main() -> None: graph_id=graph_id, metadata=metadata, source_description=source_description, + strict_ontology=strict_ontology, user_id=user_id, request_options=request_options, ) @@ -1417,6 +1493,7 @@ async def add_batch( *, episodes: typing.Sequence[EpisodeData], graph_id: typing.Optional[str] = OMIT, + strict_ontology: typing.Optional[bool] = OMIT, user_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.List[Episode]: @@ -1432,6 +1509,9 @@ async def add_batch( graph_id : typing.Optional[str] graph_id is the ID of the graph to which the data will be added. If adding to the user graph, please use user_id field instead. + strict_ontology : typing.Optional[bool] + When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + user_id : typing.Optional[str] User ID is the ID of the user to which the data will be added. If not adding to a user graph, please use graph_id field instead. @@ -1468,7 +1548,11 @@ async def main() -> None: asyncio.run(main()) """ _response = await self._raw_client.add_batch( - episodes=episodes, graph_id=graph_id, user_id=user_id, request_options=request_options + episodes=episodes, + graph_id=graph_id, + strict_ontology=strict_ontology, + user_id=user_id, + request_options=request_options, ) return _response.data @@ -1696,6 +1780,7 @@ async def create( graph_id: str, description: typing.Optional[str] = OMIT, name: typing.Optional[str] = OMIT, + time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> Graph: """ @@ -1709,6 +1794,9 @@ async def create( name : typing.Optional[str] + time_zone : typing.Optional[str] + The graph's IANA time zone. Stored on its group-backed subject. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1737,7 +1825,7 @@ async def main() -> None: asyncio.run(main()) """ _response = await self._raw_client.create( - graph_id=graph_id, description=description, name=name, request_options=request_options + graph_id=graph_id, description=description, name=name, time_zone=time_zone, request_options=request_options ) return _response.data @@ -1812,6 +1900,62 @@ async def main() -> None: ) return _response.data + async def add_nodes( + self, + *, + nodes: typing.Sequence[AddNodeItem], + graph_id: typing.Optional[str] = OMIT, + user_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddNodesResponse: + """ + Add entity nodes to a user or graph directly, without episode ingestion. Up to 100 nodes per request. + + Parameters + ---------- + nodes : typing.Sequence[AddNodeItem] + The nodes to add. 1 to 100 items. + + graph_id : typing.Optional[str] + + user_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddNodesResponse + Accepted + + Examples + -------- + import asyncio + + from zep_cloud import AddNodeItem, AsyncZep + + client = AsyncZep( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.graph.add_nodes( + nodes=[ + AddNodeItem( + name="name", + ) + ], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.add_nodes( + nodes=nodes, graph_id=graph_id, user_id=user_id, request_options=request_options + ) + return _response.data + async def detect_patterns( self, *, @@ -2106,6 +2250,7 @@ async def update( *, description: typing.Optional[str] = OMIT, name: typing.Optional[str] = OMIT, + time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> Graph: """ @@ -2120,6 +2265,9 @@ async def update( name : typing.Optional[str] + time_zone : typing.Optional[str] + The graph's IANA time zone. Stored on its group-backed subject. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -2148,7 +2296,7 @@ async def main() -> None: asyncio.run(main()) """ _response = await self._raw_client.update( - graph_id, description=description, name=name, request_options=request_options + graph_id, description=description, name=name, time_zone=time_zone, request_options=request_options ) return _response.data diff --git a/src/zep_cloud/graph/edge/raw_client.py b/src/zep_cloud/graph/edge/raw_client.py index 65979bd..33f435d 100644 --- a/src/zep_cloud/graph/edge/raw_client.py +++ b/src/zep_cloud/graph/edge/raw_client.py @@ -88,9 +88,6 @@ def get_by_graph_id( "order_by": order_by, "uuid_cursor": uuid_cursor, }, - headers={ - "content-type": "application/json", - }, request_options=request_options, omit=OMIT, ) @@ -197,9 +194,6 @@ def get_by_user_id( "order_by": order_by, "uuid_cursor": uuid_cursor, }, - headers={ - "content-type": "application/json", - }, request_options=request_options, omit=OMIT, ) @@ -576,9 +570,6 @@ async def get_by_graph_id( "order_by": order_by, "uuid_cursor": uuid_cursor, }, - headers={ - "content-type": "application/json", - }, request_options=request_options, omit=OMIT, ) @@ -685,9 +676,6 @@ async def get_by_user_id( "order_by": order_by, "uuid_cursor": uuid_cursor, }, - headers={ - "content-type": "application/json", - }, request_options=request_options, omit=OMIT, ) diff --git a/src/zep_cloud/graph/node/raw_client.py b/src/zep_cloud/graph/node/raw_client.py index b921c68..45c6cf8 100644 --- a/src/zep_cloud/graph/node/raw_client.py +++ b/src/zep_cloud/graph/node/raw_client.py @@ -90,9 +90,6 @@ def get_by_graph_id( "order_by": order_by, "uuid_cursor": uuid_cursor, }, - headers={ - "content-type": "application/json", - }, request_options=request_options, omit=OMIT, ) @@ -199,9 +196,6 @@ def get_by_user_id( "order_by": order_by, "uuid_cursor": uuid_cursor, }, - headers={ - "content-type": "application/json", - }, request_options=request_options, omit=OMIT, ) @@ -698,9 +692,6 @@ async def get_by_graph_id( "order_by": order_by, "uuid_cursor": uuid_cursor, }, - headers={ - "content-type": "application/json", - }, request_options=request_options, omit=OMIT, ) @@ -807,9 +798,6 @@ async def get_by_user_id( "order_by": order_by, "uuid_cursor": uuid_cursor, }, - headers={ - "content-type": "application/json", - }, request_options=request_options, omit=OMIT, ) diff --git a/src/zep_cloud/graph/observation/raw_client.py b/src/zep_cloud/graph/observation/raw_client.py index 025f5fa..72b18a5 100644 --- a/src/zep_cloud/graph/observation/raw_client.py +++ b/src/zep_cloud/graph/observation/raw_client.py @@ -87,9 +87,6 @@ def get_by_graph_id( "order_by": order_by, "uuid_cursor": uuid_cursor, }, - headers={ - "content-type": "application/json", - }, request_options=request_options, omit=OMIT, ) @@ -207,9 +204,6 @@ def get_by_user_id( "order_by": order_by, "uuid_cursor": uuid_cursor, }, - headers={ - "content-type": "application/json", - }, request_options=request_options, omit=OMIT, ) @@ -406,9 +400,6 @@ async def get_by_graph_id( "order_by": order_by, "uuid_cursor": uuid_cursor, }, - headers={ - "content-type": "application/json", - }, request_options=request_options, omit=OMIT, ) @@ -526,9 +517,6 @@ async def get_by_user_id( "order_by": order_by, "uuid_cursor": uuid_cursor, }, - headers={ - "content-type": "application/json", - }, request_options=request_options, omit=OMIT, ) diff --git a/src/zep_cloud/graph/raw_client.py b/src/zep_cloud/graph/raw_client.py index 4e48005..a6e4f8a 100644 --- a/src/zep_cloud/graph/raw_client.py +++ b/src/zep_cloud/graph/raw_client.py @@ -14,6 +14,8 @@ from ..errors.forbidden_error import ForbiddenError from ..errors.internal_server_error import InternalServerError from ..errors.not_found_error import NotFoundError +from ..types.add_node_item import AddNodeItem +from ..types.add_nodes_response import AddNodesResponse from ..types.add_triple_response import AddTripleResponse from ..types.api_error import ApiError as types_api_error_ApiError from ..types.clone_graph_response import CloneGraphResponse @@ -523,6 +525,7 @@ def add( graph_id: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, source_description: typing.Optional[str] = OMIT, + strict_ontology: typing.Optional[bool] = OMIT, user_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[Episode]: @@ -545,6 +548,9 @@ def add( source_description : typing.Optional[str] + strict_ontology : typing.Optional[bool] + When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + user_id : typing.Optional[str] User ID is the ID of the user to which the data will be added. If not adding to a user graph, please use graph_id field instead. @@ -565,6 +571,7 @@ def add( "graph_id": graph_id, "metadata": metadata, "source_description": source_description, + "strict_ontology": strict_ontology, "type": type, "user_id": user_id, }, @@ -620,6 +627,7 @@ def add_batch( *, episodes: typing.Sequence[EpisodeData], graph_id: typing.Optional[str] = OMIT, + strict_ontology: typing.Optional[bool] = OMIT, user_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[typing.List[Episode]]: @@ -635,6 +643,9 @@ def add_batch( graph_id : typing.Optional[str] graph_id is the ID of the graph to which the data will be added. If adding to the user graph, please use user_id field instead. + strict_ontology : typing.Optional[bool] + When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + user_id : typing.Optional[str] User ID is the ID of the user to which the data will be added. If not adding to a user graph, please use graph_id field instead. @@ -654,6 +665,7 @@ def add_batch( object_=episodes, annotation=typing.Sequence[EpisodeData], direction="write" ), "graph_id": graph_id, + "strict_ontology": strict_ontology, "user_id": user_id, }, headers={ @@ -984,6 +996,7 @@ def create( graph_id: str, description: typing.Optional[str] = OMIT, name: typing.Optional[str] = OMIT, + time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[Graph]: """ @@ -997,6 +1010,9 @@ def create( name : typing.Optional[str] + time_zone : typing.Optional[str] + The graph's IANA time zone. Stored on its group-backed subject. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1012,6 +1028,7 @@ def create( "description": description, "graph_id": graph_id, "name": name, + "time_zone": time_zone, }, headers={ "content-type": "application/json", @@ -1151,6 +1168,91 @@ def list_all( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) + def add_nodes( + self, + *, + nodes: typing.Sequence[AddNodeItem], + graph_id: typing.Optional[str] = OMIT, + user_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AddNodesResponse]: + """ + Add entity nodes to a user or graph directly, without episode ingestion. Up to 100 nodes per request. + + Parameters + ---------- + nodes : typing.Sequence[AddNodeItem] + The nodes to add. 1 to 100 items. + + graph_id : typing.Optional[str] + + user_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddNodesResponse] + Accepted + """ + _response = self._client_wrapper.httpx_client.request( + "graph/nodes", + method="POST", + json={ + "graph_id": graph_id, + "nodes": convert_and_respect_annotation_metadata( + object_=nodes, annotation=typing.Sequence[AddNodeItem], direction="write" + ), + "user_id": user_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddNodesResponse, + parse_obj_as( + type_=AddNodesResponse, # 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( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # 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 + ) + def detect_patterns( self, *, @@ -1592,6 +1694,7 @@ def update( *, description: typing.Optional[str] = OMIT, name: typing.Optional[str] = OMIT, + time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[Graph]: """ @@ -1606,6 +1709,9 @@ def update( name : typing.Optional[str] + time_zone : typing.Optional[str] + The graph's IANA time zone. Stored on its group-backed subject. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1620,6 +1726,7 @@ def update( json={ "description": description, "name": name, + "time_zone": time_zone, }, headers={ "content-type": "application/json", @@ -2227,6 +2334,7 @@ async def add( graph_id: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, source_description: typing.Optional[str] = OMIT, + strict_ontology: typing.Optional[bool] = OMIT, user_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[Episode]: @@ -2249,6 +2357,9 @@ async def add( source_description : typing.Optional[str] + strict_ontology : typing.Optional[bool] + When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + user_id : typing.Optional[str] User ID is the ID of the user to which the data will be added. If not adding to a user graph, please use graph_id field instead. @@ -2269,6 +2380,7 @@ async def add( "graph_id": graph_id, "metadata": metadata, "source_description": source_description, + "strict_ontology": strict_ontology, "type": type, "user_id": user_id, }, @@ -2324,6 +2436,7 @@ async def add_batch( *, episodes: typing.Sequence[EpisodeData], graph_id: typing.Optional[str] = OMIT, + strict_ontology: typing.Optional[bool] = OMIT, user_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[typing.List[Episode]]: @@ -2339,6 +2452,9 @@ async def add_batch( graph_id : typing.Optional[str] graph_id is the ID of the graph to which the data will be added. If adding to the user graph, please use user_id field instead. + strict_ontology : typing.Optional[bool] + When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + user_id : typing.Optional[str] User ID is the ID of the user to which the data will be added. If not adding to a user graph, please use graph_id field instead. @@ -2358,6 +2474,7 @@ async def add_batch( object_=episodes, annotation=typing.Sequence[EpisodeData], direction="write" ), "graph_id": graph_id, + "strict_ontology": strict_ontology, "user_id": user_id, }, headers={ @@ -2688,6 +2805,7 @@ async def create( graph_id: str, description: typing.Optional[str] = OMIT, name: typing.Optional[str] = OMIT, + time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[Graph]: """ @@ -2701,6 +2819,9 @@ async def create( name : typing.Optional[str] + time_zone : typing.Optional[str] + The graph's IANA time zone. Stored on its group-backed subject. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -2716,6 +2837,7 @@ async def create( "description": description, "graph_id": graph_id, "name": name, + "time_zone": time_zone, }, headers={ "content-type": "application/json", @@ -2855,6 +2977,91 @@ async def list_all( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) + async def add_nodes( + self, + *, + nodes: typing.Sequence[AddNodeItem], + graph_id: typing.Optional[str] = OMIT, + user_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AddNodesResponse]: + """ + Add entity nodes to a user or graph directly, without episode ingestion. Up to 100 nodes per request. + + Parameters + ---------- + nodes : typing.Sequence[AddNodeItem] + The nodes to add. 1 to 100 items. + + graph_id : typing.Optional[str] + + user_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddNodesResponse] + Accepted + """ + _response = await self._client_wrapper.httpx_client.request( + "graph/nodes", + method="POST", + json={ + "graph_id": graph_id, + "nodes": convert_and_respect_annotation_metadata( + object_=nodes, annotation=typing.Sequence[AddNodeItem], direction="write" + ), + "user_id": user_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddNodesResponse, + parse_obj_as( + type_=AddNodesResponse, # 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( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # 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 + ) + async def detect_patterns( self, *, @@ -3298,6 +3505,7 @@ async def update( *, description: typing.Optional[str] = OMIT, name: typing.Optional[str] = OMIT, + time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[Graph]: """ @@ -3312,6 +3520,9 @@ async def update( name : typing.Optional[str] + time_zone : typing.Optional[str] + The graph's IANA time zone. Stored on its group-backed subject. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -3326,6 +3537,7 @@ async def update( json={ "description": description, "name": name, + "time_zone": time_zone, }, headers={ "content-type": "application/json", diff --git a/src/zep_cloud/graph/thread_summary/raw_client.py b/src/zep_cloud/graph/thread_summary/raw_client.py index 242d113..2d041df 100644 --- a/src/zep_cloud/graph/thread_summary/raw_client.py +++ b/src/zep_cloud/graph/thread_summary/raw_client.py @@ -87,9 +87,6 @@ def get_by_graph_id( "order_by": order_by, "uuid_cursor": uuid_cursor, }, - headers={ - "content-type": "application/json", - }, request_options=request_options, omit=OMIT, ) @@ -207,9 +204,6 @@ def get_by_user_id( "order_by": order_by, "uuid_cursor": uuid_cursor, }, - headers={ - "content-type": "application/json", - }, request_options=request_options, omit=OMIT, ) @@ -332,9 +326,6 @@ async def get_by_graph_id( "order_by": order_by, "uuid_cursor": uuid_cursor, }, - headers={ - "content-type": "application/json", - }, request_options=request_options, omit=OMIT, ) @@ -452,9 +443,6 @@ async def get_by_user_id( "order_by": order_by, "uuid_cursor": uuid_cursor, }, - headers={ - "content-type": "application/json", - }, request_options=request_options, omit=OMIT, ) diff --git a/src/zep_cloud/project/client.py b/src/zep_cloud/project/client.py index 8db3379..a5ba6f3 100644 --- a/src/zep_cloud/project/client.py +++ b/src/zep_cloud/project/client.py @@ -4,9 +4,14 @@ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from ..core.request_options import RequestOptions +from ..types.observation_steering_config import ObservationSteeringConfig +from ..types.observation_type import ObservationType from ..types.project_info_response import ProjectInfoResponse from .raw_client import AsyncRawProjectClient, RawProjectClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + class ProjectClient: def __init__(self, *, client_wrapper: SyncClientWrapper): @@ -49,6 +54,129 @@ def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> Pro _response = self._raw_client.get(request_options=request_options) return _response.data + def update( + self, *, default_time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None + ) -> ProjectInfoResponse: + """ + Sets or clears the project-level fallback time zone for the API key's project. + + Parameters + ---------- + default_time_zone : typing.Optional[str] + The project's IANA fallback time zone. Null clears the existing value. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProjectInfoResponse + Updated + + Examples + -------- + from zep_cloud import Zep + + client = Zep( + api_key="YOUR_API_KEY", + ) + client.project.update() + """ + _response = self._raw_client.update(default_time_zone=default_time_zone, request_options=request_options) + return _response.data + + def get_observation_steering( + self, + *, + user_id: typing.Optional[str] = None, + graph_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ObservationSteeringConfig: + """ + Returns project steering or the effective user/graph steering with project fallback. This API is experimental and may change in future releases. + + Parameters + ---------- + user_id : typing.Optional[str] + User ID for user-specific steering + + graph_id : typing.Optional[str] + Graph ID for graph-specific steering + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObservationSteeringConfig + Retrieved + + Examples + -------- + from zep_cloud import Zep + + client = Zep( + api_key="YOUR_API_KEY", + ) + client.project.get_observation_steering( + user_id="user_id", + graph_id="graph_id", + ) + """ + _response = self._raw_client.get_observation_steering( + user_id=user_id, graph_id=graph_id, request_options=request_options + ) + return _response.data + + def set_observation_steering( + self, + *, + user_id: typing.Optional[str] = None, + graph_id: typing.Optional[str] = None, + instruction: typing.Optional[str] = OMIT, + types: typing.Optional[typing.Sequence[ObservationType]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ObservationSteeringConfig: + """ + Replaces project, user, or graph steering. An empty configuration clears the project default or removes the user/graph override. Changes affect later materializer runs only. This API is experimental and may change in future releases. + + Parameters + ---------- + user_id : typing.Optional[str] + User ID for user-specific steering + + graph_id : typing.Optional[str] + Graph ID for graph-specific steering + + instruction : typing.Optional[str] + + types : typing.Optional[typing.Sequence[ObservationType]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObservationSteeringConfig + Updated + + Examples + -------- + from zep_cloud import Zep + + client = Zep( + api_key="YOUR_API_KEY", + ) + client.project.set_observation_steering( + user_id="user_id", + graph_id="graph_id", + ) + """ + _response = self._raw_client.set_observation_steering( + user_id=user_id, graph_id=graph_id, instruction=instruction, types=types, request_options=request_options + ) + return _response.data + class AsyncProjectClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): @@ -98,3 +226,150 @@ async def main() -> None: """ _response = await self._raw_client.get(request_options=request_options) return _response.data + + async def update( + self, *, default_time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None + ) -> ProjectInfoResponse: + """ + Sets or clears the project-level fallback time zone for the API key's project. + + Parameters + ---------- + default_time_zone : typing.Optional[str] + The project's IANA fallback time zone. Null clears the existing value. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProjectInfoResponse + Updated + + Examples + -------- + import asyncio + + from zep_cloud import AsyncZep + + client = AsyncZep( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.project.update() + + + asyncio.run(main()) + """ + _response = await self._raw_client.update(default_time_zone=default_time_zone, request_options=request_options) + return _response.data + + async def get_observation_steering( + self, + *, + user_id: typing.Optional[str] = None, + graph_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ObservationSteeringConfig: + """ + Returns project steering or the effective user/graph steering with project fallback. This API is experimental and may change in future releases. + + Parameters + ---------- + user_id : typing.Optional[str] + User ID for user-specific steering + + graph_id : typing.Optional[str] + Graph ID for graph-specific steering + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObservationSteeringConfig + Retrieved + + Examples + -------- + import asyncio + + from zep_cloud import AsyncZep + + client = AsyncZep( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.project.get_observation_steering( + user_id="user_id", + graph_id="graph_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_observation_steering( + user_id=user_id, graph_id=graph_id, request_options=request_options + ) + return _response.data + + async def set_observation_steering( + self, + *, + user_id: typing.Optional[str] = None, + graph_id: typing.Optional[str] = None, + instruction: typing.Optional[str] = OMIT, + types: typing.Optional[typing.Sequence[ObservationType]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ObservationSteeringConfig: + """ + Replaces project, user, or graph steering. An empty configuration clears the project default or removes the user/graph override. Changes affect later materializer runs only. This API is experimental and may change in future releases. + + Parameters + ---------- + user_id : typing.Optional[str] + User ID for user-specific steering + + graph_id : typing.Optional[str] + Graph ID for graph-specific steering + + instruction : typing.Optional[str] + + types : typing.Optional[typing.Sequence[ObservationType]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObservationSteeringConfig + Updated + + Examples + -------- + import asyncio + + from zep_cloud import AsyncZep + + client = AsyncZep( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.project.set_observation_steering( + user_id="user_id", + graph_id="graph_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.set_observation_steering( + user_id=user_id, graph_id=graph_id, instruction=instruction, types=types, request_options=request_options + ) + return _response.data diff --git a/src/zep_cloud/project/raw_client.py b/src/zep_cloud/project/raw_client.py index bd2e85b..a8ce469 100644 --- a/src/zep_cloud/project/raw_client.py +++ b/src/zep_cloud/project/raw_client.py @@ -8,12 +8,18 @@ from ..core.http_response import AsyncHttpResponse, HttpResponse from ..core.pydantic_utilities import parse_obj_as from ..core.request_options import RequestOptions +from ..core.serialization import convert_and_respect_annotation_metadata from ..errors.bad_request_error import BadRequestError from ..errors.internal_server_error import InternalServerError from ..errors.not_found_error import NotFoundError from ..types.api_error import ApiError as types_api_error_ApiError +from ..types.observation_steering_config import ObservationSteeringConfig +from ..types.observation_type import ObservationType from ..types.project_info_response import ProjectInfoResponse +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + class RawProjectClient: def __init__(self, *, client_wrapper: SyncClientWrapper): @@ -90,6 +96,257 @@ def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> Htt status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) + def update( + self, *, default_time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ProjectInfoResponse]: + """ + Sets or clears the project-level fallback time zone for the API key's project. + + Parameters + ---------- + default_time_zone : typing.Optional[str] + The project's IANA fallback time zone. Null clears the existing value. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ProjectInfoResponse] + Updated + """ + _response = self._client_wrapper.httpx_client.request( + "projects/info", + method="PATCH", + json={ + "default_time_zone": default_time_zone, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProjectInfoResponse, + parse_obj_as( + type_=ProjectInfoResponse, # 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( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + 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 + ) + + def get_observation_steering( + self, + *, + user_id: typing.Optional[str] = None, + graph_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ObservationSteeringConfig]: + """ + Returns project steering or the effective user/graph steering with project fallback. This API is experimental and may change in future releases. + + Parameters + ---------- + user_id : typing.Optional[str] + User ID for user-specific steering + + graph_id : typing.Optional[str] + Graph ID for graph-specific steering + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ObservationSteeringConfig] + Retrieved + """ + _response = self._client_wrapper.httpx_client.request( + "projects/observation-steering", + method="GET", + params={ + "user_id": user_id, + "graph_id": graph_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ObservationSteeringConfig, + parse_obj_as( + type_=ObservationSteeringConfig, # 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( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # 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 + ) + + def set_observation_steering( + self, + *, + user_id: typing.Optional[str] = None, + graph_id: typing.Optional[str] = None, + instruction: typing.Optional[str] = OMIT, + types: typing.Optional[typing.Sequence[ObservationType]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ObservationSteeringConfig]: + """ + Replaces project, user, or graph steering. An empty configuration clears the project default or removes the user/graph override. Changes affect later materializer runs only. This API is experimental and may change in future releases. + + Parameters + ---------- + user_id : typing.Optional[str] + User ID for user-specific steering + + graph_id : typing.Optional[str] + Graph ID for graph-specific steering + + instruction : typing.Optional[str] + + types : typing.Optional[typing.Sequence[ObservationType]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ObservationSteeringConfig] + Updated + """ + _response = self._client_wrapper.httpx_client.request( + "projects/observation-steering", + method="PUT", + params={ + "user_id": user_id, + "graph_id": graph_id, + }, + json={ + "instruction": instruction, + "types": convert_and_respect_annotation_metadata( + object_=types, annotation=typing.Sequence[ObservationType], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ObservationSteeringConfig, + parse_obj_as( + type_=ObservationSteeringConfig, # 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( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # 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 AsyncRawProjectClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): @@ -167,3 +424,254 @@ async def get( raise core_api_error_ApiError( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) + + async def update( + self, *, default_time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ProjectInfoResponse]: + """ + Sets or clears the project-level fallback time zone for the API key's project. + + Parameters + ---------- + default_time_zone : typing.Optional[str] + The project's IANA fallback time zone. Null clears the existing value. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ProjectInfoResponse] + Updated + """ + _response = await self._client_wrapper.httpx_client.request( + "projects/info", + method="PATCH", + json={ + "default_time_zone": default_time_zone, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProjectInfoResponse, + parse_obj_as( + type_=ProjectInfoResponse, # 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( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + 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 + ) + + async def get_observation_steering( + self, + *, + user_id: typing.Optional[str] = None, + graph_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ObservationSteeringConfig]: + """ + Returns project steering or the effective user/graph steering with project fallback. This API is experimental and may change in future releases. + + Parameters + ---------- + user_id : typing.Optional[str] + User ID for user-specific steering + + graph_id : typing.Optional[str] + Graph ID for graph-specific steering + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ObservationSteeringConfig] + Retrieved + """ + _response = await self._client_wrapper.httpx_client.request( + "projects/observation-steering", + method="GET", + params={ + "user_id": user_id, + "graph_id": graph_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ObservationSteeringConfig, + parse_obj_as( + type_=ObservationSteeringConfig, # 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( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # 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 + ) + + async def set_observation_steering( + self, + *, + user_id: typing.Optional[str] = None, + graph_id: typing.Optional[str] = None, + instruction: typing.Optional[str] = OMIT, + types: typing.Optional[typing.Sequence[ObservationType]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ObservationSteeringConfig]: + """ + Replaces project, user, or graph steering. An empty configuration clears the project default or removes the user/graph override. Changes affect later materializer runs only. This API is experimental and may change in future releases. + + Parameters + ---------- + user_id : typing.Optional[str] + User ID for user-specific steering + + graph_id : typing.Optional[str] + Graph ID for graph-specific steering + + instruction : typing.Optional[str] + + types : typing.Optional[typing.Sequence[ObservationType]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ObservationSteeringConfig] + Updated + """ + _response = await self._client_wrapper.httpx_client.request( + "projects/observation-steering", + method="PUT", + params={ + "user_id": user_id, + "graph_id": graph_id, + }, + json={ + "instruction": instruction, + "types": convert_and_respect_annotation_metadata( + object_=types, annotation=typing.Sequence[ObservationType], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ObservationSteeringConfig, + parse_obj_as( + type_=ObservationSteeringConfig, # 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( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # 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/thread/client.py b/src/zep_cloud/thread/client.py index 90cba81..e4a8add 100644 --- a/src/zep_cloud/thread/client.py +++ b/src/zep_cloud/thread/client.py @@ -244,7 +244,7 @@ def get( client.thread.get( thread_id="threadId", limit=1, - cursor=1000000, + cursor=1, lastn=1, ) """ @@ -260,6 +260,7 @@ def add_messages( messages: typing.Sequence[Message], ignore_roles: typing.Optional[typing.Sequence[RoleType]] = OMIT, return_context: typing.Optional[bool] = OMIT, + strict_ontology: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AddThreadMessagesResponse: """ @@ -281,6 +282,9 @@ def add_messages( return_context : typing.Optional[bool] Optionally return context block relevant to the most recent messages. + strict_ontology : typing.Optional[bool] + When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -311,6 +315,7 @@ def add_messages( messages=messages, ignore_roles=ignore_roles, return_context=return_context, + strict_ontology=strict_ontology, request_options=request_options, ) return _response.data @@ -322,6 +327,7 @@ def add_messages_batch( messages: typing.Sequence[Message], ignore_roles: typing.Optional[typing.Sequence[RoleType]] = OMIT, return_context: typing.Optional[bool] = OMIT, + strict_ontology: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AddThreadMessagesResponse: """ @@ -345,6 +351,9 @@ def add_messages_batch( return_context : typing.Optional[bool] Optionally return context block relevant to the most recent messages. + strict_ontology : typing.Optional[bool] + When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -375,6 +384,7 @@ def add_messages_batch( messages=messages, ignore_roles=ignore_roles, return_context=return_context, + strict_ontology=strict_ontology, request_options=request_options, ) return _response.data @@ -674,7 +684,7 @@ async def main() -> None: await client.thread.get( thread_id="threadId", limit=1, - cursor=1000000, + cursor=1, lastn=1, ) @@ -693,6 +703,7 @@ async def add_messages( messages: typing.Sequence[Message], ignore_roles: typing.Optional[typing.Sequence[RoleType]] = OMIT, return_context: typing.Optional[bool] = OMIT, + strict_ontology: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AddThreadMessagesResponse: """ @@ -714,6 +725,9 @@ async def add_messages( return_context : typing.Optional[bool] Optionally return context block relevant to the most recent messages. + strict_ontology : typing.Optional[bool] + When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -752,6 +766,7 @@ async def main() -> None: messages=messages, ignore_roles=ignore_roles, return_context=return_context, + strict_ontology=strict_ontology, request_options=request_options, ) return _response.data @@ -763,6 +778,7 @@ async def add_messages_batch( messages: typing.Sequence[Message], ignore_roles: typing.Optional[typing.Sequence[RoleType]] = OMIT, return_context: typing.Optional[bool] = OMIT, + strict_ontology: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AddThreadMessagesResponse: """ @@ -786,6 +802,9 @@ async def add_messages_batch( return_context : typing.Optional[bool] Optionally return context block relevant to the most recent messages. + strict_ontology : typing.Optional[bool] + When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -824,6 +843,7 @@ async def main() -> None: messages=messages, ignore_roles=ignore_roles, return_context=return_context, + strict_ontology=strict_ontology, request_options=request_options, ) return _response.data diff --git a/src/zep_cloud/thread/raw_client.py b/src/zep_cloud/thread/raw_client.py index 8b207e5..94237e6 100644 --- a/src/zep_cloud/thread/raw_client.py +++ b/src/zep_cloud/thread/raw_client.py @@ -427,6 +427,7 @@ def add_messages( messages: typing.Sequence[Message], ignore_roles: typing.Optional[typing.Sequence[RoleType]] = OMIT, return_context: typing.Optional[bool] = OMIT, + strict_ontology: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[AddThreadMessagesResponse]: """ @@ -448,6 +449,9 @@ def add_messages( return_context : typing.Optional[bool] Optionally return context block relevant to the most recent messages. + strict_ontology : typing.Optional[bool] + When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -465,9 +469,7 @@ def add_messages( object_=messages, annotation=typing.Sequence[Message], direction="write" ), "return_context": return_context, - }, - headers={ - "content-type": "application/json", + "strict_ontology": strict_ontology, }, request_options=request_options, omit=OMIT, @@ -509,6 +511,7 @@ def add_messages_batch( messages: typing.Sequence[Message], ignore_roles: typing.Optional[typing.Sequence[RoleType]] = OMIT, return_context: typing.Optional[bool] = OMIT, + strict_ontology: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[AddThreadMessagesResponse]: """ @@ -532,6 +535,9 @@ def add_messages_batch( return_context : typing.Optional[bool] Optionally return context block relevant to the most recent messages. + strict_ontology : typing.Optional[bool] + When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -549,9 +555,7 @@ def add_messages_batch( object_=messages, annotation=typing.Sequence[Message], direction="write" ), "return_context": return_context, - }, - headers={ - "content-type": "application/json", + "strict_ontology": strict_ontology, }, request_options=request_options, omit=OMIT, @@ -1061,6 +1065,7 @@ async def add_messages( messages: typing.Sequence[Message], ignore_roles: typing.Optional[typing.Sequence[RoleType]] = OMIT, return_context: typing.Optional[bool] = OMIT, + strict_ontology: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[AddThreadMessagesResponse]: """ @@ -1082,6 +1087,9 @@ async def add_messages( return_context : typing.Optional[bool] Optionally return context block relevant to the most recent messages. + strict_ontology : typing.Optional[bool] + When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1099,9 +1107,7 @@ async def add_messages( object_=messages, annotation=typing.Sequence[Message], direction="write" ), "return_context": return_context, - }, - headers={ - "content-type": "application/json", + "strict_ontology": strict_ontology, }, request_options=request_options, omit=OMIT, @@ -1143,6 +1149,7 @@ async def add_messages_batch( messages: typing.Sequence[Message], ignore_roles: typing.Optional[typing.Sequence[RoleType]] = OMIT, return_context: typing.Optional[bool] = OMIT, + strict_ontology: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[AddThreadMessagesResponse]: """ @@ -1166,6 +1173,9 @@ async def add_messages_batch( return_context : typing.Optional[bool] Optionally return context block relevant to the most recent messages. + strict_ontology : typing.Optional[bool] + When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1183,9 +1193,7 @@ async def add_messages_batch( object_=messages, annotation=typing.Sequence[Message], direction="write" ), "return_context": return_context, - }, - headers={ - "content-type": "application/json", + "strict_ontology": strict_ontology, }, request_options=request_options, omit=OMIT, diff --git a/src/zep_cloud/types/__init__.py b/src/zep_cloud/types/__init__.py index 247b46d..331188b 100644 --- a/src/zep_cloud/types/__init__.py +++ b/src/zep_cloud/types/__init__.py @@ -2,6 +2,8 @@ # isort: skip_file +from .add_node_item import AddNodeItem +from .add_nodes_response import AddNodesResponse from .add_thread_messages_request import AddThreadMessagesRequest from .add_thread_messages_response import AddThreadMessagesResponse from .add_triple_response import AddTripleResponse @@ -60,6 +62,8 @@ from .message import Message from .message_list_response import MessageListResponse from .metadata_filter_group import MetadataFilterGroup +from .observation_steering_config import ObservationSteeringConfig +from .observation_type import ObservationType from .path_detect_config import PathDetectConfig from .pattern_metadata import PatternMetadata from .pattern_result import PatternResult @@ -85,6 +89,8 @@ from .user_node_response import UserNodeResponse __all__ = [ + "AddNodeItem", + "AddNodesResponse", "AddThreadMessagesRequest", "AddThreadMessagesResponse", "AddTripleResponse", @@ -143,6 +149,8 @@ "Message", "MessageListResponse", "MetadataFilterGroup", + "ObservationSteeringConfig", + "ObservationType", "PathDetectConfig", "PatternMetadata", "PatternResult", diff --git a/src/zep_cloud/types/add_node_item.py b/src/zep_cloud/types/add_node_item.py new file mode 100644 index 0000000..f218035 --- /dev/null +++ b/src/zep_cloud/types/add_node_item.py @@ -0,0 +1,60 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata + + +class AddNodeItem(UniversalBaseModel): + attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + """ + Additional attributes of the node. Values must be scalar types (string, + number, boolean, or null). Nested objects and arrays are not allowed. + """ + + created_at: typing.Optional[str] = pydantic.Field(default=None) + """ + The node creation time. Defaults to the request time when absent. + """ + + label: typing.Optional[str] = pydantic.Field(default=None) + """ + The node's entity type. At most one; the base "Entity" label is added + implicitly by the graph layer on save and does not need to be supplied. + """ + + metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + """ + Optional metadata attached to the node's shadow episode. Max 10 scalar + key-value pairs. + """ + + name: str = pydantic.Field() + """ + The name of the node. Used to derive the node's search embedding. + """ + + summary: typing.Optional[str] = pydantic.Field(default=None) + """ + A regional summary of the node. + """ + + uuid_: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="uuid")] = pydantic.Field(default=None) + """ + Optional caller-supplied node UUID. When it matches an existing node the + node is upserted; when well-formed but unknown the node is created with + this UUID; when absent the server assigns one. This is the node's only + identity/dedup key -- there is no name-based resolution. + """ + + 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/add_nodes_response.py b/src/zep_cloud/types/add_nodes_response.py new file mode 100644 index 0000000..0f94650 --- /dev/null +++ b/src/zep_cloud/types/add_nodes_response.py @@ -0,0 +1,29 @@ +# 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 .add_node_item import AddNodeItem + + +class AddNodesResponse(UniversalBaseModel): + nodes: typing.Optional[typing.List[AddNodeItem]] = pydantic.Field(default=None) + """ + The accepted nodes, each carrying its resolved (server-assigned or + caller-supplied) UUID, in request order. + """ + + task_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Task ID of the async add-nodes task. + """ + + 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/add_thread_messages_request.py b/src/zep_cloud/types/add_thread_messages_request.py index dadaf65..72df5d9 100644 --- a/src/zep_cloud/types/add_thread_messages_request.py +++ b/src/zep_cloud/types/add_thread_messages_request.py @@ -26,6 +26,11 @@ class AddThreadMessagesRequest(UniversalBaseModel): Optionally return context block relevant to the most recent messages. """ + strict_ontology: typing.Optional[bool] = pydantic.Field(default=None) + """ + When true, prevents extraction of generic Entity nodes that do not match the configured ontology. + """ + if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: diff --git a/src/zep_cloud/types/batch_item_detail.py b/src/zep_cloud/types/batch_item_detail.py index 5db9b4c..439cd2f 100644 --- a/src/zep_cloud/types/batch_item_detail.py +++ b/src/zep_cloud/types/batch_item_detail.py @@ -20,6 +20,7 @@ class BatchItemDetail(UniversalBaseModel): error: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None graph_id: typing.Optional[str] = None + graph_uuid: typing.Optional[str] = None item_id: typing.Optional[str] = None kind: typing.Optional[BatchItemKind] = None sequence_index: typing.Optional[int] = None @@ -28,6 +29,7 @@ class BatchItemDetail(UniversalBaseModel): thread_id: typing.Optional[str] = None updated_at: typing.Optional[str] = None user_id: typing.Optional[str] = None + user_uuid: typing.Optional[str] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/zep_cloud/types/entity_type.py b/src/zep_cloud/types/entity_type.py index 0c1566a..b86cd9d 100644 --- a/src/zep_cloud/types/entity_type.py +++ b/src/zep_cloud/types/entity_type.py @@ -9,6 +9,7 @@ class EntityType(UniversalBaseModel): description: str + identity_properties: typing.Optional[typing.List[str]] = None name: str properties: typing.Optional[typing.List[EntityProperty]] = None diff --git a/src/zep_cloud/types/graph.py b/src/zep_cloud/types/graph.py index 62defa6..8ae534e 100644 --- a/src/zep_cloud/types/graph.py +++ b/src/zep_cloud/types/graph.py @@ -15,6 +15,7 @@ class Graph(UniversalBaseModel): id: typing.Optional[int] = None name: typing.Optional[str] = None project_uuid: typing.Optional[str] = None + time_zone: typing.Optional[str] = None uuid_: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="uuid")] = None if IS_PYDANTIC_V2: diff --git a/src/zep_cloud/types/message_list_response.py b/src/zep_cloud/types/message_list_response.py index 9a7b881..0e6edb3 100644 --- a/src/zep_cloud/types/message_list_response.py +++ b/src/zep_cloud/types/message_list_response.py @@ -33,6 +33,11 @@ class MessageListResponse(UniversalBaseModel): The user ID associated with this thread. """ + user_uuid: typing.Optional[str] = pydantic.Field(default=None) + """ + The opaque user identifier used by dashboard routes. + """ + if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: diff --git a/src/zep_cloud/types/observation_steering_config.py b/src/zep_cloud/types/observation_steering_config.py new file mode 100644 index 0000000..ad1d41d --- /dev/null +++ b/src/zep_cloud/types/observation_steering_config.py @@ -0,0 +1,21 @@ +# 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 .observation_type import ObservationType + + +class ObservationSteeringConfig(UniversalBaseModel): + instruction: typing.Optional[str] = None + types: typing.Optional[typing.List[ObservationType]] = None + + 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/observation_type.py b/src/zep_cloud/types/observation_type.py new file mode 100644 index 0000000..14166bf --- /dev/null +++ b/src/zep_cloud/types/observation_type.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class ObservationType(UniversalBaseModel): + description: str + name: str + + 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/project_info.py b/src/zep_cloud/types/project_info.py index 252adf1..86efb2c 100644 --- a/src/zep_cloud/types/project_info.py +++ b/src/zep_cloud/types/project_info.py @@ -10,6 +10,7 @@ class ProjectInfo(UniversalBaseModel): created_at: typing.Optional[str] = None + default_time_zone: typing.Optional[str] = None description: typing.Optional[str] = None name: typing.Optional[str] = None uuid_: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="uuid")] = None diff --git a/src/zep_cloud/types/thread.py b/src/zep_cloud/types/thread.py index 30bfdde..964b51c 100644 --- a/src/zep_cloud/types/thread.py +++ b/src/zep_cloud/types/thread.py @@ -13,6 +13,7 @@ class Thread(UniversalBaseModel): project_uuid: typing.Optional[str] = None thread_id: typing.Optional[str] = None user_id: typing.Optional[str] = None + user_uuid: typing.Optional[str] = None uuid_: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="uuid")] = None if IS_PYDANTIC_V2: diff --git a/src/zep_cloud/types/user.py b/src/zep_cloud/types/user.py index 5a41a69..50b8df9 100644 --- a/src/zep_cloud/types/user.py +++ b/src/zep_cloud/types/user.py @@ -27,6 +27,7 @@ class User(UniversalBaseModel): Deprecated """ + time_zone: typing.Optional[str] = None updated_at: typing.Optional[str] = pydantic.Field(default=None) """ Deprecated diff --git a/src/zep_cloud/user/client.py b/src/zep_cloud/user/client.py index 79e1ec4..e8a84fe 100644 --- a/src/zep_cloud/user/client.py +++ b/src/zep_cloud/user/client.py @@ -161,6 +161,7 @@ def add( first_name: typing.Optional[str] = OMIT, last_name: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> User: """ @@ -186,6 +187,9 @@ def add( metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] The metadata associated with the user. + time_zone : typing.Optional[str] + The user's IANA time zone. Null or omission leaves it unset at creation. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -212,6 +216,7 @@ def add( first_name=first_name, last_name=last_name, metadata=metadata, + time_zone=time_zone, request_options=request_options, ) return _response.data @@ -350,6 +355,7 @@ def update( first_name: typing.Optional[str] = OMIT, last_name: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> User: """ @@ -375,6 +381,9 @@ def update( metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] The metadata to update + time_zone : typing.Optional[str] + The user's IANA time zone. Null clears the existing value. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -401,6 +410,7 @@ def update( first_name=first_name, last_name=last_name, metadata=metadata, + time_zone=time_zone, request_options=request_options, ) return _response.data @@ -671,6 +681,7 @@ async def add( first_name: typing.Optional[str] = OMIT, last_name: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> User: """ @@ -696,6 +707,9 @@ async def add( metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] The metadata associated with the user. + time_zone : typing.Optional[str] + The user's IANA time zone. Null or omission leaves it unset at creation. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -730,6 +744,7 @@ async def main() -> None: first_name=first_name, last_name=last_name, metadata=metadata, + time_zone=time_zone, request_options=request_options, ) return _response.data @@ -892,6 +907,7 @@ async def update( first_name: typing.Optional[str] = OMIT, last_name: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> User: """ @@ -917,6 +933,9 @@ async def update( metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] The metadata to update + time_zone : typing.Optional[str] + The user's IANA time zone. Null clears the existing value. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -951,6 +970,7 @@ async def main() -> None: first_name=first_name, last_name=last_name, metadata=metadata, + time_zone=time_zone, request_options=request_options, ) return _response.data diff --git a/src/zep_cloud/user/raw_client.py b/src/zep_cloud/user/raw_client.py index 5eec6c9..ee2aa51 100644 --- a/src/zep_cloud/user/raw_client.py +++ b/src/zep_cloud/user/raw_client.py @@ -302,6 +302,7 @@ def add( first_name: typing.Optional[str] = OMIT, last_name: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[User]: """ @@ -327,6 +328,9 @@ def add( metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] The metadata associated with the user. + time_zone : typing.Optional[str] + The user's IANA time zone. Null or omission leaves it unset at creation. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -344,6 +348,7 @@ def add( "first_name": first_name, "last_name": last_name, "metadata": metadata, + "time_zone": time_zone, "user_id": user_id, }, headers={ @@ -621,6 +626,7 @@ def update( first_name: typing.Optional[str] = OMIT, last_name: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[User]: """ @@ -646,6 +652,9 @@ def update( metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] The metadata to update + time_zone : typing.Optional[str] + The user's IANA time zone. Null clears the existing value. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -663,6 +672,7 @@ def update( "first_name": first_name, "last_name": last_name, "metadata": metadata, + "time_zone": time_zone, }, headers={ "content-type": "application/json", @@ -1183,6 +1193,7 @@ async def add( first_name: typing.Optional[str] = OMIT, last_name: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[User]: """ @@ -1208,6 +1219,9 @@ async def add( metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] The metadata associated with the user. + time_zone : typing.Optional[str] + The user's IANA time zone. Null or omission leaves it unset at creation. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1225,6 +1239,7 @@ async def add( "first_name": first_name, "last_name": last_name, "metadata": metadata, + "time_zone": time_zone, "user_id": user_id, }, headers={ @@ -1504,6 +1519,7 @@ async def update( first_name: typing.Optional[str] = OMIT, last_name: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + time_zone: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[User]: """ @@ -1529,6 +1545,9 @@ async def update( metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] The metadata to update + time_zone : typing.Optional[str] + The user's IANA time zone. Null clears the existing value. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1546,6 +1565,7 @@ async def update( "first_name": first_name, "last_name": last_name, "metadata": metadata, + "time_zone": time_zone, }, headers={ "content-type": "application/json",