diff --git a/pyproject.toml b/pyproject.toml index 53e560c..5d898b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "zep-cloud" -version = "2.1.1" +version = "2.2.0" description = "" readme = "README.md" authors = [] diff --git a/src/zep_cloud/__init__.py b/src/zep_cloud/__init__.py index 9f02d0e..c5d93b1 100644 --- a/src/zep_cloud/__init__.py +++ b/src/zep_cloud/__init__.py @@ -1,6 +1,7 @@ # This file was auto-generated by Fern from our API Definition. from .types import ( + AddMemoryResponse, ApiError, ApidataDocument, ApidataDocumentCollection, @@ -53,6 +54,7 @@ from .version import __version__ __all__ = [ + "AddMemoryResponse", "ApiError", "ApidataDocument", "ApidataDocumentCollection", diff --git a/src/zep_cloud/core/client_wrapper.py b/src/zep_cloud/core/client_wrapper.py index 83c16f7..961dad0 100644 --- a/src/zep_cloud/core/client_wrapper.py +++ b/src/zep_cloud/core/client_wrapper.py @@ -17,7 +17,7 @@ def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { "X-Fern-Language": "Python", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "2.1.1", + "X-Fern-SDK-Version": "2.2.0", } headers["Authorization"] = f"Api-Key {self.api_key}" return headers diff --git a/src/zep_cloud/graph/client.py b/src/zep_cloud/graph/client.py index e72ea5b..8847b2c 100644 --- a/src/zep_cloud/graph/client.py +++ b/src/zep_cloud/graph/client.py @@ -105,7 +105,7 @@ def search( request_options: typing.Optional[RequestOptions] = None ) -> GraphSearchResults: """ - Perform a graph search query + Perform a graph search query. Parameters ---------- @@ -119,7 +119,7 @@ def search( one of user_id or group_id must be provided limit : typing.Optional[int] - The maximum number of facts to retrieve + The maximum number of facts to retrieve. Defaults to 10. Limited to 50. min_score : typing.Optional[float] minimum similarity score for a result to be returned @@ -131,7 +131,7 @@ def search( Defaults to RRF scope : typing.Optional[GraphSearchScope] - Defaults to Edges. Nodes and Communities will be added in the future. + Defaults to Edges. Communities will be added in the future. user_id : typing.Optional[str] one of user_id or group_id must be provided @@ -269,7 +269,7 @@ async def search( request_options: typing.Optional[RequestOptions] = None ) -> GraphSearchResults: """ - Perform a graph search query + Perform a graph search query. Parameters ---------- @@ -283,7 +283,7 @@ async def search( one of user_id or group_id must be provided limit : typing.Optional[int] - The maximum number of facts to retrieve + The maximum number of facts to retrieve. Defaults to 10. Limited to 50. min_score : typing.Optional[float] minimum similarity score for a result to be returned @@ -295,7 +295,7 @@ async def search( Defaults to RRF scope : typing.Optional[GraphSearchScope] - Defaults to Edges. Nodes and Communities will be added in the future. + Defaults to Edges. Communities will be added in the future. user_id : typing.Optional[str] one of user_id or group_id must be provided diff --git a/src/zep_cloud/group/client.py b/src/zep_cloud/group/client.py index d21846e..1ee7672 100644 --- a/src/zep_cloud/group/client.py +++ b/src/zep_cloud/group/client.py @@ -27,9 +27,9 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): def add( self, *, + group_id: str, description: typing.Optional[str] = OMIT, fact_rating_instruction: typing.Optional[ApidataFactRatingInstruction] = OMIT, - group_id: typing.Optional[str] = OMIT, name: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> Group: @@ -38,13 +38,13 @@ def add( Parameters ---------- + group_id : str + description : typing.Optional[str] fact_rating_instruction : typing.Optional[ApidataFactRatingInstruction] UserIDs []string `json:"user_ids"` - group_id : typing.Optional[str] - name : typing.Optional[str] request_options : typing.Optional[RequestOptions] @@ -62,7 +62,9 @@ def add( client = Zep( api_key="YOUR_API_KEY", ) - client.group.add() + client.group.add( + group_id="group_id", + ) """ _response = self._client_wrapper.httpx_client.request( "groups", @@ -145,9 +147,9 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): async def add( self, *, + group_id: str, description: typing.Optional[str] = OMIT, fact_rating_instruction: typing.Optional[ApidataFactRatingInstruction] = OMIT, - group_id: typing.Optional[str] = OMIT, name: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> Group: @@ -156,13 +158,13 @@ async def add( Parameters ---------- + group_id : str + description : typing.Optional[str] fact_rating_instruction : typing.Optional[ApidataFactRatingInstruction] UserIDs []string `json:"user_ids"` - group_id : typing.Optional[str] - name : typing.Optional[str] request_options : typing.Optional[RequestOptions] @@ -180,7 +182,9 @@ async def add( client = AsyncZep( api_key="YOUR_API_KEY", ) - await client.group.add() + await client.group.add( + group_id="group_id", + ) """ _response = await self._client_wrapper.httpx_client.request( "groups", diff --git a/src/zep_cloud/memory/client.py b/src/zep_cloud/memory/client.py index 33d2355..b751f9e 100644 --- a/src/zep_cloud/memory/client.py +++ b/src/zep_cloud/memory/client.py @@ -12,6 +12,7 @@ from ..errors.conflict_error import ConflictError from ..errors.internal_server_error import InternalServerError from ..errors.not_found_error import NotFoundError +from ..types.add_memory_response import AddMemoryResponse from ..types.api_error import ApiError as types_api_error_ApiError from ..types.classify_session_request import ClassifySessionRequest from ..types.end_session_response import EndSessionResponse @@ -938,9 +939,10 @@ def add( *, messages: typing.Sequence[Message], fact_instruction: typing.Optional[str] = OMIT, + return_context: typing.Optional[bool] = OMIT, summary_instruction: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> SuccessResponse: + ) -> AddMemoryResponse: """ Add memory to the specified session. @@ -955,6 +957,9 @@ def add( fact_instruction : typing.Optional[str] Additional instruction for generating the facts. Zep Cloud Only, will be ignored on Community Edition. + return_context : typing.Optional[bool] + Optionally return memory context relevant to the most recent messages. + summary_instruction : typing.Optional[str] Additional instruction for generating the summary. Zep Cloud Only, will be ignored on Community Edition. @@ -963,8 +968,8 @@ def add( Returns ------- - SuccessResponse - OK + AddMemoryResponse + An object, optionally containing memory context retrieved for the last message Examples -------- @@ -990,13 +995,14 @@ def add( json={ "fact_instruction": fact_instruction, "messages": messages, + "return_context": return_context, "summary_instruction": summary_instruction, }, request_options=request_options, omit=OMIT, ) if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(SuccessResponse, _response.json()) # type: ignore + return pydantic_v1.parse_obj_as(AddMemoryResponse, _response.json()) # type: ignore if _response.status_code == 500: raise InternalServerError( pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore @@ -2326,9 +2332,10 @@ async def add( *, messages: typing.Sequence[Message], fact_instruction: typing.Optional[str] = OMIT, + return_context: typing.Optional[bool] = OMIT, summary_instruction: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> SuccessResponse: + ) -> AddMemoryResponse: """ Add memory to the specified session. @@ -2343,6 +2350,9 @@ async def add( fact_instruction : typing.Optional[str] Additional instruction for generating the facts. Zep Cloud Only, will be ignored on Community Edition. + return_context : typing.Optional[bool] + Optionally return memory context relevant to the most recent messages. + summary_instruction : typing.Optional[str] Additional instruction for generating the summary. Zep Cloud Only, will be ignored on Community Edition. @@ -2351,8 +2361,8 @@ async def add( Returns ------- - SuccessResponse - OK + AddMemoryResponse + An object, optionally containing memory context retrieved for the last message Examples -------- @@ -2378,13 +2388,14 @@ async def add( json={ "fact_instruction": fact_instruction, "messages": messages, + "return_context": return_context, "summary_instruction": summary_instruction, }, request_options=request_options, omit=OMIT, ) if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(SuccessResponse, _response.json()) # type: ignore + return pydantic_v1.parse_obj_as(AddMemoryResponse, _response.json()) # type: ignore if _response.status_code == 500: raise InternalServerError( pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore diff --git a/src/zep_cloud/types/__init__.py b/src/zep_cloud/types/__init__.py index 9e4ddce..c19d4a8 100644 --- a/src/zep_cloud/types/__init__.py +++ b/src/zep_cloud/types/__init__.py @@ -1,5 +1,6 @@ # This file was auto-generated by Fern from our API Definition. +from .add_memory_response import AddMemoryResponse from .api_error import ApiError from .apidata_document import ApidataDocument from .apidata_document_collection import ApidataDocumentCollection @@ -47,6 +48,7 @@ from .user_list_response import UserListResponse __all__ = [ + "AddMemoryResponse", "ApiError", "ApidataDocument", "ApidataDocumentCollection", diff --git a/src/zep_cloud/types/add_memory_response.py b/src/zep_cloud/types/add_memory_response.py new file mode 100644 index 0000000..d30e641 --- /dev/null +++ b/src/zep_cloud/types/add_memory_response.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ..core.datetime_utils import serialize_datetime +from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 + + +class AddMemoryResponse(pydantic_v1.BaseModel): + context: typing.Optional[str] = None + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/zep_cloud/types/user.py b/src/zep_cloud/types/user.py index cd43a26..fa33387 100644 --- a/src/zep_cloud/types/user.py +++ b/src/zep_cloud/types/user.py @@ -5,12 +5,14 @@ from ..core.datetime_utils import serialize_datetime from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 +from .fact_rating_instruction import FactRatingInstruction class User(pydantic_v1.BaseModel): created_at: typing.Optional[str] = None deleted_at: typing.Optional[str] = None email: typing.Optional[str] = None + fact_rating_instruction: typing.Optional[FactRatingInstruction] = None first_name: typing.Optional[str] = None id: typing.Optional[int] = None last_name: typing.Optional[str] = None