├── .fernignore ├── .github └── workflows │ ├── ci.yml │ └── release-cloud.yml ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── examples ├── autogen-agent │ └── agent.ipynb ├── chat_history │ ├── chat_history_shoe_purchase.py │ └── memory.py ├── ecommerce-chainlit │ ├── .chainlit │ │ ├── config.toml │ │ └── translations │ │ │ ├── en-US.json │ │ │ └── pt-BR.json │ ├── README.md │ ├── app.py │ ├── chainlit.md │ ├── chat_history_shoe_purchase.py │ ├── ingest.py │ ├── poetry.lock │ ├── public │ │ ├── logo_dark.png │ │ └── logo_light.png │ ├── pyproject.toml │ └── shoe_data.py ├── graph_example │ ├── conversations.py │ ├── entity_types.py │ ├── group_graph_example.py │ ├── tickets_example.py │ └── user_graph_example.py ├── langgraph-agent │ └── agent.ipynb ├── openai-agents-sdk │ ├── README.md │ ├── openai_agents_sdk_example.py │ ├── pyproject.toml │ └── uv.lock ├── quickstart │ └── quickstart.ipynb └── user_example.py ├── poetry.lock ├── pyproject.toml ├── reference.md ├── src └── zep_cloud │ ├── __init__.py │ ├── base_client.py │ ├── client.py │ ├── core │ ├── __init__.py │ ├── api_error.py │ ├── client_wrapper.py │ ├── datetime_utils.py │ ├── file.py │ ├── http_client.py │ ├── jsonable_encoder.py │ ├── pydantic_utilities.py │ ├── query_encoder.py │ ├── remove_none_from_dict.py │ └── request_options.py │ ├── document │ ├── __init__.py │ └── client.py │ ├── environment.py │ ├── errors │ ├── __init__.py │ ├── bad_request_error.py │ ├── conflict_error.py │ ├── internal_server_error.py │ ├── not_found_error.py │ └── unauthorized_error.py │ ├── external_clients │ ├── document.py │ ├── graph.py │ ├── memory.py │ ├── ontology.py │ └── user.py │ ├── extractor │ ├── __init__.py │ └── models.py │ ├── graph │ ├── __init__.py │ ├── client.py │ ├── edge │ │ ├── __init__.py │ │ └── client.py │ ├── episode │ │ ├── __init__.py │ │ └── client.py │ └── node │ │ ├── __init__.py │ │ └── client.py │ ├── group │ ├── __init__.py │ └── client.py │ ├── memory │ ├── __init__.py │ └── client.py │ ├── py.typed │ ├── types │ ├── __init__.py │ ├── add_memory_response.py │ ├── add_triple_response.py │ ├── api_error.py │ ├── apidata_document.py │ ├── apidata_document_collection.py │ ├── apidata_document_search_response.py │ ├── apidata_document_with_score.py │ ├── classify_session_request.py │ ├── create_document_request.py │ ├── edge_type.py │ ├── end_session_response.py │ ├── end_sessions_response.py │ ├── entity_edge.py │ ├── entity_edge_source_target.py │ ├── entity_node.py │ ├── entity_property.py │ ├── entity_property_type.py │ ├── entity_type.py │ ├── entity_type_response.py │ ├── episode.py │ ├── episode_data.py │ ├── episode_response.py │ ├── fact.py │ ├── fact_rating_examples.py │ ├── fact_rating_instruction.py │ ├── fact_response.py │ ├── facts_response.py │ ├── graph_data_type.py │ ├── graph_edges_request.py │ ├── graph_nodes_request.py │ ├── graph_search_results.py │ ├── graph_search_scope.py │ ├── group.py │ ├── group_list_response.py │ ├── memory.py │ ├── memory_search_result.py │ ├── message.py │ ├── message_list_response.py │ ├── new_fact.py │ ├── question.py │ ├── reranker.py │ ├── role_type.py │ ├── search_filters.py │ ├── search_scope.py │ ├── search_type.py │ ├── session.py │ ├── session_classification.py │ ├── session_list_response.py │ ├── session_search_response.py │ ├── session_search_result.py │ ├── success_response.py │ ├── summary.py │ ├── summary_list_response.py │ ├── update_document_list_request.py │ ├── user.py │ ├── user_list_response.py │ └── user_node_response.py │ ├── user │ ├── __init__.py │ └── client.py │ └── version.py └── tests ├── custom └── test_client.py └── utils ├── test_http_client.py └── test_query_encoding.py /.fernignore: -------------------------------------------------------------------------------- 1 | # Specify files that shouldn't be modified by Fern 2 | src/zep_cloud/client.py 3 | src/zep_cloud/external_clients/ 4 | src/zep_cloud/extractor/ 5 | examples/ 6 | src/zep_cloud/langchain/ 7 | pyproject.toml 8 | poetry.lock 9 | README.md 10 | .github 11 | Makefile 12 | .gitignore 13 | LICENSE -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: ci 2 | 3 | on: [push] 4 | jobs: 5 | compile: 6 | runs-on: ubuntu-24.04 7 | steps: 8 | - name: Checkout repo 9 | uses: actions/checkout@v4 10 | - name: Set up python 11 | uses: actions/setup-python@v5 12 | with: 13 | python-version: 3.9 14 | - name: Bootstrap poetry 15 | run: | 16 | curl -sSL https://install.python-poetry.org | python - -y --version 1.8.3 17 | - name: Install dependencies 18 | run: poetry install 19 | - name: Compile 20 | run: poetry run mypy . --exclude examples 21 | test: 22 | runs-on: ubuntu-24.04 23 | steps: 24 | - name: Checkout repo 25 | uses: actions/checkout@v4 26 | - name: Set up python 27 | uses: actions/setup-python@v5 28 | with: 29 | python-version: 3.9 30 | - name: Bootstrap poetry 31 | run: | 32 | curl -sSL https://install.python-poetry.org | python - -y --version 1.8.3 33 | - name: Install dependencies 34 | run: poetry install 35 | - name: Test 36 | run: poetry run pytest . 37 | -------------------------------------------------------------------------------- /.github/workflows/release-cloud.yml: -------------------------------------------------------------------------------- 1 | name: Release Cloud SDK to PyPI 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | env: 8 | POETRY_VERSION: "1.8.3" 9 | 10 | jobs: 11 | release: 12 | runs-on: ubuntu-latest 13 | if: github.event.release.target_commitish == 'main' 14 | permissions: 15 | id-token: write 16 | contents: write 17 | environment: 18 | name: release 19 | url: https://pypi.org/p/zep-cloud 20 | steps: 21 | - uses: actions/checkout@v4 22 | - name: Install poetry 23 | run: pipx install poetry==$POETRY_VERSION 24 | - name: Set up Python 3.10 25 | uses: actions/setup-python@v5 26 | with: 27 | python-version: "3.10" 28 | cache: "poetry" 29 | - name: Compare pyproject version with tag 30 | run: | 31 | TAG_VERSION=${GITHUB_REF#refs/tags/} 32 | if [ "$TAG_VERSION" != "v$(poetry version --short)" ]; then 33 | echo "Tag version $TAG_VERSION does not match the project version $(poetry version --short)" 34 | exit 1 35 | fi 36 | - name: Build project for distribution 37 | run: poetry build 38 | - name: Publish package distributions to PyPI 39 | uses: pypa/gh-action-pypi-publish@release/v1 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | dist/ 3 | .mypy_cache/ 4 | __pycache__/ 5 | poetry.toml 6 | .idea/ 7 | .vscode/ 8 | *.env 9 | .venv/ 10 | venv/ 11 | .cache/ -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all format lint test coverage 2 | 3 | all: help 4 | 5 | coverage: 6 | poetry run pytest --cov \ 7 | --cov-config=.coveragerc \ 8 | --cov-report xml \ 9 | --cov-report term-missing:skip-covered 10 | 11 | format: 12 | poetry run ruff check --select I --fix . 13 | poetry run ruff format . 14 | 15 | lint: 16 | poetry run mypy --exclude tests src/ 17 | poetry run ruff check src/ 18 | 19 | test: 20 | poetry run pytest tests -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | [![Release to PyPI](https://github.com/getzep/zep-python/actions/workflows/release.yml/badge.svg)](https://github.com/getzep/zep-python/actions/workflows/release.yml) ![GitHub](https://img.shields.io/github/license/getzep/zep-python?color=blue) [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern) 3 | 4 | 5 |

6 | 7 | Zep Logo 8 | 9 |

10 | 11 |

12 | Zep: Long-Term Memory for ‍AI Assistants. 13 |

14 |

Recall, understand, and extract data from chat histories. Power personalized AI experiences.

15 |
16 | 17 |

18 | Quick Start | 19 | Documentation | 20 | LangChain and 21 | LlamaIndex Support | 22 | Discord
23 | www.getzep.com 24 |

