Giter VIP home page Giter VIP logo

zep-python's People

Contributors

danielchalef avatar dependabot[bot] avatar petergarbers avatar rsharath avatar sweep-ai[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

zep-python's Issues

Any way do delete session messages instantly?

Hello.

I'm using zep memory (and probably session in future) for chat history.
I currently use my internal user_id as session session_id=user_id.

The issue is that I want to be able to reset the history faster.
When having
purge_every: 1 in config.yaml and using zep_client.memory.delete_memory(user_id) or zep_client.memory.get_memory(user_id).messages.clear()
User then starts a new conversation before msg="completed purging memory store" log, and i get

API error: {'status_code': 400, 'message': 'storage error: session .... is deleted (original error: <nil>)\n'}

Unfortunately, I can not use any new session variable except same user_id.

Is there any way to renew session instantly - or at least remove all messages and session variables?

Thank you for this very helpful solution and advices.

Issue with `packaging` in latest version

Description

I just installed the following packages in a clean conda environment with python3.8 and I am running into the following error message. It's pretty easy to duplicate.

Packages

tiktoken==0.4.0
zep-python==1.1.0
packaging==23.1

Error Trace

zep-seeder  | Traceback (most recent call last):
zep-seeder  |   File "/app/setup.py", line 9, in <module>
zep-seeder  |     client = ZepClient(base_url=zep_api_url)
zep-seeder  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
zep-seeder  |   File "/usr/local/lib/python3.11/site-packages/zep_python/zep_client.py", line 86, in __init__
zep-seeder  |     self._healthcheck(base_url)
zep-seeder  |   File "/usr/local/lib/python3.11/site-packages/zep_python/zep_client.py", line 120, in _healthcheck
zep-seeder  |     zep_server_version = Version(zep_server_version_str.split("-")[0])
zep-seeder  |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
zep-seeder  |   File "/usr/local/lib/python3.11/site-packages/packaging/version.py", line 198, in __init__
zep-seeder  |     raise InvalidVersion(f"Invalid version: '{version}'")
zep-seeder  | packaging.version.InvalidVersion: Invalid version: ''

Support Pydantic v2

Pydantic has gone live with their new version

Being that its production ready and as suggested by Pydantic's README:

Pydantic V2 also ships with the latest version of Pydantic V1 built in so that you can incrementally upgrade your code base and projects: from pydantic import v1 as pydantic_v1.

It should be safe to upgrade and allow folks using poetry (like me) to resolve dependancies in a way that unblocks upgrading to Pydantic v2, FastAPI v0.100.0, etc

About save_context function

Thx for your jobs! ღ( ´・ᴗ・` )
In the usage scenario of memory, whether it is summarized knowledge, insights, or historical information stored in the time dimension, they will eventually become part of the new question prompt.
Why is it necessary to divide historical information into AI and Human parts?

def save_context(
        self,
        inputs: Dict[str, Any],
        outputs: Dict[str, str],
        metadata: Optional[Dict[str, Any]] = None,
    ) -> None:
        """Save context from this conversation to buffer.

        Args:
            inputs (Dict[str, Any]): The inputs to the chain.
            outputs (Dict[str, str]): The outputs from the chain.
            metadata (Optional[Dict[str, Any]], optional): Any metadata to save with
                                                           the context. Defaults to None

        Returns:
            None
        """
        input_str, output_str = self._get_input_output(inputs, outputs)
        self.chat_memory.add_user_message(input_str, metadata=metadata)
        self.chat_memory.add_ai_message(output_str, metadata=metadata)

Support directories in the base url

We are running Zep as a docker container on our virtual server and have proxied it. Our URL is like https://server.com/zep

During deploy, I noticed that we couldn't hit this server. Looking at the module code:

self.base_url = urljoin(base_url, API_BASE_PATH)

Urljoin strips off the path at the end of the base_url string.

>>> print(urljoin("https://server.com/zep", "/v1/foo"))
https://server.com/v1/foo

Thank you for an amazing app!

About the Rest API

Title: Error 400 when adding a new memory using REST API

Description:
I have been working with the API to create a session-based memory in my application. I've implemented basic GET and DELETE operations for memory, and they seem to be working properly. However, I'm encountering an Error 400 when trying to add a new memory using the POST method.

I've tried various approaches to pass the Memory object, including using the zep-python library, custom JSON, and other methods, but none of them seem to work. The API documentation lacks examples for the REST API part, making it difficult to troubleshoot the issue.

Steps to Reproduce:

Perform a POST request to add a new memory using the REST API.
Include the necessary parameters in the request (e.g., session ID, memory data).
Observe the Error 400 response.
Expected Behavior:
The POST request should add a new memory to the session without any errors.

Additional Information:

I have successfully used the GET and DELETE methods for memory, which suggests that the authentication and basic functionality of the API are working as expected.
The issue seems to be specific to the POST method when adding a new memory.

Note:
The API documentation lacks clear examples for the REST API part, especially when it comes to the POST method for adding a new memory. This makes it challenging to understand the correct format and parameters required for the request. It would be highly beneficial to include detailed examples in the documentation to help developers use the API effectively.

Automatically add chat history and context into question

I've used Zep as follows:

memory = ZepMemory(
session_id=session_id,
url=ZEP_API_URL,
memory_key="chat_history",
output_key='answer',
return_messages=True
)

when I pass this into a ConversationalRetrievalChain, it would be really nice if Zep could automatically search chat history and add it on top of retriever context

Quick start code looks out of date.

In the quick start code, it looks like the function signature for "aget_memory" and "asearch_memory" are a bit out of date.

When I run:

memories = await client.aget_memory(session_id)
    for memory in memories:
        for message in memory.messages:
            print(message.to_dict())

It complains:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[26], line 22
     20 memories = await client.aget_memory(session_id)
     21 for memory in memories:
---> 22     for message in memory.messages:
     23         print(message.to_dict())
     25 # Search memory
     26 # Messages uploaded to Zep are automatically embedded and made available
     27 # for vector-based similarity search.

AttributeError: 'tuple' object has no attribute 'messages'

Also when I run

search_payload = SearchPayload({}, "Who is Yuri Gagarin?")

it complains

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[27], line 1
----> 1 search_payload = SearchPayload({}, "Who is Yuri Gagarin?")

File [c:\Users\jayfd\anaconda3\envs\family-gpt\lib\site-packages\pydantic\main.py:332](file:///C:/Users/jayfd/anaconda3/envs/family-gpt/lib/site-packages/pydantic/main.py:332), in pydantic.main.BaseModel.__init__()

TypeError: __init__() takes exactly 1 positional argument (3 given)

Both look like easy fixes that i was able to do, just though it would be good to update the quickstart code in various places if indeed the signature has changed for these functions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.