zep-cloud 0.0.1rc1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- zep_cloud-0.0.1rc1/PKG-INFO +123 -0
- zep_cloud-0.0.1rc1/README.md +107 -0
- zep_cloud-0.0.1rc1/pyproject.toml +36 -0
- zep_cloud-0.0.1rc1/src/zep/__init__.py +68 -0
- zep_cloud-0.0.1rc1/src/zep/base_client.py +152 -0
- zep_cloud-0.0.1rc1/src/zep/client.py +57 -0
- zep_cloud-0.0.1rc1/src/zep/core/__init__.py +27 -0
- zep_cloud-0.0.1rc1/src/zep/core/api_error.py +15 -0
- zep_cloud-0.0.1rc1/src/zep/core/client_wrapper.py +45 -0
- zep_cloud-0.0.1rc1/src/zep/core/datetime_utils.py +28 -0
- zep_cloud-0.0.1rc1/src/zep/core/file.py +38 -0
- zep_cloud-0.0.1rc1/src/zep/core/http_client.py +130 -0
- zep_cloud-0.0.1rc1/src/zep/core/jsonable_encoder.py +99 -0
- zep_cloud-0.0.1rc1/src/zep/core/pydantic_utilities.py +12 -0
- zep_cloud-0.0.1rc1/src/zep/core/remove_none_from_dict.py +11 -0
- zep_cloud-0.0.1rc1/src/zep/core/request_options.py +32 -0
- zep_cloud-0.0.1rc1/src/zep/document/__init__.py +2 -0
- zep_cloud-0.0.1rc1/src/zep/document/client.py +2255 -0
- zep_cloud-0.0.1rc1/src/zep/environment.py +7 -0
- zep_cloud-0.0.1rc1/src/zep/errors/__init__.py +8 -0
- zep_cloud-0.0.1rc1/src/zep/errors/bad_request_error.py +9 -0
- zep_cloud-0.0.1rc1/src/zep/errors/internal_server_error.py +9 -0
- zep_cloud-0.0.1rc1/src/zep/errors/not_found_error.py +9 -0
- zep_cloud-0.0.1rc1/src/zep/errors/unauthorized_error.py +9 -0
- zep_cloud-0.0.1rc1/src/zep/external_clients/document.py +16 -0
- zep_cloud-0.0.1rc1/src/zep/external_clients/memory.py +16 -0
- zep_cloud-0.0.1rc1/src/zep/external_clients/user.py +16 -0
- zep_cloud-0.0.1rc1/src/zep/langchain/__init__.py +7 -0
- zep_cloud-0.0.1rc1/src/zep/langchain/helpers.py +16 -0
- zep_cloud-0.0.1rc1/src/zep/langchain/history.py +196 -0
- zep_cloud-0.0.1rc1/src/zep/langchain/vectorstore.py +554 -0
- zep_cloud-0.0.1rc1/src/zep/memory/__init__.py +5 -0
- zep_cloud-0.0.1rc1/src/zep/memory/client.py +2566 -0
- zep_cloud-0.0.1rc1/src/zep/memory/types/__init__.py +5 -0
- zep_cloud-0.0.1rc1/src/zep/memory/types/memory_get_request_memory_type.py +7 -0
- zep_cloud-0.0.1rc1/src/zep/py.typed +0 -0
- zep_cloud-0.0.1rc1/src/zep/types/__init__.py +51 -0
- zep_cloud-0.0.1rc1/src/zep/types/api_error.py +25 -0
- zep_cloud-0.0.1rc1/src/zep/types/classify_session_response.py +28 -0
- zep_cloud-0.0.1rc1/src/zep/types/create_document_request.py +28 -0
- zep_cloud-0.0.1rc1/src/zep/types/document_collection_response.py +47 -0
- zep_cloud-0.0.1rc1/src/zep/types/document_response.py +34 -0
- zep_cloud-0.0.1rc1/src/zep/types/document_search_result.py +35 -0
- zep_cloud-0.0.1rc1/src/zep/types/document_search_result_page.py +30 -0
- zep_cloud-0.0.1rc1/src/zep/types/memory.py +45 -0
- zep_cloud-0.0.1rc1/src/zep/types/memory_search_result.py +31 -0
- zep_cloud-0.0.1rc1/src/zep/types/message.py +66 -0
- zep_cloud-0.0.1rc1/src/zep/types/message_list_response.py +39 -0
- zep_cloud-0.0.1rc1/src/zep/types/models_zep_data_class.py +27 -0
- zep_cloud-0.0.1rc1/src/zep/types/question.py +25 -0
- zep_cloud-0.0.1rc1/src/zep/types/role_type.py +5 -0
- zep_cloud-0.0.1rc1/src/zep/types/search_scope.py +5 -0
- zep_cloud-0.0.1rc1/src/zep/types/search_type.py +5 -0
- zep_cloud-0.0.1rc1/src/zep/types/session.py +41 -0
- zep_cloud-0.0.1rc1/src/zep/types/success_response.py +25 -0
- zep_cloud-0.0.1rc1/src/zep/types/summary.py +47 -0
- zep_cloud-0.0.1rc1/src/zep/types/summary_list_response.py +28 -0
- zep_cloud-0.0.1rc1/src/zep/types/update_document_list_request.py +29 -0
- zep_cloud-0.0.1rc1/src/zep/types/user.py +38 -0
- zep_cloud-0.0.1rc1/src/zep/types/user_list_response.py +28 -0
- zep_cloud-0.0.1rc1/src/zep/user/__init__.py +2 -0
- zep_cloud-0.0.1rc1/src/zep/user/client.py +963 -0
- zep_cloud-0.0.1rc1/src/zep/version.py +4 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: zep-cloud
|
|
3
|
+
Version: 0.0.1rc1
|
|
4
|
+
Summary:
|
|
5
|
+
Requires-Python: >=3.8.1,<4.0
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Requires-Dist: httpx (>=0.21.2)
|
|
12
|
+
Requires-Dist: pydantic (>=1.9.2)
|
|
13
|
+
Requires-Dist: typing_extensions (>=4.0.0)
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
[](https://github.com/getzep/zep-python/actions/workflows/release.yml)  [](https://github.com/fern-api/fern)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
<p align="center">
|
|
21
|
+
<a href="https://www.getzep.com/">
|
|
22
|
+
<img src="https://raw.githubusercontent.com/getzep/zep/main/assets/zep-logo-icon-gradient-rgb.svg" width="150" alt="Zep Logo">
|
|
23
|
+
</a>
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
<h1 align="center">
|
|
27
|
+
Zep: Long-Term Memory for AI Assistants.
|
|
28
|
+
</h1>
|
|
29
|
+
<h2 align="center">Recall, understand, and extract data from chat histories. Power personalized AI experiences.</h2>
|
|
30
|
+
<br />
|
|
31
|
+
|
|
32
|
+
<p align="center">
|
|
33
|
+
<a href="https://docs.getzep.com/deployment/quickstart/">Quick Start</a> |
|
|
34
|
+
<a href="https://docs.getzep.com/">Documentation</a> |
|
|
35
|
+
<a href="https://docs.getzep.com/sdk/langchain/">LangChain</a> and
|
|
36
|
+
<a href="https://docs.getzep.com/sdk/langchain/">LlamaIndex</a> Support |
|
|
37
|
+
<a href="https://discord.gg/W8Kw6bsgXQ">Discord</a><br />
|
|
38
|
+
<a href="https://www.getzep.com">www.getzep.com</a>
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
## What is Zep? 💬
|
|
42
|
+
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.
|
|
43
|
+
|
|
44
|
+
### Installation Notes
|
|
45
|
+
Main branch contains the latest version of zep-cloud sdk. You can install it by running:
|
|
46
|
+
```bash
|
|
47
|
+
pip install zep-cloud
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
-- OR --
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
poetry add zep-cloud
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Open Source Compatible SDK is available in the [oss](https://github.com/getzep/zep-python/tree/oss) branch, where you can also find Open Source compatible examples. You can install it by running:
|
|
57
|
+
```bash
|
|
58
|
+
pip install zep-python
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
-- OR --
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
poetry add zep-python
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### How Zep works
|
|
68
|
+
|
|
69
|
+
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.
|
|
70
|
+
|
|
71
|
+
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.
|
|
72
|
+
|
|
73
|
+
Zep allows you to be more intentional about constructing your prompt:
|
|
74
|
+
1. automatically adding a few recent messages, with the number customized for your app;
|
|
75
|
+
2. a summary of recent conversations prior to the messages above;
|
|
76
|
+
3. and/or contextually relevant summaries or messages surfaced from the entire chat session.
|
|
77
|
+
4. and/or relevant Business data from Zep Document Collections.
|
|
78
|
+
|
|
79
|
+
Zep Cloud offers:
|
|
80
|
+
- **Fact Extraction:** Automatically build fact tables from conversations, without having to define a data schema upfront.
|
|
81
|
+
- **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.
|
|
82
|
+
- **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.
|
|
83
|
+
|
|
84
|
+
You will also need to provide a Zep Project API key to your zep client.
|
|
85
|
+
You can find out about zep projects in our [cloud docs](https://help.getzep.com/projects.html)
|
|
86
|
+
|
|
87
|
+
### Using LangChain Zep Classes with `zep-python`
|
|
88
|
+
|
|
89
|
+
(Currently only available on release candidate versions)
|
|
90
|
+
|
|
91
|
+
In the pre-release version `zep-python` sdk comes with `ZepChatMessageHistory` and `ZepVectorStore`
|
|
92
|
+
classes that are compatible with [LangChain's Python expression language](https://python.langchain.com/docs/expression_language/)
|
|
93
|
+
|
|
94
|
+
In order to use these classes in your application, you need to make sure that you have
|
|
95
|
+
`langchain_core` package installed, please refer to [Langchain's docs installation section](https://python.langchain.com/docs/get_started/installation#langchain-core).
|
|
96
|
+
|
|
97
|
+
We support `langchain_core@>=0.1.3<0.2.0`
|
|
98
|
+
|
|
99
|
+
You can import these classes in the following way:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from zep_cloud.langchain import ZepChatMessageHistory, ZepVectorStore
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Running Examples
|
|
106
|
+
You will need to set the following environment variables to run examples in the `examples` directory:
|
|
107
|
+
|
|
108
|
+
```dotenv
|
|
109
|
+
# Please use examples/.env.example as a template for .env file
|
|
110
|
+
|
|
111
|
+
# Required
|
|
112
|
+
ZEP_API_KEY=<zep-project-api-key># Your Zep Project API Key
|
|
113
|
+
ZEP_COLLECTION=<zep-collection-name># used in ingestion script and in vector store examples
|
|
114
|
+
OPENAI_API_KEY=<openai-api-key># Your OpenAI API Key
|
|
115
|
+
|
|
116
|
+
# Optional (If you want to use langsmith with LangServe Sample App)
|
|
117
|
+
LANGCHAIN_TRACING_V2=true
|
|
118
|
+
LANGCHAIN_API_KEY=<your-langchain-api-key>
|
|
119
|
+
LANGCHAIN_PROJECT=<your-langchain-project-name># If not specified, defaults to "default"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
|
|
2
|
+
[](https://github.com/getzep/zep-python/actions/workflows/release.yml)  [](https://github.com/fern-api/fern)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://www.getzep.com/">
|
|
7
|
+
<img src="https://raw.githubusercontent.com/getzep/zep/main/assets/zep-logo-icon-gradient-rgb.svg" width="150" alt="Zep Logo">
|
|
8
|
+
</a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<h1 align="center">
|
|
12
|
+
Zep: Long-Term Memory for AI Assistants.
|
|
13
|
+
</h1>
|
|
14
|
+
<h2 align="center">Recall, understand, and extract data from chat histories. Power personalized AI experiences.</h2>
|
|
15
|
+
<br />
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<a href="https://docs.getzep.com/deployment/quickstart/">Quick Start</a> |
|
|
19
|
+
<a href="https://docs.getzep.com/">Documentation</a> |
|
|
20
|
+
<a href="https://docs.getzep.com/sdk/langchain/">LangChain</a> and
|
|
21
|
+
<a href="https://docs.getzep.com/sdk/langchain/">LlamaIndex</a> Support |
|
|
22
|
+
<a href="https://discord.gg/W8Kw6bsgXQ">Discord</a><br />
|
|
23
|
+
<a href="https://www.getzep.com">www.getzep.com</a>
|
|
24
|
+
</p>
|
|
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
|
+
### Installation Notes
|
|
30
|
+
Main branch contains the latest version of zep-cloud sdk. You can install it by running:
|
|
31
|
+
```bash
|
|
32
|
+
pip install zep-cloud
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
-- OR --
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
poetry add zep-cloud
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Open Source Compatible SDK is available in the [oss](https://github.com/getzep/zep-python/tree/oss) branch, where you can also find Open Source compatible examples. You can install it by running:
|
|
42
|
+
```bash
|
|
43
|
+
pip install zep-python
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
-- OR --
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
poetry add zep-python
|
|
50
|
+
```
|
|
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=<zep-project-api-key># Your Zep Project API Key
|
|
98
|
+
ZEP_COLLECTION=<zep-collection-name># used in ingestion script and in vector store examples
|
|
99
|
+
OPENAI_API_KEY=<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=<your-langchain-api-key>
|
|
104
|
+
LANGCHAIN_PROJECT=<your-langchain-project-name># If not specified, defaults to "default"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "zep-cloud"
|
|
3
|
+
version = "0.0.1-rc.1"
|
|
4
|
+
description = ""
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = []
|
|
7
|
+
packages = [
|
|
8
|
+
{ include = "zep", from = "src"}
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
[tool.poetry.dependencies]
|
|
12
|
+
python = ">=3.8.1,<4.0"
|
|
13
|
+
httpx = ">=0.21.2"
|
|
14
|
+
pydantic = ">= 1.9.2"
|
|
15
|
+
typing_extensions = ">= 4.0.0"
|
|
16
|
+
|
|
17
|
+
[tool.poetry.dev-dependencies]
|
|
18
|
+
mypy = "1.9.0"
|
|
19
|
+
pytest = "^7.4.0"
|
|
20
|
+
pytest-asyncio = "^0.23.5"
|
|
21
|
+
python-dateutil = "^2.9.0"
|
|
22
|
+
langchain = "^0.1.3"
|
|
23
|
+
openai = "^1.9.0"
|
|
24
|
+
langchain-openai = "^0.0.3"
|
|
25
|
+
|
|
26
|
+
[tool.pytest.ini_options]
|
|
27
|
+
testpaths = [ "tests" ]
|
|
28
|
+
asyncio_mode = "auto"
|
|
29
|
+
|
|
30
|
+
[tool.mypy]
|
|
31
|
+
plugins = ["pydantic.mypy"]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
[build-system]
|
|
35
|
+
requires = ["poetry-core"]
|
|
36
|
+
build-backend = "poetry.core.masonry.api"
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from .types import (
|
|
4
|
+
ApiError,
|
|
5
|
+
ClassifySessionResponse,
|
|
6
|
+
CreateDocumentRequest,
|
|
7
|
+
DocumentCollectionResponse,
|
|
8
|
+
DocumentResponse,
|
|
9
|
+
DocumentSearchResult,
|
|
10
|
+
DocumentSearchResultPage,
|
|
11
|
+
Memory,
|
|
12
|
+
MemorySearchResult,
|
|
13
|
+
Message,
|
|
14
|
+
MessageListResponse,
|
|
15
|
+
ModelsZepDataClass,
|
|
16
|
+
Question,
|
|
17
|
+
RoleType,
|
|
18
|
+
SearchScope,
|
|
19
|
+
SearchType,
|
|
20
|
+
Session,
|
|
21
|
+
SuccessResponse,
|
|
22
|
+
Summary,
|
|
23
|
+
SummaryListResponse,
|
|
24
|
+
UpdateDocumentListRequest,
|
|
25
|
+
User,
|
|
26
|
+
UserListResponse,
|
|
27
|
+
)
|
|
28
|
+
from .errors import BadRequestError, InternalServerError, NotFoundError, UnauthorizedError
|
|
29
|
+
from . import document, memory, user
|
|
30
|
+
from .environment import ZepEnvironment
|
|
31
|
+
from .memory import MemoryGetRequestMemoryType
|
|
32
|
+
from .version import __version__
|
|
33
|
+
|
|
34
|
+
__all__ = [
|
|
35
|
+
"ApiError",
|
|
36
|
+
"BadRequestError",
|
|
37
|
+
"ClassifySessionResponse",
|
|
38
|
+
"CreateDocumentRequest",
|
|
39
|
+
"DocumentCollectionResponse",
|
|
40
|
+
"DocumentResponse",
|
|
41
|
+
"DocumentSearchResult",
|
|
42
|
+
"DocumentSearchResultPage",
|
|
43
|
+
"InternalServerError",
|
|
44
|
+
"Memory",
|
|
45
|
+
"MemoryGetRequestMemoryType",
|
|
46
|
+
"MemorySearchResult",
|
|
47
|
+
"Message",
|
|
48
|
+
"MessageListResponse",
|
|
49
|
+
"ModelsZepDataClass",
|
|
50
|
+
"NotFoundError",
|
|
51
|
+
"Question",
|
|
52
|
+
"RoleType",
|
|
53
|
+
"SearchScope",
|
|
54
|
+
"SearchType",
|
|
55
|
+
"Session",
|
|
56
|
+
"SuccessResponse",
|
|
57
|
+
"Summary",
|
|
58
|
+
"SummaryListResponse",
|
|
59
|
+
"UnauthorizedError",
|
|
60
|
+
"UpdateDocumentListRequest",
|
|
61
|
+
"User",
|
|
62
|
+
"UserListResponse",
|
|
63
|
+
"ZepEnvironment",
|
|
64
|
+
"__version__",
|
|
65
|
+
"document",
|
|
66
|
+
"memory",
|
|
67
|
+
"user",
|
|
68
|
+
]
|
|
@@ -0,0 +1,152 @@
|
|
|
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 .memory.client import AsyncMemoryClient, MemoryClient
|
|
13
|
+
from .user.client import AsyncUserClient, UserClient
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class BaseClient:
|
|
17
|
+
"""
|
|
18
|
+
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.
|
|
19
|
+
|
|
20
|
+
Parameters
|
|
21
|
+
----------
|
|
22
|
+
base_url : typing.Optional[str]
|
|
23
|
+
The base url to use for requests from the client.
|
|
24
|
+
|
|
25
|
+
environment : ZepEnvironment
|
|
26
|
+
The environment to use for requests from the client. from .environment import ZepEnvironment
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
Defaults to ZepEnvironment.DEFAULT
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
api_key : typing.Optional[str]
|
|
35
|
+
timeout : typing.Optional[float]
|
|
36
|
+
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 a default is not set.
|
|
37
|
+
|
|
38
|
+
follow_redirects : typing.Optional[bool]
|
|
39
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
|
40
|
+
|
|
41
|
+
httpx_client : typing.Optional[httpx.Client]
|
|
42
|
+
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.
|
|
43
|
+
|
|
44
|
+
Examples
|
|
45
|
+
--------
|
|
46
|
+
from zep.client import Zep
|
|
47
|
+
|
|
48
|
+
client = Zep(
|
|
49
|
+
api_key="YOUR_API_KEY",
|
|
50
|
+
)
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
def __init__(
|
|
54
|
+
self,
|
|
55
|
+
*,
|
|
56
|
+
base_url: typing.Optional[str] = None,
|
|
57
|
+
environment: ZepEnvironment = ZepEnvironment.DEFAULT,
|
|
58
|
+
api_key: typing.Optional[str] = os.getenv("ZEP_API_KEY"),
|
|
59
|
+
timeout: typing.Optional[float] = None,
|
|
60
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
61
|
+
httpx_client: typing.Optional[httpx.Client] = None
|
|
62
|
+
):
|
|
63
|
+
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
|
|
64
|
+
if api_key is None:
|
|
65
|
+
raise ApiError(body="The client must be instantiated be either passing in api_key or setting ZEP_API_KEY")
|
|
66
|
+
self._client_wrapper = SyncClientWrapper(
|
|
67
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
68
|
+
api_key=api_key,
|
|
69
|
+
httpx_client=httpx_client
|
|
70
|
+
if httpx_client is not None
|
|
71
|
+
else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
|
|
72
|
+
if follow_redirects is not None
|
|
73
|
+
else httpx.Client(timeout=_defaulted_timeout),
|
|
74
|
+
timeout=_defaulted_timeout,
|
|
75
|
+
)
|
|
76
|
+
self.document = DocumentClient(client_wrapper=self._client_wrapper)
|
|
77
|
+
self.memory = MemoryClient(client_wrapper=self._client_wrapper)
|
|
78
|
+
self.user = UserClient(client_wrapper=self._client_wrapper)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class AsyncBaseClient:
|
|
82
|
+
"""
|
|
83
|
+
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.
|
|
84
|
+
|
|
85
|
+
Parameters
|
|
86
|
+
----------
|
|
87
|
+
base_url : typing.Optional[str]
|
|
88
|
+
The base url to use for requests from the client.
|
|
89
|
+
|
|
90
|
+
environment : ZepEnvironment
|
|
91
|
+
The environment to use for requests from the client. from .environment import ZepEnvironment
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
Defaults to ZepEnvironment.DEFAULT
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
api_key : typing.Optional[str]
|
|
100
|
+
timeout : typing.Optional[float]
|
|
101
|
+
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 a default is not set.
|
|
102
|
+
|
|
103
|
+
follow_redirects : typing.Optional[bool]
|
|
104
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
|
105
|
+
|
|
106
|
+
httpx_client : typing.Optional[httpx.AsyncClient]
|
|
107
|
+
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.
|
|
108
|
+
|
|
109
|
+
Examples
|
|
110
|
+
--------
|
|
111
|
+
from zep.client import AsyncZep
|
|
112
|
+
|
|
113
|
+
client = AsyncZep(
|
|
114
|
+
api_key="YOUR_API_KEY",
|
|
115
|
+
)
|
|
116
|
+
"""
|
|
117
|
+
|
|
118
|
+
def __init__(
|
|
119
|
+
self,
|
|
120
|
+
*,
|
|
121
|
+
base_url: typing.Optional[str] = None,
|
|
122
|
+
environment: ZepEnvironment = ZepEnvironment.DEFAULT,
|
|
123
|
+
api_key: typing.Optional[str] = os.getenv("ZEP_API_KEY"),
|
|
124
|
+
timeout: typing.Optional[float] = None,
|
|
125
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
126
|
+
httpx_client: typing.Optional[httpx.AsyncClient] = None
|
|
127
|
+
):
|
|
128
|
+
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
|
|
129
|
+
if api_key is None:
|
|
130
|
+
raise ApiError(body="The client must be instantiated be either passing in api_key or setting ZEP_API_KEY")
|
|
131
|
+
self._client_wrapper = AsyncClientWrapper(
|
|
132
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
133
|
+
api_key=api_key,
|
|
134
|
+
httpx_client=httpx_client
|
|
135
|
+
if httpx_client is not None
|
|
136
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
|
|
137
|
+
if follow_redirects is not None
|
|
138
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout),
|
|
139
|
+
timeout=_defaulted_timeout,
|
|
140
|
+
)
|
|
141
|
+
self.document = AsyncDocumentClient(client_wrapper=self._client_wrapper)
|
|
142
|
+
self.memory = AsyncMemoryClient(client_wrapper=self._client_wrapper)
|
|
143
|
+
self.user = AsyncUserClient(client_wrapper=self._client_wrapper)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: ZepEnvironment) -> str:
|
|
147
|
+
if base_url is not None:
|
|
148
|
+
return base_url
|
|
149
|
+
elif environment is not None:
|
|
150
|
+
return environment.value
|
|
151
|
+
else:
|
|
152
|
+
raise Exception("Please pass in either base_url or environment to construct the client")
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
|
|
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
|
+
super().__init__(
|
|
24
|
+
base_url=base_url,
|
|
25
|
+
environment=environment,
|
|
26
|
+
api_key=api_key,
|
|
27
|
+
timeout=timeout,
|
|
28
|
+
follow_redirects=follow_redirects,
|
|
29
|
+
httpx_client=httpx_client
|
|
30
|
+
)
|
|
31
|
+
self.memory = MemoryClient(client_wrapper=self._client_wrapper)
|
|
32
|
+
self.document = DocumentClient(client_wrapper=self._client_wrapper)
|
|
33
|
+
self.user = UserClient(client_wrapper=self._client_wrapper)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class AsyncZep(AsyncBaseClient):
|
|
37
|
+
def __init__(
|
|
38
|
+
self,
|
|
39
|
+
*,
|
|
40
|
+
base_url: typing.Optional[str] = None,
|
|
41
|
+
environment: ZepEnvironment = ZepEnvironment.DEFAULT,
|
|
42
|
+
api_key: typing.Optional[str] = os.getenv("ZEP_API_KEY"),
|
|
43
|
+
timeout: typing.Optional[float] = None,
|
|
44
|
+
follow_redirects: typing.Optional[bool] = None,
|
|
45
|
+
httpx_client: typing.Optional[httpx.AsyncClient] = None
|
|
46
|
+
):
|
|
47
|
+
super().__init__(
|
|
48
|
+
base_url=base_url,
|
|
49
|
+
environment=environment,
|
|
50
|
+
api_key=api_key,
|
|
51
|
+
timeout=timeout,
|
|
52
|
+
follow_redirects=follow_redirects,
|
|
53
|
+
httpx_client=httpx_client
|
|
54
|
+
)
|
|
55
|
+
self.memory = AsyncMemoryClient(client_wrapper=self._client_wrapper)
|
|
56
|
+
self.document = AsyncDocumentClient(client_wrapper=self._client_wrapper)
|
|
57
|
+
self.user = AsyncUserClient(client_wrapper=self._client_wrapper)
|
|
@@ -0,0 +1,27 @@
|
|
|
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 pydantic_v1
|
|
10
|
+
from .remove_none_from_dict import remove_none_from_dict
|
|
11
|
+
from .request_options import RequestOptions
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"ApiError",
|
|
15
|
+
"AsyncClientWrapper",
|
|
16
|
+
"AsyncHttpClient",
|
|
17
|
+
"BaseClientWrapper",
|
|
18
|
+
"File",
|
|
19
|
+
"HttpClient",
|
|
20
|
+
"RequestOptions",
|
|
21
|
+
"SyncClientWrapper",
|
|
22
|
+
"convert_file_dict_to_httpx_tuples",
|
|
23
|
+
"jsonable_encoder",
|
|
24
|
+
"pydantic_v1",
|
|
25
|
+
"remove_none_from_dict",
|
|
26
|
+
"serialize_datetime",
|
|
27
|
+
]
|
|
@@ -0,0 +1,15 @@
|
|
|
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}"
|
|
@@ -0,0 +1,45 @@
|
|
|
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",
|
|
20
|
+
"X-Fern-SDK-Version": "1.0.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(httpx_client=httpx_client)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class AsyncClientWrapper(BaseClientWrapper):
|
|
41
|
+
def __init__(
|
|
42
|
+
self, *, api_key: str, base_url: str, timeout: typing.Optional[float] = None, httpx_client: httpx.AsyncClient
|
|
43
|
+
):
|
|
44
|
+
super().__init__(api_key=api_key, base_url=base_url, timeout=timeout)
|
|
45
|
+
self.httpx_client = AsyncHttpClient(httpx_client=httpx_client)
|
|
@@ -0,0 +1,28 @@
|
|
|
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)
|