25 | 26 | ## What is Zep? 💬 27 | Zep is a long-term memory service for AI Assistant apps. With Zep, you can provide AI assistants with the ability to recall past conversations, no matter how distant, while also reducing hallucinations, latency, and cost. 28 | 29 | ### Cloud Installation 30 | You can install the Zep Cloud SDK by running: 31 | ```bash 32 | pip install zep-cloud 33 | ``` 34 | > [!NOTE] 35 | > Zep Cloud [overview](https://help.getzep.com/concepts) and [cloud sdk guide](https://help.getzep.com/sdks). 36 | 37 | ### Community Installation 38 | ```bash 39 | pip install zep-python 40 | ``` 41 | > [!NOTE] 42 | > Zep Community Edition [quick start](https://help.getzep.com/ce/quickstart) and [sdk guide](https://help.getzep.com/ce/sdks). 43 | 44 | ### Zep v0.x Compatible SDK 45 | You can install Zep v0.x compatible sdk by running: 46 | ```bash 47 | pip install "zep-python>=1.5.0,<2.0.0" 48 | ``` 49 | > [!NOTE] 50 | > Zep v0.x [quick start](https://help.getzep.com/ce/legacy/deployment/quickstart) and [sdk guide](https://help.getzep.com/ce/legacy/sdk). 51 | 52 | ### How Zep works 53 | 54 | Zep persists and recalls chat histories, and automatically generates summaries and other artifacts from these chat histories. It also embeds messages and summaries, enabling you to search Zep for relevant context from past conversations. Zep does all of this asynchronously, ensuring these operations don't impact your user's chat experience. Data is persisted to database, allowing you to scale out when growth demands. 55 | 56 | Zep also provides a simple, easy to use abstraction for document vector search called Document Collections. This is designed to complement Zep's core memory features, but is not designed to be a general purpose vector database. 57 | 58 | Zep allows you to be more intentional about constructing your prompt: 59 | 1. automatically adding a few recent messages, with the number customized for your app; 60 | 2. a summary of recent conversations prior to the messages above; 61 | 3. and/or contextually relevant summaries or messages surfaced from the entire chat session. 62 | 4. and/or relevant Business data from Zep Document Collections. 63 | 64 | Zep Cloud offers: 65 | - **Fact Extraction:** Automatically build fact tables from conversations, without having to define a data schema upfront. 66 | - **Dialog Classification:** Instantly and accurately classify chat dialog. Understand user intent and emotion, segment users, and more. Route chains based on semantic context, and trigger events. 67 | - **Structured Data Extraction:** Quickly extract business data from chat conversations using a schema you define. Understand what your Assistant should ask for next in order to complete its task. 68 | 69 | You will also need to provide a Zep Project API key to your zep client. 70 | You can find out about zep projects in our [cloud docs](https://help.getzep.com/projects.html) 71 | 72 | ### Using LangChain Zep Classes with `zep-python` 73 | 74 | (Currently only available on release candidate versions) 75 | 76 | In the pre-release version `zep-python` sdk comes with `ZepChatMessageHistory` and `ZepVectorStore` 77 | classes that are compatible with [LangChain's Python expression language](https://python.langchain.com/docs/expression_language/) 78 | 79 | In order to use these classes in your application, you need to make sure that you have 80 | `langchain_core` package installed, please refer to [Langchain's docs installation section](https://python.langchain.com/docs/get_started/installation#langchain-core). 81 | 82 | We support `langchain_core@>=0.1.3<0.2.0` 83 | 84 | You can import these classes in the following way: 85 | 86 | ```python 87 | from zep_cloud.langchain import ZepChatMessageHistory, ZepVectorStore 88 | ``` 89 | 90 | ### Running Examples 91 | You will need to set the following environment variables to run examples in the `examples` directory: 92 | 93 | ```dotenv 94 | # Please use examples/.env.example as a template for .env file 95 | 96 | # Required 97 | ZEP_API_KEY=# Your Zep Project API Key 98 | ZEP_COLLECTION=# used in ingestion script and in vector store examples 99 | OPENAI_API_KEY=# Your OpenAI API Key 100 | 101 | # Optional (If you want to use langsmith with LangServe Sample App) 102 | LANGCHAIN_TRACING_V2=true 103 | LANGCHAIN_API_KEY= 104 | LANGCHAIN_PROJECT=# If not specified, defaults to "default" 105 | ``` 106 | 107 | 108 | -------------------------------------------------------------------------------- /examples/chat_history/chat_history_shoe_purchase.py: -------------------------------------------------------------------------------- 1 | history = [ 2 | { 3 | "role": "Jane", 4 | "role_type": "user", 5 | "content": ( 6 | "Hi there, I'm looking for a new pair of shoes. I'm not sure where" 7 | " to start." 8 | ), 9 | }, 10 | { 11 | "role": "assistant", 12 | "role_type": "assistant", 13 | "content": ( 14 | "Hello! I'd be happy to help you find the perfect pair of shoes. To" 15 | " get started, could you tell me what brand you're interested in," 16 | " or if you're open to any brand?" 17 | ), 18 | }, 19 | { 20 | "role": "Jane", 21 | "role_type": "user", 22 | "content": "I like Nike and Adidas, but I'm open to other brands too.", 23 | }, 24 | { 25 | "role": "assistant", 26 | "role_type": "assistant", 27 | "content": ( 28 | "That's great! It's important to find the right shoe for your" 29 | " needs. Could you tell me what you'll be using these shoes for" 30 | " mainly? For example, are they for running, basketball, or casual" 31 | " wear?" 32 | ), 33 | }, 34 | { 35 | "role": "Jane", 36 | "role_type": "user", 37 | "content": "I'll be using them for running.", 38 | }, 39 | { 40 | "role": "assistant", 41 | "role_type": "assistant", 42 | "content": ( 43 | "Fantastic! Now, could you please provide me with your shoe size" 44 | " and foot width? This information will help me narrow down the" 45 | " options for you." 46 | ), 47 | }, 48 | { 49 | "role": "Jane", 50 | "role_type": "user", 51 | "content": ("I wear a men's size 10, and I'm not sure about the foot width."), 52 | }, 53 | { 54 | "role": "assistant", 55 | "role_type": "assistant", 56 | "content": ( 57 | "Thank you. Based on your size, I'll make sure to suggest shoes" 58 | " with a wide range of sizes and widths available." 59 | ), 60 | }, 61 | { 62 | "role": "Jane", 63 | "role_type": "user", 64 | "content": ( 65 | "I have a bit of a pronation issue. Do I need to consider that" 66 | " while choosing shoes?" 67 | ), 68 | }, 69 | { 70 | "role": "assistant", 71 | "role_type": "assistant", 72 | "content": ( 73 | "Yes, pronation is essential when choosing running shoes. It refers" 74 | " to the way your foot rolls inward or outward when you walk or" 75 | " run. For pronation issues, stability or motion control shoes are" 76 | " usually recommended. I'll make sure to consider this in my" 77 | " suggestions." 78 | ), 79 | }, 80 | { 81 | "role": "Jane", 82 | "role_type": "user", 83 | "content": "Great, I have a budget of around $120.", 84 | }, 85 | { 86 | "role": "assistant", 87 | "role_type": "assistant", 88 | "content": ( 89 | "Perfect! I'll make sure to find the best running shoes that fit" 90 | " your preferences, taking into account your brand preferences," 91 | " running needs, size, and budget." 92 | ), 93 | }, 94 | { 95 | "role": "assistant", 96 | "role_type": "assistant", 97 | "content": ( 98 | "I've found a few great options for you. The first one is the" 99 | " Brooks Ghost 14, which is known for its cushioning and support," 100 | " ideal for runners with pronation issues. It's available in your" 101 | " size, and it's within your budget." 102 | ), 103 | "metadata": {"bar": "foo"}, 104 | }, 105 | { 106 | "role": "Jane", 107 | "role_type": "user", 108 | "content": ( 109 | "I've heard good things about Brooks, but I was kind of hoping to" 110 | " get a Nike or an Adidas shoe." 111 | ), 112 | }, 113 | { 114 | "role": "assistant", 115 | "role_type": "assistant", 116 | "content": ( 117 | "I understand. In that case, I'd recommend the Adidas Ultraboost" 118 | " 21. It's a popular choice among runners for its comfort, energy" 119 | " return, and stability. Plus, it's on sale at $129.99 today," 120 | " almost within your budget." 121 | ), 122 | }, 123 | { 124 | "role": "Jane", 125 | "role_type": "user", 126 | "content": "They're nice looking. Yes, I think I'll go with those.", 127 | }, 128 | { 129 | "role": "assistant", 130 | "role_type": "assistant", 131 | "content": ( 132 | "Excellent choice! To complete the purchase, I'll need you to" 133 | " provide your credit card information in our secure payment form." 134 | " This will allow us to process your order and ensure a smooth" 135 | " delivery." 136 | ), 137 | }, 138 | ] -------------------------------------------------------------------------------- /examples/chat_history/memory.py: -------------------------------------------------------------------------------- 1 | """ 2 | Example of using the Zep Python SDK asynchronously. 3 | 4 | This script demonstrates the following functionality: 5 | - Creating a user. 6 | - Creating a session associated with the created user. 7 | - Adding messages to the session. 8 | - Searching the session memory for a specific query. 9 | - Searching the session memory with MMR reranking. 10 | - Searching the session memory with a metadata filter. 11 | - optionally deleting the session. 12 | """ 13 | 14 | import asyncio 15 | import os 16 | import uuid 17 | 18 | from dotenv import find_dotenv, load_dotenv 19 | 20 | from chat_history_shoe_purchase import history 21 | 22 | from zep_cloud.client import AsyncZep 23 | from zep_cloud.types import Message, FactRatingInstruction, FactRatingExamples 24 | 25 | load_dotenv( 26 | dotenv_path=find_dotenv() 27 | ) # load environment variables from .env file, if present 28 | 29 | API_KEY = os.environ.get("ZEP_API_KEY") or "YOUR_API_KEY" 30 | 31 | 32 | async def main() -> None: 33 | client = AsyncZep( 34 | api_key=API_KEY, 35 | ) 36 | 37 | # Create a user 38 | user_id = uuid.uuid4().hex # unique user id. can be any alphanum string 39 | fact_rating_instruction = """Rate the facts by poignancy. Highly poignant 40 | facts have a significant emotional impact or relevance to the user. 41 | Facts with low poignancy are minimally relevant or of little emotional 42 | significance.""" 43 | fact_rating_examples = FactRatingExamples( 44 | high="The user received news of a family member's serious illness.", 45 | medium="The user completed a challenging marathon.", 46 | low="The user bought a new brand of toothpaste.", 47 | ) 48 | await client.user.add( 49 | user_id=user_id, 50 | email="user@example.com", 51 | first_name="Jane", 52 | last_name="Smith", 53 | metadata={"vip": "true"}, 54 | ) 55 | 56 | # await asyncio.sleep(1) 57 | print(f"User added: {user_id}") 58 | session_id = uuid.uuid4().hex # unique session id. can be any alphanum string 59 | 60 | # Create session associated with the above user 61 | print(f"\n---Creating session: {session_id}") 62 | 63 | await client.memory.add_session( 64 | session_id=session_id, 65 | user_id=user_id, 66 | metadata={"foo": "bar"}, 67 | ) 68 | # await asyncio.sleep(1) 69 | # Update session metadata 70 | print(f"\n---Updating session: {session_id}") 71 | await client.memory.update_session(session_id=session_id, metadata={"bar": "foo"}) 72 | # await asyncio.sleep(3) 73 | # Get session 74 | print(f"\n---Getting session: {session_id}") 75 | session = await client.memory.get_session(session_id) 76 | print(f"Session details: {session}") 77 | # await asyncio.sleep(3) 78 | 79 | # Add Memory for session 80 | print(f"\n---Add Memory for Session: {session_id}") 81 | for m in history: 82 | print(f"{m['role']}: {m['content']}") 83 | await client.memory.add(session_id=session_id, messages=[Message(**m)]) 84 | # await asyncio.sleep(0.5) 85 | 86 | # Wait for the messages to be processed 87 | await asyncio.sleep(50) 88 | 89 | # Synthesize a question from most recent messages. 90 | # Useful for RAG apps. This is faster than using an LLM chain. 91 | print("\n---Synthesize a question from most recent messages") 92 | question = await client.memory.synthesize_question(session_id, last_n_messages=3) 93 | print(f"Question: {question}") 94 | 95 | # Classify the session. 96 | # Useful for semantic routing, filtering, and many other use cases. 97 | print("\n---Classify the session") 98 | classes = [ 99 | "low spender <$50", 100 | "medium spender >=$50, <$100", 101 | "high spender >=$100", 102 | "unknown", 103 | ] 104 | classification = await client.memory.classify_session( 105 | session_id, name="spender_category", classes=classes, persist=True 106 | ) 107 | print(f"Classification: {classification}") 108 | 109 | # Get Memory for session 110 | print(f"\n---Get Perpetual Memory for Session: {session_id}") 111 | memory = await client.memory.get(session_id) 112 | print(f"Memory: {memory}") 113 | print("\n---End of Memory") 114 | 115 | print(f"Memory context: {memory.context}") 116 | 117 | # Delete Memory for session 118 | # Uncomment to run 119 | # print(f"\n6---deleteMemory for Session: {session_id}") 120 | # await client.memory.delete(session_id) 121 | 122 | 123 | if __name__ == "__main__": 124 | asyncio.run(main()) -------------------------------------------------------------------------------- /examples/ecommerce-chainlit/.chainlit/config.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | # Whether to enable telemetry (default: true). No personal data is collected. 3 | enable_telemetry = false 4 | 5 | 6 | # List of environment variables to be provided by each user to use the app. 7 | user_env = [] 8 | 9 | # Duration (in seconds) during which the session is saved when the connection is lost 10 | session_timeout = 3600 11 | 12 | # Enable third parties caching (e.g LangChain cache) 13 | cache = false 14 | 15 | # Authorized origins 16 | allow_origins = ["*"] 17 | 18 | # Follow symlink for asset mount (see https://github.com/Chainlit/chainlit/issues/317) 19 | # follow_symlink = false 20 | 21 | [features] 22 | # Show the prompt playground 23 | prompt_playground = true 24 | 25 | # Process and display HTML in messages. This can be a security risk (see https://stackoverflow.com/questions/19603097/why-is-it-dangerous-to-render-user-generated-html-or-javascript) 26 | unsafe_allow_html = false 27 | 28 | # Process and display mathematical expressions. This can clash with "$" characters in messages. 29 | latex = false 30 | 31 | # Authorize users to upload files with messages 32 | multi_modal = true 33 | 34 | # Allows user to use speech to text 35 | [features.speech_to_text] 36 | enabled = false 37 | # See all languages here https://github.com/JamesBrill/react-speech-recognition/blob/HEAD/docs/API.md#language-string 38 | # language = "en-US" 39 | 40 | [UI] 41 | # Name of the app and chatbot. 42 | name = "Amazing Shoe Salesbot" 43 | 44 | # Show the readme while the thread is empty. 45 | show_readme_as_default = false 46 | 47 | # Description of the app and chatbot. This is used for HTML tags. 48 | # description = "" 49 | 50 | # Large size content are by default collapsed for a cleaner ui 51 | default_collapse_content = true 52 | 53 | # The default value for the expand messages settings. 54 | default_expand_messages = false 55 | 56 | # Hide the chain of thought details from the user in the UI. 57 | hide_cot = false 58 | 59 | # Link to your github repo. This will add a github button in the UI's header. 60 | # github = "" 61 | 62 | # Specify a CSS file that can be used to customize the user interface. 63 | # The CSS file can be served from the public directory or via an external link. 64 | # custom_css = "/public/test.css" 65 | 66 | # Specify a Javascript file that can be used to customize the user interface. 67 | # The Javascript file can be served from the public directory. 68 | # custom_js = "/public/test.js" 69 | 70 | # Specify a custom font url. 71 | # custom_font = "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap" 72 | 73 | # Override default MUI light theme. (Check theme.ts) 74 | [UI.theme] 75 | #font_family = "Inter, sans-serif" 76 | [UI.theme.light] 77 | #background = "#FAFAFA" 78 | #paper = "#FFFFFF" 79 | 80 | [UI.theme.light.primary] 81 | #main = "#F80061" 82 | #dark = "#980039" 83 | #light = "#FFE7EB" 84 | 85 | # Override default MUI dark theme. (Check theme.ts) 86 | [UI.theme.dark] 87 | #background = "#FAFAFA" 88 | #paper = "#FFFFFF" 89 | 90 | [UI.theme.dark.primary] 91 | #main = "#F80061" 92 | #dark = "#980039" 93 | #light = "#FFE7EB" 94 | 95 | 96 | [meta] 97 | generated_by = "1.0.301" 98 | -------------------------------------------------------------------------------- /examples/ecommerce-chainlit/.chainlit/translations/en-US.json: -------------------------------------------------------------------------------- 1 | { 2 | "components": { 3 | "atoms": { 4 | "buttons": { 5 | "userButton": { 6 | "menu": { 7 | "settings": "Settings", 8 | "settingsKey": "S", 9 | "APIKeys": "API Keys", 10 | "logout": "Logout" 11 | } 12 | } 13 | } 14 | }, 15 | "molecules": { 16 | "newChatButton": { 17 | "newChat": "New Chat" 18 | }, 19 | "tasklist": { 20 | "TaskList": { 21 | "title": "\ud83d\uddd2\ufe0f Task List", 22 | "loading": "Loading...", 23 | "error": "An error occured" 24 | } 25 | }, 26 | "attachments": { 27 | "cancelUpload": "Cancel upload", 28 | "removeAttachment": "Remove attachment" 29 | }, 30 | "newChatDialog": { 31 | "createNewChat": "Create new chat?", 32 | "clearChat": "This will clear the current messages and start a new chat.", 33 | "cancel": "Cancel", 34 | "confirm": "Confirm" 35 | }, 36 | "settingsModal": { 37 | "expandMessages": "Expand Messages", 38 | "hideChainOfThought": "Hide Chain of Thought", 39 | "darkMode": "Dark Mode" 40 | } 41 | }, 42 | "organisms": { 43 | "chat": { 44 | "history": { 45 | "index": { 46 | "lastInputs": "Last Inputs", 47 | "noInputs": "Such empty...", 48 | "loading": "Loading..." 49 | } 50 | }, 51 | "inputBox": { 52 | "input": { 53 | "placeholder": "Type your message here..." 54 | }, 55 | "speechButton": { 56 | "start": "Start recording", 57 | "stop": "Stop recording" 58 | }, 59 | "SubmitButton": { 60 | "sendMessage": "Send message", 61 | "stopTask": "Stop Task" 62 | }, 63 | "UploadButton": { 64 | "attachFiles": "Attach files" 65 | }, 66 | "waterMark": { 67 | "text": "Built with" 68 | } 69 | }, 70 | "Messages": { 71 | "index": { 72 | "running": "Running", 73 | "executedSuccessfully": "executed successfully", 74 | "failed": "failed", 75 | "feedbackUpdated": "Feedback updated", 76 | "updating": "Updating" 77 | } 78 | }, 79 | "dropScreen": { 80 | "dropYourFilesHere": "Drop your files here" 81 | }, 82 | "index": { 83 | "failedToUpload": "Failed to upload", 84 | "cancelledUploadOf": "Cancelled upload of", 85 | "couldNotReachServer": "Could not reach the server", 86 | "continuingChat": "Continuing previous chat" 87 | }, 88 | "settings": { 89 | "settingsPanel": "Settings panel", 90 | "reset": "Reset", 91 | "cancel": "Cancel", 92 | "confirm": "Confirm" 93 | } 94 | }, 95 | "threadHistory": { 96 | "sidebar": { 97 | "filters": { 98 | "FeedbackSelect": { 99 | "feedbackAll": "Feedback: All", 100 | "feedbackPositive": "Feedback: Positive", 101 | "feedbackNegative": "Feedback: Negative" 102 | }, 103 | "SearchBar": { 104 | "search": "Search" 105 | } 106 | }, 107 | "DeleteThreadButton": { 108 | "confirmMessage": "This will delete the thread as well as it's messages and elements.", 109 | "cancel": "Cancel", 110 | "confirm": "Confirm", 111 | "deletingChat": "Deleting chat", 112 | "chatDeleted": "Chat deleted" 113 | }, 114 | "index": { 115 | "pastChats": "Past Chats" 116 | }, 117 | "ThreadList": { 118 | "empty": "Empty..." 119 | }, 120 | "TriggerButton": { 121 | "closeSidebar": "Close sidebar", 122 | "openSidebar": "Open sidebar" 123 | } 124 | }, 125 | "Thread": { 126 | "backToChat": "Go back to chat", 127 | "chatCreatedOn": "This chat was created on" 128 | } 129 | }, 130 | "header": { 131 | "chat": "Chat", 132 | "readme": "Readme" 133 | } 134 | } 135 | }, 136 | "hooks": { 137 | "useLLMProviders": { 138 | "failedToFetchProviders": "Failed to fetch providers:" 139 | } 140 | }, 141 | "pages": { 142 | "Design": {}, 143 | "Env": { 144 | "savedSuccessfully": "Saved successfully", 145 | "requiredApiKeys": "Required API Keys", 146 | "requiredApiKeysInfo": "To use this app, the following API keys are required. The keys are stored on your device's local storage." 147 | }, 148 | "Page": { 149 | "notPartOfProject": "You are not part of this project." 150 | }, 151 | "ResumeButton": { 152 | "resumeChat": "Resume Chat" 153 | } 154 | } 155 | } -------------------------------------------------------------------------------- /examples/ecommerce-chainlit/.chainlit/translations/pt-BR.json: -------------------------------------------------------------------------------- 1 | { 2 | "components": { 3 | "atoms": { 4 | "buttons": { 5 | "userButton": { 6 | "menu": { 7 | "settings": "Configura\u00e7\u00f5es", 8 | "settingsKey": "S", 9 | "APIKeys": "Chaves de API", 10 | "logout": "Sair" 11 | } 12 | } 13 | } 14 | }, 15 | "molecules": { 16 | "newChatButton": { 17 | "newChat": "Nova Conversa" 18 | }, 19 | "tasklist": { 20 | "TaskList": { 21 | "title": "\ud83d\uddd2\ufe0f Lista de Tarefas", 22 | "loading": "Carregando...", 23 | "error": "Ocorreu um erro" 24 | } 25 | }, 26 | "attachments": { 27 | "cancelUpload": "Cancelar envio", 28 | "removeAttachment": "Remover anexo" 29 | }, 30 | "newChatDialog": { 31 | "createNewChat": "Criar novo chat?", 32 | "clearChat": "Isso limpar\u00e1 as mensagens atuais e iniciar\u00e1 uma nova conversa.", 33 | "cancel": "Cancelar", 34 | "confirm": "Confirmar" 35 | }, 36 | "settingsModal": { 37 | "expandMessages": "Expandir Mensagens", 38 | "hideChainOfThought": "Esconder Sequ\u00eancia de Pensamento", 39 | "darkMode": "Modo Escuro" 40 | } 41 | }, 42 | "organisms": { 43 | "chat": { 44 | "history": { 45 | "index": { 46 | "lastInputs": "\u00daltimas Entradas", 47 | "noInputs": "Vazio...", 48 | "loading": "Carregando..." 49 | } 50 | }, 51 | "inputBox": { 52 | "input": { 53 | "placeholder": "Digite sua mensagem aqui..." 54 | }, 55 | "speechButton": { 56 | "start": "Iniciar grava\u00e7\u00e3o", 57 | "stop": "Parar grava\u00e7\u00e3o" 58 | }, 59 | "SubmitButton": { 60 | "sendMessage": "Enviar mensagem", 61 | "stopTask": "Parar Tarefa" 62 | }, 63 | "UploadButton": { 64 | "attachFiles": "Anexar arquivos" 65 | }, 66 | "waterMark": { 67 | "text": "Constru\u00eddo com" 68 | } 69 | }, 70 | "Messages": { 71 | "index": { 72 | "running": "Executando", 73 | "executedSuccessfully": "executado com sucesso", 74 | "failed": "falhou", 75 | "feedbackUpdated": "Feedback atualizado", 76 | "updating": "Atualizando" 77 | } 78 | }, 79 | "dropScreen": { 80 | "dropYourFilesHere": "Solte seus arquivos aqui" 81 | }, 82 | "index": { 83 | "failedToUpload": "Falha ao enviar", 84 | "cancelledUploadOf": "Envio cancelado de", 85 | "couldNotReachServer": "N\u00e3o foi poss\u00edvel conectar ao servidor", 86 | "continuingChat": "Continuando o chat anterior" 87 | }, 88 | "settings": { 89 | "settingsPanel": "Painel de Configura\u00e7\u00f5es", 90 | "reset": "Redefinir", 91 | "cancel": "Cancelar", 92 | "confirm": "Confirmar" 93 | } 94 | }, 95 | "threadHistory": { 96 | "sidebar": { 97 | "filters": { 98 | "FeedbackSelect": { 99 | "feedbackAll": "Feedback: Todos", 100 | "feedbackPositive": "Feedback: Positivo", 101 | "feedbackNegative": "Feedback: Negativo" 102 | }, 103 | "SearchBar": { 104 | "search": "Buscar" 105 | } 106 | }, 107 | "DeleteThreadButton": { 108 | "confirmMessage": "Isso deletar\u00e1 a conversa, assim como suas mensagens e elementos.", 109 | "cancel": "Cancelar", 110 | "confirm": "Confirmar", 111 | "deletingChat": "Deletando conversa", 112 | "chatDeleted": "Conversa deletada" 113 | }, 114 | "index": { 115 | "pastChats": "Conversas Anteriores" 116 | }, 117 | "ThreadList": { 118 | "empty": "Vazio..." 119 | }, 120 | "TriggerButton": { 121 | "closeSidebar": "Fechar barra lateral", 122 | "openSidebar": "Abrir barra lateral" 123 | } 124 | }, 125 | "Thread": { 126 | "backToChat": "Voltar para a conversa", 127 | "chatCreatedOn": "Esta conversa foi criada em" 128 | } 129 | }, 130 | "header": { 131 | "chat": "Conversa", 132 | "readme": "Leia-me" 133 | } 134 | }, 135 | "hooks": { 136 | "useLLMProviders": { 137 | "failedToFetchProviders": "Falha ao buscar provedores:" 138 | } 139 | }, 140 | "pages": { 141 | "Design": {}, 142 | "Env": { 143 | "savedSuccessfully": "Salvo com sucesso", 144 | "requiredApiKeys": "Chaves de API necess\u00e1rias", 145 | "requiredApiKeysInfo": "Para usar este aplicativo, as seguintes chaves de API s\u00e3o necess\u00e1rias. As chaves s\u00e3o armazenadas localmente em seu dispositivo." 146 | }, 147 | "Page": { 148 | "notPartOfProject": "Voc\u00ea n\u00e3o faz parte deste projeto." 149 | }, 150 | "ResumeButton": { 151 | "resumeChat": "Continuar Conversa" 152 | } 153 | } 154 | } 155 | } -------------------------------------------------------------------------------- /examples/ecommerce-chainlit/README.md: -------------------------------------------------------------------------------- 1 | ## Running Chainlit sample app 2 | 3 | Requires `OPENAI_API_KEY`, `ZEP_API_KEY`, `ZEP_COLLECTION` environment variables to be set. 4 | 5 | ```bash 6 | poetry install 7 | ``` 8 | 9 | ```bash 10 | chainlit run app.py -w 11 | ``` 12 | 13 | (More detailed docs coming soon...) -------------------------------------------------------------------------------- /examples/ecommerce-chainlit/chainlit.md: -------------------------------------------------------------------------------- 1 | # Welcome to Chainlit! 🚀🤖 2 | 3 | Hi there, Developer! 👋 We're excited to have you on board. Chainlit is a powerful tool designed to help you prototype, debug and share applications built on top of LLMs. 4 | 5 | ## Useful Links 🔗 6 | 7 | - **Documentation:** Get started with our comprehensive [Chainlit Documentation](https://docs.chainlit.io) 📚 8 | - **Discord Community:** Join our friendly [Chainlit Discord](https://discord.gg/k73SQ3FyUh) to ask questions, share your projects, and connect with other developers! 💬 9 | 10 | We can't wait to see what you create with Chainlit! Happy coding! 💻😊 11 | 12 | ## Welcome screen 13 | 14 | To modify the welcome screen, edit the `chainlit.md` file at the root of your project. If you do not want a welcome screen, just leave this file empty. 15 | -------------------------------------------------------------------------------- /examples/ecommerce-chainlit/chat_history_shoe_purchase.py: -------------------------------------------------------------------------------- 1 | history = [ 2 | { 3 | "role_type": "user", 4 | "content": ( 5 | "Hi there, I'm looking for a new pair of shoes. I'm not sure where" 6 | " to start." 7 | ), 8 | }, 9 | { 10 | "role_type": "assistant", 11 | "content": ( 12 | "Hello! I'd be happy to help you find the perfect pair of shoes. To" 13 | " get started, could you tell me what brand you're interested in," 14 | " or if you're open to any brand?" 15 | ), 16 | }, 17 | { 18 | "role_type": "user", 19 | "content": "I like Nike and Adidas, but I'm open to other brands too.", 20 | }, 21 | { 22 | "role_type": "assistant", 23 | "content": ( 24 | "That's great! It's important to find the right shoe for your" 25 | " needs. Could you tell me what you'll be using these shoes for" 26 | " mainly? For example, are they for running, basketball, or casual" 27 | " wear?" 28 | ), 29 | }, 30 | { 31 | "role_type": "user", 32 | "content": "I'll be using them for running.", 33 | }, 34 | { 35 | "role_type": "assistant", 36 | "content": ( 37 | "Fantastic! Now, could you please provide me with your shoe size" 38 | " and foot width? This information will help me narrow down the" 39 | " options for you." 40 | ), 41 | }, 42 | { 43 | "role_type": "user", 44 | "content": ("I wear a men's size 10, and I'm not sure about the foot width."), 45 | }, 46 | { 47 | "role_type": "assistant", 48 | "content": ( 49 | "Thank you. Based on your size, I'll make sure to suggest shoes" 50 | " with a wide range of sizes and widths available." 51 | ), 52 | }, 53 | { 54 | "role_type": "user", 55 | "content": ( 56 | "I have a bit of a pronation issue. Do I need to consider that" 57 | " while choosing shoes?" 58 | ), 59 | }, 60 | { 61 | "role_type": "assistant", 62 | "content": ( 63 | "Yes, pronation is essential when choosing running shoes. It refers" 64 | " to the way your foot rolls inward or outward when you walk or" 65 | " run. For pronation issues, stability or motion control shoes are" 66 | " usually recommended. I'll make sure to consider this in my" 67 | " suggestions." 68 | ), 69 | }, 70 | { 71 | "role_type": "user", 72 | "content": "Great, I have a budget of around $120.", 73 | }, 74 | { 75 | "role_type": "assistant", 76 | "content": ( 77 | "Perfect! I'll make sure to find the best running shoes that fit" 78 | " your preferences, taking into account your brand preferences," 79 | " running needs, size, and budget." 80 | ), 81 | }, 82 | { 83 | "role_type": "assistant", 84 | "content": ( 85 | "I've found a few great options for you. The first one is the" 86 | " Brooks Ghost 14, which is known for its cushioning and support," 87 | " ideal for runners with pronation issues. It's available in your" 88 | " size, and it's within your budget." 89 | ), 90 | "metadata": {"bar": "foo"}, 91 | }, 92 | { 93 | "role_type": "user", 94 | "content": ( 95 | "I've heard good things about Brooks, but I was kind of hoping to" 96 | " get a Nike or an Adidas shoe." 97 | ), 98 | }, 99 | { 100 | "role_type": "assistant", 101 | "content": ( 102 | "I understand. In that case, I'd recommend the Adidas Ultraboost" 103 | " 21. It's a popular choice among runners for its comfort, energy" 104 | " return, and stability. Plus, it's on sale at $129.99 today," 105 | " almost within your budget." 106 | ), 107 | }, 108 | { 109 | "role_type": "user", 110 | "content": "They're nice looking. Yes, I think I'll go with those.", 111 | }, 112 | { 113 | "role_type": "assistant", 114 | "content": ( 115 | "Excellent choice! To complete the purchase, I'll need you to" 116 | " provide your credit card information in our secure payment form." 117 | " This will allow us to process your order and ensure a smooth" 118 | " delivery." 119 | ), 120 | }, 121 | { 122 | "role_type": "system", 123 | "content": "Credit card purchase approved. Order complete.", 124 | }, 125 | { 126 | "role_type": "assistant", 127 | "content": ( 128 | "Thank you for completing your order with us! Your purchase of a pair of Adidas Ultraboost 21 will" 129 | " be processed and shipped right away!" 130 | ), 131 | }, 132 | { 133 | "role_type": "assistant", 134 | "content": "To complete the order, I'll need your full name, email address, and shipping address.", 135 | }, 136 | ] 137 | -------------------------------------------------------------------------------- /examples/ecommerce-chainlit/ingest.py: -------------------------------------------------------------------------------- 1 | # Ingest Documents into a Zep Collection 2 | import os 3 | 4 | from dotenv import find_dotenv, load_dotenv 5 | from shoe_data import shoes 6 | 7 | from zep_cloud.langchain import ZepVectorStore 8 | 9 | load_dotenv(dotenv_path=find_dotenv()) 10 | 11 | ZEP_API_KEY = os.environ.get("ZEP_API_KEY") # Required for Zep Cloud 12 | if ZEP_API_KEY is None: 13 | raise ValueError( 14 | "ZEP_API_KEY is required for Zep Cloud. " 15 | "Remove this check if using Zep Open Source." 16 | ) 17 | 18 | ZEP_COLLECTION_NAME = "shoe_data" 19 | 20 | texts = [str(shoe) for shoe in shoes] 21 | 22 | # Add to vectorDB 23 | vectorstore = ZepVectorStore.from_texts( 24 | texts=texts, 25 | collection_name=ZEP_COLLECTION_NAME, 26 | api_key=ZEP_API_KEY, 27 | ) 28 | 29 | print(f"Added {len(shoes)} documents to {ZEP_COLLECTION_NAME}...") 30 | -------------------------------------------------------------------------------- /examples/ecommerce-chainlit/public/logo_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getzep/zep-python/1e11581a05722a2681d73ea956e2234a4a4ef8b3/examples/ecommerce-chainlit/public/logo_dark.png -------------------------------------------------------------------------------- /examples/ecommerce-chainlit/public/logo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getzep/zep-python/1e11581a05722a2681d73ea956e2234a4a4ef8b3/examples/ecommerce-chainlit/public/logo_light.png -------------------------------------------------------------------------------- /examples/ecommerce-chainlit/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "zep-chainlit" 3 | version = "0.1.0" 4 | description = "" 5 | authors = ["paulpaliychuk "] 6 | readme = "README.md" 7 | 8 | [tool.poetry.dependencies] 9 | python = "^3.10" 10 | chainlit = "^1.0.301" 11 | zep-cloud = {path = "../.."} 12 | openai = "^1.13.3" 13 | langchain-community = "^0.0.25" 14 | langchain = "^0.1.11" 15 | bs4 = "^0.0.2" 16 | 17 | [build-system] 18 | requires = ["poetry-core"] 19 | build-backend = "poetry.core.masonry.api" 20 | -------------------------------------------------------------------------------- /examples/graph_example/entity_types.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import os 3 | 4 | from dotenv import find_dotenv, load_dotenv 5 | 6 | from zep_cloud import EntityEdgeSourceTarget, SearchFilters 7 | from zep_cloud.client import AsyncZep 8 | from pydantic import Field 9 | from zep_cloud.external_clients.ontology import EntityModel, EntityText, EdgeModel 10 | 11 | load_dotenv( 12 | dotenv_path=find_dotenv() 13 | ) 14 | 15 | API_KEY = os.environ.get("ZEP_API_KEY") or "YOUR_API_KEY" 16 | 17 | 18 | async def main() -> None: 19 | client = AsyncZep( 20 | api_key=API_KEY, 21 | ) 22 | 23 | class Destination(EntityModel): 24 | """ 25 | A destination is a place that travelers visit. 26 | """ 27 | destination_name: EntityText = Field( 28 | description="The name of the destination", 29 | default=None 30 | ) 31 | country: EntityText = Field( 32 | description="The country of the destination", 33 | default=None 34 | ) 35 | region: EntityText = Field( 36 | description="The region of the destination", 37 | default=None 38 | ) 39 | description: EntityText = Field( 40 | description="A description of the destination", 41 | default=None 42 | ) 43 | 44 | class TravelingTo(EdgeModel): 45 | """ 46 | An edge representing a traveler going to a destination. 47 | """ 48 | travel_date: EntityText = Field( 49 | description="The date of travel to this destination", 50 | default=None 51 | ) 52 | purpose: EntityText = Field( 53 | description="The purpose of travel (Business, Leisure, etc.)", 54 | default=None 55 | ) 56 | await client.graph.set_entity_types( 57 | entities={ 58 | "Destination": Destination, 59 | }, 60 | edges={ 61 | "TRAVELING_TO": ( 62 | TravelingTo, 63 | [ 64 | EntityEdgeSourceTarget( 65 | source="User", 66 | target="Destination" 67 | ) 68 | ] 69 | ), 70 | } 71 | ) 72 | 73 | results = await client.graph.search( 74 | user_id="", 75 | query="travel", 76 | # scope="nodes", 77 | scope="edges", 78 | search_filters=SearchFilters( 79 | edge_types=["TRAVELING_TO"] 80 | # node_labels=["Destination"] 81 | ) 82 | ) 83 | 84 | if results.nodes: 85 | for node in results.nodes: 86 | print(Destination(**node.attributes)) 87 | if results.edges: 88 | for edge in results.edges: 89 | print(TravelingTo(**edge.attributes)) 90 | 91 | 92 | enntl = await client.graph.list_entity_types() 93 | print(enntl) 94 | 95 | if __name__ == "__main__": 96 | asyncio.run(main()) -------------------------------------------------------------------------------- /examples/graph_example/group_graph_example.py: -------------------------------------------------------------------------------- 1 | """ 2 | Example of using the Zep Python SDK asynchronously with Graph functionality. 3 | 4 | This script demonstrates the following functionality: 5 | - Creating a group. 6 | - Updating a group. 7 | - Adding episodes to the group (text and JSON). 8 | - Retrieving nodes from the group. 9 | - Retrieving edges from the group. 10 | - Searching the group for specific content. 11 | 12 | The script showcases various operations using the Zep Graph API, including 13 | group management, adding different types of episodes, and querying the graph structure. 14 | """ 15 | 16 | import asyncio 17 | import os 18 | import uuid 19 | 20 | from dotenv import find_dotenv, load_dotenv 21 | 22 | from zep_cloud.client import AsyncZep 23 | 24 | load_dotenv( 25 | dotenv_path=find_dotenv() 26 | ) # load environment variables from .env file, if present 27 | 28 | API_KEY = os.environ.get("ZEP_API_KEY") or "YOUR_API_KEY" 29 | 30 | 31 | async def main() -> None: 32 | client = AsyncZep( 33 | api_key=API_KEY, 34 | ) 35 | 36 | group_id = f"slack:{uuid.uuid4().hex}" 37 | print(f"Creating group {group_id}...") 38 | group = await client.group.add( 39 | group_id=group_id, 40 | name="My Group", 41 | description="This is my group", 42 | ) 43 | await asyncio.sleep(2) 44 | print(f"Group {group_id} created {group}") 45 | 46 | print(f"Adding episode to group {group_id}...") 47 | await client.graph.add( 48 | group_id=group_id, 49 | data="This is a test episode", 50 | type="text", 51 | ) 52 | await asyncio.sleep(2) 53 | print(f"Adding more meaningful episode to group {group_id}...") 54 | await client.graph.add( 55 | group_id=group_id, 56 | data="Eric Clapton is a rock star", 57 | type="text", 58 | ) 59 | await asyncio.sleep(2) 60 | print(f"Adding a JSON episode to group {group_id}...") 61 | json_string = '{"name": "Eric Clapton", "age": 78, "genre": "Rock"}' 62 | await client.graph.add( 63 | group_id=group_id, 64 | data=json_string, 65 | type="json", 66 | ) 67 | await asyncio.sleep(20) 68 | 69 | # TODO: Need to enable non-message episodic content retrieval 70 | print(f"Getting episodes from group {group_id}...") 71 | results = await client.graph.episode.get_by_group_id(group_id, lastn=2) 72 | await asyncio.sleep(2) 73 | print(f"Episodes from group {group_id} {results.episodes}") 74 | episode = await client.graph.episode.get(results.episodes[0].uuid_) 75 | await asyncio.sleep(2) 76 | print(f"Episode {episode.uuid_} from group {group_id} {episode}") 77 | 78 | print(f"Getting nodes from group {group_id}...") 79 | nodes = await client.graph.node.get_by_group_id(group_id) 80 | await asyncio.sleep(2) 81 | print(f"Nodes from group {group_id} {nodes}") 82 | 83 | print(f"Getting edges from group {group_id}...") 84 | edges = await client.graph.edge.get_by_group_id(group_id) 85 | await asyncio.sleep(2) 86 | print(f"Edges from group {group_id} {edges}") 87 | 88 | print(f"Searching group {group_id}...") 89 | search_results = await client.graph.search( 90 | group_id=group_id, 91 | query="Eric Clapton", 92 | ) 93 | await asyncio.sleep(2) 94 | print(f"Search results from group {group_id} {search_results}") 95 | 96 | # await client.group.delete(group_id) 97 | print(f"Group {group_id} deleted") 98 | 99 | 100 | if __name__ == "__main__": 101 | asyncio.run(main()) -------------------------------------------------------------------------------- /examples/graph_example/tickets_example.py: -------------------------------------------------------------------------------- 1 | """ 2 | Example of using Zep Graph API to create a concert ticket purchasing scenario. 3 | This playground demonstrates user interactions with a ticket sales system, 4 | mixing chat messages and purchase events to build a knowledge graph. 5 | """ 6 | 7 | import asyncio 8 | import os 9 | import uuid 10 | import json 11 | from dotenv import find_dotenv, load_dotenv 12 | 13 | from zep_cloud.client import AsyncZep 14 | from zep_cloud.types import Message 15 | 16 | load_dotenv(dotenv_path=find_dotenv()) 17 | 18 | API_KEY = os.environ.get("ZEP_API_KEY") or "YOUR_API_KEY" 19 | 20 | async def create_ticket_playground() -> None: 21 | client = AsyncZep(api_key=API_KEY) 22 | 23 | # Create a user for the playground 24 | user_id = uuid.uuid4().hex 25 | await client.user.add(user_id=user_id, first_name="Sarah", last_name="Smith", email="sarah.smith@example.com") 26 | print(f"Created playground user: {user_id}") 27 | 28 | 29 | # Sample user interactions and system events 30 | episodes = [ 31 | { 32 | "type": "message", 33 | "data": "Sarah (user): Hi, I'm looking for Taylor Swift concert tickets in New York, I am a huge fan!" 34 | }, 35 | { 36 | "type": "json", 37 | "data": { 38 | "event_type": "search_performed", 39 | "user_id": user_id, 40 | "artist": "Taylor Swift", 41 | "location": "New York", 42 | "date_range": "2024-07", 43 | "timestamp": "2024-01-15T10:30:00Z" 44 | } 45 | }, 46 | { 47 | "type": "message", 48 | "data": "TickerSalesBot (assistant): Hi Sarah, welcome to the TicketSales. I found 2 Taylor Swift concerts at Madison Square Garden on July 15 and 16, 2024. Tickets start at $199." 49 | }, 50 | { 51 | "type": "message", 52 | "data": "Sarah (user): Great! I'd like 2 tickets for July 15th please." 53 | }, 54 | { 55 | "type": "json", 56 | "data": { 57 | "event_type": "ticket_purchase", 58 | "user_id": user_id, 59 | "email": "sarah.smith@example.com", 60 | "concert_id": "TS-MSG-0715", 61 | "artist": "Taylor Swift", 62 | "venue": "Madison Square Garden", 63 | "date": "2024-07-15", 64 | "quantity": 2, 65 | "seat_type": "Floor", 66 | "price_per_ticket": 199, 67 | "total_amount": 398, 68 | "transaction_id": "TRX-12345", 69 | "purchase_timestamp": "2024-01-15T10:35:00Z" 70 | } 71 | }, 72 | { 73 | "type": "message", 74 | "data": "Sarah (user): Are there any upcoming Arctic Monkeys concerts?" 75 | }, 76 | { 77 | "type": "json", 78 | "data": { 79 | "event_type": "search_performed", 80 | "user_id": user_id, 81 | "artist": "Arctic Monkeys", 82 | "timestamp": "2024-01-15T10:40:00Z" 83 | } 84 | }, 85 | { 86 | "type": "message", 87 | "data": "TickerSalesBot (assistant): Yes! Arctic Monkeys are playing at Barclays Center on August 5th, 2024." 88 | }, 89 | { 90 | "type": "message", 91 | "data": "Sarah (user): Can you add me to the waitlist for that concert?" 92 | }, 93 | { 94 | "type": "json", 95 | "data": { 96 | "event_type": "waitlist_addition", 97 | "user_id": user_id, 98 | "concert_id": "AM-BC-0805", 99 | "artist": "Arctic Monkeys", 100 | "venue": "Barclays Center", 101 | "date": "2024-08-05", 102 | "timestamp": "2024-01-15T10:42:00Z" 103 | } 104 | }, 105 | { 106 | "type": "message", 107 | "data": "System Notification - Arctic Monkeys tickets are now available for waitlist members!" 108 | }, 109 | { 110 | "type": "json", 111 | "data": { 112 | "event_type": "ticket_purchase", 113 | "user_id": user_id, 114 | "concert_id": "AM-BC-0805", 115 | "artist": "Arctic Monkeys", 116 | "venue": "Barclays Center", 117 | "date": "2024-08-05", 118 | "quantity": 1, 119 | "seat_type": "General Admission", 120 | "price_per_ticket": 150, 121 | "total_amount": 150, 122 | "transaction_id": "TRX-12346", 123 | "purchase_timestamp": "2024-01-15T14:20:00Z" 124 | } 125 | } 126 | ] 127 | 128 | # Add all episodes to the graph 129 | for episode in episodes: 130 | if episode["type"] == "json": 131 | await client.graph.add( 132 | user_id=user_id, 133 | type="json", 134 | data=json.dumps(episode["data"]), 135 | ) 136 | else: # message type 137 | await client.graph.add( 138 | user_id=user_id, 139 | type="message", 140 | data=episode["data"], 141 | ) 142 | 143 | print("Added all ticket purchase episodes to the graph") 144 | print("Waiting for graph processing...") 145 | await asyncio.sleep(30) 146 | 147 | episodes = await client.graph.episode.get_by_user_id(user_id=user_id) 148 | print(episodes) 149 | 150 | 151 | return user_id 152 | 153 | if __name__ == "__main__": 154 | user_id = asyncio.run(create_ticket_playground()) 155 | print(f"\nPlayground ready! User ID: {user_id}") 156 | print("You can now explore the ticket purchase graph and add new episodes!") -------------------------------------------------------------------------------- /examples/graph_example/user_graph_example.py: -------------------------------------------------------------------------------- 1 | """ 2 | Example of using the Zep Python SDK asynchronously with Graph functionality. 3 | 4 | This script demonstrates the following functionality: 5 | - Creating a user. 6 | - Creating a session associated with the created user. 7 | - Adding messages to the session. 8 | - Retrieving episodes, edges, and nodes for a user. 9 | - Searching the user's graph memory. 10 | - Adding text and JSON episodes to the graph. 11 | - Performing a centered search on a specific node. 12 | 13 | The script showcases various operations using the Zep Graph API, including 14 | user and session management, adding different types of episodes, and querying 15 | the graph structure. 16 | """ 17 | 18 | import asyncio 19 | import os 20 | import uuid 21 | import json 22 | from dotenv import find_dotenv, load_dotenv 23 | from conversations import history 24 | 25 | from zep_cloud.client import AsyncZep 26 | from zep_cloud.types import Message 27 | 28 | load_dotenv( 29 | dotenv_path=find_dotenv() 30 | ) # load environment variables from .env file, if present 31 | 32 | API_KEY = os.environ.get("ZEP_API_KEY") or "YOUR_API_KEY" 33 | 34 | 35 | async def main() -> None: 36 | client = AsyncZep( 37 | api_key=API_KEY, 38 | ) 39 | user_id = uuid.uuid4().hex 40 | session_id = uuid.uuid4().hex 41 | await client.user.add(user_id=user_id, first_name="Paul") 42 | print(f"User {user_id} created") 43 | await client.memory.add_session(session_id=session_id, user_id=user_id) 44 | print(f"Session {session_id} created") 45 | for message in history[2]: 46 | await client.memory.add( 47 | session_id, 48 | messages=[ 49 | Message( 50 | role_type=message["role_type"], 51 | content=message["content"], 52 | ) 53 | ], 54 | ) 55 | 56 | print("Waiting for the graph to be updated...") 57 | await asyncio.sleep(30) 58 | print("Getting memory for session") 59 | session_memory = await client.memory.get(session_id) 60 | print(session_memory) 61 | print("Searching user memory...") 62 | search_results = await client.memory.search_sessions( 63 | text="What is the weather in San Francisco?", 64 | user_id=user_id, 65 | search_scope="facts", 66 | ) 67 | print(search_results) 68 | sessions = await client.user.get_sessions(user_id) 69 | print(sessions) 70 | print("Getting episodes for user") 71 | episode_result = await client.graph.episode.get_by_user_id(user_id, lastn=3) 72 | episodes = episode_result.episodes 73 | print(f"Episodes for user {user_id}:") 74 | print(episodes) 75 | episode = await client.graph.episode.get(episodes[0].uuid_) 76 | print(episode) 77 | 78 | edges = await client.graph.edge.get_by_user_id(user_id) 79 | print(f"Edges for user {user_id}:") 80 | print(edges) 81 | edge = await client.graph.edge.get(edges[0].uuid_) 82 | print(edge) 83 | 84 | nodes = await client.graph.node.get_by_user_id(user_id) 85 | print(f"Nodes for user {user_id}:") 86 | print(nodes) 87 | node = await client.graph.node.get(nodes[0].uuid_) 88 | print(node) 89 | 90 | print("Searching user graph memory...") 91 | search_results = await client.graph.search( 92 | user_id=user_id, 93 | query="What is the weather in San Francisco?", 94 | ) 95 | print(search_results.edges) 96 | 97 | print("Adding a new text episode to the graph...") 98 | await client.graph.add( 99 | user_id=user_id, 100 | type="text", 101 | data="The user is an avid fan of Eric Clapton", 102 | ) 103 | print("Text episode added") 104 | print("Adding a new JSON episode to the graph...") 105 | json_data = { 106 | "name": "Eric Clapton", 107 | "age": 78, 108 | "genre": "Rock", 109 | "favorite_user_id": user_id, 110 | } 111 | json_string = json.dumps(json_data) 112 | await client.graph.add( 113 | user_id=user_id, 114 | type="json", 115 | data=json_string, 116 | ) 117 | print("JSON episode added") 118 | 119 | print("Adding a new message episode to the graph...") 120 | message = "Paul (user): I went to Eric Clapton concert last night" 121 | await client.graph.add( 122 | user_id=user_id, 123 | type="message", 124 | data=message, 125 | ) 126 | print("Message episode added") 127 | 128 | print("Waiting for the graph to be updated...") 129 | # wait for the graph to be updated 130 | await asyncio.sleep(30) 131 | 132 | print("Getting nodes from the graph...") 133 | nodes = await client.graph.node.get_by_user_id(user_id) 134 | print(nodes) 135 | 136 | print("Finding Eric Clapton in the graph...") 137 | clapton_node = [node for node in nodes if node.name == "Eric Clapton"] 138 | print(clapton_node) 139 | 140 | print("Performing Eric Clapton centered edge search...") 141 | search_results = await client.graph.search( 142 | user_id=user_id, 143 | query="Eric Clapton", 144 | center_node_uuid=clapton_node[0].uuid_, 145 | scope="edges", 146 | ) 147 | print(search_results.edges) 148 | 149 | print("Performing Eric Clapton centered node search...") 150 | search_results = await client.graph.search( 151 | user_id=user_id, 152 | query="Eric Clapton", 153 | center_node_uuid=clapton_node[0].uuid_, 154 | scope="nodes", 155 | ) 156 | print(search_results.nodes) 157 | print("Getting all user facts") 158 | result = await client.user.get_facts(user_id) 159 | print(result.facts) 160 | 161 | for fact in result.facts: 162 | if fact.valid_at or fact.invalid_at: 163 | print( 164 | f"Fact {fact.fact} is valid at {fact.valid_at} and invalid at {fact.invalid_at}\n " 165 | ) 166 | 167 | # Uncomment to delete the user 168 | # await client.user.delete(user_id) 169 | # print(f"User {user_id} deleted") 170 | 171 | 172 | if __name__ == "__main__": 173 | asyncio.run(main()) -------------------------------------------------------------------------------- /examples/openai-agents-sdk/README.md: -------------------------------------------------------------------------------- 1 | # OpenAI Agents SDK with Zep Memory Example 2 | 3 | This example demonstrates how to integrate Zep memory with an agent built using the OpenAI Agents SDK. It creates an assistant that can remember previous conversations using Zep's asynchronous memory capabilities. 4 | 5 | ## Features 6 | 7 | - Integration of OpenAI Agents SDK with Zep's memory system 8 | - Persistent memory across conversations 9 | - Memory search functionality to retrieve relevant information 10 | - User management with metadata support 11 | - Interactive chat mode 12 | - Session management with optional reuse 13 | 14 | ## Prerequisites 15 | 16 | - Python 3.10+ 17 | - uv or poetry for dependency management 18 | - OpenAI API key 19 | - Zep Cloud API key 20 | 21 | ## Installation 22 | 23 | 1. Clone the repository: 24 | 25 | ```bash 26 | git clone https://github.com/getzep/zep-python.git 27 | cd zep-python/examples/openai-agents-sdk 28 | ``` 29 | 30 | 2. Install the required dependencies using uv or poetry: 31 | 32 | Using uv: 33 | 34 | ```bash 35 | uv sync 36 | ``` 37 | 38 | Or using poetry: 39 | 40 | ```bash 41 | poetry install 42 | ``` 43 | 44 | 3. Set up environment variables: 45 | 46 | Create a `.env` file in the project directory with the following content: 47 | 48 | ``` 49 | OPENAI_API_KEY=your_openai_api_key 50 | ZEP_API_KEY=your_zep_api_key 51 | ``` 52 | 53 | 4. Enter a `uv` or `poetry` shell: 54 | 55 | ```bash 56 | uv shell 57 | ``` 58 | 59 | Or using poetry: 60 | 61 | ```bash 62 | poetry shell 63 | ``` 64 | 65 | ## Usage 66 | 67 | ### Basic Usage 68 | 69 | Run the example with default settings: 70 | 71 | ```bash 72 | python openai_agents_sdk_example.py 73 | ``` 74 | 75 | ### Interactive Mode 76 | 77 | Run in interactive mode for continuous conversation: 78 | 79 | ```bash 80 | python openai_agents_sdk_example.py --interactive 81 | ``` 82 | 83 | ### User Information 84 | 85 | Provide user information for better memory management: 86 | 87 | ```bash 88 | python openai_agents_sdk_example.py --username user123 --email user@example.com --firstname John --lastname Doe 89 | ``` 90 | 91 | ### Session Management 92 | 93 | Specify a session ID to reuse the same session: 94 | 95 | ```bash 96 | python openai_agents_sdk_example.py --username user123 --session my-session-id 97 | ``` 98 | 99 | Note: By default, a timestamp will be appended to the session ID to create a new session each time. 100 | 101 | ## How It Works 102 | 103 | The example consists of two main components: 104 | 105 | 1. **AsyncZepMemoryManager**: Handles memory operations using the AsyncZep client. 106 | 107 | - Initializes the AsyncZep client 108 | - Creates or retrieves users 109 | - Manages memory sessions 110 | - Adds messages to memory 111 | - Retrieves memory context 112 | - Searches memory for relevant information 113 | 114 | 2. **AsyncZepMemoryAgent**: Integrates the memory manager with the OpenAI Agents SDK. 115 | - Creates an agent with memory-related tools 116 | - Processes and stores messages 117 | - Handles chat interactions 118 | 119 | ## Available Tools 120 | 121 | The agent is equipped with the following tools: 122 | 123 | - **search_memory**: Searches Zep memory for relevant facts based on a query 124 | - **get_weather**: A simple example tool that returns weather information for a given city 125 | 126 | ## Example Conversation 127 | 128 | When you run the example, you can have conversations like: 129 | 130 | ``` 131 | User: My name is Alice and I live in New York. 132 | Agent: Nice to meet you, Alice! I'll remember that you live in New York. How can I help you today? 133 | 134 | User: What's the weather like? 135 | Agent: Based on your location in New York, the current weather is... 136 | 137 | User: Where do I live again? 138 | Agent: You mentioned that you live in New York. 139 | ``` 140 | -------------------------------------------------------------------------------- /examples/openai-agents-sdk/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "openai-agents-sdk" 3 | version = "0.1.0" 4 | description = "Add your description here" 5 | readme = "README.md" 6 | requires-python = ">=3.10" 7 | dependencies = [ 8 | "click>=8.1.8", 9 | "openai-agents>=0.0.3", 10 | "packaging>=24.2", 11 | "python-dotenv>=1.0.1", 12 | "zep-cloud>=2.6.1", 13 | ] 14 | -------------------------------------------------------------------------------- /examples/user_example.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import os 3 | import uuid 4 | 5 | from dotenv import find_dotenv, load_dotenv 6 | 7 | from zep_cloud.types import ApiError 8 | from zep_cloud.client import AsyncZep 9 | 10 | load_dotenv( 11 | dotenv_path=find_dotenv() 12 | ) # load environment variables from .env file, if present 13 | 14 | API_KEY = os.environ.get("ZEP_API_KEY") or "YOUR_API_KEY" 15 | 16 | 17 | async def main() -> None: 18 | client = AsyncZep(api_key=API_KEY) 19 | # Create multiple users 20 | for i in range(3): 21 | user_id = f"user{i}" + uuid.uuid4().hex 22 | try: 23 | user = await client.user.add( 24 | user_id=user_id, 25 | email=f"user{i}@example.com", 26 | first_name=f"John{i}", 27 | last_name=f"Doe{i}", 28 | metadata={"foo": "bar"}, 29 | ) 30 | print(f"Created user {i+1}: {user.user_id}") 31 | except ApiError as e: 32 | print(f"Failed to create user {i+1}: {e}") 33 | 34 | # Update the first user 35 | user_list = await client.user.list_ordered(page_size=1, page_number=1) 36 | user_id = user_list.users[0].user_id 37 | try: 38 | updated_user = await client.user.update( 39 | user_id=user_id, 40 | email="updated_user@example.com", 41 | first_name="UpdatedJohn", 42 | last_name="UpdatedDoe", 43 | metadata={"foo": "updated_bar"}, 44 | ) 45 | print(f"Updated user: {updated_user.user_id}") 46 | except ApiError as e: 47 | print(f"Failed to update user: {e}") 48 | 49 | # Create a Session for the first user 50 | session_id = uuid.uuid4().hex 51 | try: 52 | result = await client.memory.add_session( 53 | session_id=session_id, user_id=user_id, metadata={"session": i + 1} 54 | ) 55 | print(f"Created session {i+1}: {result}") 56 | except ApiError as e: 57 | print(f"Failed to create session {i+1}: {e}") 58 | 59 | # Delete the second user 60 | user_list = await client.user.list_ordered(page_size=1, page_number=1) 61 | user_id = user_list.users[0].user_id 62 | try: 63 | await client.user.delete(user_id=user_id) 64 | print(f"Deleted user: {user_id}") 65 | except ApiError as e: 66 | print(f"Failed to delete user: {e}") 67 | 68 | 69 | if __name__ == "__main__": 70 | asyncio.run(main()) -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "zep-cloud" 3 | version = "2.13.1" 4 | description = "" 5 | readme = "README.md" 6 | authors = [] 7 | packages = [{ include = "zep_cloud", from = "src" }] 8 | 9 | classifiers = [ 10 | "Intended Audience :: Developers", 11 | "Programming Language :: Python", 12 | "Programming Language :: Python :: 3", 13 | "Programming Language :: Python :: 3.8", 14 | "Programming Language :: Python :: 3.9", 15 | "Programming Language :: Python :: 3.10", 16 | "Programming Language :: Python :: 3.11", 17 | "Programming Language :: Python :: 3.12", 18 | "Operating System :: OS Independent", 19 | "Operating System :: POSIX", 20 | "Operating System :: MacOS", 21 | "Operating System :: POSIX :: Linux", 22 | "Operating System :: Microsoft :: Windows", 23 | "Topic :: Software Development :: Libraries :: Python Modules", 24 | "Typing :: Typed" 25 | ] 26 | 27 | [tool.poetry.dependencies] 28 | python = ">=3.9.0,<4.0" 29 | httpx = ">=0.21.2" 30 | pydantic = ">= 1.9.2" 31 | typing_extensions = ">= 4.0.0" 32 | 33 | [tool.poetry.group.dev.dependencies] 34 | mypy = "1.9.0" 35 | pytest = "^7.4.0" 36 | pytest-asyncio = "^0.23.5" 37 | python-dateutil = "^2.9.0" 38 | types-python-dateutil = "^2.9.0.20240316" 39 | langchain = "^0.1.3" 40 | openai = "^1.9.0" 41 | langchain-openai = "^0.0.3" 42 | black = "^24.4.2" 43 | ruff = "^0.4.8" 44 | ipykernel = "^6.29.4" 45 | 46 | [tool.pytest.ini_options] 47 | testpaths = [ "tests" ] 48 | asyncio_mode = "auto" 49 | 50 | [tool.mypy] 51 | plugins = ["pydantic.mypy"] 52 | 53 | 54 | [build-system] 55 | requires = ["poetry-core"] 56 | build-backend = "poetry.core.masonry.api" 57 | -------------------------------------------------------------------------------- /src/zep_cloud/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | from .types import ( 4 | AddMemoryResponse, 5 | AddTripleResponse, 6 | ApiError, 7 | ApidataDocument, 8 | ApidataDocumentCollection, 9 | ApidataDocumentSearchResponse, 10 | ApidataDocumentWithScore, 11 | ClassifySessionRequest, 12 | CreateDocumentRequest, 13 | EdgeType, 14 | EndSessionResponse, 15 | EndSessionsResponse, 16 | EntityEdge, 17 | EntityEdgeSourceTarget, 18 | EntityNode, 19 | EntityProperty, 20 | EntityPropertyType, 21 | EntityType, 22 | EntityTypeResponse, 23 | Episode, 24 | EpisodeData, 25 | EpisodeResponse, 26 | Fact, 27 | FactRatingExamples, 28 | FactRatingInstruction, 29 | FactResponse, 30 | FactsResponse, 31 | GraphDataType, 32 | GraphEdgesRequest, 33 | GraphNodesRequest, 34 | GraphSearchResults, 35 | GraphSearchScope, 36 | Group, 37 | GroupListResponse, 38 | Memory, 39 | MemorySearchResult, 40 | Message, 41 | MessageListResponse, 42 | NewFact, 43 | Question, 44 | Reranker, 45 | RoleType, 46 | SearchFilters, 47 | SearchScope, 48 | SearchType, 49 | Session, 50 | SessionClassification, 51 | SessionListResponse, 52 | SessionSearchResponse, 53 | SessionSearchResult, 54 | SuccessResponse, 55 | Summary, 56 | SummaryListResponse, 57 | UpdateDocumentListRequest, 58 | User, 59 | UserListResponse, 60 | UserNodeResponse, 61 | ) 62 | from .errors import BadRequestError, ConflictError, InternalServerError, NotFoundError, UnauthorizedError 63 | from . import document, graph, group, memory, user 64 | from .environment import ZepEnvironment 65 | from .version import __version__ 66 | 67 | __all__ = [ 68 | "AddMemoryResponse", 69 | "AddTripleResponse", 70 | "ApiError", 71 | "ApidataDocument", 72 | "ApidataDocumentCollection", 73 | "ApidataDocumentSearchResponse", 74 | "ApidataDocumentWithScore", 75 | "BadRequestError", 76 | "ClassifySessionRequest", 77 | "ConflictError", 78 | "CreateDocumentRequest", 79 | "EdgeType", 80 | "EndSessionResponse", 81 | "EndSessionsResponse", 82 | "EntityEdge", 83 | "EntityEdgeSourceTarget", 84 | "EntityNode", 85 | "EntityProperty", 86 | "EntityPropertyType", 87 | "EntityType", 88 | "EntityTypeResponse", 89 | "Episode", 90 | "EpisodeData", 91 | "EpisodeResponse", 92 | "Fact", 93 | "FactRatingExamples", 94 | "FactRatingInstruction", 95 | "FactResponse", 96 | "FactsResponse", 97 | "GraphDataType", 98 | "GraphEdgesRequest", 99 | "GraphNodesRequest", 100 | "GraphSearchResults", 101 | "GraphSearchScope", 102 | "Group", 103 | "GroupListResponse", 104 | "InternalServerError", 105 | "Memory", 106 | "MemorySearchResult", 107 | "Message", 108 | "MessageListResponse", 109 | "NewFact", 110 | "NotFoundError", 111 | "Question", 112 | "Reranker", 113 | "RoleType", 114 | "SearchFilters", 115 | "SearchScope", 116 | "SearchType", 117 | "Session", 118 | "SessionClassification", 119 | "SessionListResponse", 120 | "SessionSearchResponse", 121 | "SessionSearchResult", 122 | "SuccessResponse", 123 | "Summary", 124 | "SummaryListResponse", 125 | "UnauthorizedError", 126 | "UpdateDocumentListRequest", 127 | "User", 128 | "UserListResponse", 129 | "UserNodeResponse", 130 | "ZepEnvironment", 131 | "__version__", 132 | "document", 133 | "graph", 134 | "group", 135 | "memory", 136 | "user", 137 | ] 138 | -------------------------------------------------------------------------------- /src/zep_cloud/base_client.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import os 4 | import typing 5 | 6 | import httpx 7 | 8 | from .core.api_error import ApiError 9 | from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper 10 | from .document.client import AsyncDocumentClient, DocumentClient 11 | from .environment import ZepEnvironment 12 | from .graph.client import AsyncGraphClient, GraphClient 13 | from .group.client import AsyncGroupClient, GroupClient 14 | from .memory.client import AsyncMemoryClient, MemoryClient 15 | from .user.client import AsyncUserClient, UserClient 16 | 17 | 18 | class BaseClient: 19 | """ 20 | Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions. 21 | 22 | Parameters 23 | ---------- 24 | base_url : typing.Optional[str] 25 | The base url to use for requests from the client. 26 | 27 | environment : ZepEnvironment 28 | The environment to use for requests from the client. from .environment import ZepEnvironment 29 | 30 | 31 | 32 | Defaults to ZepEnvironment.DEFAULT 33 | 34 | 35 | 36 | api_key : typing.Optional[str] 37 | timeout : typing.Optional[float] 38 | The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced. 39 | 40 | follow_redirects : typing.Optional[bool] 41 | Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in. 42 | 43 | httpx_client : typing.Optional[httpx.Client] 44 | The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration. 45 | 46 | Examples 47 | -------- 48 | from zep_cloud.client import Zep 49 | 50 | client = Zep( 51 | api_key="YOUR_API_KEY", 52 | ) 53 | """ 54 | 55 | def __init__( 56 | self, 57 | *, 58 | base_url: typing.Optional[str] = None, 59 | environment: ZepEnvironment = ZepEnvironment.DEFAULT, 60 | api_key: typing.Optional[str] = os.getenv("ZEP_API_KEY"), 61 | timeout: typing.Optional[float] = None, 62 | follow_redirects: typing.Optional[bool] = True, 63 | httpx_client: typing.Optional[httpx.Client] = None 64 | ): 65 | _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None 66 | if api_key is None: 67 | raise ApiError(body="The client must be instantiated be either passing in api_key or setting ZEP_API_KEY") 68 | self._client_wrapper = SyncClientWrapper( 69 | base_url=_get_base_url(base_url=base_url, environment=environment), 70 | api_key=api_key, 71 | httpx_client=httpx_client 72 | if httpx_client is not None 73 | else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects) 74 | if follow_redirects is not None 75 | else httpx.Client(timeout=_defaulted_timeout), 76 | timeout=_defaulted_timeout, 77 | ) 78 | self.document = DocumentClient(client_wrapper=self._client_wrapper) 79 | self.graph = GraphClient(client_wrapper=self._client_wrapper) 80 | self.memory = MemoryClient(client_wrapper=self._client_wrapper) 81 | self.group = GroupClient(client_wrapper=self._client_wrapper) 82 | self.user = UserClient(client_wrapper=self._client_wrapper) 83 | 84 | 85 | class AsyncBaseClient: 86 | """ 87 | Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions. 88 | 89 | Parameters 90 | ---------- 91 | base_url : typing.Optional[str] 92 | The base url to use for requests from the client. 93 | 94 | environment : ZepEnvironment 95 | The environment to use for requests from the client. from .environment import ZepEnvironment 96 | 97 | 98 | 99 | Defaults to ZepEnvironment.DEFAULT 100 | 101 | 102 | 103 | api_key : typing.Optional[str] 104 | timeout : typing.Optional[float] 105 | The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced. 106 | 107 | follow_redirects : typing.Optional[bool] 108 | Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in. 109 | 110 | httpx_client : typing.Optional[httpx.AsyncClient] 111 | The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration. 112 | 113 | Examples 114 | -------- 115 | from zep_cloud.client import AsyncZep 116 | 117 | client = AsyncZep( 118 | api_key="YOUR_API_KEY", 119 | ) 120 | """ 121 | 122 | def __init__( 123 | self, 124 | *, 125 | base_url: typing.Optional[str] = None, 126 | environment: ZepEnvironment = ZepEnvironment.DEFAULT, 127 | api_key: typing.Optional[str] = os.getenv("ZEP_API_KEY"), 128 | timeout: typing.Optional[float] = None, 129 | follow_redirects: typing.Optional[bool] = True, 130 | httpx_client: typing.Optional[httpx.AsyncClient] = None 131 | ): 132 | _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None 133 | if api_key is None: 134 | raise ApiError(body="The client must be instantiated be either passing in api_key or setting ZEP_API_KEY") 135 | self._client_wrapper = AsyncClientWrapper( 136 | base_url=_get_base_url(base_url=base_url, environment=environment), 137 | api_key=api_key, 138 | httpx_client=httpx_client 139 | if httpx_client is not None 140 | else httpx.AsyncClient(timeout=_defaulted_timeout, follow_redirects=follow_redirects) 141 | if follow_redirects is not None 142 | else httpx.AsyncClient(timeout=_defaulted_timeout), 143 | timeout=_defaulted_timeout, 144 | ) 145 | self.document = AsyncDocumentClient(client_wrapper=self._client_wrapper) 146 | self.graph = AsyncGraphClient(client_wrapper=self._client_wrapper) 147 | self.memory = AsyncMemoryClient(client_wrapper=self._client_wrapper) 148 | self.group = AsyncGroupClient(client_wrapper=self._client_wrapper) 149 | self.user = AsyncUserClient(client_wrapper=self._client_wrapper) 150 | 151 | 152 | def _get_base_url(*, base_url: typing.Optional[str] = None, environment: ZepEnvironment) -> str: 153 | if base_url is not None: 154 | return base_url 155 | elif environment is not None: 156 | return environment.value 157 | else: 158 | raise Exception("Please pass in either base_url or environment to construct the client") 159 | -------------------------------------------------------------------------------- /src/zep_cloud/client.py: -------------------------------------------------------------------------------- 1 | from .base_client import \ 2 | BaseClient, AsyncBaseClient 3 | import typing 4 | import os 5 | import httpx 6 | from .environment import ZepEnvironment 7 | from .external_clients.memory import MemoryClient, AsyncMemoryClient 8 | from .external_clients.document import DocumentClient, AsyncDocumentClient 9 | from .external_clients.user import UserClient, AsyncUserClient 10 | from .external_clients.graph import GraphClient, AsyncGraphClient 11 | 12 | class Zep(BaseClient): 13 | def __init__( 14 | self, 15 | *, 16 | base_url: typing.Optional[str] = None, 17 | environment: ZepEnvironment = ZepEnvironment.DEFAULT, 18 | api_key: typing.Optional[str] = os.getenv("ZEP_API_KEY"), 19 | timeout: typing.Optional[float] = None, 20 | follow_redirects: typing.Optional[bool] = None, 21 | httpx_client: typing.Optional[httpx.Client] = None 22 | ): 23 | env_api_url = os.getenv("ZEP_API_URL") 24 | if env_api_url: 25 | base_url = f"{env_api_url}/api/v2" 26 | super().__init__( 27 | base_url=base_url, 28 | environment=environment, 29 | api_key=api_key, 30 | timeout=timeout, 31 | follow_redirects=follow_redirects, 32 | httpx_client=httpx_client 33 | ) 34 | self.memory = MemoryClient(client_wrapper=self._client_wrapper) 35 | self.document = DocumentClient(client_wrapper=self._client_wrapper) 36 | self.user = UserClient(client_wrapper=self._client_wrapper) 37 | self.graph = GraphClient(client_wrapper=self._client_wrapper) 38 | 39 | class AsyncZep(AsyncBaseClient): 40 | def __init__( 41 | self, 42 | *, 43 | base_url: typing.Optional[str] = None, 44 | environment: ZepEnvironment = ZepEnvironment.DEFAULT, 45 | api_key: typing.Optional[str] = os.getenv("ZEP_API_KEY"), 46 | timeout: typing.Optional[float] = None, 47 | follow_redirects: typing.Optional[bool] = None, 48 | httpx_client: typing.Optional[httpx.AsyncClient] = None 49 | ): 50 | env_api_url = os.getenv("ZEP_API_URL") 51 | if env_api_url: 52 | base_url = f"{env_api_url}/api/v2" 53 | super().__init__( 54 | base_url=base_url, 55 | environment=environment, 56 | api_key=api_key, 57 | timeout=timeout, 58 | follow_redirects=follow_redirects, 59 | httpx_client=httpx_client 60 | ) 61 | self.memory = AsyncMemoryClient(client_wrapper=self._client_wrapper) 62 | self.document = AsyncDocumentClient(client_wrapper=self._client_wrapper) 63 | self.user = AsyncUserClient(client_wrapper=self._client_wrapper) 64 | self.graph = AsyncGraphClient(client_wrapper=self._client_wrapper) 65 | -------------------------------------------------------------------------------- /src/zep_cloud/core/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | from .api_error import ApiError 4 | from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper 5 | from .datetime_utils import serialize_datetime 6 | from .file import File, convert_file_dict_to_httpx_tuples 7 | from .http_client import AsyncHttpClient, HttpClient 8 | from .jsonable_encoder import jsonable_encoder 9 | from .pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 10 | from .query_encoder import encode_query 11 | from .remove_none_from_dict import remove_none_from_dict 12 | from .request_options import RequestOptions 13 | 14 | __all__ = [ 15 | "ApiError", 16 | "AsyncClientWrapper", 17 | "AsyncHttpClient", 18 | "BaseClientWrapper", 19 | "File", 20 | "HttpClient", 21 | "RequestOptions", 22 | "SyncClientWrapper", 23 | "convert_file_dict_to_httpx_tuples", 24 | "deep_union_pydantic_dicts", 25 | "encode_query", 26 | "jsonable_encoder", 27 | "pydantic_v1", 28 | "remove_none_from_dict", 29 | "serialize_datetime", 30 | ] 31 | -------------------------------------------------------------------------------- /src/zep_cloud/core/api_error.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | 6 | class ApiError(Exception): 7 | status_code: typing.Optional[int] 8 | body: typing.Any 9 | 10 | def __init__(self, *, status_code: typing.Optional[int] = None, body: typing.Any = None): 11 | self.status_code = status_code 12 | self.body = body 13 | 14 | def __str__(self) -> str: 15 | return f"status_code: {self.status_code}, body: {self.body}" 16 | -------------------------------------------------------------------------------- /src/zep_cloud/core/client_wrapper.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import httpx 6 | 7 | from .http_client import AsyncHttpClient, HttpClient 8 | 9 | 10 | class BaseClientWrapper: 11 | def __init__(self, *, api_key: str, base_url: str, timeout: typing.Optional[float] = None): 12 | self.api_key = api_key 13 | self._base_url = base_url 14 | self._timeout = timeout 15 | 16 | def get_headers(self) -> typing.Dict[str, str]: 17 | headers: typing.Dict[str, str] = { 18 | "X-Fern-Language": "Python", 19 | "X-Fern-SDK-Name": "zep-cloud", 20 | "X-Fern-SDK-Version": "2.13.0", 21 | } 22 | headers["Authorization"] = f"Api-Key {self.api_key}" 23 | return headers 24 | 25 | def get_base_url(self) -> str: 26 | return self._base_url 27 | 28 | def get_timeout(self) -> typing.Optional[float]: 29 | return self._timeout 30 | 31 | 32 | class SyncClientWrapper(BaseClientWrapper): 33 | def __init__( 34 | self, *, api_key: str, base_url: str, timeout: typing.Optional[float] = None, httpx_client: httpx.Client 35 | ): 36 | super().__init__(api_key=api_key, base_url=base_url, timeout=timeout) 37 | self.httpx_client = HttpClient( 38 | httpx_client=httpx_client, 39 | base_headers=self.get_headers(), 40 | base_timeout=self.get_timeout(), 41 | base_url=self.get_base_url(), 42 | ) 43 | 44 | 45 | class AsyncClientWrapper(BaseClientWrapper): 46 | def __init__( 47 | self, *, api_key: str, base_url: str, timeout: typing.Optional[float] = None, httpx_client: httpx.AsyncClient 48 | ): 49 | super().__init__(api_key=api_key, base_url=base_url, timeout=timeout) 50 | self.httpx_client = AsyncHttpClient( 51 | httpx_client=httpx_client, 52 | base_headers=self.get_headers(), 53 | base_timeout=self.get_timeout(), 54 | base_url=self.get_base_url(), 55 | ) 56 | -------------------------------------------------------------------------------- /src/zep_cloud/core/datetime_utils.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | 5 | 6 | def serialize_datetime(v: dt.datetime) -> str: 7 | """ 8 | Serialize a datetime including timezone info. 9 | 10 | Uses the timezone info provided if present, otherwise uses the current runtime's timezone info. 11 | 12 | UTC datetimes end in "Z" while all other timezones are represented as offset from UTC, e.g. +05:00. 13 | """ 14 | 15 | def _serialize_zoned_datetime(v: dt.datetime) -> str: 16 | if v.tzinfo is not None and v.tzinfo.tzname(None) == dt.timezone.utc.tzname(None): 17 | # UTC is a special case where we use "Z" at the end instead of "+00:00" 18 | return v.isoformat().replace("+00:00", "Z") 19 | else: 20 | # Delegate to the typical +/- offset format 21 | return v.isoformat() 22 | 23 | if v.tzinfo is not None: 24 | return _serialize_zoned_datetime(v) 25 | else: 26 | local_tz = dt.datetime.now().astimezone().tzinfo 27 | localized_dt = v.replace(tzinfo=local_tz) 28 | return _serialize_zoned_datetime(localized_dt) 29 | -------------------------------------------------------------------------------- /src/zep_cloud/core/file.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | # File typing inspired by the flexibility of types within the httpx library 6 | # https://github.com/encode/httpx/blob/master/httpx/_types.py 7 | FileContent = typing.Union[typing.IO[bytes], bytes, str] 8 | File = typing.Union[ 9 | # file (or bytes) 10 | FileContent, 11 | # (filename, file (or bytes)) 12 | typing.Tuple[typing.Optional[str], FileContent], 13 | # (filename, file (or bytes), content_type) 14 | typing.Tuple[typing.Optional[str], FileContent, typing.Optional[str]], 15 | # (filename, file (or bytes), content_type, headers) 16 | typing.Tuple[typing.Optional[str], FileContent, typing.Optional[str], typing.Mapping[str, str]], 17 | ] 18 | 19 | 20 | def convert_file_dict_to_httpx_tuples( 21 | d: typing.Dict[str, typing.Union[File, typing.List[File]]] 22 | ) -> typing.List[typing.Tuple[str, File]]: 23 | """ 24 | The format we use is a list of tuples, where the first element is the 25 | name of the file and the second is the file object. Typically HTTPX wants 26 | a dict, but to be able to send lists of files, you have to use the list 27 | approach (which also works for non-lists) 28 | https://github.com/encode/httpx/pull/1032 29 | """ 30 | 31 | httpx_tuples = [] 32 | for key, file_like in d.items(): 33 | if isinstance(file_like, list): 34 | for file_like_item in file_like: 35 | httpx_tuples.append((key, file_like_item)) 36 | else: 37 | httpx_tuples.append((key, file_like)) 38 | return httpx_tuples 39 | -------------------------------------------------------------------------------- /src/zep_cloud/core/jsonable_encoder.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | """ 4 | jsonable_encoder converts a Python object to a JSON-friendly dict 5 | (e.g. datetimes to strings, Pydantic models to dicts). 6 | 7 | Taken from FastAPI, and made a bit simpler 8 | https://github.com/tiangolo/fastapi/blob/master/fastapi/encoders.py 9 | """ 10 | 11 | import base64 12 | import dataclasses 13 | import datetime as dt 14 | from collections import defaultdict 15 | from enum import Enum 16 | from pathlib import PurePath 17 | from types import GeneratorType 18 | from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union 19 | 20 | from .datetime_utils import serialize_datetime 21 | from .pydantic_utilities import pydantic_v1 22 | 23 | SetIntStr = Set[Union[int, str]] 24 | DictIntStrAny = Dict[Union[int, str], Any] 25 | 26 | 27 | def generate_encoders_by_class_tuples( 28 | type_encoder_map: Dict[Any, Callable[[Any], Any]] 29 | ) -> Dict[Callable[[Any], Any], Tuple[Any, ...]]: 30 | encoders_by_class_tuples: Dict[Callable[[Any], Any], Tuple[Any, ...]] = defaultdict(tuple) 31 | for type_, encoder in type_encoder_map.items(): 32 | encoders_by_class_tuples[encoder] += (type_,) 33 | return encoders_by_class_tuples 34 | 35 | 36 | encoders_by_class_tuples = generate_encoders_by_class_tuples(pydantic_v1.json.ENCODERS_BY_TYPE) 37 | 38 | 39 | def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any], Any]]] = None) -> Any: 40 | custom_encoder = custom_encoder or {} 41 | if custom_encoder: 42 | if type(obj) in custom_encoder: 43 | return custom_encoder[type(obj)](obj) 44 | else: 45 | for encoder_type, encoder_instance in custom_encoder.items(): 46 | if isinstance(obj, encoder_type): 47 | return encoder_instance(obj) 48 | if isinstance(obj, pydantic_v1.BaseModel): 49 | encoder = getattr(obj.__config__, "json_encoders", {}) 50 | if custom_encoder: 51 | encoder.update(custom_encoder) 52 | obj_dict = obj.dict(by_alias=True) 53 | if "__root__" in obj_dict: 54 | obj_dict = obj_dict["__root__"] 55 | return jsonable_encoder(obj_dict, custom_encoder=encoder) 56 | if dataclasses.is_dataclass(obj): 57 | obj_dict = dataclasses.asdict(obj) 58 | return jsonable_encoder(obj_dict, custom_encoder=custom_encoder) 59 | if isinstance(obj, bytes): 60 | return base64.b64encode(obj).decode("utf-8") 61 | if isinstance(obj, Enum): 62 | return obj.value 63 | if isinstance(obj, PurePath): 64 | return str(obj) 65 | if isinstance(obj, (str, int, float, type(None))): 66 | return obj 67 | if isinstance(obj, dt.datetime): 68 | return serialize_datetime(obj) 69 | if isinstance(obj, dt.date): 70 | return str(obj) 71 | if isinstance(obj, dict): 72 | encoded_dict = {} 73 | allowed_keys = set(obj.keys()) 74 | for key, value in obj.items(): 75 | if key in allowed_keys: 76 | encoded_key = jsonable_encoder(key, custom_encoder=custom_encoder) 77 | encoded_value = jsonable_encoder(value, custom_encoder=custom_encoder) 78 | encoded_dict[encoded_key] = encoded_value 79 | return encoded_dict 80 | if isinstance(obj, (list, set, frozenset, GeneratorType, tuple)): 81 | encoded_list = [] 82 | for item in obj: 83 | encoded_list.append(jsonable_encoder(item, custom_encoder=custom_encoder)) 84 | return encoded_list 85 | 86 | if type(obj) in pydantic_v1.json.ENCODERS_BY_TYPE: 87 | return pydantic_v1.json.ENCODERS_BY_TYPE[type(obj)](obj) 88 | for encoder, classes_tuple in encoders_by_class_tuples.items(): 89 | if isinstance(obj, classes_tuple): 90 | return encoder(obj) 91 | 92 | try: 93 | data = dict(obj) 94 | except Exception as e: 95 | errors: List[Exception] = [] 96 | errors.append(e) 97 | try: 98 | data = vars(obj) 99 | except Exception as e: 100 | errors.append(e) 101 | raise ValueError(errors) from e 102 | return jsonable_encoder(data, custom_encoder=custom_encoder) 103 | -------------------------------------------------------------------------------- /src/zep_cloud/core/pydantic_utilities.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | import pydantic 6 | 7 | IS_PYDANTIC_V2 = pydantic.VERSION.startswith("2.") 8 | 9 | if IS_PYDANTIC_V2: 10 | import pydantic.v1 as pydantic_v1 # type: ignore # nopycln: import 11 | else: 12 | import pydantic as pydantic_v1 # type: ignore # nopycln: import 13 | 14 | 15 | def deep_union_pydantic_dicts( 16 | source: typing.Dict[str, typing.Any], destination: typing.Dict[str, typing.Any] 17 | ) -> typing.Dict[str, typing.Any]: 18 | for key, value in source.items(): 19 | if isinstance(value, dict): 20 | node = destination.setdefault(key, {}) 21 | deep_union_pydantic_dicts(value, node) 22 | else: 23 | destination[key] = value 24 | 25 | return destination 26 | 27 | 28 | __all__ = ["pydantic_v1"] 29 | -------------------------------------------------------------------------------- /src/zep_cloud/core/query_encoder.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | from collections import ChainMap 4 | from typing import Any, Dict, Optional 5 | 6 | from .pydantic_utilities import pydantic_v1 7 | 8 | 9 | # Flattens dicts to be of the form {"key[subkey][subkey2]": value} where value is not a dict 10 | def traverse_query_dict(dict_flat: Dict[str, Any], key_prefix: Optional[str] = None) -> Dict[str, Any]: 11 | result = {} 12 | for k, v in dict_flat.items(): 13 | key = f"{key_prefix}[{k}]" if key_prefix is not None else k 14 | if isinstance(v, dict): 15 | result.update(traverse_query_dict(v, key)) 16 | else: 17 | result[key] = v 18 | return result 19 | 20 | 21 | def single_query_encoder(query_key: str, query_value: Any) -> Dict[str, Any]: 22 | if isinstance(query_value, pydantic_v1.BaseModel) or isinstance(query_value, dict): 23 | if isinstance(query_value, pydantic_v1.BaseModel): 24 | obj_dict = query_value.dict(by_alias=True) 25 | else: 26 | obj_dict = query_value 27 | return traverse_query_dict(obj_dict, query_key) 28 | 29 | return {query_key: query_value} 30 | 31 | 32 | def encode_query(query: Optional[Dict[str, Any]]) -> Optional[Dict[str, Any]]: 33 | return dict(ChainMap(*[single_query_encoder(k, v) for k, v in query.items()])) if query is not None else None 34 | -------------------------------------------------------------------------------- /src/zep_cloud/core/remove_none_from_dict.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | from typing import Any, Dict, Mapping, Optional 4 | 5 | 6 | def remove_none_from_dict(original: Mapping[str, Optional[Any]]) -> Dict[str, Any]: 7 | new: Dict[str, Any] = {} 8 | for key, value in original.items(): 9 | if value is not None: 10 | new[key] = value 11 | return new 12 | -------------------------------------------------------------------------------- /src/zep_cloud/core/request_options.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | try: 6 | from typing import NotRequired # type: ignore 7 | except ImportError: 8 | from typing_extensions import NotRequired 9 | 10 | 11 | class RequestOptions(typing.TypedDict, total=False): 12 | """ 13 | Additional options for request-specific configuration when calling APIs via the SDK. 14 | This is used primarily as an optional final parameter for service functions. 15 | 16 | Attributes: 17 | - timeout_in_seconds: int. The number of seconds to await an API call before timing out. 18 | 19 | - max_retries: int. The max number of retries to attempt if the API call fails. 20 | 21 | - additional_headers: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's header dict 22 | 23 | - additional_query_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's query parameters dict 24 | 25 | - additional_body_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's body parameters dict 26 | """ 27 | 28 | timeout_in_seconds: NotRequired[int] 29 | max_retries: NotRequired[int] 30 | additional_headers: NotRequired[typing.Dict[str, typing.Any]] 31 | additional_query_parameters: NotRequired[typing.Dict[str, typing.Any]] 32 | additional_body_parameters: NotRequired[typing.Dict[str, typing.Any]] 33 | -------------------------------------------------------------------------------- /src/zep_cloud/document/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | -------------------------------------------------------------------------------- /src/zep_cloud/environment.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import enum 4 | 5 | 6 | class ZepEnvironment(enum.Enum): 7 | DEFAULT = "https://api.getzep.com/api/v2" 8 | -------------------------------------------------------------------------------- /src/zep_cloud/errors/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | from .bad_request_error import BadRequestError 4 | from .conflict_error import ConflictError 5 | from .internal_server_error import InternalServerError 6 | from .not_found_error import NotFoundError 7 | from .unauthorized_error import UnauthorizedError 8 | 9 | __all__ = ["BadRequestError", "ConflictError", "InternalServerError", "NotFoundError", "UnauthorizedError"] 10 | -------------------------------------------------------------------------------- /src/zep_cloud/errors/bad_request_error.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | from ..core.api_error import ApiError as core_api_error_ApiError 4 | from ..types.api_error import ApiError as types_api_error_ApiError 5 | 6 | 7 | class BadRequestError(core_api_error_ApiError): 8 | def __init__(self, body: types_api_error_ApiError): 9 | super().__init__(status_code=400, body=body) 10 | -------------------------------------------------------------------------------- /src/zep_cloud/errors/conflict_error.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | from ..core.api_error import ApiError as core_api_error_ApiError 4 | from ..types.api_error import ApiError as types_api_error_ApiError 5 | 6 | 7 | class ConflictError(core_api_error_ApiError): 8 | def __init__(self, body: types_api_error_ApiError): 9 | super().__init__(status_code=409, body=body) 10 | -------------------------------------------------------------------------------- /src/zep_cloud/errors/internal_server_error.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | from ..core.api_error import ApiError as core_api_error_ApiError 4 | from ..types.api_error import ApiError as types_api_error_ApiError 5 | 6 | 7 | class InternalServerError(core_api_error_ApiError): 8 | def __init__(self, body: types_api_error_ApiError): 9 | super().__init__(status_code=500, body=body) 10 | -------------------------------------------------------------------------------- /src/zep_cloud/errors/not_found_error.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | from ..core.api_error import ApiError as core_api_error_ApiError 4 | from ..types.api_error import ApiError as types_api_error_ApiError 5 | 6 | 7 | class NotFoundError(core_api_error_ApiError): 8 | def __init__(self, body: types_api_error_ApiError): 9 | super().__init__(status_code=404, body=body) 10 | -------------------------------------------------------------------------------- /src/zep_cloud/errors/unauthorized_error.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | from ..core.api_error import ApiError as core_api_error_ApiError 4 | from ..types.api_error import ApiError as types_api_error_ApiError 5 | 6 | 7 | class UnauthorizedError(core_api_error_ApiError): 8 | def __init__(self, body: types_api_error_ApiError): 9 | super().__init__(status_code=401, body=body) 10 | -------------------------------------------------------------------------------- /src/zep_cloud/external_clients/document.py: -------------------------------------------------------------------------------- 1 | from zep_cloud.core.client_wrapper import AsyncClientWrapper, SyncClientWrapper 2 | from zep_cloud.document.client import DocumentClient as BaseDocumentClient, AsyncDocumentClient as AsyncBaseDocumentClient 3 | 4 | 5 | class DocumentClient(BaseDocumentClient): 6 | def __init__(self, *, client_wrapper: SyncClientWrapper): 7 | super().__init__( 8 | client_wrapper=client_wrapper 9 | ) 10 | 11 | 12 | class AsyncDocumentClient(AsyncBaseDocumentClient): 13 | def __init__(self, *, client_wrapper: AsyncClientWrapper): 14 | super().__init__( 15 | client_wrapper=client_wrapper 16 | ) -------------------------------------------------------------------------------- /src/zep_cloud/external_clients/memory.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | import json 3 | import typing 4 | 5 | from zep_cloud.core.client_wrapper import AsyncClientWrapper, SyncClientWrapper 6 | from zep_cloud.memory.client import ( 7 | AsyncMemoryClient as AsyncBaseMemoryClient, 8 | ) 9 | from zep_cloud.memory.client import ( 10 | MemoryClient as BaseMemoryClient, 11 | ) 12 | 13 | if typing.TYPE_CHECKING: 14 | from zep_cloud.extractor.models import ZepModel 15 | 16 | class MemoryClient(BaseMemoryClient): 17 | def __init__(self, *, client_wrapper: SyncClientWrapper): 18 | super().__init__(client_wrapper=client_wrapper) 19 | 20 | def extract( 21 | self, 22 | session_id: str, 23 | model: "ZepModel", 24 | current_date_time: typing.Optional[datetime.datetime] = None, 25 | last_n: int = 4, 26 | validate: bool = False, 27 | ): 28 | """Extracts structured data from a session based on a ZepModel schema. 29 | This method retrieves data based on a given model and session details. 30 | It then returns the extracted and validated data as an instance of the given ZepModel. 31 | 32 | Parameters 33 | ---------- 34 | session_id: str 35 | Session ID. 36 | model: ZepModel 37 | An instance of a ZepModel subclass defining the expected data structure and field types. 38 | current_date_time: typing.Optional[datetime.datetime] 39 | Your current date and time in ISO 8601 format including timezone. 40 | This is used for determining relative dates. 41 | last_n: typing.Optional[int] 42 | The number of messages in the chat history from which to extract data. 43 | validate: typing.Optional[bool] 44 | Validate that the extracted data is present in the dialog and correct per the field description. 45 | Mitigates hallucination, but is slower and may result in false negatives. 46 | 47 | Returns 48 | ------- 49 | ZepModel: An instance of the provided ZepModel subclass populated with the 50 | extracted and validated data. 51 | 52 | Examples 53 | -------- 54 | class CustomerInfo(ZepModel): 55 | name: Optional[ZepText] = Field(description="Customer name", default=None) 56 | email: Optional[ZepEmail] = Field(description="Customer email", default=None) 57 | signup_date: Optional[ZepDate] = Field(description="Customer Sign up date", default=None) 58 | 59 | client = AsyncMemoryClient(...) 60 | 61 | customer_data = await client.memory.extract( 62 | session_id="session123", 63 | model=CustomerInfo(), 64 | current_date_time=datetime.datetime.now(), # Filter data up to now 65 | ) 66 | 67 | print(customer_data.name) # Access extracted and validated customer name 68 | """ 69 | 70 | model_schema = json.dumps(model.model_json_schema()) 71 | 72 | result = self.extract_data( 73 | session_id=session_id, 74 | model_schema=model_schema, 75 | validate=validate, 76 | last_n=last_n, 77 | current_date_time=( 78 | current_date_time.isoformat() if current_date_time else None 79 | ), 80 | ) 81 | 82 | return model.model_validate(result) 83 | 84 | 85 | class AsyncMemoryClient(AsyncBaseMemoryClient): 86 | def __init__(self, *, client_wrapper: AsyncClientWrapper): 87 | super().__init__(client_wrapper=client_wrapper) 88 | 89 | async def extract( 90 | self, 91 | session_id: str, 92 | model: "ZepModel", 93 | current_date_time: typing.Optional[datetime.datetime] = None, 94 | last_n: int = 4, 95 | validate: bool = False, 96 | ): 97 | """Extracts structured data from a session based on a ZepModel schema. 98 | This method retrieves data based on a given model and session details. 99 | It then returns the extracted and validated data as an instance of the given ZepModel. 100 | 101 | Parameters 102 | ---------- 103 | session_id: str 104 | Session ID. 105 | model: ZepModel 106 | An instance of a ZepModel subclass defining the expected data structure and field types. 107 | current_date_time: typing.Optional[datetime.datetime] 108 | Your current date and time in ISO 8601 format including timezone. 109 | This is used for determining relative dates. 110 | last_n: typing.Optional[int] 111 | The number of messages in the chat history from which to extract data. 112 | validate: typing.Optional[bool] 113 | Validate that the extracted data is present in the dialog and correct per the field description. 114 | Mitigates hallucination, but is slower and may result in false negatives. 115 | 116 | Returns 117 | ------- 118 | ZepModel: An instance of the provided ZepModel subclass populated with the 119 | extracted and validated data. 120 | 121 | Examples 122 | -------- 123 | class CustomerInfo(ZepModel): 124 | name: Optional[ZepText] = Field(description="Customer name", default=None) 125 | name: Optional[ZepEmail] = Field(description="Customer email", default=None) 126 | signup_date: Optional[ZepDate] = Field(description="Customer Sign up date", default=None) 127 | 128 | client = AsyncMemoryClient(...) 129 | 130 | customer_data = await client.memory.extract( 131 | session_id="session123", 132 | model=CustomerInfo(), 133 | current_date_time=datetime.datetime.now(), # Filter data up to now 134 | ) 135 | 136 | print(customer_data.name) # Access extracted and validated customer name 137 | """ 138 | 139 | model_schema = json.dumps(model.model_json_schema()) 140 | 141 | result = await self.extract_data( 142 | session_id=session_id, 143 | model_schema=model_schema, 144 | validate=validate, 145 | last_n=last_n, 146 | current_date_time=( 147 | current_date_time.isoformat() if current_date_time else None 148 | ), 149 | ) 150 | 151 | return model.model_validate(result) 152 | -------------------------------------------------------------------------------- /src/zep_cloud/external_clients/ontology.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | import typing 3 | from pydantic import BaseModel, Field, WithJsonSchema, create_model 4 | from typing_extensions import Annotated 5 | from pydantic.json_schema import GenerateJsonSchema, JsonSchemaValue 6 | from pydantic_core import core_schema 7 | 8 | class EntityPropertyType(Enum): 9 | Text = "Text" 10 | Int = "Int" 11 | Float = "Float" 12 | Boolean = "Boolean" 13 | 14 | class EntityField(BaseModel): 15 | """Base class for entity field definitions""" 16 | description: str 17 | type: EntityPropertyType 18 | 19 | class EntityBaseText(EntityField): 20 | """Entity field with Text type""" 21 | type: EntityPropertyType = EntityPropertyType.Text 22 | 23 | class EntityBaseInt(EntityField): 24 | """Entity field with Int type""" 25 | type: EntityPropertyType = EntityPropertyType.Int 26 | 27 | class EntityBaseFloat(EntityField): 28 | """Entity field with Float type""" 29 | type: EntityPropertyType = EntityPropertyType.Float 30 | 31 | class EntityBaseBoolean(EntityField): 32 | """Entity field with Boolean type""" 33 | type: EntityPropertyType = EntityPropertyType.Boolean 34 | 35 | # Annotated types for entity properties 36 | # These types are used to define the properties of entity and edge models 37 | # Each type includes: 38 | # 1. The base Python type (str, int, float, bool) 39 | # 2. A default value of None 40 | # 3. Entity type information 41 | # 4. JSON schema information for serialization 42 | 43 | EntityText = Annotated[ 44 | typing.Optional[str], 45 | Field(default=None), 46 | Field(..., entity_type=EntityPropertyType.Text), 47 | WithJsonSchema(EntityBaseText.model_json_schema(), mode="serialization"), 48 | ] 49 | 50 | EntityInt = Annotated[ 51 | typing.Optional[int], 52 | Field(default=None), 53 | Field(..., entity_type=EntityPropertyType.Int), 54 | WithJsonSchema(EntityBaseInt.model_json_schema(), mode="serialization"), 55 | ] 56 | 57 | EntityFloat = Annotated[ 58 | typing.Optional[float], 59 | Field(default=None), 60 | Field(..., entity_type=EntityPropertyType.Float), 61 | WithJsonSchema(EntityBaseFloat.model_json_schema(), mode="serialization"), 62 | ] 63 | 64 | EntityBoolean = Annotated[ 65 | typing.Optional[bool], 66 | Field(default=None), 67 | Field(..., entity_type=EntityPropertyType.Boolean), 68 | WithJsonSchema(EntityBaseBoolean.model_json_schema(), mode="serialization"), 69 | ] 70 | 71 | class _CustomJsonSchema(GenerateJsonSchema): 72 | """ 73 | _CustomJsonSchema is a helper class that flattens and removes nullable as these aren't relevant to the entity schema 74 | and this simplifies server-side deserialization 75 | """ 76 | def nullable_schema(self, schema: core_schema.CoreSchema) -> JsonSchemaValue: 77 | return self.generate_inner(schema["schema"]) 78 | 79 | class _BaseSchemaModel(BaseModel): 80 | """Base class for models that need custom JSON schema generation""" 81 | @classmethod 82 | def model_json_schema(cls, *args, **kwargs): 83 | kwargs["schema_generator"] = _CustomJsonSchema 84 | return super().model_json_schema(*args, **kwargs) 85 | 86 | class EntityModel(_BaseSchemaModel): 87 | """Entity model for representing entity types""" 88 | pass 89 | 90 | class EdgeModel(_BaseSchemaModel): 91 | """Edge model for representing edge types""" 92 | pass 93 | 94 | def _model_to_api_schema_common(model_class: typing.Union["EntityModel", "EdgeModel"], name: str, is_edge: bool = False) -> dict[str, typing.Any]: 95 | """Common function to convert a Pydantic Model to a JSON schema for API EntityType or EdgeType""" 96 | 97 | schema = model_class.model_json_schema() 98 | 99 | # Define the type with proper typings for properties as a list of dictionaries 100 | result_type: dict[str, typing.Any] = { 101 | "name": name, 102 | "description": model_class.__doc__.strip() if model_class.__doc__ else "", 103 | "properties": [] 104 | } 105 | 106 | # Add source_targets field for edge types 107 | if is_edge: 108 | result_type["source_targets"] = [] 109 | 110 | for field_name, field_schema in schema.get("properties", {}).items(): 111 | if "type" not in field_schema: 112 | continue 113 | 114 | property_type = field_schema.get("type") 115 | type_mapping = { 116 | "string": "Text", 117 | "integer": "Int", 118 | "number": "Float", 119 | "boolean": "Boolean" 120 | } 121 | 122 | if property_type in type_mapping: 123 | property_type = type_mapping[property_type] 124 | else: 125 | raise ValueError(f"Unsupported property type: {property_type}") 126 | 127 | description = field_schema.get("description", "") 128 | 129 | result_type["properties"].append({ 130 | "name": field_name, 131 | "type": property_type, 132 | "description": description 133 | }) 134 | 135 | return result_type 136 | 137 | 138 | def entity_model_to_api_schema(model_class: "EntityModel", name: str) -> dict[str, typing.Any]: 139 | """Convert a Pydantic EntityModel to a JSON schema for API EntityType""" 140 | return _model_to_api_schema_common(model_class, name, is_edge=False) 141 | 142 | 143 | def edge_model_to_api_schema(model_class: "EdgeModel", name: str) -> dict[str, typing.Any]: 144 | """Convert a Pydantic EdgeModel to a JSON schema for API EntityEdge""" 145 | return _model_to_api_schema_common(model_class, name, is_edge=True) 146 | 147 | -------------------------------------------------------------------------------- /src/zep_cloud/external_clients/user.py: -------------------------------------------------------------------------------- 1 | from zep_cloud.core.client_wrapper import AsyncClientWrapper, SyncClientWrapper 2 | from zep_cloud.user.client import UserClient as BaseUserClient, AsyncUserClient as AsyncBaseUserClient 3 | 4 | 5 | class UserClient(BaseUserClient): 6 | def __init__(self, *, client_wrapper: SyncClientWrapper): 7 | super().__init__( 8 | client_wrapper=client_wrapper 9 | ) 10 | 11 | 12 | class AsyncUserClient(AsyncBaseUserClient): 13 | def __init__(self, *, client_wrapper: AsyncClientWrapper): 14 | super().__init__( 15 | client_wrapper=client_wrapper 16 | ) -------------------------------------------------------------------------------- /src/zep_cloud/extractor/__init__.py: -------------------------------------------------------------------------------- 1 | # mypy: disable-error-code=no-redef 2 | 3 | from typing import Type 4 | 5 | # Zep Extraction requires Pydantic v2. If v2 is not installed, catch the error 6 | # and set the variables to PydanticV2Required 7 | 8 | 9 | class PydanticV2Required: 10 | def __init__(self, *args, **kwargs): 11 | raise RuntimeError("Pydantic v2 is required to use this class.") 12 | 13 | 14 | try: 15 | from zep_cloud.extractor.models import ( 16 | ZepModel, 17 | ZepText, 18 | ZepNumber, 19 | ZepFloat, 20 | ZepRegex, 21 | ZepZipCode, 22 | ZepDate, 23 | ZepDateTime, 24 | ZepEmail, 25 | ZepPhoneNumber, 26 | ) 27 | except ImportError: 28 | ZepModel: Type = PydanticV2Required 29 | ZepText: Type = PydanticV2Required 30 | ZepNumber: Type = PydanticV2Required 31 | ZepFloat: Type = PydanticV2Required 32 | ZepRegex: Type = PydanticV2Required 33 | ZepZipCode: Type = PydanticV2Required 34 | ZepDate: Type = PydanticV2Required 35 | ZepDateTime: Type = PydanticV2Required 36 | ZepEmail: Type = PydanticV2Required 37 | ZepPhoneNumber: Type = PydanticV2Required 38 | 39 | __all__ = [ 40 | "ZepModel", 41 | "ZepText", 42 | "ZepNumber", 43 | "ZepFloat", 44 | "ZepRegex", 45 | "ZepZipCode", 46 | "ZepDate", 47 | "ZepDateTime", 48 | "ZepEmail", 49 | "ZepPhoneNumber", 50 | ] 51 | -------------------------------------------------------------------------------- /src/zep_cloud/extractor/models.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | import typing 3 | from enum import Enum 4 | 5 | from pydantic import BaseModel, Field, WithJsonSchema 6 | from typing_extensions import Annotated 7 | 8 | from pydantic.json_schema import GenerateJsonSchema, JsonSchemaValue 9 | from pydantic_core import core_schema 10 | 11 | 12 | class ZepDataType(Enum): 13 | ZepText = "ZepText" 14 | ZepZipCode = "ZepZipCode" 15 | ZepDate = "ZepDate" 16 | ZepDateTime = "ZepDateTime" 17 | ZepEmail = "ZepEmail" 18 | ZepPhoneNumber = "ZepPhoneNumber" 19 | ZepFloat = "ZepFloat" 20 | ZepNumber = "ZepNumber" 21 | ZepRegex = "ZepRegex" 22 | 23 | 24 | class ZepField(BaseModel): 25 | description: typing.Optional[str] = None 26 | 27 | 28 | class ZepBaseText(ZepField): 29 | type: ZepDataType = ZepDataType.ZepText 30 | 31 | 32 | ZepText = Annotated[ 33 | typing.Optional[str], 34 | Field(..., zep_type=ZepDataType.ZepText), 35 | WithJsonSchema(ZepBaseText.model_json_schema(), mode="serialization"), 36 | ] 37 | 38 | 39 | class ZepBaseNumber(ZepField): 40 | type: ZepDataType = ZepDataType.ZepFloat 41 | pattern: typing.Optional[str] = None 42 | 43 | 44 | ZepNumber = Annotated[ 45 | typing.Optional[int], 46 | Field(..., zep_type=ZepDataType.ZepNumber), 47 | WithJsonSchema(ZepBaseNumber.model_json_schema(), mode="serialization"), 48 | ] 49 | 50 | 51 | class ZepBaseFloat(ZepField): 52 | type: ZepDataType = ZepDataType.ZepFloat 53 | 54 | 55 | ZepFloat = Annotated[ 56 | typing.Optional[float], 57 | Field(..., zep_type=ZepDataType.ZepFloat), 58 | WithJsonSchema(ZepBaseFloat.model_json_schema(), mode="serialization"), 59 | ] 60 | 61 | 62 | class ZepBaseRegex(ZepField): 63 | type: ZepDataType = ZepDataType.ZepRegex 64 | 65 | 66 | ZepRegex = Annotated[ 67 | typing.Optional[str], 68 | Field(..., zep_type=ZepDataType.ZepRegex), 69 | WithJsonSchema(ZepBaseRegex.model_json_schema(), mode="serialization"), 70 | ] 71 | 72 | 73 | class ZepBaseZipCode(ZepField): 74 | type: ZepDataType = ZepDataType.ZepZipCode 75 | 76 | 77 | ZepZipCode = Annotated[ 78 | typing.Optional[str], 79 | Field(..., zep_type=ZepDataType.ZepZipCode), 80 | WithJsonSchema(ZepBaseZipCode.model_json_schema(), mode="serialization"), 81 | ] 82 | 83 | 84 | class ZepBaseDate(ZepField): 85 | type: ZepDataType = ZepDataType.ZepDate 86 | 87 | 88 | ZepDate = Annotated[ 89 | typing.Optional[datetime.date], 90 | Field(..., zep_type=ZepDataType.ZepDate), 91 | WithJsonSchema(ZepBaseDate.model_json_schema(), mode="serialization"), 92 | ] 93 | 94 | 95 | class ZepBaseDateTime(ZepField): 96 | type: ZepDataType = ZepDataType.ZepDateTime 97 | 98 | 99 | ZepDateTime = Annotated[ 100 | typing.Optional[datetime.datetime], 101 | Field(..., zep_type=ZepDataType.ZepDateTime), 102 | WithJsonSchema(ZepBaseDateTime.model_json_schema(), mode="serialization"), 103 | ] 104 | 105 | 106 | class ZepBaseEmail(ZepField): 107 | type: ZepDataType = ZepDataType.ZepEmail 108 | 109 | 110 | ZepEmail = Annotated[ 111 | typing.Optional[str], 112 | Field(..., zep_type=ZepDataType.ZepEmail), 113 | WithJsonSchema(ZepBaseEmail.model_json_schema(), mode="serialization"), 114 | ] 115 | 116 | 117 | class ZepBasePhoneNumber(ZepField): 118 | type: ZepDataType = ZepDataType.ZepPhoneNumber 119 | 120 | 121 | ZepPhoneNumber = Annotated[ 122 | typing.Optional[str], 123 | Field(..., zep_type=ZepDataType.ZepPhoneNumber), 124 | WithJsonSchema(ZepBasePhoneNumber.model_json_schema(), mode="serialization"), 125 | ] 126 | 127 | 128 | class _CustomJsonSchema(GenerateJsonSchema): 129 | """ 130 | _CustomJsonSchema is a helper class that flattens and remove nullable as these aren't relevant to the Zep schema 131 | and this simplifies server-side deserialization 132 | """ 133 | 134 | def nullable_schema(self, schema: core_schema.CoreSchema) -> JsonSchemaValue: 135 | return self.generate_inner(schema["schema"]) 136 | 137 | 138 | class ZepModel(BaseModel): 139 | @classmethod 140 | def model_json_schema(cls, *args, **kwargs): 141 | kwargs["schema_generator"] = _CustomJsonSchema 142 | return super().model_json_schema(*args, **kwargs) 143 | -------------------------------------------------------------------------------- /src/zep_cloud/graph/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | from . import edge, episode, node 4 | 5 | __all__ = ["edge", "episode", "node"] 6 | -------------------------------------------------------------------------------- /src/zep_cloud/graph/edge/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | -------------------------------------------------------------------------------- /src/zep_cloud/graph/episode/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | -------------------------------------------------------------------------------- /src/zep_cloud/graph/node/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | -------------------------------------------------------------------------------- /src/zep_cloud/group/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | -------------------------------------------------------------------------------- /src/zep_cloud/memory/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | -------------------------------------------------------------------------------- /src/zep_cloud/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getzep/zep-python/1e11581a05722a2681d73ea956e2234a4a4ef8b3/src/zep_cloud/py.typed -------------------------------------------------------------------------------- /src/zep_cloud/types/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | from .add_memory_response import AddMemoryResponse 4 | from .add_triple_response import AddTripleResponse 5 | from .api_error import ApiError 6 | from .apidata_document import ApidataDocument 7 | from .apidata_document_collection import ApidataDocumentCollection 8 | from .apidata_document_search_response import ApidataDocumentSearchResponse 9 | from .apidata_document_with_score import ApidataDocumentWithScore 10 | from .classify_session_request import ClassifySessionRequest 11 | from .create_document_request import CreateDocumentRequest 12 | from .edge_type import EdgeType 13 | from .end_session_response import EndSessionResponse 14 | from .end_sessions_response import EndSessionsResponse 15 | from .entity_edge import EntityEdge 16 | from .entity_edge_source_target import EntityEdgeSourceTarget 17 | from .entity_node import EntityNode 18 | from .entity_property import EntityProperty 19 | from .entity_property_type import EntityPropertyType 20 | from .entity_type import EntityType 21 | from .entity_type_response import EntityTypeResponse 22 | from .episode import Episode 23 | from .episode_data import EpisodeData 24 | from .episode_response import EpisodeResponse 25 | from .fact import Fact 26 | from .fact_rating_examples import FactRatingExamples 27 | from .fact_rating_instruction import FactRatingInstruction 28 | from .fact_response import FactResponse 29 | from .facts_response import FactsResponse 30 | from .graph_data_type import GraphDataType 31 | from .graph_edges_request import GraphEdgesRequest 32 | from .graph_nodes_request import GraphNodesRequest 33 | from .graph_search_results import GraphSearchResults 34 | from .graph_search_scope import GraphSearchScope 35 | from .group import Group 36 | from .group_list_response import GroupListResponse 37 | from .memory import Memory 38 | from .memory_search_result import MemorySearchResult 39 | from .message import Message 40 | from .message_list_response import MessageListResponse 41 | from .new_fact import NewFact 42 | from .question import Question 43 | from .reranker import Reranker 44 | from .role_type import RoleType 45 | from .search_filters import SearchFilters 46 | from .search_scope import SearchScope 47 | from .search_type import SearchType 48 | from .session import Session 49 | from .session_classification import SessionClassification 50 | from .session_list_response import SessionListResponse 51 | from .session_search_response import SessionSearchResponse 52 | from .session_search_result import SessionSearchResult 53 | from .success_response import SuccessResponse 54 | from .summary import Summary 55 | from .summary_list_response import SummaryListResponse 56 | from .update_document_list_request import UpdateDocumentListRequest 57 | from .user import User 58 | from .user_list_response import UserListResponse 59 | from .user_node_response import UserNodeResponse 60 | 61 | __all__ = [ 62 | "AddMemoryResponse", 63 | "AddTripleResponse", 64 | "ApiError", 65 | "ApidataDocument", 66 | "ApidataDocumentCollection", 67 | "ApidataDocumentSearchResponse", 68 | "ApidataDocumentWithScore", 69 | "ClassifySessionRequest", 70 | "CreateDocumentRequest", 71 | "EdgeType", 72 | "EndSessionResponse", 73 | "EndSessionsResponse", 74 | "EntityEdge", 75 | "EntityEdgeSourceTarget", 76 | "EntityNode", 77 | "EntityProperty", 78 | "EntityPropertyType", 79 | "EntityType", 80 | "EntityTypeResponse", 81 | "Episode", 82 | "EpisodeData", 83 | "EpisodeResponse", 84 | "Fact", 85 | "FactRatingExamples", 86 | "FactRatingInstruction", 87 | "FactResponse", 88 | "FactsResponse", 89 | "GraphDataType", 90 | "GraphEdgesRequest", 91 | "GraphNodesRequest", 92 | "GraphSearchResults", 93 | "GraphSearchScope", 94 | "Group", 95 | "GroupListResponse", 96 | "Memory", 97 | "MemorySearchResult", 98 | "Message", 99 | "MessageListResponse", 100 | "NewFact", 101 | "Question", 102 | "Reranker", 103 | "RoleType", 104 | "SearchFilters", 105 | "SearchScope", 106 | "SearchType", 107 | "Session", 108 | "SessionClassification", 109 | "SessionListResponse", 110 | "SessionSearchResponse", 111 | "SessionSearchResult", 112 | "SuccessResponse", 113 | "Summary", 114 | "SummaryListResponse", 115 | "UpdateDocumentListRequest", 116 | "User", 117 | "UserListResponse", 118 | "UserNodeResponse", 119 | ] 120 | -------------------------------------------------------------------------------- /src/zep_cloud/types/add_memory_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class AddMemoryResponse(pydantic_v1.BaseModel): 11 | context: typing.Optional[str] = None 12 | 13 | def json(self, **kwargs: typing.Any) -> str: 14 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 15 | return super().json(**kwargs_with_defaults) 16 | 17 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 18 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 19 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 20 | 21 | return deep_union_pydantic_dicts( 22 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 23 | ) 24 | 25 | class Config: 26 | frozen = True 27 | smart_union = True 28 | extra = pydantic_v1.Extra.allow 29 | json_encoders = {dt.datetime: serialize_datetime} 30 | -------------------------------------------------------------------------------- /src/zep_cloud/types/add_triple_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .entity_edge import EntityEdge 9 | from .entity_node import EntityNode 10 | 11 | 12 | class AddTripleResponse(pydantic_v1.BaseModel): 13 | edge: typing.Optional[EntityEdge] = None 14 | source_node: typing.Optional[EntityNode] = None 15 | target_node: typing.Optional[EntityNode] = None 16 | 17 | def json(self, **kwargs: typing.Any) -> str: 18 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 19 | return super().json(**kwargs_with_defaults) 20 | 21 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 22 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 23 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 24 | 25 | return deep_union_pydantic_dicts( 26 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 27 | ) 28 | 29 | class Config: 30 | frozen = True 31 | smart_union = True 32 | extra = pydantic_v1.Extra.allow 33 | json_encoders = {dt.datetime: serialize_datetime} 34 | -------------------------------------------------------------------------------- /src/zep_cloud/types/api_error.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class ApiError(pydantic_v1.BaseModel): 11 | message: typing.Optional[str] = None 12 | 13 | def json(self, **kwargs: typing.Any) -> str: 14 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 15 | return super().json(**kwargs_with_defaults) 16 | 17 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 18 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 19 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 20 | 21 | return deep_union_pydantic_dicts( 22 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 23 | ) 24 | 25 | class Config: 26 | frozen = True 27 | smart_union = True 28 | extra = pydantic_v1.Extra.allow 29 | json_encoders = {dt.datetime: serialize_datetime} 30 | -------------------------------------------------------------------------------- /src/zep_cloud/types/apidata_document.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class ApidataDocument(pydantic_v1.BaseModel): 11 | content: typing.Optional[str] = None 12 | created_at: typing.Optional[str] = None 13 | document_id: typing.Optional[str] = None 14 | embedding: typing.Optional[typing.List[float]] = None 15 | is_embedded: typing.Optional[bool] = None 16 | metadata: typing.Optional[typing.Dict[str, typing.Any]] = None 17 | updated_at: typing.Optional[str] = None 18 | uuid_: typing.Optional[str] = pydantic_v1.Field(alias="uuid", default=None) 19 | 20 | def json(self, **kwargs: typing.Any) -> str: 21 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 22 | return super().json(**kwargs_with_defaults) 23 | 24 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 25 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 26 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 27 | 28 | return deep_union_pydantic_dicts( 29 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 30 | ) 31 | 32 | class Config: 33 | frozen = True 34 | smart_union = True 35 | allow_population_by_field_name = True 36 | populate_by_name = True 37 | extra = pydantic_v1.Extra.allow 38 | json_encoders = {dt.datetime: serialize_datetime} 39 | -------------------------------------------------------------------------------- /src/zep_cloud/types/apidata_document_collection.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class ApidataDocumentCollection(pydantic_v1.BaseModel): 11 | created_at: typing.Optional[str] = None 12 | description: typing.Optional[str] = None 13 | document_count: typing.Optional[int] = None 14 | document_embedded_count: typing.Optional[int] = None 15 | embedding_dimensions: typing.Optional[int] = None 16 | embedding_model_name: typing.Optional[str] = None 17 | is_auto_embedded: typing.Optional[bool] = None 18 | is_indexed: typing.Optional[bool] = None 19 | is_normalized: typing.Optional[bool] = None 20 | metadata: typing.Optional[typing.Dict[str, typing.Any]] = None 21 | name: typing.Optional[str] = None 22 | updated_at: typing.Optional[str] = None 23 | uuid_: typing.Optional[str] = pydantic_v1.Field(alias="uuid", default=None) 24 | 25 | def json(self, **kwargs: typing.Any) -> str: 26 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 27 | return super().json(**kwargs_with_defaults) 28 | 29 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 30 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 31 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 32 | 33 | return deep_union_pydantic_dicts( 34 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 35 | ) 36 | 37 | class Config: 38 | frozen = True 39 | smart_union = True 40 | allow_population_by_field_name = True 41 | populate_by_name = True 42 | extra = pydantic_v1.Extra.allow 43 | json_encoders = {dt.datetime: serialize_datetime} 44 | -------------------------------------------------------------------------------- /src/zep_cloud/types/apidata_document_search_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .apidata_document_with_score import ApidataDocumentWithScore 9 | 10 | 11 | class ApidataDocumentSearchResponse(pydantic_v1.BaseModel): 12 | current_page: typing.Optional[int] = None 13 | query_vector: typing.Optional[typing.List[float]] = None 14 | result_count: typing.Optional[int] = None 15 | results: typing.Optional[typing.List[ApidataDocumentWithScore]] = None 16 | total_pages: typing.Optional[int] = None 17 | 18 | def json(self, **kwargs: typing.Any) -> str: 19 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 20 | return super().json(**kwargs_with_defaults) 21 | 22 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 23 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 24 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 25 | 26 | return deep_union_pydantic_dicts( 27 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 28 | ) 29 | 30 | class Config: 31 | frozen = True 32 | smart_union = True 33 | extra = pydantic_v1.Extra.allow 34 | json_encoders = {dt.datetime: serialize_datetime} 35 | -------------------------------------------------------------------------------- /src/zep_cloud/types/apidata_document_with_score.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class ApidataDocumentWithScore(pydantic_v1.BaseModel): 11 | content: typing.Optional[str] = None 12 | created_at: typing.Optional[str] = None 13 | document_id: typing.Optional[str] = None 14 | embedding: typing.Optional[typing.List[float]] = None 15 | is_embedded: typing.Optional[bool] = None 16 | metadata: typing.Optional[typing.Dict[str, typing.Any]] = None 17 | score: typing.Optional[float] = None 18 | updated_at: typing.Optional[str] = None 19 | uuid_: typing.Optional[str] = pydantic_v1.Field(alias="uuid", default=None) 20 | 21 | def json(self, **kwargs: typing.Any) -> str: 22 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 23 | return super().json(**kwargs_with_defaults) 24 | 25 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 26 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 27 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 28 | 29 | return deep_union_pydantic_dicts( 30 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 31 | ) 32 | 33 | class Config: 34 | frozen = True 35 | smart_union = True 36 | allow_population_by_field_name = True 37 | populate_by_name = True 38 | extra = pydantic_v1.Extra.allow 39 | json_encoders = {dt.datetime: serialize_datetime} 40 | -------------------------------------------------------------------------------- /src/zep_cloud/types/classify_session_request.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class ClassifySessionRequest(pydantic_v1.BaseModel): 11 | classes: typing.List[str] = pydantic_v1.Field() 12 | """ 13 | The classes to use for classification. 14 | """ 15 | 16 | instruction: typing.Optional[str] = pydantic_v1.Field(default=None) 17 | """ 18 | Custom instruction to use for classification. 19 | """ 20 | 21 | last_n: typing.Optional[int] = pydantic_v1.Field(default=None) 22 | """ 23 | The number of session messages to consider for classification. Defaults to 4. 24 | """ 25 | 26 | name: str = pydantic_v1.Field() 27 | """ 28 | The name of the classifier. 29 | """ 30 | 31 | persist: typing.Optional[bool] = pydantic_v1.Field(default=None) 32 | """ 33 | Deprecated 34 | """ 35 | 36 | def json(self, **kwargs: typing.Any) -> str: 37 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 38 | return super().json(**kwargs_with_defaults) 39 | 40 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 41 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 42 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 43 | 44 | return deep_union_pydantic_dicts( 45 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 46 | ) 47 | 48 | class Config: 49 | frozen = True 50 | smart_union = True 51 | extra = pydantic_v1.Extra.allow 52 | json_encoders = {dt.datetime: serialize_datetime} 53 | -------------------------------------------------------------------------------- /src/zep_cloud/types/create_document_request.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class CreateDocumentRequest(pydantic_v1.BaseModel): 11 | content: str 12 | document_id: typing.Optional[str] = None 13 | metadata: typing.Optional[typing.Dict[str, typing.Any]] = None 14 | 15 | def json(self, **kwargs: typing.Any) -> str: 16 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 17 | return super().json(**kwargs_with_defaults) 18 | 19 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 20 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 21 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 22 | 23 | return deep_union_pydantic_dicts( 24 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 25 | ) 26 | 27 | class Config: 28 | frozen = True 29 | smart_union = True 30 | extra = pydantic_v1.Extra.allow 31 | json_encoders = {dt.datetime: serialize_datetime} 32 | -------------------------------------------------------------------------------- /src/zep_cloud/types/edge_type.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .entity_edge_source_target import EntityEdgeSourceTarget 9 | from .entity_property import EntityProperty 10 | 11 | 12 | class EdgeType(pydantic_v1.BaseModel): 13 | description: str 14 | name: str 15 | properties: typing.Optional[typing.List[EntityProperty]] = None 16 | source_targets: typing.Optional[typing.List[EntityEdgeSourceTarget]] = None 17 | 18 | def json(self, **kwargs: typing.Any) -> str: 19 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 20 | return super().json(**kwargs_with_defaults) 21 | 22 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 23 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 24 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 25 | 26 | return deep_union_pydantic_dicts( 27 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 28 | ) 29 | 30 | class Config: 31 | frozen = True 32 | smart_union = True 33 | extra = pydantic_v1.Extra.allow 34 | json_encoders = {dt.datetime: serialize_datetime} 35 | -------------------------------------------------------------------------------- /src/zep_cloud/types/end_session_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .session import Session 9 | from .session_classification import SessionClassification 10 | 11 | 12 | class EndSessionResponse(pydantic_v1.BaseModel): 13 | classification: typing.Optional[SessionClassification] = None 14 | session: typing.Optional[Session] = None 15 | 16 | def json(self, **kwargs: typing.Any) -> str: 17 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 18 | return super().json(**kwargs_with_defaults) 19 | 20 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 21 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 22 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 23 | 24 | return deep_union_pydantic_dicts( 25 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 26 | ) 27 | 28 | class Config: 29 | frozen = True 30 | smart_union = True 31 | extra = pydantic_v1.Extra.allow 32 | json_encoders = {dt.datetime: serialize_datetime} 33 | -------------------------------------------------------------------------------- /src/zep_cloud/types/end_sessions_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .session import Session 9 | 10 | 11 | class EndSessionsResponse(pydantic_v1.BaseModel): 12 | sessions: typing.Optional[typing.List[Session]] = None 13 | 14 | def json(self, **kwargs: typing.Any) -> str: 15 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 16 | return super().json(**kwargs_with_defaults) 17 | 18 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 19 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 20 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 21 | 22 | return deep_union_pydantic_dicts( 23 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 24 | ) 25 | 26 | class Config: 27 | frozen = True 28 | smart_union = True 29 | extra = pydantic_v1.Extra.allow 30 | json_encoders = {dt.datetime: serialize_datetime} 31 | -------------------------------------------------------------------------------- /src/zep_cloud/types/entity_edge.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class EntityEdge(pydantic_v1.BaseModel): 11 | attributes: typing.Optional[typing.Dict[str, typing.Any]] = pydantic_v1.Field(default=None) 12 | """ 13 | Additional attributes of the edge. Dependent on edge types 14 | """ 15 | 16 | created_at: str = pydantic_v1.Field() 17 | """ 18 | Creation time of the edge 19 | """ 20 | 21 | episodes: typing.Optional[typing.List[str]] = pydantic_v1.Field(default=None) 22 | """ 23 | List of episode ids that reference these entity edges 24 | """ 25 | 26 | expired_at: typing.Optional[str] = pydantic_v1.Field(default=None) 27 | """ 28 | Datetime of when the node was invalidated 29 | """ 30 | 31 | fact: str = pydantic_v1.Field() 32 | """ 33 | Fact representing the edge and nodes that it connects 34 | """ 35 | 36 | invalid_at: typing.Optional[str] = pydantic_v1.Field(default=None) 37 | """ 38 | Datetime of when the fact stopped being true 39 | """ 40 | 41 | name: str = pydantic_v1.Field() 42 | """ 43 | Name of the edge, relation name 44 | """ 45 | 46 | source_node_uuid: str = pydantic_v1.Field() 47 | """ 48 | UUID of the source node 49 | """ 50 | 51 | target_node_uuid: str = pydantic_v1.Field() 52 | """ 53 | UUID of the target node 54 | """ 55 | 56 | uuid_: str = pydantic_v1.Field(alias="uuid") 57 | """ 58 | UUID of the edge 59 | """ 60 | 61 | valid_at: typing.Optional[str] = pydantic_v1.Field(default=None) 62 | """ 63 | Datetime of when the fact became true 64 | """ 65 | 66 | def json(self, **kwargs: typing.Any) -> str: 67 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 68 | return super().json(**kwargs_with_defaults) 69 | 70 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 71 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 72 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 73 | 74 | return deep_union_pydantic_dicts( 75 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 76 | ) 77 | 78 | class Config: 79 | frozen = True 80 | smart_union = True 81 | allow_population_by_field_name = True 82 | populate_by_name = True 83 | extra = pydantic_v1.Extra.allow 84 | json_encoders = {dt.datetime: serialize_datetime} 85 | -------------------------------------------------------------------------------- /src/zep_cloud/types/entity_edge_source_target.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class EntityEdgeSourceTarget(pydantic_v1.BaseModel): 11 | source: typing.Optional[str] = pydantic_v1.Field(default=None) 12 | """ 13 | Source represents the originating node identifier in the edge type relationship. (optional) 14 | """ 15 | 16 | target: typing.Optional[str] = pydantic_v1.Field(default=None) 17 | """ 18 | Target represents the target node identifier in the edge type relationship. (optional) 19 | """ 20 | 21 | def json(self, **kwargs: typing.Any) -> str: 22 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 23 | return super().json(**kwargs_with_defaults) 24 | 25 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 26 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 27 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 28 | 29 | return deep_union_pydantic_dicts( 30 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 31 | ) 32 | 33 | class Config: 34 | frozen = True 35 | smart_union = True 36 | extra = pydantic_v1.Extra.allow 37 | json_encoders = {dt.datetime: serialize_datetime} 38 | -------------------------------------------------------------------------------- /src/zep_cloud/types/entity_node.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class EntityNode(pydantic_v1.BaseModel): 11 | attributes: typing.Optional[typing.Dict[str, typing.Any]] = pydantic_v1.Field(default=None) 12 | """ 13 | Additional attributes of the node. Dependent on node labels 14 | """ 15 | 16 | created_at: str = pydantic_v1.Field() 17 | """ 18 | Creation time of the node 19 | """ 20 | 21 | labels: typing.Optional[typing.List[str]] = pydantic_v1.Field(default=None) 22 | """ 23 | Labels associated with the node 24 | """ 25 | 26 | name: str = pydantic_v1.Field() 27 | """ 28 | Name of the node 29 | """ 30 | 31 | summary: str = pydantic_v1.Field() 32 | """ 33 | Regional summary of surrounding edges 34 | """ 35 | 36 | uuid_: str = pydantic_v1.Field(alias="uuid") 37 | """ 38 | UUID of the node 39 | """ 40 | 41 | def json(self, **kwargs: typing.Any) -> str: 42 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 43 | return super().json(**kwargs_with_defaults) 44 | 45 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 46 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 47 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 48 | 49 | return deep_union_pydantic_dicts( 50 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 51 | ) 52 | 53 | class Config: 54 | frozen = True 55 | smart_union = True 56 | allow_population_by_field_name = True 57 | populate_by_name = True 58 | extra = pydantic_v1.Extra.allow 59 | json_encoders = {dt.datetime: serialize_datetime} 60 | -------------------------------------------------------------------------------- /src/zep_cloud/types/entity_property.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .entity_property_type import EntityPropertyType 9 | 10 | 11 | class EntityProperty(pydantic_v1.BaseModel): 12 | description: str 13 | name: str 14 | type: EntityPropertyType 15 | 16 | def json(self, **kwargs: typing.Any) -> str: 17 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 18 | return super().json(**kwargs_with_defaults) 19 | 20 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 21 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 22 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 23 | 24 | return deep_union_pydantic_dicts( 25 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 26 | ) 27 | 28 | class Config: 29 | frozen = True 30 | smart_union = True 31 | extra = pydantic_v1.Extra.allow 32 | json_encoders = {dt.datetime: serialize_datetime} 33 | -------------------------------------------------------------------------------- /src/zep_cloud/types/entity_property_type.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | EntityPropertyType = typing.Union[typing.Literal["Text", "Int", "Float", "Boolean"], typing.Any] 6 | -------------------------------------------------------------------------------- /src/zep_cloud/types/entity_type.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .entity_property import EntityProperty 9 | 10 | 11 | class EntityType(pydantic_v1.BaseModel): 12 | description: str 13 | name: str 14 | properties: typing.Optional[typing.List[EntityProperty]] = None 15 | 16 | def json(self, **kwargs: typing.Any) -> str: 17 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 18 | return super().json(**kwargs_with_defaults) 19 | 20 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 21 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 22 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 23 | 24 | return deep_union_pydantic_dicts( 25 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 26 | ) 27 | 28 | class Config: 29 | frozen = True 30 | smart_union = True 31 | extra = pydantic_v1.Extra.allow 32 | json_encoders = {dt.datetime: serialize_datetime} 33 | -------------------------------------------------------------------------------- /src/zep_cloud/types/entity_type_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .edge_type import EdgeType 9 | from .entity_type import EntityType 10 | 11 | 12 | class EntityTypeResponse(pydantic_v1.BaseModel): 13 | edge_types: typing.Optional[typing.List[EdgeType]] = None 14 | entity_types: typing.Optional[typing.List[EntityType]] = None 15 | 16 | def json(self, **kwargs: typing.Any) -> str: 17 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 18 | return super().json(**kwargs_with_defaults) 19 | 20 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 21 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 22 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 23 | 24 | return deep_union_pydantic_dicts( 25 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 26 | ) 27 | 28 | class Config: 29 | frozen = True 30 | smart_union = True 31 | extra = pydantic_v1.Extra.allow 32 | json_encoders = {dt.datetime: serialize_datetime} 33 | -------------------------------------------------------------------------------- /src/zep_cloud/types/episode.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .graph_data_type import GraphDataType 9 | 10 | 11 | class Episode(pydantic_v1.BaseModel): 12 | content: str 13 | created_at: str 14 | processed: typing.Optional[bool] = None 15 | session_id: typing.Optional[str] = pydantic_v1.Field(default=None) 16 | """ 17 | Optional session ID. Will be present only if the episode corresponds to the messages added using memory.add API 18 | """ 19 | 20 | source: typing.Optional[GraphDataType] = None 21 | source_description: typing.Optional[str] = None 22 | uuid_: str = pydantic_v1.Field(alias="uuid") 23 | 24 | def json(self, **kwargs: typing.Any) -> str: 25 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 26 | return super().json(**kwargs_with_defaults) 27 | 28 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 29 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 30 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 31 | 32 | return deep_union_pydantic_dicts( 33 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 34 | ) 35 | 36 | class Config: 37 | frozen = True 38 | smart_union = True 39 | allow_population_by_field_name = True 40 | populate_by_name = True 41 | extra = pydantic_v1.Extra.allow 42 | json_encoders = {dt.datetime: serialize_datetime} 43 | -------------------------------------------------------------------------------- /src/zep_cloud/types/episode_data.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .graph_data_type import GraphDataType 9 | 10 | 11 | class EpisodeData(pydantic_v1.BaseModel): 12 | created_at: typing.Optional[str] = None 13 | data: str 14 | source_description: typing.Optional[str] = None 15 | type: GraphDataType 16 | 17 | def json(self, **kwargs: typing.Any) -> str: 18 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 19 | return super().json(**kwargs_with_defaults) 20 | 21 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 22 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 23 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 24 | 25 | return deep_union_pydantic_dicts( 26 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 27 | ) 28 | 29 | class Config: 30 | frozen = True 31 | smart_union = True 32 | extra = pydantic_v1.Extra.allow 33 | json_encoders = {dt.datetime: serialize_datetime} 34 | -------------------------------------------------------------------------------- /src/zep_cloud/types/episode_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .episode import Episode 9 | 10 | 11 | class EpisodeResponse(pydantic_v1.BaseModel): 12 | episodes: typing.Optional[typing.List[Episode]] = None 13 | 14 | def json(self, **kwargs: typing.Any) -> str: 15 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 16 | return super().json(**kwargs_with_defaults) 17 | 18 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 19 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 20 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 21 | 22 | return deep_union_pydantic_dicts( 23 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 24 | ) 25 | 26 | class Config: 27 | frozen = True 28 | smart_union = True 29 | extra = pydantic_v1.Extra.allow 30 | json_encoders = {dt.datetime: serialize_datetime} 31 | -------------------------------------------------------------------------------- /src/zep_cloud/types/fact.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class Fact(pydantic_v1.BaseModel): 11 | content: str 12 | created_at: str 13 | expired_at: typing.Optional[str] = None 14 | fact: str = pydantic_v1.Field() 15 | """ 16 | Deprecated 17 | """ 18 | 19 | invalid_at: typing.Optional[str] = None 20 | name: typing.Optional[str] = None 21 | rating: typing.Optional[float] = None 22 | source_node_name: typing.Optional[str] = None 23 | target_node_name: typing.Optional[str] = None 24 | uuid_: str = pydantic_v1.Field(alias="uuid") 25 | valid_at: typing.Optional[str] = None 26 | 27 | def json(self, **kwargs: typing.Any) -> str: 28 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 29 | return super().json(**kwargs_with_defaults) 30 | 31 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 32 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 33 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 34 | 35 | return deep_union_pydantic_dicts( 36 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 37 | ) 38 | 39 | class Config: 40 | frozen = True 41 | smart_union = True 42 | allow_population_by_field_name = True 43 | populate_by_name = True 44 | extra = pydantic_v1.Extra.allow 45 | json_encoders = {dt.datetime: serialize_datetime} 46 | -------------------------------------------------------------------------------- /src/zep_cloud/types/fact_rating_examples.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class FactRatingExamples(pydantic_v1.BaseModel): 11 | high: typing.Optional[str] = None 12 | low: typing.Optional[str] = None 13 | medium: typing.Optional[str] = None 14 | 15 | def json(self, **kwargs: typing.Any) -> str: 16 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 17 | return super().json(**kwargs_with_defaults) 18 | 19 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 20 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 21 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 22 | 23 | return deep_union_pydantic_dicts( 24 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 25 | ) 26 | 27 | class Config: 28 | frozen = True 29 | smart_union = True 30 | extra = pydantic_v1.Extra.allow 31 | json_encoders = {dt.datetime: serialize_datetime} 32 | -------------------------------------------------------------------------------- /src/zep_cloud/types/fact_rating_instruction.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .fact_rating_examples import FactRatingExamples 9 | 10 | 11 | class FactRatingInstruction(pydantic_v1.BaseModel): 12 | examples: typing.Optional[FactRatingExamples] = pydantic_v1.Field(default=None) 13 | """ 14 | Examples is a list of examples that demonstrate how facts might be rated based on your instruction. You should provide 15 | an example of a highly rated example, a low rated example, and a medium (or in between example). For example, if you are rating 16 | based on relevance to a trip planning application, your examples might be: 17 | High: "Joe's dream vacation is Bali" 18 | Medium: "Joe has a fear of flying", 19 | Low: "Joe's favorite food is Japanese", 20 | """ 21 | 22 | instruction: typing.Optional[str] = pydantic_v1.Field(default=None) 23 | """ 24 | A string describing how to rate facts as they apply to your application. A trip planning application may 25 | use something like "relevancy to planning a trip, the user's preferences when traveling, 26 | or the user's travel history." 27 | """ 28 | 29 | def json(self, **kwargs: typing.Any) -> str: 30 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 31 | return super().json(**kwargs_with_defaults) 32 | 33 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 34 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 35 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 36 | 37 | return deep_union_pydantic_dicts( 38 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 39 | ) 40 | 41 | class Config: 42 | frozen = True 43 | smart_union = True 44 | extra = pydantic_v1.Extra.allow 45 | json_encoders = {dt.datetime: serialize_datetime} 46 | -------------------------------------------------------------------------------- /src/zep_cloud/types/fact_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .fact import Fact 9 | 10 | 11 | class FactResponse(pydantic_v1.BaseModel): 12 | fact: typing.Optional[Fact] = None 13 | 14 | def json(self, **kwargs: typing.Any) -> str: 15 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 16 | return super().json(**kwargs_with_defaults) 17 | 18 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 19 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 20 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 21 | 22 | return deep_union_pydantic_dicts( 23 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 24 | ) 25 | 26 | class Config: 27 | frozen = True 28 | smart_union = True 29 | extra = pydantic_v1.Extra.allow 30 | json_encoders = {dt.datetime: serialize_datetime} 31 | -------------------------------------------------------------------------------- /src/zep_cloud/types/facts_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .fact import Fact 9 | 10 | 11 | class FactsResponse(pydantic_v1.BaseModel): 12 | facts: typing.Optional[typing.List[Fact]] = None 13 | 14 | def json(self, **kwargs: typing.Any) -> str: 15 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 16 | return super().json(**kwargs_with_defaults) 17 | 18 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 19 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 20 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 21 | 22 | return deep_union_pydantic_dicts( 23 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 24 | ) 25 | 26 | class Config: 27 | frozen = True 28 | smart_union = True 29 | extra = pydantic_v1.Extra.allow 30 | json_encoders = {dt.datetime: serialize_datetime} 31 | -------------------------------------------------------------------------------- /src/zep_cloud/types/graph_data_type.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | GraphDataType = typing.Union[typing.Literal["text", "json", "message"], typing.Any] 6 | -------------------------------------------------------------------------------- /src/zep_cloud/types/graph_edges_request.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class GraphEdgesRequest(pydantic_v1.BaseModel): 11 | limit: typing.Optional[int] = pydantic_v1.Field(default=None) 12 | """ 13 | Maximum number of items to return 14 | """ 15 | 16 | uuid_cursor: typing.Optional[str] = pydantic_v1.Field(default=None) 17 | """ 18 | UUID based cursor, used for pagination. Should be the UUID of the last item in the previous page 19 | """ 20 | 21 | def json(self, **kwargs: typing.Any) -> str: 22 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 23 | return super().json(**kwargs_with_defaults) 24 | 25 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 26 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 27 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 28 | 29 | return deep_union_pydantic_dicts( 30 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 31 | ) 32 | 33 | class Config: 34 | frozen = True 35 | smart_union = True 36 | extra = pydantic_v1.Extra.allow 37 | json_encoders = {dt.datetime: serialize_datetime} 38 | -------------------------------------------------------------------------------- /src/zep_cloud/types/graph_nodes_request.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class GraphNodesRequest(pydantic_v1.BaseModel): 11 | limit: typing.Optional[int] = pydantic_v1.Field(default=None) 12 | """ 13 | Maximum number of items to return 14 | """ 15 | 16 | uuid_cursor: typing.Optional[str] = pydantic_v1.Field(default=None) 17 | """ 18 | UUID based cursor, used for pagination. Should be the UUID of the last item in the previous page 19 | """ 20 | 21 | def json(self, **kwargs: typing.Any) -> str: 22 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 23 | return super().json(**kwargs_with_defaults) 24 | 25 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 26 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 27 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 28 | 29 | return deep_union_pydantic_dicts( 30 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 31 | ) 32 | 33 | class Config: 34 | frozen = True 35 | smart_union = True 36 | extra = pydantic_v1.Extra.allow 37 | json_encoders = {dt.datetime: serialize_datetime} 38 | -------------------------------------------------------------------------------- /src/zep_cloud/types/graph_search_results.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .entity_edge import EntityEdge 9 | from .entity_node import EntityNode 10 | 11 | 12 | class GraphSearchResults(pydantic_v1.BaseModel): 13 | edges: typing.Optional[typing.List[EntityEdge]] = None 14 | nodes: typing.Optional[typing.List[EntityNode]] = None 15 | 16 | def json(self, **kwargs: typing.Any) -> str: 17 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 18 | return super().json(**kwargs_with_defaults) 19 | 20 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 21 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 22 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 23 | 24 | return deep_union_pydantic_dicts( 25 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 26 | ) 27 | 28 | class Config: 29 | frozen = True 30 | smart_union = True 31 | extra = pydantic_v1.Extra.allow 32 | json_encoders = {dt.datetime: serialize_datetime} 33 | -------------------------------------------------------------------------------- /src/zep_cloud/types/graph_search_scope.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | GraphSearchScope = typing.Union[typing.Literal["edges", "nodes"], typing.Any] 6 | -------------------------------------------------------------------------------- /src/zep_cloud/types/group.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .fact_rating_instruction import FactRatingInstruction 9 | 10 | 11 | class Group(pydantic_v1.BaseModel): 12 | created_at: typing.Optional[str] = None 13 | description: typing.Optional[str] = None 14 | external_id: typing.Optional[str] = pydantic_v1.Field(default=None) 15 | """ 16 | Deprecated 17 | """ 18 | 19 | fact_rating_instruction: typing.Optional[FactRatingInstruction] = None 20 | group_id: typing.Optional[str] = None 21 | id: typing.Optional[int] = None 22 | name: typing.Optional[str] = None 23 | project_uuid: typing.Optional[str] = None 24 | uuid_: typing.Optional[str] = pydantic_v1.Field(alias="uuid", default=None) 25 | 26 | def json(self, **kwargs: typing.Any) -> str: 27 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 28 | return super().json(**kwargs_with_defaults) 29 | 30 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 31 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 32 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 33 | 34 | return deep_union_pydantic_dicts( 35 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 36 | ) 37 | 38 | class Config: 39 | frozen = True 40 | smart_union = True 41 | allow_population_by_field_name = True 42 | populate_by_name = True 43 | extra = pydantic_v1.Extra.allow 44 | json_encoders = {dt.datetime: serialize_datetime} 45 | -------------------------------------------------------------------------------- /src/zep_cloud/types/group_list_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .group import Group 9 | 10 | 11 | class GroupListResponse(pydantic_v1.BaseModel): 12 | groups: typing.Optional[typing.List[Group]] = None 13 | row_count: typing.Optional[int] = None 14 | total_count: typing.Optional[int] = None 15 | 16 | def json(self, **kwargs: typing.Any) -> str: 17 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 18 | return super().json(**kwargs_with_defaults) 19 | 20 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 21 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 22 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 23 | 24 | return deep_union_pydantic_dicts( 25 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 26 | ) 27 | 28 | class Config: 29 | frozen = True 30 | smart_union = True 31 | extra = pydantic_v1.Extra.allow 32 | json_encoders = {dt.datetime: serialize_datetime} 33 | -------------------------------------------------------------------------------- /src/zep_cloud/types/memory.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .fact import Fact 9 | from .message import Message 10 | from .summary import Summary 11 | 12 | 13 | class Memory(pydantic_v1.BaseModel): 14 | context: typing.Optional[str] = pydantic_v1.Field(default=None) 15 | """ 16 | Memory context containing relevant facts and entities for the session. Can be put into the prompt directly. 17 | """ 18 | 19 | facts: typing.Optional[typing.List[str]] = pydantic_v1.Field(default=None) 20 | """ 21 | Deprecated: Use relevant_facts instead. 22 | """ 23 | 24 | messages: typing.Optional[typing.List[Message]] = pydantic_v1.Field(default=None) 25 | """ 26 | A list of message objects, where each message contains a role and content. Only last_n messages will be returned 27 | """ 28 | 29 | metadata: typing.Optional[typing.Dict[str, typing.Any]] = pydantic_v1.Field(default=None) 30 | """ 31 | Deprecated 32 | """ 33 | 34 | relevant_facts: typing.Optional[typing.List[Fact]] = pydantic_v1.Field(default=None) 35 | """ 36 | Most relevant facts to the recent messages in the session. 37 | """ 38 | 39 | summary: typing.Optional[Summary] = pydantic_v1.Field(default=None) 40 | """ 41 | Deprecated: Use context string instead. 42 | """ 43 | 44 | def json(self, **kwargs: typing.Any) -> str: 45 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 46 | return super().json(**kwargs_with_defaults) 47 | 48 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 49 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 50 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 51 | 52 | return deep_union_pydantic_dicts( 53 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 54 | ) 55 | 56 | class Config: 57 | frozen = True 58 | smart_union = True 59 | extra = pydantic_v1.Extra.allow 60 | json_encoders = {dt.datetime: serialize_datetime} 61 | -------------------------------------------------------------------------------- /src/zep_cloud/types/memory_search_result.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .message import Message 9 | from .summary import Summary 10 | 11 | 12 | class MemorySearchResult(pydantic_v1.BaseModel): 13 | message: typing.Optional[Message] = None 14 | metadata: typing.Optional[typing.Dict[str, typing.Any]] = None 15 | score: typing.Optional[float] = None 16 | summary: typing.Optional[Summary] = None 17 | 18 | def json(self, **kwargs: typing.Any) -> str: 19 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 20 | return super().json(**kwargs_with_defaults) 21 | 22 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 23 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 24 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 25 | 26 | return deep_union_pydantic_dicts( 27 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 28 | ) 29 | 30 | class Config: 31 | frozen = True 32 | smart_union = True 33 | extra = pydantic_v1.Extra.allow 34 | json_encoders = {dt.datetime: serialize_datetime} 35 | -------------------------------------------------------------------------------- /src/zep_cloud/types/message.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .role_type import RoleType 9 | 10 | 11 | class Message(pydantic_v1.BaseModel): 12 | content: str = pydantic_v1.Field() 13 | """ 14 | The content of the message. 15 | """ 16 | 17 | created_at: typing.Optional[str] = pydantic_v1.Field(default=None) 18 | """ 19 | The timestamp of when the message was created. 20 | """ 21 | 22 | metadata: typing.Optional[typing.Dict[str, typing.Any]] = pydantic_v1.Field(default=None) 23 | """ 24 | The metadata associated with the message. 25 | """ 26 | 27 | processed: typing.Optional[bool] = pydantic_v1.Field(default=None) 28 | """ 29 | Whether the message has been processed. 30 | """ 31 | 32 | role: typing.Optional[str] = pydantic_v1.Field(default=None) 33 | """ 34 | Customizable role of the sender of the message (e.g., "john", "sales_agent"). 35 | """ 36 | 37 | role_type: RoleType = pydantic_v1.Field() 38 | """ 39 | The type of the role (e.g., "user", "system"). 40 | """ 41 | 42 | token_count: typing.Optional[int] = pydantic_v1.Field(default=None) 43 | """ 44 | Deprecated 45 | """ 46 | 47 | updated_at: typing.Optional[str] = pydantic_v1.Field(default=None) 48 | """ 49 | Deprecated 50 | """ 51 | 52 | uuid_: typing.Optional[str] = pydantic_v1.Field(alias="uuid", default=None) 53 | """ 54 | The unique identifier of the message. 55 | """ 56 | 57 | def json(self, **kwargs: typing.Any) -> str: 58 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 59 | return super().json(**kwargs_with_defaults) 60 | 61 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 62 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 63 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 64 | 65 | return deep_union_pydantic_dicts( 66 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 67 | ) 68 | 69 | class Config: 70 | frozen = True 71 | smart_union = True 72 | allow_population_by_field_name = True 73 | populate_by_name = True 74 | extra = pydantic_v1.Extra.allow 75 | json_encoders = {dt.datetime: serialize_datetime} 76 | -------------------------------------------------------------------------------- /src/zep_cloud/types/message_list_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .message import Message 9 | 10 | 11 | class MessageListResponse(pydantic_v1.BaseModel): 12 | messages: typing.Optional[typing.List[Message]] = pydantic_v1.Field(default=None) 13 | """ 14 | A list of message objects. 15 | """ 16 | 17 | row_count: typing.Optional[int] = pydantic_v1.Field(default=None) 18 | """ 19 | The number of messages returned. 20 | """ 21 | 22 | total_count: typing.Optional[int] = pydantic_v1.Field(default=None) 23 | """ 24 | The total number of messages. 25 | """ 26 | 27 | def json(self, **kwargs: typing.Any) -> str: 28 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 29 | return super().json(**kwargs_with_defaults) 30 | 31 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 32 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 33 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 34 | 35 | return deep_union_pydantic_dicts( 36 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 37 | ) 38 | 39 | class Config: 40 | frozen = True 41 | smart_union = True 42 | extra = pydantic_v1.Extra.allow 43 | json_encoders = {dt.datetime: serialize_datetime} 44 | -------------------------------------------------------------------------------- /src/zep_cloud/types/new_fact.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class NewFact(pydantic_v1.BaseModel): 11 | fact: str 12 | 13 | def json(self, **kwargs: typing.Any) -> str: 14 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 15 | return super().json(**kwargs_with_defaults) 16 | 17 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 18 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 19 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 20 | 21 | return deep_union_pydantic_dicts( 22 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 23 | ) 24 | 25 | class Config: 26 | frozen = True 27 | smart_union = True 28 | extra = pydantic_v1.Extra.allow 29 | json_encoders = {dt.datetime: serialize_datetime} 30 | -------------------------------------------------------------------------------- /src/zep_cloud/types/question.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class Question(pydantic_v1.BaseModel): 11 | question: typing.Optional[str] = None 12 | 13 | def json(self, **kwargs: typing.Any) -> str: 14 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 15 | return super().json(**kwargs_with_defaults) 16 | 17 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 18 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 19 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 20 | 21 | return deep_union_pydantic_dicts( 22 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 23 | ) 24 | 25 | class Config: 26 | frozen = True 27 | smart_union = True 28 | extra = pydantic_v1.Extra.allow 29 | json_encoders = {dt.datetime: serialize_datetime} 30 | -------------------------------------------------------------------------------- /src/zep_cloud/types/reranker.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | Reranker = typing.Union[typing.Literal["rrf", "mmr", "node_distance", "episode_mentions", "cross_encoder"], typing.Any] 6 | -------------------------------------------------------------------------------- /src/zep_cloud/types/role_type.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | RoleType = typing.Union[typing.Literal["norole", "system", "assistant", "user", "function", "tool"], typing.Any] 6 | -------------------------------------------------------------------------------- /src/zep_cloud/types/search_filters.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class SearchFilters(pydantic_v1.BaseModel): 11 | edge_types: typing.Optional[typing.List[str]] = pydantic_v1.Field(default=None) 12 | """ 13 | List of edge types to filter on 14 | """ 15 | 16 | node_labels: typing.Optional[typing.List[str]] = pydantic_v1.Field(default=None) 17 | """ 18 | List of node labels to filter on 19 | """ 20 | 21 | def json(self, **kwargs: typing.Any) -> str: 22 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 23 | return super().json(**kwargs_with_defaults) 24 | 25 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 26 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 27 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 28 | 29 | return deep_union_pydantic_dicts( 30 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 31 | ) 32 | 33 | class Config: 34 | frozen = True 35 | smart_union = True 36 | extra = pydantic_v1.Extra.allow 37 | json_encoders = {dt.datetime: serialize_datetime} 38 | -------------------------------------------------------------------------------- /src/zep_cloud/types/search_scope.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | SearchScope = typing.Union[typing.Literal["messages", "summary", "facts"], typing.Any] 6 | -------------------------------------------------------------------------------- /src/zep_cloud/types/search_type.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import typing 4 | 5 | SearchType = typing.Union[typing.Literal["similarity", "mmr"], typing.Any] 6 | -------------------------------------------------------------------------------- /src/zep_cloud/types/session.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .fact_rating_instruction import FactRatingInstruction 9 | 10 | 11 | class Session(pydantic_v1.BaseModel): 12 | classifications: typing.Optional[typing.Dict[str, str]] = None 13 | created_at: typing.Optional[str] = None 14 | deleted_at: typing.Optional[str] = None 15 | ended_at: typing.Optional[str] = None 16 | fact_rating_instruction: typing.Optional[FactRatingInstruction] = pydantic_v1.Field(default=None) 17 | """ 18 | Deprecated 19 | """ 20 | 21 | facts: typing.Optional[typing.List[str]] = pydantic_v1.Field(default=None) 22 | """ 23 | Deprecated 24 | """ 25 | 26 | id: typing.Optional[int] = None 27 | metadata: typing.Optional[typing.Dict[str, typing.Any]] = pydantic_v1.Field(default=None) 28 | """ 29 | Deprecated 30 | """ 31 | 32 | project_uuid: typing.Optional[str] = None 33 | session_id: typing.Optional[str] = None 34 | updated_at: typing.Optional[str] = pydantic_v1.Field(default=None) 35 | """ 36 | Deprecated 37 | """ 38 | 39 | user_id: typing.Optional[str] = None 40 | uuid_: typing.Optional[str] = pydantic_v1.Field(alias="uuid", default=None) 41 | 42 | def json(self, **kwargs: typing.Any) -> str: 43 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 44 | return super().json(**kwargs_with_defaults) 45 | 46 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 47 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 48 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 49 | 50 | return deep_union_pydantic_dicts( 51 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 52 | ) 53 | 54 | class Config: 55 | frozen = True 56 | smart_union = True 57 | allow_population_by_field_name = True 58 | populate_by_name = True 59 | extra = pydantic_v1.Extra.allow 60 | json_encoders = {dt.datetime: serialize_datetime} 61 | -------------------------------------------------------------------------------- /src/zep_cloud/types/session_classification.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class SessionClassification(pydantic_v1.BaseModel): 11 | class_: typing.Optional[str] = pydantic_v1.Field(alias="class", default=None) 12 | label: typing.Optional[str] = None 13 | 14 | def json(self, **kwargs: typing.Any) -> str: 15 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 16 | return super().json(**kwargs_with_defaults) 17 | 18 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 19 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 20 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 21 | 22 | return deep_union_pydantic_dicts( 23 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 24 | ) 25 | 26 | class Config: 27 | frozen = True 28 | smart_union = True 29 | allow_population_by_field_name = True 30 | populate_by_name = True 31 | extra = pydantic_v1.Extra.allow 32 | json_encoders = {dt.datetime: serialize_datetime} 33 | -------------------------------------------------------------------------------- /src/zep_cloud/types/session_list_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .session import Session 9 | 10 | 11 | class SessionListResponse(pydantic_v1.BaseModel): 12 | response_count: typing.Optional[int] = None 13 | sessions: typing.Optional[typing.List[Session]] = None 14 | total_count: typing.Optional[int] = None 15 | 16 | def json(self, **kwargs: typing.Any) -> str: 17 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 18 | return super().json(**kwargs_with_defaults) 19 | 20 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 21 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 22 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 23 | 24 | return deep_union_pydantic_dicts( 25 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 26 | ) 27 | 28 | class Config: 29 | frozen = True 30 | smart_union = True 31 | extra = pydantic_v1.Extra.allow 32 | json_encoders = {dt.datetime: serialize_datetime} 33 | -------------------------------------------------------------------------------- /src/zep_cloud/types/session_search_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .session_search_result import SessionSearchResult 9 | 10 | 11 | class SessionSearchResponse(pydantic_v1.BaseModel): 12 | results: typing.Optional[typing.List[SessionSearchResult]] = None 13 | 14 | def json(self, **kwargs: typing.Any) -> str: 15 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 16 | return super().json(**kwargs_with_defaults) 17 | 18 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 19 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 20 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 21 | 22 | return deep_union_pydantic_dicts( 23 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 24 | ) 25 | 26 | class Config: 27 | frozen = True 28 | smart_union = True 29 | extra = pydantic_v1.Extra.allow 30 | json_encoders = {dt.datetime: serialize_datetime} 31 | -------------------------------------------------------------------------------- /src/zep_cloud/types/session_search_result.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .fact import Fact 9 | from .message import Message 10 | from .summary import Summary 11 | 12 | 13 | class SessionSearchResult(pydantic_v1.BaseModel): 14 | fact: typing.Optional[Fact] = None 15 | message: typing.Optional[Message] = None 16 | score: typing.Optional[float] = None 17 | session_id: typing.Optional[str] = None 18 | summary: typing.Optional[Summary] = None 19 | 20 | def json(self, **kwargs: typing.Any) -> str: 21 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 22 | return super().json(**kwargs_with_defaults) 23 | 24 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 25 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 26 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 27 | 28 | return deep_union_pydantic_dicts( 29 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 30 | ) 31 | 32 | class Config: 33 | frozen = True 34 | smart_union = True 35 | extra = pydantic_v1.Extra.allow 36 | json_encoders = {dt.datetime: serialize_datetime} 37 | -------------------------------------------------------------------------------- /src/zep_cloud/types/success_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class SuccessResponse(pydantic_v1.BaseModel): 11 | message: typing.Optional[str] = None 12 | 13 | def json(self, **kwargs: typing.Any) -> str: 14 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 15 | return super().json(**kwargs_with_defaults) 16 | 17 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 18 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 19 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 20 | 21 | return deep_union_pydantic_dicts( 22 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 23 | ) 24 | 25 | class Config: 26 | frozen = True 27 | smart_union = True 28 | extra = pydantic_v1.Extra.allow 29 | json_encoders = {dt.datetime: serialize_datetime} 30 | -------------------------------------------------------------------------------- /src/zep_cloud/types/summary.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class Summary(pydantic_v1.BaseModel): 11 | content: typing.Optional[str] = pydantic_v1.Field(default=None) 12 | """ 13 | The content of the summary. 14 | """ 15 | 16 | created_at: typing.Optional[str] = pydantic_v1.Field(default=None) 17 | """ 18 | The timestamp of when the summary was created. 19 | """ 20 | 21 | metadata: typing.Optional[typing.Dict[str, typing.Any]] = None 22 | related_message_uuids: typing.Optional[typing.List[str]] = None 23 | token_count: typing.Optional[int] = pydantic_v1.Field(default=None) 24 | """ 25 | The number of tokens in the summary. 26 | """ 27 | 28 | uuid_: typing.Optional[str] = pydantic_v1.Field(alias="uuid", default=None) 29 | """ 30 | The unique identifier of the summary. 31 | """ 32 | 33 | def json(self, **kwargs: typing.Any) -> str: 34 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 35 | return super().json(**kwargs_with_defaults) 36 | 37 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 38 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 39 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 40 | 41 | return deep_union_pydantic_dicts( 42 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 43 | ) 44 | 45 | class Config: 46 | frozen = True 47 | smart_union = True 48 | allow_population_by_field_name = True 49 | populate_by_name = True 50 | extra = pydantic_v1.Extra.allow 51 | json_encoders = {dt.datetime: serialize_datetime} 52 | -------------------------------------------------------------------------------- /src/zep_cloud/types/summary_list_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .summary import Summary 9 | 10 | 11 | class SummaryListResponse(pydantic_v1.BaseModel): 12 | row_count: typing.Optional[int] = None 13 | summaries: typing.Optional[typing.List[Summary]] = None 14 | total_count: typing.Optional[int] = None 15 | 16 | def json(self, **kwargs: typing.Any) -> str: 17 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 18 | return super().json(**kwargs_with_defaults) 19 | 20 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 21 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 22 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 23 | 24 | return deep_union_pydantic_dicts( 25 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 26 | ) 27 | 28 | class Config: 29 | frozen = True 30 | smart_union = True 31 | extra = pydantic_v1.Extra.allow 32 | json_encoders = {dt.datetime: serialize_datetime} 33 | -------------------------------------------------------------------------------- /src/zep_cloud/types/update_document_list_request.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | 9 | 10 | class UpdateDocumentListRequest(pydantic_v1.BaseModel): 11 | document_id: typing.Optional[str] = None 12 | metadata: typing.Optional[typing.Dict[str, typing.Any]] = None 13 | uuid_: str = pydantic_v1.Field(alias="uuid") 14 | 15 | def json(self, **kwargs: typing.Any) -> str: 16 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 17 | return super().json(**kwargs_with_defaults) 18 | 19 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 20 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 21 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 22 | 23 | return deep_union_pydantic_dicts( 24 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 25 | ) 26 | 27 | class Config: 28 | frozen = True 29 | smart_union = True 30 | allow_population_by_field_name = True 31 | populate_by_name = True 32 | extra = pydantic_v1.Extra.allow 33 | json_encoders = {dt.datetime: serialize_datetime} 34 | -------------------------------------------------------------------------------- /src/zep_cloud/types/user.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .fact_rating_instruction import FactRatingInstruction 9 | 10 | 11 | class User(pydantic_v1.BaseModel): 12 | created_at: typing.Optional[str] = None 13 | deleted_at: typing.Optional[str] = None 14 | email: typing.Optional[str] = None 15 | fact_rating_instruction: typing.Optional[FactRatingInstruction] = None 16 | first_name: typing.Optional[str] = None 17 | id: typing.Optional[int] = None 18 | last_name: typing.Optional[str] = None 19 | metadata: typing.Optional[typing.Dict[str, typing.Any]] = pydantic_v1.Field(default=None) 20 | """ 21 | Deprecated 22 | """ 23 | 24 | project_uuid: typing.Optional[str] = None 25 | session_count: typing.Optional[int] = pydantic_v1.Field(default=None) 26 | """ 27 | Deprecated 28 | """ 29 | 30 | updated_at: typing.Optional[str] = pydantic_v1.Field(default=None) 31 | """ 32 | Deprecated 33 | """ 34 | 35 | user_id: typing.Optional[str] = None 36 | uuid_: typing.Optional[str] = pydantic_v1.Field(alias="uuid", default=None) 37 | 38 | def json(self, **kwargs: typing.Any) -> str: 39 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 40 | return super().json(**kwargs_with_defaults) 41 | 42 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 43 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 44 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 45 | 46 | return deep_union_pydantic_dicts( 47 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 48 | ) 49 | 50 | class Config: 51 | frozen = True 52 | smart_union = True 53 | allow_population_by_field_name = True 54 | populate_by_name = True 55 | extra = pydantic_v1.Extra.allow 56 | json_encoders = {dt.datetime: serialize_datetime} 57 | -------------------------------------------------------------------------------- /src/zep_cloud/types/user_list_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .user import User 9 | 10 | 11 | class UserListResponse(pydantic_v1.BaseModel): 12 | row_count: typing.Optional[int] = None 13 | total_count: typing.Optional[int] = None 14 | users: typing.Optional[typing.List[User]] = None 15 | 16 | def json(self, **kwargs: typing.Any) -> str: 17 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 18 | return super().json(**kwargs_with_defaults) 19 | 20 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 21 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 22 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 23 | 24 | return deep_union_pydantic_dicts( 25 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 26 | ) 27 | 28 | class Config: 29 | frozen = True 30 | smart_union = True 31 | extra = pydantic_v1.Extra.allow 32 | json_encoders = {dt.datetime: serialize_datetime} 33 | -------------------------------------------------------------------------------- /src/zep_cloud/types/user_node_response.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | import datetime as dt 4 | import typing 5 | 6 | from ..core.datetime_utils import serialize_datetime 7 | from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 8 | from .entity_node import EntityNode 9 | 10 | 11 | class UserNodeResponse(pydantic_v1.BaseModel): 12 | node: typing.Optional[EntityNode] = None 13 | 14 | def json(self, **kwargs: typing.Any) -> str: 15 | kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 16 | return super().json(**kwargs_with_defaults) 17 | 18 | def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: 19 | kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} 20 | kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} 21 | 22 | return deep_union_pydantic_dicts( 23 | super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) 24 | ) 25 | 26 | class Config: 27 | frozen = True 28 | smart_union = True 29 | extra = pydantic_v1.Extra.allow 30 | json_encoders = {dt.datetime: serialize_datetime} 31 | -------------------------------------------------------------------------------- /src/zep_cloud/user/__init__.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | -------------------------------------------------------------------------------- /src/zep_cloud/version.py: -------------------------------------------------------------------------------- 1 | 2 | from importlib import metadata 3 | 4 | __version__ = metadata.version("zep-cloud") 5 | -------------------------------------------------------------------------------- /tests/custom/test_client.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | # Get started with writing tests with pytest at https://docs.pytest.org 4 | @pytest.mark.skip(reason="Unimplemented") 5 | def test_client() -> None: 6 | assert True == True 7 | -------------------------------------------------------------------------------- /tests/utils/test_http_client.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | from zep_cloud.core.http_client import get_request_body 4 | from zep_cloud.core.request_options import RequestOptions 5 | 6 | 7 | def get_request_options() -> RequestOptions: 8 | return {"additional_body_parameters": {"see you": "later"}} 9 | 10 | 11 | def test_get_json_request_body() -> None: 12 | json_body, data_body = get_request_body(json={"hello": "world"}, data=None, request_options=None, omit=None) 13 | assert json_body == {"hello": "world"} 14 | assert data_body is None 15 | 16 | json_body_extras, data_body_extras = get_request_body( 17 | json={"goodbye": "world"}, data=None, request_options=get_request_options(), omit=None 18 | ) 19 | 20 | assert json_body_extras == {"goodbye": "world", "see you": "later"} 21 | assert data_body_extras is None 22 | 23 | 24 | def test_get_files_request_body() -> None: 25 | json_body, data_body = get_request_body(json=None, data={"hello": "world"}, request_options=None, omit=None) 26 | assert data_body == {"hello": "world"} 27 | assert json_body is None 28 | 29 | json_body_extras, data_body_extras = get_request_body( 30 | json=None, data={"goodbye": "world"}, request_options=get_request_options(), omit=None 31 | ) 32 | 33 | assert data_body_extras == {"goodbye": "world", "see you": "later"} 34 | assert json_body_extras is None 35 | 36 | 37 | def test_get_none_request_body() -> None: 38 | json_body, data_body = get_request_body(json=None, data=None, request_options=None, omit=None) 39 | assert data_body is None 40 | assert json_body is None 41 | 42 | json_body_extras, data_body_extras = get_request_body( 43 | json=None, data=None, request_options=get_request_options(), omit=None 44 | ) 45 | 46 | assert json_body_extras == {"see you": "later"} 47 | assert data_body_extras is None 48 | -------------------------------------------------------------------------------- /tests/utils/test_query_encoding.py: -------------------------------------------------------------------------------- 1 | # This file was auto-generated by Fern from our API Definition. 2 | 3 | from zep_cloud.core.query_encoder import encode_query 4 | 5 | 6 | def test_query_encoding() -> None: 7 | assert encode_query({"hello world": "hello world"}) == {"hello world": "hello world"} 8 | assert encode_query({"hello_world": {"hello": "world"}}) == {"hello_world[hello]": "world"} 9 | assert encode_query({"hello_world": {"hello": {"world": "today"}, "test": "this"}, "hi": "there"}) == { 10 | "hello_world[hello][world]": "today", 11 | "hello_world[test]": "this", 12 | "hi": "there", 13 | } 14 | --------------------------------------------------------------------------------