From c5274196c4b69cde8f2954f35f3aa9a9f4eb6ecd Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Thu, 12 Sep 2024 01:58:45 +0000 Subject: [PATCH] SDK regeneration --- src/zep_python/__init__.py | 92 +- src/zep_python/base_client.py | 3 - src/zep_python/document/__init__.py | 2 - src/zep_python/document/client.py | 1565 ---------------- src/zep_python/errors/__init__.py | 3 +- src/zep_python/errors/unauthorized_error.py | 9 - src/zep_python/memory/client.py | 1567 +++-------------- src/zep_python/types/__init__.py | 86 - src/zep_python/types/add_facts_request.py | 5 - src/zep_python/types/added_fact.py | 5 - src/zep_python/types/api_error.py | 5 - src/zep_python/types/apidata_document.py | 38 - .../types/apidata_document_collection.py | 43 - .../types/apidata_document_search_response.py | 34 - .../types/apidata_document_with_score.py | 39 - .../types/apidata_end_session_response.py | 32 - .../types/apidata_end_sessions_response.py | 30 - .../types/apidata_facts_response.py | 30 - .../types/apidata_memory_search_result.py | 32 - src/zep_python/types/apidata_new_fact.py | 29 - src/zep_python/types/apidata_question.py | 29 - .../types/apidata_session_classification.py | 32 - .../types/apidata_summary_list_response.py | 32 - .../types/classify_session_request.py | 52 - .../types/classify_session_response.py | 5 - .../types/create_document_request.py | 31 - .../types/document_collection_response.py | 5 - src/zep_python/types/document_response.py | 5 - .../types/document_search_result.py | 5 - .../types/document_search_result_page.py | 5 - src/zep_python/types/end_session_response.py | 5 - src/zep_python/types/end_sessions_response.py | 5 - src/zep_python/types/fact.py | 5 - src/zep_python/types/fact_response.py | 5 - src/zep_python/types/facts_response.py | 5 - src/zep_python/types/memory.py | 5 - src/zep_python/types/memory_search_result.py | 5 - src/zep_python/types/message_list_response.py | 5 - src/zep_python/types/question.py | 5 - src/zep_python/types/search_scope.py | 5 - src/zep_python/types/search_type.py | 5 - src/zep_python/types/session.py | 5 - src/zep_python/types/session_list_response.py | 5 - .../types/session_search_response.py | 5 - src/zep_python/types/session_search_result.py | 5 - src/zep_python/types/success_response.py | 5 - src/zep_python/types/summary.py | 5 - src/zep_python/types/summary_list_response.py | 5 - .../types/update_document_list_request.py | 33 - src/zep_python/types/user.py | 5 - src/zep_python/types/user_list_response.py | 5 - 51 files changed, 220 insertions(+), 3763 deletions(-) delete mode 100644 src/zep_python/document/__init__.py delete mode 100644 src/zep_python/document/client.py delete mode 100644 src/zep_python/errors/unauthorized_error.py delete mode 100644 src/zep_python/types/add_facts_request.py delete mode 100644 src/zep_python/types/added_fact.py delete mode 100644 src/zep_python/types/api_error.py delete mode 100644 src/zep_python/types/apidata_document.py delete mode 100644 src/zep_python/types/apidata_document_collection.py delete mode 100644 src/zep_python/types/apidata_document_search_response.py delete mode 100644 src/zep_python/types/apidata_document_with_score.py delete mode 100644 src/zep_python/types/apidata_end_session_response.py delete mode 100644 src/zep_python/types/apidata_end_sessions_response.py delete mode 100644 src/zep_python/types/apidata_facts_response.py delete mode 100644 src/zep_python/types/apidata_memory_search_result.py delete mode 100644 src/zep_python/types/apidata_new_fact.py delete mode 100644 src/zep_python/types/apidata_question.py delete mode 100644 src/zep_python/types/apidata_session_classification.py delete mode 100644 src/zep_python/types/apidata_summary_list_response.py delete mode 100644 src/zep_python/types/classify_session_request.py delete mode 100644 src/zep_python/types/classify_session_response.py delete mode 100644 src/zep_python/types/create_document_request.py delete mode 100644 src/zep_python/types/document_collection_response.py delete mode 100644 src/zep_python/types/document_response.py delete mode 100644 src/zep_python/types/document_search_result.py delete mode 100644 src/zep_python/types/document_search_result_page.py delete mode 100644 src/zep_python/types/end_session_response.py delete mode 100644 src/zep_python/types/end_sessions_response.py delete mode 100644 src/zep_python/types/fact.py delete mode 100644 src/zep_python/types/fact_response.py delete mode 100644 src/zep_python/types/facts_response.py delete mode 100644 src/zep_python/types/memory.py delete mode 100644 src/zep_python/types/memory_search_result.py delete mode 100644 src/zep_python/types/message_list_response.py delete mode 100644 src/zep_python/types/question.py delete mode 100644 src/zep_python/types/search_scope.py delete mode 100644 src/zep_python/types/search_type.py delete mode 100644 src/zep_python/types/session.py delete mode 100644 src/zep_python/types/session_list_response.py delete mode 100644 src/zep_python/types/session_search_response.py delete mode 100644 src/zep_python/types/session_search_result.py delete mode 100644 src/zep_python/types/success_response.py delete mode 100644 src/zep_python/types/summary.py delete mode 100644 src/zep_python/types/summary_list_response.py delete mode 100644 src/zep_python/types/update_document_list_request.py delete mode 100644 src/zep_python/types/user.py delete mode 100644 src/zep_python/types/user_list_response.py diff --git a/src/zep_python/__init__.py b/src/zep_python/__init__.py index c7fd71de..15c24eda 100644 --- a/src/zep_python/__init__.py +++ b/src/zep_python/__init__.py @@ -1,28 +1,14 @@ # This file was auto-generated by Fern from our API Definition. from .types import ( - AddFactsRequest, - AddedFact, - ApiError, ApidataApiError, - ApidataDocument, - ApidataDocumentCollection, - ApidataDocumentSearchResponse, - ApidataDocumentWithScore, - ApidataEndSessionResponse, - ApidataEndSessionsResponse, ApidataFact, ApidataFactResponse, - ApidataFactsResponse, ApidataMemory, - ApidataMemorySearchResult, ApidataMessage, ApidataMessageListResponse, - ApidataNewFact, - ApidataQuestion, ApidataRoleType, ApidataSession, - ApidataSessionClassification, ApidataSessionFactRatingExamples, ApidataSessionFactRatingInstruction, ApidataSessionListResponse, @@ -30,71 +16,28 @@ ApidataSessionSearchResult, ApidataSuccessResponse, ApidataSummary, - ApidataSummaryListResponse, ApidataUser, ApidataUserListResponse, - ClassifySessionRequest, - ClassifySessionResponse, - CreateDocumentRequest, - DocumentCollectionResponse, - DocumentResponse, - DocumentSearchResult, - DocumentSearchResultPage, - EndSessionResponse, - EndSessionsResponse, - Fact, FactRatingExamples, FactRatingInstruction, - FactResponse, - FactsResponse, - Memory, - MemorySearchResult, MemoryType, Message, - MessageListResponse, - Question, RoleType, - SearchScope, - SearchType, - Session, - SessionListResponse, - SessionSearchResponse, - SessionSearchResult, - SuccessResponse, - Summary, - SummaryListResponse, - UpdateDocumentListRequest, - User, - UserListResponse, ) -from .errors import BadRequestError, ConflictError, InternalServerError, NotFoundError, UnauthorizedError -from . import document, memory, user +from .errors import BadRequestError, ConflictError, InternalServerError, NotFoundError +from . import memory, user from .environment import ZepEnvironment from .version import __version__ __all__ = [ - "AddFactsRequest", - "AddedFact", - "ApiError", "ApidataApiError", - "ApidataDocument", - "ApidataDocumentCollection", - "ApidataDocumentSearchResponse", - "ApidataDocumentWithScore", - "ApidataEndSessionResponse", - "ApidataEndSessionsResponse", "ApidataFact", "ApidataFactResponse", - "ApidataFactsResponse", "ApidataMemory", - "ApidataMemorySearchResult", "ApidataMessage", "ApidataMessageListResponse", - "ApidataNewFact", - "ApidataQuestion", "ApidataRoleType", "ApidataSession", - "ApidataSessionClassification", "ApidataSessionFactRatingExamples", "ApidataSessionFactRatingInstruction", "ApidataSessionListResponse", @@ -102,50 +45,19 @@ "ApidataSessionSearchResult", "ApidataSuccessResponse", "ApidataSummary", - "ApidataSummaryListResponse", "ApidataUser", "ApidataUserListResponse", "BadRequestError", - "ClassifySessionRequest", - "ClassifySessionResponse", "ConflictError", - "CreateDocumentRequest", - "DocumentCollectionResponse", - "DocumentResponse", - "DocumentSearchResult", - "DocumentSearchResultPage", - "EndSessionResponse", - "EndSessionsResponse", - "Fact", "FactRatingExamples", "FactRatingInstruction", - "FactResponse", - "FactsResponse", "InternalServerError", - "Memory", - "MemorySearchResult", "MemoryType", "Message", - "MessageListResponse", "NotFoundError", - "Question", "RoleType", - "SearchScope", - "SearchType", - "Session", - "SessionListResponse", - "SessionSearchResponse", - "SessionSearchResult", - "SuccessResponse", - "Summary", - "SummaryListResponse", - "UnauthorizedError", - "UpdateDocumentListRequest", - "User", - "UserListResponse", "ZepEnvironment", "__version__", - "document", "memory", "user", ] diff --git a/src/zep_python/base_client.py b/src/zep_python/base_client.py index 38729c42..168abc6c 100644 --- a/src/zep_python/base_client.py +++ b/src/zep_python/base_client.py @@ -7,7 +7,6 @@ from .core.api_error import ApiError from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .document.client import AsyncDocumentClient, DocumentClient from .environment import ZepEnvironment from .memory.client import AsyncMemoryClient, MemoryClient from .user.client import AsyncUserClient, UserClient @@ -73,7 +72,6 @@ def __init__( else httpx.Client(timeout=_defaulted_timeout), timeout=_defaulted_timeout, ) - self.document = DocumentClient(client_wrapper=self._client_wrapper) self.memory = MemoryClient(client_wrapper=self._client_wrapper) self.user = UserClient(client_wrapper=self._client_wrapper) @@ -138,7 +136,6 @@ def __init__( else httpx.AsyncClient(timeout=_defaulted_timeout), timeout=_defaulted_timeout, ) - self.document = AsyncDocumentClient(client_wrapper=self._client_wrapper) self.memory = AsyncMemoryClient(client_wrapper=self._client_wrapper) self.user = AsyncUserClient(client_wrapper=self._client_wrapper) diff --git a/src/zep_python/document/__init__.py b/src/zep_python/document/__init__.py deleted file mode 100644 index f3ea2659..00000000 --- a/src/zep_python/document/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - diff --git a/src/zep_python/document/client.py b/src/zep_python/document/client.py deleted file mode 100644 index 5a6a41db..00000000 --- a/src/zep_python/document/client.py +++ /dev/null @@ -1,1565 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -from json.decoder import JSONDecodeError - -from ..core.api_error import ApiError -from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ..core.jsonable_encoder import jsonable_encoder -from ..core.pydantic_utilities import pydantic_v1 -from ..core.request_options import RequestOptions -from ..errors.bad_request_error import BadRequestError -from ..errors.internal_server_error import InternalServerError -from ..errors.not_found_error import NotFoundError -from ..errors.unauthorized_error import UnauthorizedError -from ..types.apidata_api_error import ApidataApiError -from ..types.apidata_document import ApidataDocument -from ..types.apidata_document_collection import ApidataDocumentCollection -from ..types.apidata_document_search_response import ApidataDocumentSearchResponse -from ..types.apidata_success_response import ApidataSuccessResponse -from ..types.create_document_request import CreateDocumentRequest -from ..types.search_type import SearchType -from ..types.update_document_list_request import UpdateDocumentListRequest - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - - -class DocumentClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def list_collections( - self, *, request_options: typing.Optional[RequestOptions] = None - ) -> typing.List[typing.List[ApidataDocumentCollection]]: - """ - Returns a list of all DocumentCollections. - - Parameters - ---------- - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - typing.List[typing.List[ApidataDocumentCollection]] - OK - - Examples - -------- - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.document.list_collections() - """ - _response = self._client_wrapper.httpx_client.request( - "collections", method="GET", request_options=request_options - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(typing.List[typing.List[ApidataDocumentCollection]], _response.json()) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def get_collection( - self, collection_name: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> ApidataDocumentCollection: - """ - Returns a DocumentCollection if it exists. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataDocumentCollection - OK - - Examples - -------- - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.document.get_collection( - collection_name="collectionName", - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}", method="GET", request_options=request_options - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataDocumentCollection, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def add_collection( - self, - collection_name: str, - *, - description: typing.Optional[str] = OMIT, - metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataSuccessResponse: - """ - If a collection with the same name already exists, an error will be returned. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - description : typing.Optional[str] - - metadata : typing.Optional[typing.Dict[str, typing.Any]] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSuccessResponse - OK - - Examples - -------- - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.document.add_collection( - collection_name="collectionName", - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}", - method="POST", - json={"description": description, "metadata": metadata}, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def delete_collection( - self, collection_name: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> ApidataSuccessResponse: - """ - If a collection with the same name already exists, it will be overwritten. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSuccessResponse - OK - - Examples - -------- - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.document.delete_collection( - collection_name="collectionName", - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}", method="DELETE", request_options=request_options - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def update_collection( - self, - collection_name: str, - *, - description: typing.Optional[str] = OMIT, - metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataSuccessResponse: - """ - Updates a DocumentCollection - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - description : typing.Optional[str] - - metadata : typing.Optional[typing.Dict[str, typing.Any]] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSuccessResponse - OK - - Examples - -------- - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.document.update_collection( - collection_name="collectionName", - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}", - method="PATCH", - json={"description": description, "metadata": metadata}, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def add_documents( - self, - collection_name: str, - *, - request: typing.Sequence[CreateDocumentRequest], - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.List[typing.List[str]]: - """ - Creates Documents in a specified DocumentCollection and returns their UUIDs. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - request : typing.Sequence[CreateDocumentRequest] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - typing.List[typing.List[str]] - OK - - Examples - -------- - from zep_python import CreateDocumentRequest - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.document.add_documents( - collection_name="collectionName", - request=[ - CreateDocumentRequest( - content="content", - ) - ], - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}/documents", - method="POST", - json=request, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(typing.List[typing.List[str]], _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def batch_delete_documents( - self, - collection_name: str, - *, - request: typing.Sequence[str], - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataSuccessResponse: - """ - Deletes specified Documents from a DocumentCollection. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - request : typing.Sequence[str] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSuccessResponse - OK - - Examples - -------- - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.document.batch_delete_documents( - collection_name="collectionName", - request=["string"], - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}/documents/batchDelete", - method="POST", - json=request, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def batch_get_documents( - self, - collection_name: str, - *, - document_ids: typing.Optional[typing.Sequence[str]] = OMIT, - uuids: typing.Optional[typing.Sequence[str]] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.List[typing.List[ApidataDocument]]: - """ - Returns Documents from a DocumentCollection specified by UUID or ID. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - document_ids : typing.Optional[typing.Sequence[str]] - - uuids : typing.Optional[typing.Sequence[str]] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - typing.List[typing.List[ApidataDocument]] - OK - - Examples - -------- - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.document.batch_get_documents( - collection_name="collectionName", - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}/documents/batchGet", - method="POST", - json={"document_ids": document_ids, "uuids": uuids}, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(typing.List[typing.List[ApidataDocument]], _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def batch_update_documents( - self, - collection_name: str, - *, - request: typing.Sequence[UpdateDocumentListRequest], - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataSuccessResponse: - """ - Updates Documents in a specified DocumentCollection. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - request : typing.Sequence[UpdateDocumentListRequest] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSuccessResponse - OK - - Examples - -------- - from zep_python import UpdateDocumentListRequest - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.document.batch_update_documents( - collection_name="collectionName", - request=[ - UpdateDocumentListRequest( - uuid_="uuid", - ) - ], - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}/documents/batchUpdate", - method="PATCH", - json=request, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def gets_a_document_from_a_document_collection_by_uuid( - self, collection_name: str, document_uuid: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> ApidataDocument: - """ - Returns specified Document from a DocumentCollection. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - document_uuid : str - UUID of the Document to be updated - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataDocument - OK - - Examples - -------- - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.document.gets_a_document_from_a_document_collection_by_uuid( - collection_name="collectionName", - document_uuid="documentUUID", - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}/documents/uuid/{jsonable_encoder(document_uuid)}", - method="GET", - request_options=request_options, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataDocument, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def delete_document( - self, collection_name: str, document_uuid: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> ApidataSuccessResponse: - """ - Delete specified Document from a DocumentCollection. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - document_uuid : str - UUID of the Document to be deleted - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSuccessResponse - OK - - Examples - -------- - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.document.delete_document( - collection_name="collectionName", - document_uuid="documentUUID", - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}/documents/uuid/{jsonable_encoder(document_uuid)}", - method="DELETE", - request_options=request_options, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def updates_a_document( - self, - collection_name: str, - document_uuid: str, - *, - document_id: typing.Optional[str] = OMIT, - metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataSuccessResponse: - """ - Updates a Document in a DocumentCollection by UUID - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - document_uuid : str - UUID of the Document to be updated - - document_id : typing.Optional[str] - - metadata : typing.Optional[typing.Dict[str, typing.Any]] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSuccessResponse - OK - - Examples - -------- - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.document.updates_a_document( - collection_name="collectionName", - document_uuid="documentUUID", - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}/documents/uuid/{jsonable_encoder(document_uuid)}", - method="PATCH", - json={"document_id": document_id, "metadata": metadata}, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def search( - self, - collection_name: str, - *, - limit: typing.Optional[int] = None, - metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, - min_score: typing.Optional[float] = OMIT, - mmr_lambda: typing.Optional[float] = OMIT, - search_type: typing.Optional[SearchType] = OMIT, - text: typing.Optional[str] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataDocumentSearchResponse: - """ - Searches over documents in a collection based on provided search criteria. One of text or metadata must be provided. Returns an empty list if no documents are found. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - limit : typing.Optional[int] - Limit the number of returned documents - - metadata : typing.Optional[typing.Dict[str, typing.Any]] - Document metadata to filter on. - - min_score : typing.Optional[float] - - mmr_lambda : typing.Optional[float] - The lambda parameter for the MMR Reranking Algorithm. - - search_type : typing.Optional[SearchType] - The type of search to perform. Defaults to "similarity". Must be one of "similarity" or "mmr". - - text : typing.Optional[str] - The search text. - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataDocumentSearchResponse - OK - - Examples - -------- - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.document.search( - collection_name="collectionName", - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}/search", - method="POST", - params={"limit": limit}, - json={ - "metadata": metadata, - "min_score": min_score, - "mmr_lambda": mmr_lambda, - "search_type": search_type, - "text": text, - }, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataDocumentSearchResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncDocumentClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def list_collections( - self, *, request_options: typing.Optional[RequestOptions] = None - ) -> typing.List[typing.List[ApidataDocumentCollection]]: - """ - Returns a list of all DocumentCollections. - - Parameters - ---------- - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - typing.List[typing.List[ApidataDocumentCollection]] - OK - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.document.list_collections() - """ - _response = await self._client_wrapper.httpx_client.request( - "collections", method="GET", request_options=request_options - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(typing.List[typing.List[ApidataDocumentCollection]], _response.json()) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def get_collection( - self, collection_name: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> ApidataDocumentCollection: - """ - Returns a DocumentCollection if it exists. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataDocumentCollection - OK - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.document.get_collection( - collection_name="collectionName", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}", method="GET", request_options=request_options - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataDocumentCollection, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def add_collection( - self, - collection_name: str, - *, - description: typing.Optional[str] = OMIT, - metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataSuccessResponse: - """ - If a collection with the same name already exists, an error will be returned. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - description : typing.Optional[str] - - metadata : typing.Optional[typing.Dict[str, typing.Any]] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSuccessResponse - OK - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.document.add_collection( - collection_name="collectionName", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}", - method="POST", - json={"description": description, "metadata": metadata}, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def delete_collection( - self, collection_name: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> ApidataSuccessResponse: - """ - If a collection with the same name already exists, it will be overwritten. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSuccessResponse - OK - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.document.delete_collection( - collection_name="collectionName", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}", method="DELETE", request_options=request_options - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def update_collection( - self, - collection_name: str, - *, - description: typing.Optional[str] = OMIT, - metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataSuccessResponse: - """ - Updates a DocumentCollection - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - description : typing.Optional[str] - - metadata : typing.Optional[typing.Dict[str, typing.Any]] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSuccessResponse - OK - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.document.update_collection( - collection_name="collectionName", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}", - method="PATCH", - json={"description": description, "metadata": metadata}, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def add_documents( - self, - collection_name: str, - *, - request: typing.Sequence[CreateDocumentRequest], - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.List[typing.List[str]]: - """ - Creates Documents in a specified DocumentCollection and returns their UUIDs. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - request : typing.Sequence[CreateDocumentRequest] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - typing.List[typing.List[str]] - OK - - Examples - -------- - from zep_python import CreateDocumentRequest - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.document.add_documents( - collection_name="collectionName", - request=[ - CreateDocumentRequest( - content="content", - ) - ], - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}/documents", - method="POST", - json=request, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(typing.List[typing.List[str]], _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def batch_delete_documents( - self, - collection_name: str, - *, - request: typing.Sequence[str], - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataSuccessResponse: - """ - Deletes specified Documents from a DocumentCollection. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - request : typing.Sequence[str] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSuccessResponse - OK - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.document.batch_delete_documents( - collection_name="collectionName", - request=["string"], - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}/documents/batchDelete", - method="POST", - json=request, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def batch_get_documents( - self, - collection_name: str, - *, - document_ids: typing.Optional[typing.Sequence[str]] = OMIT, - uuids: typing.Optional[typing.Sequence[str]] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.List[typing.List[ApidataDocument]]: - """ - Returns Documents from a DocumentCollection specified by UUID or ID. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - document_ids : typing.Optional[typing.Sequence[str]] - - uuids : typing.Optional[typing.Sequence[str]] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - typing.List[typing.List[ApidataDocument]] - OK - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.document.batch_get_documents( - collection_name="collectionName", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}/documents/batchGet", - method="POST", - json={"document_ids": document_ids, "uuids": uuids}, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(typing.List[typing.List[ApidataDocument]], _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def batch_update_documents( - self, - collection_name: str, - *, - request: typing.Sequence[UpdateDocumentListRequest], - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataSuccessResponse: - """ - Updates Documents in a specified DocumentCollection. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - request : typing.Sequence[UpdateDocumentListRequest] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSuccessResponse - OK - - Examples - -------- - from zep_python import UpdateDocumentListRequest - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.document.batch_update_documents( - collection_name="collectionName", - request=[ - UpdateDocumentListRequest( - uuid_="uuid", - ) - ], - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}/documents/batchUpdate", - method="PATCH", - json=request, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def gets_a_document_from_a_document_collection_by_uuid( - self, collection_name: str, document_uuid: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> ApidataDocument: - """ - Returns specified Document from a DocumentCollection. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - document_uuid : str - UUID of the Document to be updated - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataDocument - OK - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.document.gets_a_document_from_a_document_collection_by_uuid( - collection_name="collectionName", - document_uuid="documentUUID", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}/documents/uuid/{jsonable_encoder(document_uuid)}", - method="GET", - request_options=request_options, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataDocument, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def delete_document( - self, collection_name: str, document_uuid: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> ApidataSuccessResponse: - """ - Delete specified Document from a DocumentCollection. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - document_uuid : str - UUID of the Document to be deleted - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSuccessResponse - OK - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.document.delete_document( - collection_name="collectionName", - document_uuid="documentUUID", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}/documents/uuid/{jsonable_encoder(document_uuid)}", - method="DELETE", - request_options=request_options, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def updates_a_document( - self, - collection_name: str, - document_uuid: str, - *, - document_id: typing.Optional[str] = OMIT, - metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataSuccessResponse: - """ - Updates a Document in a DocumentCollection by UUID - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - document_uuid : str - UUID of the Document to be updated - - document_id : typing.Optional[str] - - metadata : typing.Optional[typing.Dict[str, typing.Any]] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSuccessResponse - OK - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.document.updates_a_document( - collection_name="collectionName", - document_uuid="documentUUID", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}/documents/uuid/{jsonable_encoder(document_uuid)}", - method="PATCH", - json={"document_id": document_id, "metadata": metadata}, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def search( - self, - collection_name: str, - *, - limit: typing.Optional[int] = None, - metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, - min_score: typing.Optional[float] = OMIT, - mmr_lambda: typing.Optional[float] = OMIT, - search_type: typing.Optional[SearchType] = OMIT, - text: typing.Optional[str] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataDocumentSearchResponse: - """ - Searches over documents in a collection based on provided search criteria. One of text or metadata must be provided. Returns an empty list if no documents are found. - - Parameters - ---------- - collection_name : str - Name of the Document Collection - - limit : typing.Optional[int] - Limit the number of returned documents - - metadata : typing.Optional[typing.Dict[str, typing.Any]] - Document metadata to filter on. - - min_score : typing.Optional[float] - - mmr_lambda : typing.Optional[float] - The lambda parameter for the MMR Reranking Algorithm. - - search_type : typing.Optional[SearchType] - The type of search to perform. Defaults to "similarity". Must be one of "similarity" or "mmr". - - text : typing.Optional[str] - The search text. - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataDocumentSearchResponse - OK - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.document.search( - collection_name="collectionName", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"collections/{jsonable_encoder(collection_name)}/search", - method="POST", - params={"limit": limit}, - json={ - "metadata": metadata, - "min_score": min_score, - "mmr_lambda": mmr_lambda, - "search_type": search_type, - "text": text, - }, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataDocumentSearchResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 401: - raise UnauthorizedError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/zep_python/errors/__init__.py b/src/zep_python/errors/__init__.py index 800ce534..100aa551 100644 --- a/src/zep_python/errors/__init__.py +++ b/src/zep_python/errors/__init__.py @@ -4,6 +4,5 @@ from .conflict_error import ConflictError from .internal_server_error import InternalServerError from .not_found_error import NotFoundError -from .unauthorized_error import UnauthorizedError -__all__ = ["BadRequestError", "ConflictError", "InternalServerError", "NotFoundError", "UnauthorizedError"] +__all__ = ["BadRequestError", "ConflictError", "InternalServerError", "NotFoundError"] diff --git a/src/zep_python/errors/unauthorized_error.py b/src/zep_python/errors/unauthorized_error.py deleted file mode 100644 index 84896bcc..00000000 --- a/src/zep_python/errors/unauthorized_error.py +++ /dev/null @@ -1,9 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ..core.api_error import ApiError -from ..types.apidata_api_error import ApidataApiError - - -class UnauthorizedError(ApiError): - def __init__(self, body: ApidataApiError): - super().__init__(status_code=401, body=body) diff --git a/src/zep_python/memory/client.py b/src/zep_python/memory/client.py index 6408e15f..ac224b00 100644 --- a/src/zep_python/memory/client.py +++ b/src/zep_python/memory/client.py @@ -13,28 +13,17 @@ from ..errors.internal_server_error import InternalServerError from ..errors.not_found_error import NotFoundError from ..types.apidata_api_error import ApidataApiError -from ..types.apidata_end_session_response import ApidataEndSessionResponse -from ..types.apidata_end_sessions_response import ApidataEndSessionsResponse from ..types.apidata_fact_response import ApidataFactResponse -from ..types.apidata_facts_response import ApidataFactsResponse from ..types.apidata_memory import ApidataMemory -from ..types.apidata_memory_search_result import ApidataMemorySearchResult from ..types.apidata_message import ApidataMessage from ..types.apidata_message_list_response import ApidataMessageListResponse -from ..types.apidata_new_fact import ApidataNewFact -from ..types.apidata_question import ApidataQuestion from ..types.apidata_session import ApidataSession -from ..types.apidata_session_classification import ApidataSessionClassification from ..types.apidata_session_list_response import ApidataSessionListResponse from ..types.apidata_session_search_response import ApidataSessionSearchResponse from ..types.apidata_success_response import ApidataSuccessResponse -from ..types.apidata_summary_list_response import ApidataSummaryListResponse -from ..types.classify_session_request import ClassifySessionRequest from ..types.fact_rating_instruction import FactRatingInstruction from ..types.memory_type import MemoryType from ..types.message import Message -from ..types.search_scope import SearchScope -from ..types.search_type import SearchType # this is used as the default value for optional parameters OMIT = typing.cast(typing.Any, ...) @@ -262,62 +251,6 @@ def list_sessions( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - def end_sessions( - self, - *, - session_ids: typing.Sequence[str], - instruction: typing.Optional[str] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataEndSessionsResponse: - """ - End multiple sessions by their IDs - - Parameters - ---------- - session_ids : typing.Sequence[str] - - instruction : typing.Optional[str] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataEndSessionsResponse - OK - - Examples - -------- - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.memory.end_sessions( - session_ids=["session_ids"], - ) - """ - _response = self._client_wrapper.httpx_client.request( - "sessions/end", - method="POST", - json={"instruction": instruction, "session_ids": session_ids}, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataEndSessionsResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - def search_sessions( self, *, @@ -484,47 +417,35 @@ def update_session( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - def classify_session( + def get( self, session_id: str, *, - classes: typing.Sequence[str], - name: str, - instruction: typing.Optional[str] = OMIT, - last_n: typing.Optional[int] = OMIT, - persist: typing.Optional[bool] = OMIT, + lastn: typing.Optional[MemoryType] = None, + min_rating: typing.Optional[float] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataSessionClassification: + ) -> ApidataMemory: """ - classify a session by session id + Returns a memory (latest summary, list of messages and facts) for a given session Parameters ---------- session_id : str - Session ID - - classes : typing.Sequence[str] - The classes to use for classification. - - name : str - The name of the classifier. Will be used to store the classification in session metadata if persist is True. - - instruction : typing.Optional[str] - Custom instruction to use for classification. + The ID of the session for which to retrieve memory. - last_n : typing.Optional[int] - The number of session messages to consider for classification. Defaults to 4. + lastn : typing.Optional[MemoryType] + The number of most recent memory entries to retrieve. - persist : typing.Optional[bool] - Whether to persist the classification to session metadata. Defaults to True. + min_rating : typing.Optional[float] + The minimum rating by which to filter facts request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - ApidataSessionClassification - A response object containing the name and classification result. + ApidataMemory + OK Examples -------- @@ -533,21 +454,18 @@ def classify_session( client = Zep( api_key="YOUR_API_KEY", ) - client.memory.classify_session( + client.memory.get( session_id="sessionId", - classes=["classes"], - name="name", ) """ _response = self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/classify", - method="POST", - json={"classes": classes, "instruction": instruction, "last_n": last_n, "name": name, "persist": persist}, + f"sessions/{jsonable_encoder(session_id)}/memory", + method="GET", + params={"lastn": lastn, "minRating": min_rating}, request_options=request_options, - omit=OMIT, ) if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSessionClassification, _response.json()) # type: ignore + return pydantic_v1.parse_obj_as(ApidataMemory, _response.json()) # type: ignore if _response.status_code == 404: raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore if _response.status_code == 500: @@ -558,58 +476,54 @@ def classify_session( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - def end_session( + def add( self, session_id: str, *, - classify: typing.Optional[ClassifySessionRequest] = OMIT, - instruction: typing.Optional[str] = OMIT, + messages: typing.Sequence[Message], request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataEndSessionResponse: + ) -> ApidataSuccessResponse: """ - End a session by ID + Add memory to the specified session. Parameters ---------- session_id : str - Session ID - - classify : typing.Optional[ClassifySessionRequest] + The ID of the session to which memory should be added. - instruction : typing.Optional[str] + messages : typing.Sequence[Message] + A list of message objects, where each message contains a role and content. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - ApidataEndSessionResponse + ApidataSuccessResponse OK Examples -------- + from zep_python import Message from zep_python.client import Zep client = Zep( api_key="YOUR_API_KEY", ) - client.memory.end_session( + client.memory.add( session_id="sessionId", + messages=[Message()], ) """ _response = self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/end", + f"sessions/{jsonable_encoder(session_id)}/memory", method="POST", - json={"classify": classify, "instruction": instruction}, + json={"messages": messages}, request_options=request_options, omit=OMIT, ) if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataEndSessionResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore + return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore if _response.status_code == 500: raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore try: @@ -618,43 +532,23 @@ def end_session( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - def extract_data( - self, - session_id: str, - *, - last_n: int, - model_schema: str, - current_date_time: typing.Optional[str] = OMIT, - validate: typing.Optional[bool] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.Dict[str, str]: + def delete( + self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ApidataSuccessResponse: """ - extract data from a session by session id + delete memory messages by session id Parameters ---------- session_id : str - Session ID - - last_n : int - The number of messages in the chat history from which to extract data - - model_schema : str - The schema describing the data to be extracted. See Zep's SDKs for more details. - - current_date_time : typing.Optional[str] - Your current date and time in ISO 8601 format including timezone. This is used for determining relative dates. - - validate : typing.Optional[bool] - Validate that the extracted data is present in the dialog and correct per the field description. - Mitigates hallucination, but is slower and may result in false negatives. + The ID of the session for which memory should be deleted. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - typing.Dict[str, str] + ApidataSuccessResponse OK Examples @@ -664,28 +558,15 @@ def extract_data( client = Zep( api_key="YOUR_API_KEY", ) - client.memory.extract_data( + client.memory.delete( session_id="sessionId", - last_n=1, - model_schema="model_schema", ) """ _response = self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/extract", - method="POST", - json={ - "current_date_time": current_date_time, - "last_n": last_n, - "model_schema": model_schema, - "validate": validate, - }, - request_options=request_options, - omit=OMIT, + f"sessions/{jsonable_encoder(session_id)}/memory", method="DELETE", request_options=request_options ) if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(typing.Dict[str, str], _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore + return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore if _response.status_code == 404: raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore if _response.status_code == 500: @@ -696,31 +577,35 @@ def extract_data( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - def get_session_facts( + def get_session_messages( self, session_id: str, *, - min_rating: typing.Optional[float] = None, + limit: typing.Optional[int] = None, + cursor: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataFactsResponse: + ) -> ApidataMessageListResponse: """ - get facts for a session + Lists messages for a session, specified by limit and cursor. Parameters ---------- session_id : str Session ID - min_rating : typing.Optional[float] - Minimum rating by which to filter facts (Zep Cloud only) + limit : typing.Optional[int] + Limit the number of results returned + + cursor : typing.Optional[int] + Cursor for pagination request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - ApidataFactsResponse - The facts for the session. + ApidataMessageListResponse + OK Examples -------- @@ -729,18 +614,18 @@ def get_session_facts( client = Zep( api_key="YOUR_API_KEY", ) - client.memory.get_session_facts( + client.memory.get_session_messages( session_id="sessionId", ) """ _response = self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/facts", + f"sessions/{jsonable_encoder(session_id)}/messages", method="GET", - params={"minRating": min_rating}, + params={"limit": limit, "cursor": cursor}, request_options=request_options, ) if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataFactsResponse, _response.json()) # type: ignore + return pydantic_v1.parse_obj_as(ApidataMessageListResponse, _response.json()) # type: ignore if _response.status_code == 404: raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore if _response.status_code == 500: @@ -751,30 +636,27 @@ def get_session_facts( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - def add_session_facts( - self, - session_id: str, - *, - facts: typing.Optional[typing.Sequence[ApidataNewFact]] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataSuccessResponse: + def get_session_message( + self, session_id: str, message_uuid: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ApidataMessage: """ - Adds facts to a session + Gets a specific message from a session Parameters ---------- session_id : str - Session ID + The ID of the session. - facts : typing.Optional[typing.Sequence[ApidataNewFact]] + message_uuid : str + The UUID of the message. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - ApidataSuccessResponse - OK + ApidataMessage + The message. Examples -------- @@ -783,19 +665,18 @@ def add_session_facts( client = Zep( api_key="YOUR_API_KEY", ) - client.memory.add_session_facts( + client.memory.get_session_message( session_id="sessionId", + message_uuid="messageUUID", ) """ _response = self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/facts", - method="POST", - json={"facts": facts}, + f"sessions/{jsonable_encoder(session_id)}/messages/{jsonable_encoder(message_uuid)}", + method="GET", request_options=request_options, - omit=OMIT, ) if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore + return pydantic_v1.parse_obj_as(ApidataMessage, _response.json()) # type: ignore if _response.status_code == 404: raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore if _response.status_code == 500: @@ -806,35 +687,35 @@ def add_session_facts( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - def get( + def update_message_metadata( self, session_id: str, + message_uuid: str, *, - lastn: typing.Optional[MemoryType] = None, - min_rating: typing.Optional[float] = None, + metadata: typing.Dict[str, typing.Any], request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataMemory: + ) -> ApidataMessage: """ - Returns a memory (latest summary, list of messages and facts) for a given session + Updates the metadata of a message. Parameters ---------- session_id : str - The ID of the session for which to retrieve memory. + The ID of the session. - lastn : typing.Optional[MemoryType] - The number of most recent memory entries to retrieve. + message_uuid : str + The UUID of the message. - min_rating : typing.Optional[float] - The minimum rating by which to filter facts + metadata : typing.Dict[str, typing.Any] + The metadata to update request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - ApidataMemory - OK + ApidataMessage + The updated message. Examples -------- @@ -843,18 +724,21 @@ def get( client = Zep( api_key="YOUR_API_KEY", ) - client.memory.get( + client.memory.update_message_metadata( session_id="sessionId", + message_uuid="messageUUID", + metadata={}, ) """ _response = self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/memory", - method="GET", - params={"lastn": lastn, "minRating": min_rating}, + f"sessions/{jsonable_encoder(session_id)}/messages/{jsonable_encoder(message_uuid)}", + method="PATCH", + json={"metadata": metadata}, request_options=request_options, + omit=OMIT, ) if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataMemory, _response.json()) # type: ignore + return pydantic_v1.parse_obj_as(ApidataMessage, _response.json()) # type: ignore if _response.status_code == 404: raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore if _response.status_code == 500: @@ -865,54 +749,48 @@ def get( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - def add( - self, - session_id: str, - *, - messages: typing.Sequence[Message], - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataSuccessResponse: + +class AsyncMemoryClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_fact( + self, fact_uuid: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ApidataFactResponse: """ - Add memory to the specified session. + get fact by uuid Parameters ---------- - session_id : str - The ID of the session to which memory should be added. - - messages : typing.Sequence[Message] - A list of message objects, where each message contains a role and content. + fact_uuid : str + Fact UUID request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - ApidataSuccessResponse - OK + ApidataFactResponse + The fact with the specified UUID. Examples -------- - from zep_python import Message - from zep_python.client import Zep + from zep_python.client import AsyncZep - client = Zep( + client = AsyncZep( api_key="YOUR_API_KEY", ) - client.memory.add( - session_id="sessionId", - messages=[Message()], + await client.memory.get_fact( + fact_uuid="factUUID", ) """ - _response = self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/memory", - method="POST", - json={"messages": messages}, - request_options=request_options, - omit=OMIT, + _response = await self._client_wrapper.httpx_client.request( + f"facts/{jsonable_encoder(fact_uuid)}", method="GET", request_options=request_options ) if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore + return pydantic_v1.parse_obj_as(ApidataFactResponse, _response.json()) # type: ignore + if _response.status_code == 404: + raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore if _response.status_code == 500: raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore try: @@ -921,652 +799,22 @@ def add( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - def delete( - self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> ApidataSuccessResponse: + async def delete_fact(self, fact_uuid: str, *, request_options: typing.Optional[RequestOptions] = None) -> str: """ - delete memory messages by session id + delete a fact Parameters ---------- - session_id : str - The ID of the session for which memory should be deleted. + fact_uuid : str + Fact UUID request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - ApidataSuccessResponse - OK - - Examples - -------- - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.memory.delete( - session_id="sessionId", - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/memory", method="DELETE", request_options=request_options - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def get_session_messages( - self, - session_id: str, - *, - limit: typing.Optional[int] = None, - cursor: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataMessageListResponse: - """ - Lists messages for a session, specified by limit and cursor. - - Parameters - ---------- - session_id : str - Session ID - - limit : typing.Optional[int] - Limit the number of results returned - - cursor : typing.Optional[int] - Cursor for pagination - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataMessageListResponse - OK - - Examples - -------- - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.memory.get_session_messages( - session_id="sessionId", - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/messages", - method="GET", - params={"limit": limit, "cursor": cursor}, - request_options=request_options, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataMessageListResponse, _response.json()) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def get_session_message( - self, session_id: str, message_uuid: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> ApidataMessage: - """ - Gets a specific message from a session - - Parameters - ---------- - session_id : str - The ID of the session. - - message_uuid : str - The UUID of the message. - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataMessage - The message. - - Examples - -------- - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.memory.get_session_message( - session_id="sessionId", - message_uuid="messageUUID", - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/messages/{jsonable_encoder(message_uuid)}", - method="GET", - request_options=request_options, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataMessage, _response.json()) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def update_message_metadata( - self, - session_id: str, - message_uuid: str, - *, - metadata: typing.Dict[str, typing.Any], - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataMessage: - """ - Updates the metadata of a message. - - Parameters - ---------- - session_id : str - The ID of the session. - - message_uuid : str - The UUID of the message. - - metadata : typing.Dict[str, typing.Any] - The metadata to update - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataMessage - The updated message. - - Examples - -------- - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.memory.update_message_metadata( - session_id="sessionId", - message_uuid="messageUUID", - metadata={}, - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/messages/{jsonable_encoder(message_uuid)}", - method="PATCH", - json={"metadata": metadata}, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataMessage, _response.json()) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def search( - self, - session_id: str, - *, - limit: typing.Optional[int] = None, - metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, - min_score: typing.Optional[float] = OMIT, - mmr_lambda: typing.Optional[float] = OMIT, - search_scope: typing.Optional[SearchScope] = OMIT, - search_type: typing.Optional[SearchType] = OMIT, - text: typing.Optional[str] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.List[ApidataMemorySearchResult]: - """ - Search memory for the specified session. - - Parameters - ---------- - session_id : str - The ID of the session for which memory should be searched. - - limit : typing.Optional[int] - The maximum number of search results to return. Defaults to None (no limit). - - metadata : typing.Optional[typing.Dict[str, typing.Any]] - Metadata Filter - - min_score : typing.Optional[float] - - mmr_lambda : typing.Optional[float] - - search_scope : typing.Optional[SearchScope] - - search_type : typing.Optional[SearchType] - - text : typing.Optional[str] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - typing.List[ApidataMemorySearchResult] - A list of SearchResult objects representing the search results. - - Examples - -------- - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.memory.search( - session_id="sessionId", - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/search", - method="POST", - params={"limit": limit}, - json={ - "metadata": metadata, - "min_score": min_score, - "mmr_lambda": mmr_lambda, - "search_scope": search_scope, - "search_type": search_type, - "text": text, - }, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(typing.List[ApidataMemorySearchResult], _response.json()) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def get_summaries( - self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> ApidataSummaryListResponse: - """ - Get session summaries by ID - - Parameters - ---------- - session_id : str - Session ID - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSummaryListResponse - OK - - Examples - -------- - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.memory.get_summaries( - session_id="sessionId", - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/summary", method="GET", request_options=request_options - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSummaryListResponse, _response.json()) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def synthesize_question( - self, - session_id: str, - *, - last_n_messages: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataQuestion: - """ - Synthesize a question from the last N messages in the chat history. - - Parameters - ---------- - session_id : str - The ID of the session. - - last_n_messages : typing.Optional[int] - The number of messages to use for question synthesis. - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataQuestion - The synthesized question. - - Examples - -------- - from zep_python.client import Zep - - client = Zep( - api_key="YOUR_API_KEY", - ) - client.memory.synthesize_question( - session_id="sessionId", - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/synthesize_question", - method="GET", - params={"lastNMessages": last_n_messages}, - request_options=request_options, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataQuestion, _response.json()) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncMemoryClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def get_fact( - self, fact_uuid: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> ApidataFactResponse: - """ - get fact by uuid - - Parameters - ---------- - fact_uuid : str - Fact UUID - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataFactResponse - The fact with the specified UUID. - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.memory.get_fact( - fact_uuid="factUUID", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"facts/{jsonable_encoder(fact_uuid)}", method="GET", request_options=request_options - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataFactResponse, _response.json()) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def delete_fact(self, fact_uuid: str, *, request_options: typing.Optional[RequestOptions] = None) -> str: - """ - delete a fact - - Parameters - ---------- - fact_uuid : str - Fact UUID - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - str - Deleted - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.memory.delete_fact( - fact_uuid="factUUID", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"facts/{jsonable_encoder(fact_uuid)}", method="DELETE", request_options=request_options - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(str, _response.json()) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def add_session( - self, - *, - session_id: str, - fact_rating_instruction: typing.Optional[FactRatingInstruction] = OMIT, - metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, - user_id: typing.Optional[str] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataSession: - """ - Create New Session - - Parameters - ---------- - session_id : str - The unique identifier of the session. - - fact_rating_instruction : typing.Optional[FactRatingInstruction] - Optional instruction to use for fact rating. - - metadata : typing.Optional[typing.Dict[str, typing.Any]] - The metadata associated with the session. - - user_id : typing.Optional[str] - The unique identifier of the user associated with the session - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSession - The added session. - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.memory.add_session( - session_id="session_id", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "sessions", - method="POST", - json={ - "fact_rating_instruction": fact_rating_instruction, - "metadata": metadata, - "session_id": session_id, - "user_id": user_id, - }, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSession, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def list_sessions( - self, - *, - page_number: typing.Optional[int] = None, - page_size: typing.Optional[int] = None, - order_by: typing.Optional[str] = None, - asc: typing.Optional[bool] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataSessionListResponse: - """ - Get all sessions with optional page number, page size, order by field and order direction for pagination. - - Parameters - ---------- - page_number : typing.Optional[int] - Page number for pagination, starting from 1 - - page_size : typing.Optional[int] - Number of sessions to retrieve per page - - order_by : typing.Optional[str] - Field to order the results by: created_at, updated_at, user_id, session_id - - asc : typing.Optional[bool] - Order direction: true for ascending, false for descending - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSessionListResponse - List of sessions - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.memory.list_sessions() - """ - _response = await self._client_wrapper.httpx_client.request( - "sessions-ordered", - method="GET", - params={"page_number": page_number, "page_size": page_size, "order_by": order_by, "asc": asc}, - request_options=request_options, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSessionListResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def end_sessions( - self, - *, - session_ids: typing.Sequence[str], - instruction: typing.Optional[str] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataEndSessionsResponse: - """ - End multiple sessions by their IDs - - Parameters - ---------- - session_ids : typing.Sequence[str] - - instruction : typing.Optional[str] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataEndSessionsResponse - OK + str + Deleted Examples -------- @@ -1575,21 +823,15 @@ async def end_sessions( client = AsyncZep( api_key="YOUR_API_KEY", ) - await client.memory.end_sessions( - session_ids=["session_ids"], + await client.memory.delete_fact( + fact_uuid="factUUID", ) """ _response = await self._client_wrapper.httpx_client.request( - "sessions/end", - method="POST", - json={"instruction": instruction, "session_ids": session_ids}, - request_options=request_options, - omit=OMIT, + f"facts/{jsonable_encoder(fact_uuid)}", method="DELETE", request_options=request_options ) if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataEndSessionsResponse, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore + return pydantic_v1.parse_obj_as(str, _response.json()) # type: ignore if _response.status_code == 404: raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore if _response.status_code == 500: @@ -1600,213 +842,39 @@ async def end_sessions( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - async def search_sessions( + async def add_session( self, *, - limit: typing.Optional[int] = None, - text: typing.Optional[str] = OMIT, - user_id: typing.Optional[str] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataSessionSearchResponse: - """ - Search sessions for the specified query. - - Parameters - ---------- - limit : typing.Optional[int] - The maximum number of search results to return. Defaults to None (no limit). - - text : typing.Optional[str] - - user_id : typing.Optional[str] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSessionSearchResponse - A SessionSearchResponse object representing the search results. - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.memory.search_sessions() - """ - _response = await self._client_wrapper.httpx_client.request( - "sessions/search", - method="POST", - params={"limit": limit}, - json={"text": text, "user_id": user_id}, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSessionSearchResponse, _response.json()) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def get_session( - self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> ApidataSession: - """ - get session by id - - Parameters - ---------- - session_id : str - Session ID - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSession - The session with the specified ID. - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.memory.get_session( - session_id="sessionId", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}", method="GET", request_options=request_options - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSession, _response.json()) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def update_session( - self, session_id: str, - *, - metadata: typing.Dict[str, typing.Any], fact_rating_instruction: typing.Optional[FactRatingInstruction] = OMIT, + metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, + user_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> ApidataSession: """ - Update Session Metadata + Create New Session Parameters ---------- session_id : str - Session ID - - metadata : typing.Dict[str, typing.Any] - The metadata to update + The unique identifier of the session. fact_rating_instruction : typing.Optional[FactRatingInstruction] Optional instruction to use for fact rating. - Fact rating instructions can not be unset. - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSession - The updated session. - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.memory.update_session( - session_id="sessionId", - metadata={}, - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}", - method="PATCH", - json={"fact_rating_instruction": fact_rating_instruction, "metadata": metadata}, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSession, _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 409: - raise ConflictError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def classify_session( - self, - session_id: str, - *, - classes: typing.Sequence[str], - name: str, - instruction: typing.Optional[str] = OMIT, - last_n: typing.Optional[int] = OMIT, - persist: typing.Optional[bool] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataSessionClassification: - """ - classify a session by session id - - Parameters - ---------- - session_id : str - Session ID - - classes : typing.Sequence[str] - The classes to use for classification. - - name : str - The name of the classifier. Will be used to store the classification in session metadata if persist is True. - - instruction : typing.Optional[str] - Custom instruction to use for classification. - last_n : typing.Optional[int] - The number of session messages to consider for classification. Defaults to 4. + metadata : typing.Optional[typing.Dict[str, typing.Any]] + The metadata associated with the session. - persist : typing.Optional[bool] - Whether to persist the classification to session metadata. Defaults to True. + user_id : typing.Optional[str] + The unique identifier of the user associated with the session request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - ApidataSessionClassification - A response object containing the name and classification result. + ApidataSession + The added session. Examples -------- @@ -1815,23 +883,26 @@ async def classify_session( client = AsyncZep( api_key="YOUR_API_KEY", ) - await client.memory.classify_session( - session_id="sessionId", - classes=["classes"], - name="name", + await client.memory.add_session( + session_id="session_id", ) """ _response = await self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/classify", + "sessions", method="POST", - json={"classes": classes, "instruction": instruction, "last_n": last_n, "name": name, "persist": persist}, + json={ + "fact_rating_instruction": fact_rating_instruction, + "metadata": metadata, + "session_id": session_id, + "user_id": user_id, + }, request_options=request_options, omit=OMIT, ) if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSessionClassification, _response.json()) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore + return pydantic_v1.parse_obj_as(ApidataSession, _response.json()) # type: ignore + if _response.status_code == 400: + raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore if _response.status_code == 500: raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore try: @@ -1840,33 +911,39 @@ async def classify_session( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - async def end_session( + async def list_sessions( self, - session_id: str, *, - classify: typing.Optional[ClassifySessionRequest] = OMIT, - instruction: typing.Optional[str] = OMIT, + page_number: typing.Optional[int] = None, + page_size: typing.Optional[int] = None, + order_by: typing.Optional[str] = None, + asc: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataEndSessionResponse: + ) -> ApidataSessionListResponse: """ - End a session by ID + Get all sessions with optional page number, page size, order by field and order direction for pagination. Parameters ---------- - session_id : str - Session ID + page_number : typing.Optional[int] + Page number for pagination, starting from 1 + + page_size : typing.Optional[int] + Number of sessions to retrieve per page - classify : typing.Optional[ClassifySessionRequest] + order_by : typing.Optional[str] + Field to order the results by: created_at, updated_at, user_id, session_id - instruction : typing.Optional[str] + asc : typing.Optional[bool] + Order direction: true for ascending, false for descending request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - ApidataEndSessionResponse - OK + ApidataSessionListResponse + List of sessions Examples -------- @@ -1875,23 +952,18 @@ async def end_session( client = AsyncZep( api_key="YOUR_API_KEY", ) - await client.memory.end_session( - session_id="sessionId", - ) + await client.memory.list_sessions() """ _response = await self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/end", - method="POST", - json={"classify": classify, "instruction": instruction}, + "sessions-ordered", + method="GET", + params={"page_number": page_number, "page_size": page_size, "order_by": order_by, "asc": asc}, request_options=request_options, - omit=OMIT, ) if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataEndSessionResponse, _response.json()) # type: ignore + return pydantic_v1.parse_obj_as(ApidataSessionListResponse, _response.json()) # type: ignore if _response.status_code == 400: raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore if _response.status_code == 500: raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore try: @@ -1900,44 +972,33 @@ async def end_session( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - async def extract_data( + async def search_sessions( self, - session_id: str, *, - last_n: int, - model_schema: str, - current_date_time: typing.Optional[str] = OMIT, - validate: typing.Optional[bool] = OMIT, + limit: typing.Optional[int] = None, + text: typing.Optional[str] = OMIT, + user_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> typing.Dict[str, str]: + ) -> ApidataSessionSearchResponse: """ - extract data from a session by session id + Search sessions for the specified query. Parameters ---------- - session_id : str - Session ID - - last_n : int - The number of messages in the chat history from which to extract data - - model_schema : str - The schema describing the data to be extracted. See Zep's SDKs for more details. + limit : typing.Optional[int] + The maximum number of search results to return. Defaults to None (no limit). - current_date_time : typing.Optional[str] - Your current date and time in ISO 8601 format including timezone. This is used for determining relative dates. + text : typing.Optional[str] - validate : typing.Optional[bool] - Validate that the extracted data is present in the dialog and correct per the field description. - Mitigates hallucination, but is slower and may result in false negatives. + user_id : typing.Optional[str] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - typing.Dict[str, str] - OK + ApidataSessionSearchResponse + A SessionSearchResponse object representing the search results. Examples -------- @@ -1946,30 +1007,18 @@ async def extract_data( client = AsyncZep( api_key="YOUR_API_KEY", ) - await client.memory.extract_data( - session_id="sessionId", - last_n=1, - model_schema="model_schema", - ) + await client.memory.search_sessions() """ _response = await self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/extract", + "sessions/search", method="POST", - json={ - "current_date_time": current_date_time, - "last_n": last_n, - "model_schema": model_schema, - "validate": validate, - }, + params={"limit": limit}, + json={"text": text, "user_id": user_id}, request_options=request_options, omit=OMIT, ) if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(typing.Dict[str, str], _response.json()) # type: ignore - if _response.status_code == 400: - raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore + return pydantic_v1.parse_obj_as(ApidataSessionSearchResponse, _response.json()) # type: ignore if _response.status_code == 500: raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore try: @@ -1978,31 +1027,24 @@ async def extract_data( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - async def get_session_facts( - self, - session_id: str, - *, - min_rating: typing.Optional[float] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataFactsResponse: + async def get_session( + self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ApidataSession: """ - get facts for a session + get session by id Parameters ---------- session_id : str Session ID - min_rating : typing.Optional[float] - Minimum rating by which to filter facts (Zep Cloud only) - request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - ApidataFactsResponse - The facts for the session. + ApidataSession + The session with the specified ID. Examples -------- @@ -2011,18 +1053,15 @@ async def get_session_facts( client = AsyncZep( api_key="YOUR_API_KEY", ) - await client.memory.get_session_facts( + await client.memory.get_session( session_id="sessionId", ) """ _response = await self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/facts", - method="GET", - params={"minRating": min_rating}, - request_options=request_options, + f"sessions/{jsonable_encoder(session_id)}", method="GET", request_options=request_options ) if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataFactsResponse, _response.json()) # type: ignore + return pydantic_v1.parse_obj_as(ApidataSession, _response.json()) # type: ignore if _response.status_code == 404: raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore if _response.status_code == 500: @@ -2033,30 +1072,36 @@ async def get_session_facts( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - async def add_session_facts( + async def update_session( self, session_id: str, *, - facts: typing.Optional[typing.Sequence[ApidataNewFact]] = OMIT, + metadata: typing.Dict[str, typing.Any], + fact_rating_instruction: typing.Optional[FactRatingInstruction] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataSuccessResponse: + ) -> ApidataSession: """ - Adds facts to a session + Update Session Metadata Parameters ---------- session_id : str Session ID - facts : typing.Optional[typing.Sequence[ApidataNewFact]] + metadata : typing.Dict[str, typing.Any] + The metadata to update + + fact_rating_instruction : typing.Optional[FactRatingInstruction] + Optional instruction to use for fact rating. + Fact rating instructions can not be unset. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - ApidataSuccessResponse - OK + ApidataSession + The updated session. Examples -------- @@ -2065,21 +1110,26 @@ async def add_session_facts( client = AsyncZep( api_key="YOUR_API_KEY", ) - await client.memory.add_session_facts( + await client.memory.update_session( session_id="sessionId", + metadata={}, ) """ _response = await self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/facts", - method="POST", - json={"facts": facts}, + f"sessions/{jsonable_encoder(session_id)}", + method="PATCH", + json={"fact_rating_instruction": fact_rating_instruction, "metadata": metadata}, request_options=request_options, omit=OMIT, ) if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSuccessResponse, _response.json()) # type: ignore + return pydantic_v1.parse_obj_as(ApidataSession, _response.json()) # type: ignore + if _response.status_code == 400: + raise BadRequestError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore if _response.status_code == 404: raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore + if _response.status_code == 409: + raise ConflictError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore if _response.status_code == 500: raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore try: @@ -2419,186 +1469,3 @@ async def update_message_metadata( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - - async def search( - self, - session_id: str, - *, - limit: typing.Optional[int] = None, - metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, - min_score: typing.Optional[float] = OMIT, - mmr_lambda: typing.Optional[float] = OMIT, - search_scope: typing.Optional[SearchScope] = OMIT, - search_type: typing.Optional[SearchType] = OMIT, - text: typing.Optional[str] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.List[ApidataMemorySearchResult]: - """ - Search memory for the specified session. - - Parameters - ---------- - session_id : str - The ID of the session for which memory should be searched. - - limit : typing.Optional[int] - The maximum number of search results to return. Defaults to None (no limit). - - metadata : typing.Optional[typing.Dict[str, typing.Any]] - Metadata Filter - - min_score : typing.Optional[float] - - mmr_lambda : typing.Optional[float] - - search_scope : typing.Optional[SearchScope] - - search_type : typing.Optional[SearchType] - - text : typing.Optional[str] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - typing.List[ApidataMemorySearchResult] - A list of SearchResult objects representing the search results. - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.memory.search( - session_id="sessionId", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/search", - method="POST", - params={"limit": limit}, - json={ - "metadata": metadata, - "min_score": min_score, - "mmr_lambda": mmr_lambda, - "search_scope": search_scope, - "search_type": search_type, - "text": text, - }, - request_options=request_options, - omit=OMIT, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(typing.List[ApidataMemorySearchResult], _response.json()) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def get_summaries( - self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> ApidataSummaryListResponse: - """ - Get session summaries by ID - - Parameters - ---------- - session_id : str - Session ID - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataSummaryListResponse - OK - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.memory.get_summaries( - session_id="sessionId", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/summary", method="GET", request_options=request_options - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataSummaryListResponse, _response.json()) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def synthesize_question( - self, - session_id: str, - *, - last_n_messages: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> ApidataQuestion: - """ - Synthesize a question from the last N messages in the chat history. - - Parameters - ---------- - session_id : str - The ID of the session. - - last_n_messages : typing.Optional[int] - The number of messages to use for question synthesis. - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ApidataQuestion - The synthesized question. - - Examples - -------- - from zep_python.client import AsyncZep - - client = AsyncZep( - api_key="YOUR_API_KEY", - ) - await client.memory.synthesize_question( - session_id="sessionId", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - f"sessions/{jsonable_encoder(session_id)}/synthesize_question", - method="GET", - params={"lastNMessages": last_n_messages}, - request_options=request_options, - ) - if 200 <= _response.status_code < 300: - return pydantic_v1.parse_obj_as(ApidataQuestion, _response.json()) # type: ignore - if _response.status_code == 404: - raise NotFoundError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - if _response.status_code == 500: - raise InternalServerError(pydantic_v1.parse_obj_as(ApidataApiError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/zep_python/types/__init__.py b/src/zep_python/types/__init__.py index 47ec0191..5ec01507 100644 --- a/src/zep_python/types/__init__.py +++ b/src/zep_python/types/__init__.py @@ -1,27 +1,13 @@ # This file was auto-generated by Fern from our API Definition. -from .add_facts_request import AddFactsRequest -from .added_fact import AddedFact -from .api_error import ApiError from .apidata_api_error import ApidataApiError -from .apidata_document import ApidataDocument -from .apidata_document_collection import ApidataDocumentCollection -from .apidata_document_search_response import ApidataDocumentSearchResponse -from .apidata_document_with_score import ApidataDocumentWithScore -from .apidata_end_session_response import ApidataEndSessionResponse -from .apidata_end_sessions_response import ApidataEndSessionsResponse from .apidata_fact import ApidataFact from .apidata_fact_response import ApidataFactResponse -from .apidata_facts_response import ApidataFactsResponse from .apidata_memory import ApidataMemory -from .apidata_memory_search_result import ApidataMemorySearchResult from .apidata_message import ApidataMessage from .apidata_message_list_response import ApidataMessageListResponse -from .apidata_new_fact import ApidataNewFact -from .apidata_question import ApidataQuestion from .apidata_role_type import ApidataRoleType from .apidata_session import ApidataSession -from .apidata_session_classification import ApidataSessionClassification from .apidata_session_fact_rating_examples import ApidataSessionFactRatingExamples from .apidata_session_fact_rating_instruction import ApidataSessionFactRatingInstruction from .apidata_session_list_response import ApidataSessionListResponse @@ -29,66 +15,23 @@ from .apidata_session_search_result import ApidataSessionSearchResult from .apidata_success_response import ApidataSuccessResponse from .apidata_summary import ApidataSummary -from .apidata_summary_list_response import ApidataSummaryListResponse from .apidata_user import ApidataUser from .apidata_user_list_response import ApidataUserListResponse -from .classify_session_request import ClassifySessionRequest -from .classify_session_response import ClassifySessionResponse -from .create_document_request import CreateDocumentRequest -from .document_collection_response import DocumentCollectionResponse -from .document_response import DocumentResponse -from .document_search_result import DocumentSearchResult -from .document_search_result_page import DocumentSearchResultPage -from .end_session_response import EndSessionResponse -from .end_sessions_response import EndSessionsResponse -from .fact import Fact from .fact_rating_examples import FactRatingExamples from .fact_rating_instruction import FactRatingInstruction -from .fact_response import FactResponse -from .facts_response import FactsResponse -from .memory import Memory -from .memory_search_result import MemorySearchResult from .memory_type import MemoryType from .message import Message -from .message_list_response import MessageListResponse -from .question import Question from .role_type import RoleType -from .search_scope import SearchScope -from .search_type import SearchType -from .session import Session -from .session_list_response import SessionListResponse -from .session_search_response import SessionSearchResponse -from .session_search_result import SessionSearchResult -from .success_response import SuccessResponse -from .summary import Summary -from .summary_list_response import SummaryListResponse -from .update_document_list_request import UpdateDocumentListRequest -from .user import User -from .user_list_response import UserListResponse __all__ = [ - "AddFactsRequest", - "AddedFact", - "ApiError", "ApidataApiError", - "ApidataDocument", - "ApidataDocumentCollection", - "ApidataDocumentSearchResponse", - "ApidataDocumentWithScore", - "ApidataEndSessionResponse", - "ApidataEndSessionsResponse", "ApidataFact", "ApidataFactResponse", - "ApidataFactsResponse", "ApidataMemory", - "ApidataMemorySearchResult", "ApidataMessage", "ApidataMessageListResponse", - "ApidataNewFact", - "ApidataQuestion", "ApidataRoleType", "ApidataSession", - "ApidataSessionClassification", "ApidataSessionFactRatingExamples", "ApidataSessionFactRatingInstruction", "ApidataSessionListResponse", @@ -96,40 +39,11 @@ "ApidataSessionSearchResult", "ApidataSuccessResponse", "ApidataSummary", - "ApidataSummaryListResponse", "ApidataUser", "ApidataUserListResponse", - "ClassifySessionRequest", - "ClassifySessionResponse", - "CreateDocumentRequest", - "DocumentCollectionResponse", - "DocumentResponse", - "DocumentSearchResult", - "DocumentSearchResultPage", - "EndSessionResponse", - "EndSessionsResponse", - "Fact", "FactRatingExamples", "FactRatingInstruction", - "FactResponse", - "FactsResponse", - "Memory", - "MemorySearchResult", "MemoryType", "Message", - "MessageListResponse", - "Question", "RoleType", - "SearchScope", - "SearchType", - "Session", - "SessionListResponse", - "SessionSearchResponse", - "SessionSearchResult", - "SuccessResponse", - "Summary", - "SummaryListResponse", - "UpdateDocumentListRequest", - "User", - "UserListResponse", ] diff --git a/src/zep_python/types/add_facts_request.py b/src/zep_python/types/add_facts_request.py deleted file mode 100644 index 49ab3ac3..00000000 --- a/src/zep_python/types/add_facts_request.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AddFactsRequest = typing.Any diff --git a/src/zep_python/types/added_fact.py b/src/zep_python/types/added_fact.py deleted file mode 100644 index d9599b4b..00000000 --- a/src/zep_python/types/added_fact.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AddedFact = typing.Any diff --git a/src/zep_python/types/api_error.py b/src/zep_python/types/api_error.py deleted file mode 100644 index 17901342..00000000 --- a/src/zep_python/types/api_error.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ApiError = typing.Any diff --git a/src/zep_python/types/apidata_document.py b/src/zep_python/types/apidata_document.py deleted file mode 100644 index bded660f..00000000 --- a/src/zep_python/types/apidata_document.py +++ /dev/null @@ -1,38 +0,0 @@ -# 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 ApidataDocument(pydantic_v1.BaseModel): - content: typing.Optional[str] = None - created_at: typing.Optional[str] = None - document_id: typing.Optional[str] = None - embedding: typing.Optional[typing.List[float]] = None - is_embedded: typing.Optional[bool] = None - metadata: typing.Optional[typing.Dict[str, typing.Any]] = None - updated_at: typing.Optional[str] = None - uuid_: typing.Optional[str] = pydantic_v1.Field(alias="uuid", default=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 - allow_population_by_field_name = True - populate_by_name = True - extra = pydantic_v1.Extra.allow - json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/zep_python/types/apidata_document_collection.py b/src/zep_python/types/apidata_document_collection.py deleted file mode 100644 index ed61656b..00000000 --- a/src/zep_python/types/apidata_document_collection.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 ApidataDocumentCollection(pydantic_v1.BaseModel): - created_at: typing.Optional[str] = None - description: typing.Optional[str] = None - document_count: typing.Optional[int] = None - document_embedded_count: typing.Optional[int] = None - embedding_dimensions: typing.Optional[int] = None - embedding_model_name: typing.Optional[str] = None - is_auto_embedded: typing.Optional[bool] = None - is_indexed: typing.Optional[bool] = None - is_normalized: typing.Optional[bool] = None - metadata: typing.Optional[typing.Dict[str, typing.Any]] = None - name: typing.Optional[str] = None - updated_at: typing.Optional[str] = None - uuid_: typing.Optional[str] = pydantic_v1.Field(alias="uuid", default=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 - allow_population_by_field_name = True - populate_by_name = True - extra = pydantic_v1.Extra.allow - json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/zep_python/types/apidata_document_search_response.py b/src/zep_python/types/apidata_document_search_response.py deleted file mode 100644 index 4a81051f..00000000 --- a/src/zep_python/types/apidata_document_search_response.py +++ /dev/null @@ -1,34 +0,0 @@ -# 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 -from .apidata_document_with_score import ApidataDocumentWithScore - - -class ApidataDocumentSearchResponse(pydantic_v1.BaseModel): - current_page: typing.Optional[int] = None - query_vector: typing.Optional[typing.List[float]] = None - result_count: typing.Optional[int] = None - results: typing.Optional[typing.List[ApidataDocumentWithScore]] = None - total_pages: typing.Optional[int] = 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_python/types/apidata_document_with_score.py b/src/zep_python/types/apidata_document_with_score.py deleted file mode 100644 index 33691f40..00000000 --- a/src/zep_python/types/apidata_document_with_score.py +++ /dev/null @@ -1,39 +0,0 @@ -# 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 ApidataDocumentWithScore(pydantic_v1.BaseModel): - content: typing.Optional[str] = None - created_at: typing.Optional[str] = None - document_id: typing.Optional[str] = None - embedding: typing.Optional[typing.List[float]] = None - is_embedded: typing.Optional[bool] = None - metadata: typing.Optional[typing.Dict[str, typing.Any]] = None - score: typing.Optional[float] = None - updated_at: typing.Optional[str] = None - uuid_: typing.Optional[str] = pydantic_v1.Field(alias="uuid", default=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 - allow_population_by_field_name = True - populate_by_name = True - extra = pydantic_v1.Extra.allow - json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/zep_python/types/apidata_end_session_response.py b/src/zep_python/types/apidata_end_session_response.py deleted file mode 100644 index a1ee27e3..00000000 --- a/src/zep_python/types/apidata_end_session_response.py +++ /dev/null @@ -1,32 +0,0 @@ -# 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 -from .apidata_session import ApidataSession -from .apidata_session_classification import ApidataSessionClassification - - -class ApidataEndSessionResponse(pydantic_v1.BaseModel): - classification: typing.Optional[ApidataSessionClassification] = None - session: typing.Optional[ApidataSession] = 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_python/types/apidata_end_sessions_response.py b/src/zep_python/types/apidata_end_sessions_response.py deleted file mode 100644 index 4b187ab9..00000000 --- a/src/zep_python/types/apidata_end_sessions_response.py +++ /dev/null @@ -1,30 +0,0 @@ -# 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 -from .apidata_session import ApidataSession - - -class ApidataEndSessionsResponse(pydantic_v1.BaseModel): - sessions: typing.Optional[typing.List[ApidataSession]] = 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_python/types/apidata_facts_response.py b/src/zep_python/types/apidata_facts_response.py deleted file mode 100644 index 2474e7f1..00000000 --- a/src/zep_python/types/apidata_facts_response.py +++ /dev/null @@ -1,30 +0,0 @@ -# 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 -from .apidata_fact import ApidataFact - - -class ApidataFactsResponse(pydantic_v1.BaseModel): - facts: typing.Optional[typing.List[ApidataFact]] = 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_python/types/apidata_memory_search_result.py b/src/zep_python/types/apidata_memory_search_result.py deleted file mode 100644 index dea60564..00000000 --- a/src/zep_python/types/apidata_memory_search_result.py +++ /dev/null @@ -1,32 +0,0 @@ -# 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 -from .apidata_message import ApidataMessage - - -class ApidataMemorySearchResult(pydantic_v1.BaseModel): - message: typing.Optional[ApidataMessage] = None - metadata: typing.Optional[typing.Dict[str, typing.Any]] = None - score: typing.Optional[float] = 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_python/types/apidata_new_fact.py b/src/zep_python/types/apidata_new_fact.py deleted file mode 100644 index c396e05a..00000000 --- a/src/zep_python/types/apidata_new_fact.py +++ /dev/null @@ -1,29 +0,0 @@ -# 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 ApidataNewFact(pydantic_v1.BaseModel): - fact: 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_python/types/apidata_question.py b/src/zep_python/types/apidata_question.py deleted file mode 100644 index 53240f27..00000000 --- a/src/zep_python/types/apidata_question.py +++ /dev/null @@ -1,29 +0,0 @@ -# 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 ApidataQuestion(pydantic_v1.BaseModel): - question: 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_python/types/apidata_session_classification.py b/src/zep_python/types/apidata_session_classification.py deleted file mode 100644 index b6b13077..00000000 --- a/src/zep_python/types/apidata_session_classification.py +++ /dev/null @@ -1,32 +0,0 @@ -# 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 ApidataSessionClassification(pydantic_v1.BaseModel): - class_: typing.Optional[str] = pydantic_v1.Field(alias="class", default=None) - label: 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 - allow_population_by_field_name = True - populate_by_name = True - extra = pydantic_v1.Extra.allow - json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/zep_python/types/apidata_summary_list_response.py b/src/zep_python/types/apidata_summary_list_response.py deleted file mode 100644 index b1636c73..00000000 --- a/src/zep_python/types/apidata_summary_list_response.py +++ /dev/null @@ -1,32 +0,0 @@ -# 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 -from .apidata_summary import ApidataSummary - - -class ApidataSummaryListResponse(pydantic_v1.BaseModel): - row_count: typing.Optional[int] = None - summaries: typing.Optional[typing.List[ApidataSummary]] = None - total_count: typing.Optional[int] = 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_python/types/classify_session_request.py b/src/zep_python/types/classify_session_request.py deleted file mode 100644 index bf71227f..00000000 --- a/src/zep_python/types/classify_session_request.py +++ /dev/null @@ -1,52 +0,0 @@ -# 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 ClassifySessionRequest(pydantic_v1.BaseModel): - classes: typing.List[str] = pydantic_v1.Field() - """ - The classes to use for classification. - """ - - instruction: typing.Optional[str] = pydantic_v1.Field(default=None) - """ - Custom instruction to use for classification. - """ - - last_n: typing.Optional[int] = pydantic_v1.Field(default=None) - """ - The number of session messages to consider for classification. Defaults to 4. - """ - - name: str = pydantic_v1.Field() - """ - The name of the classifier. Will be used to store the classification in session metadata if persist is True. - """ - - persist: typing.Optional[bool] = pydantic_v1.Field(default=None) - """ - Whether to persist the classification to session metadata. Defaults to True. - """ - - 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_python/types/classify_session_response.py b/src/zep_python/types/classify_session_response.py deleted file mode 100644 index 88e2f7bc..00000000 --- a/src/zep_python/types/classify_session_response.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ClassifySessionResponse = typing.Any diff --git a/src/zep_python/types/create_document_request.py b/src/zep_python/types/create_document_request.py deleted file mode 100644 index 16d68ebe..00000000 --- a/src/zep_python/types/create_document_request.py +++ /dev/null @@ -1,31 +0,0 @@ -# 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 CreateDocumentRequest(pydantic_v1.BaseModel): - content: str - document_id: typing.Optional[str] = None - metadata: typing.Optional[typing.Dict[str, typing.Any]] = 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_python/types/document_collection_response.py b/src/zep_python/types/document_collection_response.py deleted file mode 100644 index 4714734f..00000000 --- a/src/zep_python/types/document_collection_response.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -DocumentCollectionResponse = typing.Any diff --git a/src/zep_python/types/document_response.py b/src/zep_python/types/document_response.py deleted file mode 100644 index d728d249..00000000 --- a/src/zep_python/types/document_response.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -DocumentResponse = typing.Any diff --git a/src/zep_python/types/document_search_result.py b/src/zep_python/types/document_search_result.py deleted file mode 100644 index 93a8a754..00000000 --- a/src/zep_python/types/document_search_result.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -DocumentSearchResult = typing.Any diff --git a/src/zep_python/types/document_search_result_page.py b/src/zep_python/types/document_search_result_page.py deleted file mode 100644 index d8d2a15a..00000000 --- a/src/zep_python/types/document_search_result_page.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -DocumentSearchResultPage = typing.Any diff --git a/src/zep_python/types/end_session_response.py b/src/zep_python/types/end_session_response.py deleted file mode 100644 index 0e00b7de..00000000 --- a/src/zep_python/types/end_session_response.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -EndSessionResponse = typing.Any diff --git a/src/zep_python/types/end_sessions_response.py b/src/zep_python/types/end_sessions_response.py deleted file mode 100644 index 8347d0eb..00000000 --- a/src/zep_python/types/end_sessions_response.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -EndSessionsResponse = typing.Any diff --git a/src/zep_python/types/fact.py b/src/zep_python/types/fact.py deleted file mode 100644 index 60e26818..00000000 --- a/src/zep_python/types/fact.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -Fact = typing.Any diff --git a/src/zep_python/types/fact_response.py b/src/zep_python/types/fact_response.py deleted file mode 100644 index 6a13f0d2..00000000 --- a/src/zep_python/types/fact_response.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -FactResponse = typing.Any diff --git a/src/zep_python/types/facts_response.py b/src/zep_python/types/facts_response.py deleted file mode 100644 index 51b90a64..00000000 --- a/src/zep_python/types/facts_response.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -FactsResponse = typing.Any diff --git a/src/zep_python/types/memory.py b/src/zep_python/types/memory.py deleted file mode 100644 index cbd900cb..00000000 --- a/src/zep_python/types/memory.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -Memory = typing.Any diff --git a/src/zep_python/types/memory_search_result.py b/src/zep_python/types/memory_search_result.py deleted file mode 100644 index cdbe5499..00000000 --- a/src/zep_python/types/memory_search_result.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -MemorySearchResult = typing.Any diff --git a/src/zep_python/types/message_list_response.py b/src/zep_python/types/message_list_response.py deleted file mode 100644 index 86a501a7..00000000 --- a/src/zep_python/types/message_list_response.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -MessageListResponse = typing.Any diff --git a/src/zep_python/types/question.py b/src/zep_python/types/question.py deleted file mode 100644 index 589b5123..00000000 --- a/src/zep_python/types/question.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -Question = typing.Any diff --git a/src/zep_python/types/search_scope.py b/src/zep_python/types/search_scope.py deleted file mode 100644 index daca0fcc..00000000 --- a/src/zep_python/types/search_scope.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -SearchScope = typing.Union[typing.Literal["messages", "summary", "facts"], typing.Any] diff --git a/src/zep_python/types/search_type.py b/src/zep_python/types/search_type.py deleted file mode 100644 index bd349723..00000000 --- a/src/zep_python/types/search_type.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -SearchType = typing.Union[typing.Literal["similarity", "mmr"], typing.Any] diff --git a/src/zep_python/types/session.py b/src/zep_python/types/session.py deleted file mode 100644 index 85a26035..00000000 --- a/src/zep_python/types/session.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -Session = typing.Any diff --git a/src/zep_python/types/session_list_response.py b/src/zep_python/types/session_list_response.py deleted file mode 100644 index db3e630a..00000000 --- a/src/zep_python/types/session_list_response.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -SessionListResponse = typing.Any diff --git a/src/zep_python/types/session_search_response.py b/src/zep_python/types/session_search_response.py deleted file mode 100644 index d3a5590b..00000000 --- a/src/zep_python/types/session_search_response.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -SessionSearchResponse = typing.Any diff --git a/src/zep_python/types/session_search_result.py b/src/zep_python/types/session_search_result.py deleted file mode 100644 index 07819cc1..00000000 --- a/src/zep_python/types/session_search_result.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -SessionSearchResult = typing.Any diff --git a/src/zep_python/types/success_response.py b/src/zep_python/types/success_response.py deleted file mode 100644 index ad265044..00000000 --- a/src/zep_python/types/success_response.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -SuccessResponse = typing.Any diff --git a/src/zep_python/types/summary.py b/src/zep_python/types/summary.py deleted file mode 100644 index 8ed4b638..00000000 --- a/src/zep_python/types/summary.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -Summary = typing.Any diff --git a/src/zep_python/types/summary_list_response.py b/src/zep_python/types/summary_list_response.py deleted file mode 100644 index 5b240144..00000000 --- a/src/zep_python/types/summary_list_response.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -SummaryListResponse = typing.Any diff --git a/src/zep_python/types/update_document_list_request.py b/src/zep_python/types/update_document_list_request.py deleted file mode 100644 index 928194c4..00000000 --- a/src/zep_python/types/update_document_list_request.py +++ /dev/null @@ -1,33 +0,0 @@ -# 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 UpdateDocumentListRequest(pydantic_v1.BaseModel): - document_id: typing.Optional[str] = None - metadata: typing.Optional[typing.Dict[str, typing.Any]] = None - uuid_: str = pydantic_v1.Field(alias="uuid") - - 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 - allow_population_by_field_name = True - populate_by_name = True - extra = pydantic_v1.Extra.allow - json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/zep_python/types/user.py b/src/zep_python/types/user.py deleted file mode 100644 index 6c01a30b..00000000 --- a/src/zep_python/types/user.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -User = typing.Any diff --git a/src/zep_python/types/user_list_response.py b/src/zep_python/types/user_list_response.py deleted file mode 100644 index b51f5949..00000000 --- a/src/zep_python/types/user_list_response.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -UserListResponse = typing.Any