GET
/
api
/
v1
/
users
/
event_gist
/
search
/
{user_id}
Python
# To use the Python SDK, install the package:
# pip install memobase
from memobase import MemoBaseClient
from memobase.core.blob import ChatBlob

client = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')
uid = client.add_user()
u = client.get_user(uid)

b = ChatBlob(messages=[
    {
        "role": "user",
        "content": "Hi, I'm here again"
    },
    {
        "role": "assistant",
        "content": "Hi, Gus! How can I help you?"
    }
])
u.insert(b)
u.flush(sync=True)

events = u.search_event_gist('query')
print(events)
{
  "data": {
    "gists": [
      {
        "id": "<string>",
        "gist_data": {
          "content": "<string>"
        },
        "created_at": "2023-11-07T05:31:56Z",
        "updated_at": "2023-11-07T05:31:56Z",
        "similarity": 123
      }
    ]
  },
  "errno": 0,
  "errmsg": ""
}

Search event gists by query. Event gist is a fraction of User Event. For example, if a user event has the event_tips:

- A // info
- B // schedule
- C // reminder

The event gists will be

  • - A // info
  • - B // schedule
  • - C // reminder

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

user_id
string
required

The ID of the user

Query Parameters

query
string
required

The query to search for

topk
integer
default:10

Number of events to retrieve, default is 10

similarity_threshold
number
default:0.2

Similarity threshold, default is 0.2

time_range_in_days
integer
default:180

Only allow events within the past few days, default is 180

Response

200
application/json

Successful Response

The response is of type object.