Skip to content

Commit

Permalink
V2 (#230)
Browse files Browse the repository at this point in the history
* chore: Add quickstart notebook

* SDK regeneration

* chore: Version bump

* chore: Add license

* chore: Version bump

* SDK regeneration

* chore: Bump version and add memory context to the example

* chore: version bump

* SDK regeneration

* chore: revert example changes

* wip

* chore: revert autogen example changes

* chore: remove autogen cache

* chore: Version bump

* SDK regeneration

* SDK regeneration

---------

Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
  • Loading branch information
paul-paliychuk and fern-api[bot] authored Dec 10, 2024
1 parent deb6288 commit 7b3397e
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 24 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "zep-cloud"
version = "2.1.1"
version = "2.2.0"
description = ""
readme = "README.md"
authors = []
Expand Down
2 changes: 2 additions & 0 deletions src/zep_cloud/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This file was auto-generated by Fern from our API Definition.

from .types import (
AddMemoryResponse,
ApiError,
ApidataDocument,
ApidataDocumentCollection,
Expand Down Expand Up @@ -53,6 +54,7 @@
from .version import __version__

__all__ = [
"AddMemoryResponse",
"ApiError",
"ApidataDocument",
"ApidataDocumentCollection",
Expand Down
2 changes: 1 addition & 1 deletion src/zep_cloud/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "zep-cloud",
"X-Fern-SDK-Version": "2.1.1",
"X-Fern-SDK-Version": "2.2.0",
}
headers["Authorization"] = f"Api-Key {self.api_key}"
return headers
Expand Down
12 changes: 6 additions & 6 deletions src/zep_cloud/graph/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def search(
request_options: typing.Optional[RequestOptions] = None
) -> GraphSearchResults:
"""
Perform a graph search query
Perform a graph search query.
Parameters
----------
Expand All @@ -119,7 +119,7 @@ def search(
one of user_id or group_id must be provided
limit : typing.Optional[int]
The maximum number of facts to retrieve
The maximum number of facts to retrieve. Defaults to 10. Limited to 50.
min_score : typing.Optional[float]
minimum similarity score for a result to be returned
Expand All @@ -131,7 +131,7 @@ def search(
Defaults to RRF
scope : typing.Optional[GraphSearchScope]
Defaults to Edges. Nodes and Communities will be added in the future.
Defaults to Edges. Communities will be added in the future.
user_id : typing.Optional[str]
one of user_id or group_id must be provided
Expand Down Expand Up @@ -269,7 +269,7 @@ async def search(
request_options: typing.Optional[RequestOptions] = None
) -> GraphSearchResults:
"""
Perform a graph search query
Perform a graph search query.
Parameters
----------
Expand All @@ -283,7 +283,7 @@ async def search(
one of user_id or group_id must be provided
limit : typing.Optional[int]
The maximum number of facts to retrieve
The maximum number of facts to retrieve. Defaults to 10. Limited to 50.
min_score : typing.Optional[float]
minimum similarity score for a result to be returned
Expand All @@ -295,7 +295,7 @@ async def search(
Defaults to RRF
scope : typing.Optional[GraphSearchScope]
Defaults to Edges. Nodes and Communities will be added in the future.
Defaults to Edges. Communities will be added in the future.
user_id : typing.Optional[str]
one of user_id or group_id must be provided
Expand Down
20 changes: 12 additions & 8 deletions src/zep_cloud/group/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ def __init__(self, *, client_wrapper: SyncClientWrapper):
def add(
self,
*,
group_id: str,
description: typing.Optional[str] = OMIT,
fact_rating_instruction: typing.Optional[ApidataFactRatingInstruction] = OMIT,
group_id: typing.Optional[str] = OMIT,
name: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> Group:
Expand All @@ -38,13 +38,13 @@ def add(
Parameters
----------
group_id : str
description : typing.Optional[str]
fact_rating_instruction : typing.Optional[ApidataFactRatingInstruction]
UserIDs []string `json:"user_ids"`
group_id : typing.Optional[str]
name : typing.Optional[str]
request_options : typing.Optional[RequestOptions]
Expand All @@ -62,7 +62,9 @@ def add(
client = Zep(
api_key="YOUR_API_KEY",
)
client.group.add()
client.group.add(
group_id="group_id",
)
"""
_response = self._client_wrapper.httpx_client.request(
"groups",
Expand Down Expand Up @@ -145,9 +147,9 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper):
async def add(
self,
*,
group_id: str,
description: typing.Optional[str] = OMIT,
fact_rating_instruction: typing.Optional[ApidataFactRatingInstruction] = OMIT,
group_id: typing.Optional[str] = OMIT,
name: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> Group:
Expand All @@ -156,13 +158,13 @@ async def add(
Parameters
----------
group_id : str
description : typing.Optional[str]
fact_rating_instruction : typing.Optional[ApidataFactRatingInstruction]
UserIDs []string `json:"user_ids"`
group_id : typing.Optional[str]
name : typing.Optional[str]
request_options : typing.Optional[RequestOptions]
Expand All @@ -180,7 +182,9 @@ async def add(
client = AsyncZep(
api_key="YOUR_API_KEY",
)
await client.group.add()
await client.group.add(
group_id="group_id",
)
"""
_response = await self._client_wrapper.httpx_client.request(
"groups",
Expand Down
27 changes: 19 additions & 8 deletions src/zep_cloud/memory/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from ..errors.conflict_error import ConflictError
from ..errors.internal_server_error import InternalServerError
from ..errors.not_found_error import NotFoundError
from ..types.add_memory_response import AddMemoryResponse
from ..types.api_error import ApiError as types_api_error_ApiError
from ..types.classify_session_request import ClassifySessionRequest
from ..types.end_session_response import EndSessionResponse
Expand Down Expand Up @@ -938,9 +939,10 @@ def add(
*,
messages: typing.Sequence[Message],
fact_instruction: typing.Optional[str] = OMIT,
return_context: typing.Optional[bool] = OMIT,
summary_instruction: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> SuccessResponse:
) -> AddMemoryResponse:
"""
Add memory to the specified session.
Expand All @@ -955,6 +957,9 @@ def add(
fact_instruction : typing.Optional[str]
Additional instruction for generating the facts. Zep Cloud Only, will be ignored on Community Edition.
return_context : typing.Optional[bool]
Optionally return memory context relevant to the most recent messages.
summary_instruction : typing.Optional[str]
Additional instruction for generating the summary. Zep Cloud Only, will be ignored on Community Edition.
Expand All @@ -963,8 +968,8 @@ def add(
Returns
-------
SuccessResponse
OK
AddMemoryResponse
An object, optionally containing memory context retrieved for the last message
Examples
--------
Expand All @@ -990,13 +995,14 @@ def add(
json={
"fact_instruction": fact_instruction,
"messages": messages,
"return_context": return_context,
"summary_instruction": summary_instruction,
},
request_options=request_options,
omit=OMIT,
)
if 200 <= _response.status_code < 300:
return pydantic_v1.parse_obj_as(SuccessResponse, _response.json()) # type: ignore
return pydantic_v1.parse_obj_as(AddMemoryResponse, _response.json()) # type: ignore
if _response.status_code == 500:
raise InternalServerError(
pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore
Expand Down Expand Up @@ -2326,9 +2332,10 @@ async def add(
*,
messages: typing.Sequence[Message],
fact_instruction: typing.Optional[str] = OMIT,
return_context: typing.Optional[bool] = OMIT,
summary_instruction: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> SuccessResponse:
) -> AddMemoryResponse:
"""
Add memory to the specified session.
Expand All @@ -2343,6 +2350,9 @@ async def add(
fact_instruction : typing.Optional[str]
Additional instruction for generating the facts. Zep Cloud Only, will be ignored on Community Edition.
return_context : typing.Optional[bool]
Optionally return memory context relevant to the most recent messages.
summary_instruction : typing.Optional[str]
Additional instruction for generating the summary. Zep Cloud Only, will be ignored on Community Edition.
Expand All @@ -2351,8 +2361,8 @@ async def add(
Returns
-------
SuccessResponse
OK
AddMemoryResponse
An object, optionally containing memory context retrieved for the last message
Examples
--------
Expand All @@ -2378,13 +2388,14 @@ async def add(
json={
"fact_instruction": fact_instruction,
"messages": messages,
"return_context": return_context,
"summary_instruction": summary_instruction,
},
request_options=request_options,
omit=OMIT,
)
if 200 <= _response.status_code < 300:
return pydantic_v1.parse_obj_as(SuccessResponse, _response.json()) # type: ignore
return pydantic_v1.parse_obj_as(AddMemoryResponse, _response.json()) # type: ignore
if _response.status_code == 500:
raise InternalServerError(
pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore
Expand Down
2 changes: 2 additions & 0 deletions src/zep_cloud/types/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file was auto-generated by Fern from our API Definition.

from .add_memory_response import AddMemoryResponse
from .api_error import ApiError
from .apidata_document import ApidataDocument
from .apidata_document_collection import ApidataDocumentCollection
Expand Down Expand Up @@ -47,6 +48,7 @@
from .user_list_response import UserListResponse

__all__ = [
"AddMemoryResponse",
"ApiError",
"ApidataDocument",
"ApidataDocumentCollection",
Expand Down
29 changes: 29 additions & 0 deletions src/zep_cloud/types/add_memory_response.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

from ..core.datetime_utils import serialize_datetime
from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1


class AddMemoryResponse(pydantic_v1.BaseModel):
context: typing.Optional[str] = None

def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
return super().json(**kwargs_with_defaults)

def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}

return deep_union_pydantic_dicts(
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
)

class Config:
frozen = True
smart_union = True
extra = pydantic_v1.Extra.allow
json_encoders = {dt.datetime: serialize_datetime}
2 changes: 2 additions & 0 deletions src/zep_cloud/types/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

from ..core.datetime_utils import serialize_datetime
from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
from .fact_rating_instruction import FactRatingInstruction


class User(pydantic_v1.BaseModel):
created_at: typing.Optional[str] = None
deleted_at: typing.Optional[str] = None
email: typing.Optional[str] = None
fact_rating_instruction: typing.Optional[FactRatingInstruction] = None
first_name: typing.Optional[str] = None
id: typing.Optional[int] = None
last_name: typing.Optional[str] = None
Expand Down

0 comments on commit 7b3397e

Please sign in to comment.