{ "openapi":"3.1.0", "info":{ "title":"Memobase API", "summary":"APIs for Memobase, a user memory system for LLM Apps", "version":"0.0.40" }, "servers":[ { "url":"https://api.memobase.dev" }, { "url":"https://api.memobase.cn" } ], "paths":{ "/api/v1/healthcheck":{ "get":{ "tags":[ "chore" ], "summary":"Healthcheck", "description":"Check if your memobase is set up correctly", "operationId":"healthcheck_api_v1_healthcheck_get", "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/BaseResponse" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nmemobase = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nassert memobase.ping()\n\n", "label":"Python" }, { "lang":"javascript", "source":"// To use the JavaScript SDK, install the package:\n// npm install @memobase/memobase\n\nimport { MemoBaseClient } from '@memobase/memobase';\n\nconst client = new MemoBaseClient(process.env.MEMOBASE_PROJECT_URL, process.env.MEMOBASE_API_KEY);\n\nawait client.ping();\n\n", "label":"JavaScript" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Ping the server\n if !client.Ping() {\n log.Fatal(\"Failed to connect to server\")\n }\n fmt.Println(\"Successfully connected to server\")\n}\n\n", "label":"Go" } ], "security":[ ] } }, "/api/v1/admin/status_check":{ "get":{ "tags":[ "admin" ], "summary":"Root Running Status Check", "description":"Check if your memobase is set up correctly", "operationId":"root_running_status_check_api_v1_admin_status_check_get", "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/BaseResponse" } } } } } } }, "/api/v1/project/profile_config":{ "get":{ "tags":[ "project" ], "summary":"Get Project Profile Config String", "operationId":"get_project_profile_config_string_api_v1_project_profile_config_get", "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/ProfileConfigDataResponse" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nmemobase = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nconfig = memobase.get_config()\n\n", "label":"Python" }, { "lang":"javascript", "source":"// To use the JavaScript SDK, install the package:\n// npm install @memobase/memobase\n\nimport { MemoBaseClient } from '@memobase/memobase';\n\nconst client = new MemoBaseClient(process.env.MEMOBASE_PROJECT_URL, process.env.MEMOBASE_API_KEY);\n\nconst config = await client.getConfig();\n\n", "label":"JavaScript" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get config\n config, err := client.GetConfig()\n if err != nil {\n log.Fatalf(\"Failed to get config: %v\", err)\n }\n fmt.Printf(\"Config: %s\n\", config)\n}\n\n", "label":"Go" } ] }, "post":{ "tags":[ "project" ], "summary":"Update Project Profile Config", "operationId":"update_project_profile_config_api_v1_project_profile_config_post", "requestBody":{ "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/ProfileConfigData", "description":"The profile config to update" } } }, "required":true }, "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/BaseResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nmemobase = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nmemobase.update_config('your_profile_config')\n\n", "label":"Python" }, { "lang":"javascript", "source":"// To use the JavaScript SDK, install the package:\n// npm install @memobase/memobase\n\nimport { MemoBaseClient } from '@memobase/memobase';\n\nconst client = new MemoBaseClient(process.env.MEMOBASE_PROJECT_URL, process.env.MEMOBASE_API_KEY);\n\nawait client.updateConfig('your_profile_config');\n\n", "label":"JavaScript" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Update config\n err = client.UpdateConfig(\"your_profile_config\")\n if err != nil {\n log.Fatalf(\"Failed to update config: %v\", err)\n }\n fmt.Println(\"Successfully updated config\")\n}\n\n", "label":"Go" } ] } }, "/api/v1/project/billing":{ "get":{ "tags":[ "project" ], "summary":"Get Project Billing", "operationId":"get_project_billing_api_v1_project_billing_get", "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/BillingResponse" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nmemobase = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nprint(memobase.get_usage())\n\n", "label":"Python" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get usage\n usage, err := client.GetUsage()\n if err != nil {\n log.Fatalf(\"Failed to get usage: %v\", err)\n }\n fmt.Printf(\"Usage: %v\n\", usage)\n}\n\n", "label":"Go" } ] } }, "/api/v1/project/users":{ "get":{ "tags":[ "project" ], "summary":"Get Project Users", "description":"Get the users of a project in different orders", "operationId":"get_project_users_api_v1_project_users_get", "parameters":[ { "name":"search", "in":"query", "required":false, "schema":{ "type":"string", "description":"Search string in username field", "default":"", "title":"Search" }, "description":"Search string in username field" }, { "name":"order_by", "in":"query", "required":false, "schema":{ "enum":[ "updated_at", "profile_count", "event_count" ], "type":"string", "description":"Order by field", "default":"updated_at", "title":"Order By" }, "description":"Order by field" }, { "name":"order_desc", "in":"query", "required":false, "schema":{ "type":"boolean", "description":"Order descending or ascending", "default":true, "title":"Order Desc" }, "description":"Order descending or ascending" }, { "name":"limit", "in":"query", "required":false, "schema":{ "type":"integer", "description":"Limit the number of results returned", "default":10, "title":"Limit" }, "description":"Limit the number of results returned" }, { "name":"offset", "in":"query", "required":false, "schema":{ "type":"integer", "description":"Offset the starting point for pagination", "default":0, "title":"Offset" }, "description":"Offset the starting point for pagination" } ], "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/ProjectUsersDataResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nmemobase = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nusers = memobase.get_all_users(search=\"\", order_by=\"updated_at\", order_desc=True, limit=10, offset=0)\n\n", "label":"Python" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get all users\n users, err := client.GetAllUsers(\"\", \"updated_at\", true, 10, 0)\n if err != nil {\n log.Fatalf(\"Failed to get all users: %v\", err)\n }\n fmt.Printf(\"Found %d users\n\", len(users))\n}\n\n", "label":"Go" } ] } }, "/api/v1/project/usage":{ "get":{ "tags":[ "project" ], "summary":"Get Project Usage", "description":"Get the usage of a project in the last days", "operationId":"get_project_usage_api_v1_project_usage_get", "parameters":[ { "name":"last_days", "in":"query", "required":false, "schema":{ "type":"integer", "description":"The number of days to get", "default":7, "title":"Last Days" }, "description":"The number of days to get" } ], "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/UsageResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nmemobase = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nusage = memobase.get_daily_usage(days=7)\n\n", "label":"Python" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get daily usage\n usage, err := client.GetDailyUsage(7)\n if err != nil {\n log.Fatalf(\"Failed to get daily usage: %v\", err)\n }\n fmt.Printf(\"Usage: %v\n\", usage)\n}\n\n", "label":"Go" } ] } }, "/api/v1/users":{ "post":{ "tags":[ "user" ], "summary":"Create User", "description":"Create a new user with additional data", "operationId":"create_user_api_v1_users_post", "requestBody":{ "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/UserData", "description":"User data for creating a new user" } } }, "required":true }, "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/IdResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nuid = client.add_user({\"ANY\": \"DATA\"})\n\n", "label":"Python" }, { "lang":"javascript", "source":"// To use the JavaScript SDK, install the package:\n// npm install @memobase/memobase\n\nimport { MemoBaseClient } from '@memobase/memobase';\n\nconst client = new MemoBaseClient(process.env.MEMOBASE_PROJECT_URL, process.env.MEMOBASE_API_KEY);\n\nconst userId = await client.addUser({ANY: \"DATA\"});\n\n", "label":"JavaScript" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/google/uuid\"\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Add a user\n userID := uuid.New().String()\n data := map[string]interface{}{\"ANY\": \"DATA\"}\n _, err = client.AddUser(data, userID)\n if err != nil {\n log.Fatalf(\"Failed to add user: %v\", err)\n }\n fmt.Printf(\"User added with ID: %s\n\", userID)\n}\n\n", "label":"Go" } ] } }, "/api/v1/users/{user_id}":{ "get":{ "tags":[ "user" ], "summary":"Get User", "operationId":"get_user_api_v1_users__user_id__get", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user to retrieve", "title":"User Id" }, "description":"The ID of the user to retrieve" } ], "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/UserDataResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nu = client.get_user(uid)\n\n", "label":"Python" }, { "lang":"javascript", "source":"// To use the JavaScript SDK, install the package:\n// npm install @memobase/memobase\n\nimport { MemoBaseClient } from '@memobase/memobase';\n\nconst client = new MemoBaseClient(process.env.MEMOBASE_PROJECT_URL, process.env.MEMOBASE_API_KEY);\n\nconst user = await client.getUser(userId);\n\n", "label":"JavaScript" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/google/uuid\"\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get a user\n userID := \"EXISTING_USER_ID\" // Replace with an actual user ID\n user, err := client.GetUser(userID, false)\n if err != nil {\n log.Fatalf(\"Failed to get user: %v\", err)\n }\n fmt.Printf(\"Successfully retrieved user with ID: %s\n\", user.UserID)\n}\n\n", "label":"Go" } ] }, "put":{ "tags":[ "user" ], "summary":"Update User", "operationId":"update_user_api_v1_users__user_id__put", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user to update", "title":"User Id" }, "description":"The ID of the user to update" } ], "requestBody":{ "required":true, "content":{ "application/json":{ "schema":{ "type":"object", "additionalProperties":true, "description":"Updated user data", "title":"User Data" } } } }, "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/IdResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nclient.update_user(uid, {\"ANY\": \"NEW_DATA\"})\n\n", "label":"Python" }, { "lang":"javascript", "source":"// To use the JavaScript SDK, install the package:\n// npm install @memobase/memobase\n\nimport { MemoBaseClient } from '@memobase/memobase';\n\nconst client = new MemoBaseClient(process.env.MEMOBASE_PROJECT_URL, process.env.MEMOBASE_API_KEY);\n\nawait client.updateUser(userId, {ANY: \"NEW_DATA\"});\n\n", "label":"JavaScript" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Update a user\n userID := \"EXISTING_USER_ID\" // Replace with an actual user ID\n newData := map[string]interface{}{\"ANY\": \"NEW_DATA\"}\n _, err = client.UpdateUser(userID, newData)\n if err != nil {\n log.Fatalf(\"Failed to update user: %v\", err)\n }\n fmt.Printf(\"Successfully updated user with ID: %s\n\", userID)\n}\n\n", "label":"Go" } ] }, "delete":{ "tags":[ "user" ], "summary":"Delete User", "operationId":"delete_user_api_v1_users__user_id__delete", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user to delete", "title":"User Id" }, "description":"The ID of the user to delete" } ], "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/BaseResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nclient.delete_user(uid)\n\n", "label":"Python" }, { "lang":"javascript", "source":"// To use the JavaScript SDK, install the package:\n// npm install @memobase/memobase\n\nimport { MemoBaseClient } from '@memobase/memobase';\n\nconst client = new MemoBaseClient(process.env.MEMOBASE_PROJECT_URL, process.env.MEMOBASE_API_KEY);\n\nawait client.deleteUser(userId);\n\n", "label":"JavaScript" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Delete a user\n userID := \"EXISTING_USER_ID\" // Replace with an actual user ID\n err = client.DeleteUser(userID)\n if err != nil {\n log.Fatalf(\"Failed to delete user: %v\", err)\n }\n fmt.Printf(\"Successfully deleted user with ID: %s\n\", userID)\n}\n\n", "label":"Go" } ] } }, "/api/v1/users/blobs/{user_id}/{blob_type}":{ "get":{ "tags":[ "user" ], "summary":"Get User All Blobs", "operationId":"get_user_all_blobs_api_v1_users_blobs__user_id___blob_type__get", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user to fetch blobs for", "title":"User Id" }, "description":"The ID of the user to fetch blobs for" }, { "name":"blob_type", "in":"path", "required":true, "schema":{ "$ref":"#/components/schemas/BlobType", "description":"The type of blobs to retrieve" }, "description":"The type of blobs to retrieve" }, { "name":"page", "in":"query", "required":false, "schema":{ "type":"integer", "description":"Page number for pagination, starting from 0", "default":0, "title":"Page" }, "description":"Page number for pagination, starting from 0" }, { "name":"page_size", "in":"query", "required":false, "schema":{ "type":"integer", "description":"Number of items per page, default is 10", "default":10, "title":"Page Size" }, "description":"Number of items per page, default is 10" } ], "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/IdsResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\nfrom memobase.core.blob import BlobType\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nuser = client.get_user('user_id')\nblobs = user.get_all(BlobType.chat)\n\n", "label":"Python" }, { "lang":"javascript", "source":"// To use the JavaScript SDK, install the package:\n// npm install @memobase/memobase\n\nimport { MemoBaseClient, BlobType } from '@memobase/memobase';\n\nconst client = new MemoBaseClient(process.env.MEMOBASE_PROJECT_URL, process.env.MEMOBASE_API_KEY);\n\nconst user = client.getUser('user_id');\nconst blobs = await user.getAll(BlobType.Enum.chat);\n\n", "label":"JavaScript" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/blob\"\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get a user\n userID := \"EXISTING_USER_ID\" // Replace with an actual user ID\n user, err := client.GetUser(userID, false)\n if err != nil {\n log.Fatalf(\"Failed to get user: %v\", err)\n }\n\n // Get all chat blobs\n blobIDs, err := user.GetAll(blob.ChatType, 0, 10)\n if err != nil {\n log.Fatalf(\"Failed to get blobs: %v\", err)\n }\n\n fmt.Printf(\"Found %d chat blobs\n\", len(blobIDs))\n}\n\n", "label":"Go" } ] } }, "/api/v1/blobs/insert/{user_id}":{ "post":{ "tags":[ "blob" ], "summary":"Insert Blob", "operationId":"insert_blob_api_v1_blobs_insert__user_id__post", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user to insert the blob for", "title":"User Id" }, "description":"The ID of the user to insert the blob for" }, { "name":"wait_process", "in":"query", "required":false, "schema":{ "type":"boolean", "description":"Whether to wait for the blob to be processed", "default":false, "title":"Wait Process" }, "description":"Whether to wait for the blob to be processed" } ], "requestBody":{ "required":true, "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/BlobData", "description":"The blob data to insert" } } } }, "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/BlobInsertResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\nfrom memobase.core.blob import ChatBlob\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nb = ChatBlob(messages=[\n {\n \"role\": \"user\",\n \"content\": \"Hi, I'm here again\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Hi, Gus! How can I help you?\"\n }\n])\nu = client.get_user(uid)\nbid = u.insert(b)\n\n", "label":"Python" }, { "lang":"javascript", "source":"// To use the JavaScript SDK, install the package:\n// npm install @memobase/memobase\n\nimport { MemoBaseClient, Blob, BlobType } from '@memobase/memobase';\n\nconst client = new MemoBaseClient(process.env.MEMOBASE_PROJECT_URL, process.env.MEMOBASE_API_KEY);\nconst user = await client.getUser(userId);\n\nconst blobId = await user.insert(Blob.parse({\n type: BlobType.Enum.chat,\n messages: [\n {\n role: 'user',\n content: 'Hi, I'm here again'\n },\n {\n role: 'assistant',\n content: 'Hi, Gus! How can I help you?'\n }\n ]\n}));\n\n", "label":"JavaScript" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/blob\"\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get a user\n userID := \"EXISTING_USER_ID\" // Replace with an actual user ID\n user, err := client.GetUser(userID, false)\n if err != nil {\n log.Fatalf(\"Failed to get user: %v\", err)\n }\n\n // Create a chat blob\n chatBlob := &blob.ChatBlob{\n BaseBlob: blob.BaseBlob{\n Type: blob.ChatType,\n },\n Messages: []blob.OpenAICompatibleMessage{\n {\n Role: \"user\",\n Content: \"Hello, I am Jinjia!\",\n },\n {\n Role: \"assistant\",\n Content: \"Hi there! How can I help you today?\",\n },\n },\n }\n\n // Insert the blob\n blobID, err := user.Insert(chatBlob, false)\n if err != nil {\n log.Fatalf(\"Failed to insert blob: %v\", err)\n }\n fmt.Printf(\"Successfully inserted blob with ID: %s\n\", blobID)\n}\n\n", "label":"Go" } ] } }, "/api/v1/blobs/{user_id}/{blob_id}":{ "get":{ "tags":[ "blob" ], "summary":"Get Blob", "operationId":"get_blob_api_v1_blobs__user_id___blob_id__get", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user", "title":"User Id" }, "description":"The ID of the user" }, { "name":"blob_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the blob to retrieve", "title":"Blob Id" }, "description":"The ID of the blob to retrieve" } ], "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/BlobDataResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nu = client.get_user(uid)\nb = u.get(bid)\n\n", "label":"Python" }, { "lang":"javascript", "source":"// To use the JavaScript SDK, install the package:\n// npm install @memobase/memobase\n\nimport { MemoBaseClient } from '@memobase/memobase';\n\nconst client = new MemoBaseClient(process.env.MEMOBASE_PROJECT_URL, process.env.MEMOBASE_API_KEY);\nconst user = await client.getUser(userId);\n\nconst blob = await user.get(blobId);\n\n", "label":"JavaScript" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/blob\"\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get a user\n userID := \"EXISTING_USER_ID\" // Replace with an actual user ID\n user, err := client.GetUser(userID, false)\n if err != nil {\n log.Fatalf(\"Failed to get user: %v\", err)\n }\n\n // Get a blob\n blobID := \"EXISTING_BLOB_ID\" // Replace with an actual blob ID\n retrievedBlob, err := user.Get(blobID)\n if err != nil {\n log.Fatalf(\"Failed to get blob: %v\", err)\n }\n\n // Type assert to use as ChatBlob\n if chatBlob, ok := retrievedBlob.(*blob.ChatBlob); ok {\n fmt.Printf(\"Retrieved message: %s\n\", chatBlob.Messages[0].Content)\n }\n}\n\n", "label":"Go" } ] }, "delete":{ "tags":[ "blob" ], "summary":"Delete Blob", "operationId":"delete_blob_api_v1_blobs__user_id___blob_id__delete", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user", "title":"User Id" }, "description":"The ID of the user" }, { "name":"blob_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the blob to delete", "title":"Blob Id" }, "description":"The ID of the blob to delete" } ], "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/BaseResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nu = client.get_user(uid)\nu.delete(bid)\n\n", "label":"Python" }, { "lang":"javascript", "source":"// To use the JavaScript SDK, install the package:\n// npm install @memobase/memobase\n\nimport { MemoBaseClient } from '@memobase/memobase';\n\nconst client = new MemoBaseClient(process.env.MEMOBASE_PROJECT_URL, process.env.MEMOBASE_API_KEY);\nconst user = await client.getUser(userId);\n\nawait user.delete(blobId);\n\n", "label":"JavaScript" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get a user\n userID := \"EXISTING_USER_ID\" // Replace with an actual user ID\n user, err := client.GetUser(userID, false)\n if err != nil {\n log.Fatalf(\"Failed to get user: %v\", err)\n }\n\n // Delete a blob\n blobID := \"EXISTING_BLOB_ID\" // Replace with an actual blob ID\n err = user.Delete(blobID)\n if err != nil {\n log.Fatalf(\"Failed to delete blob: %v\", err)\n }\n fmt.Printf(\"Successfully deleted blob with ID: %s\n\", blobID)\n}\n\n", "label":"Go" } ] } }, "/api/v1/users/profile/{user_id}":{ "get":{ "tags":[ "profile" ], "summary":"Get User Profile", "description":"Get the real-time user profiles for long term memory", "operationId":"get_user_profile_api_v1_users_profile__user_id__get", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user to get profiles for", "title":"User Id" }, "description":"The ID of the user to get profiles for" }, { "name":"topk", "in":"query", "required":false, "schema":{ "type":"integer", "description":"Number of profiles to retrieve, default is all", "title":"Topk" }, "description":"Number of profiles to retrieve, default is all" }, { "name":"max_token_size", "in":"query", "required":false, "schema":{ "type":"integer", "description":"Max token size of returned profile content, default is all", "title":"Max Token Size" }, "description":"Max token size of returned profile content, default is all" }, { "name":"prefer_topics", "in":"query", "required":false, "schema":{ "type":"array", "items":{ "type":"string" }, "description":"Rank prefer topics at first to try to keep them in filtering, default order is by updated time", "title":"Prefer Topics" }, "description":"Rank prefer topics at first to try to keep them in filtering, default order is by updated time" }, { "name":"only_topics", "in":"query", "required":false, "schema":{ "type":"array", "items":{ "type":"string" }, "description":"Only return profiles with these topics, default is all", "title":"Only Topics" }, "description":"Only return profiles with these topics, default is all" }, { "name":"max_subtopic_size", "in":"query", "required":false, "schema":{ "type":"integer", "description":"Max subtopic size of the same topic in returned profile, default is all", "title":"Max Subtopic Size" }, "description":"Max subtopic size of the same topic in returned profile, default is all" }, { "name":"topic_limits_json", "in":"query", "required":false, "schema":{ "type":"string", "description":"Set specific subtopic limits for topics in JSON, for example {\"topic1\": 3, \"topic2\": 5}. The limits in this param will override `max_subtopic_size`.", "title":"Topic Limits Json" }, "description":"Set specific subtopic limits for topics in JSON, for example {\"topic1\": 3, \"topic2\": 5}. The limits in this param will override `max_subtopic_size`." }, { "name":"chats_str", "in":"query", "required":false, "schema":{ "type":"string", "description":"List of chats in OpenAI Message format, for example: [{\"role\": \"user\", \"content\": \"Hello\"}, {\"role\": \"assistant\", \"content\": \"Hi\"}]", "title":"Chats Str" }, "description":"List of chats in OpenAI Message format, for example: [{\"role\": \"user\", \"content\": \"Hello\"}, {\"role\": \"assistant\", \"content\": \"Hi\"}]" } ], "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/UserProfileResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nu = client.get_user(uid)\np = u.profile()\n\n", "label":"Python" }, { "lang":"javascript", "source":"// To use the JavaScript SDK, install the package:\n// npm install @memobase/memobase\n\nimport { MemoBaseClient } from '@memobase/memobase';\n\nconst client = new MemoBaseClient(process.env.MEMOBASE_PROJECT_URL, process.env.MEMOBASE_API_KEY);\nconst user = await client.getUser(userId);\n\nconst profiles = await user.profile();\n\n", "label":"JavaScript" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get a user\n userID := \"EXISTING_USER_ID\" // Replace with an actual user ID\n user, err := client.GetUser(userID, false)\n if err != nil {\n log.Fatalf(\"Failed to get user: %v\", err)\n }\n\n // Get user profile\n profiles, err := user.Profile(nil)\n if err != nil {\n log.Fatalf(\"Failed to get user profile: %v\", err)\n }\n\n // Print profiles\n fmt.Println(\"\nUser Profiles:\")\n for _, profile := range profiles {\n fmt.Printf(\"ID: %s\nTopic: %s\nSub-topic: %s\nContent: %s\n\n\",\n profile.ID,\n profile.Attributes.Topic,\n profile.Attributes.SubTopic,\n profile.Content,\n )\n }\n}\n\n", "label":"Go" } ] }, "post":{ "tags":[ "profile" ], "summary":"Add User Profile", "description":"Add the real-time user profiles for long term memory", "operationId":"add_user_profile_api_v1_users_profile__user_id__post", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user", "title":"User Id" }, "description":"The ID of the user" } ], "requestBody":{ "required":true, "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/ProfileDelta", "description":"The content of the profile to add" } } } }, "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/IdResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nuser = client.get_user('user_id')\nuser.add_profile(content=\"I am a software engineer\", topic=\"career\", sub_topic=\"job\")\n\n", "label":"Python" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get a user\n userID := \"EXISTING_USER_ID\" // Replace with an actual user ID\n user, err := client.GetUser(userID, false)\n if err != nil {\n log.Fatalf(\"Failed to get user: %v\", err)\n }\n\n // Add a profile\n profileID, err := user.AddProfile(\"value\", \"topic\", \"sub_topic\")\n if err != nil {\n log.Fatalf(\"Failed to add profile: %v\", err)\n }\n fmt.Printf(\"Successfully added profile with ID: %s\n\", profileID)\n}\n\n", "label":"Go" } ] } }, "/api/v1/users/profile/import/{user_id}":{ "post":{ "tags":[ "profile" ], "summary":"Import User Context", "operationId":"import_user_context_api_v1_users_profile_import__user_id__post", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user", "title":"User Id" }, "description":"The ID of the user" } ], "requestBody":{ "required":true, "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/UserContextImport", "description":"The content of the user context to import" } } } }, "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/BaseResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/users/profile/{user_id}/{profile_id}":{ "put":{ "tags":[ "profile" ], "summary":"Update User Profile", "description":"Update the real-time user profiles for long term memory", "operationId":"update_user_profile_api_v1_users_profile__user_id___profile_id__put", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user", "title":"User Id" }, "description":"The ID of the user" }, { "name":"profile_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the profile to update", "title":"Profile Id" }, "description":"The ID of the profile to update" } ], "requestBody":{ "required":true, "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/ProfileDelta", "description":"The content of the profile to update" } } } }, "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/BaseResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nuser = client.get_user('user_id')\nuser.update_profile(profile_id=\"profile_id\", content=\"I am a software engineer\", topic=\"career\", sub_topic=\"job\")\n\n", "label":"Python" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get a user\n userID := \"EXISTING_USER_ID\" // Replace with an actual user ID\n user, err := client.GetUser(userID, false)\n if err != nil {\n log.Fatalf(\"Failed to get user: %v\", err)\n }\n\n // Update a profile\n profileID := \"EXISTING_PROFILE_ID\" // Replace with an actual profile ID\n err = user.UpdateProfile(profileID, \"value2\", \"topic2\", \"sub_topic2\")\n if err != nil {\n log.Fatalf(\"Failed to update profile: %v\", err)\n }\n fmt.Printf(\"Successfully updated profile with ID: %s\n\", profileID)\n}\n\n", "label":"Go" } ] }, "delete":{ "tags":[ "profile" ], "summary":"Delete User Profile", "description":"Delete a profile", "operationId":"delete_user_profile_api_v1_users_profile__user_id___profile_id__delete", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user", "title":"User Id" }, "description":"The ID of the user" }, { "name":"profile_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the profile to delete", "title":"Profile Id" }, "description":"The ID of the profile to delete" } ], "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/BaseResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nuser = client.get_user('user_id')\nuser.delete_profile('profile_id')\n\n", "label":"Python" }, { "lang":"javascript", "source":"// To use the JavaScript SDK, install the package:\n// npm install @memobase/memobase\n\nimport { MemoBaseClient } from '@memobase/memobase';\n\nconst client = new MemoBaseClient(process.env.MEMOBASE_PROJECT_URL, process.env.MEMOBASE_API_KEY);\n\nawait client.deleteProfile('user_id', 'profile_id');\n\n", "label":"JavaScript" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get a user\n userID := \"EXISTING_USER_ID\" // Replace with an actual user ID\n user, err := client.GetUser(userID, false)\n if err != nil {\n log.Fatalf(\"Failed to get user: %v\", err)\n }\n\n // Delete a profile\n profileID := \"EXISTING_PROFILE_ID\" // Replace with an actual profile ID\n err = user.DeleteProfile(profileID)\n if err != nil {\n log.Fatalf(\"Failed to delete profile: %v\", err)\n }\n fmt.Printf(\"Successfully deleted profile with ID: %s\n\", profileID)\n}\n\n", "label":"Go" } ] } }, "/api/v1/users/buffer/{user_id}/{buffer_type}":{ "post":{ "tags":[ "buffer" ], "summary":"Flush Buffer", "description":"Flush unprocessed blobs into Memory", "operationId":"flush_buffer_api_v1_users_buffer__user_id___buffer_type__post", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user", "title":"User Id" }, "description":"The ID of the user" }, { "name":"buffer_type", "in":"path", "required":true, "schema":{ "$ref":"#/components/schemas/BlobType", "description":"The type of buffer to flush" }, "description":"The type of buffer to flush" }, { "name":"wait_process", "in":"query", "required":false, "schema":{ "type":"boolean", "description":"Whether to wait for the buffer to be processed", "default":false, "title":"Wait Process" }, "description":"Whether to wait for the buffer to be processed" } ], "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/ChatModalAPIResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nu = client.get_user(uid)\nu.flush()\nu.flush(sync=True) # wait for the buffer to be processed\n\n", "label":"Python" }, { "lang":"javascript", "source":"// To use the JavaScript SDK, install the package:\n// npm install @memobase/memobase\n\nimport { MemoBaseClient, BlobType } from '@memobase/memobase';\n\nconst client = new MemoBaseClient(process.env.MEMOBASE_PROJECT_URL, process.env.MEMOBASE_API_KEY);\nconst user = await client.getUser(userId);\n\nawait user.flush(BlobType.Enum.chat);\n\n", "label":"JavaScript" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/blob\"\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get a user\n userID := \"EXISTING_USER_ID\" // Replace with an actual user ID\n user, err := client.GetUser(userID, false)\n if err != nil {\n log.Fatalf(\"Failed to get user: %v\", err)\n }\n\n // Flush the buffer\n err = user.Flush(blob.ChatType, false)\n if err != nil {\n log.Fatalf(\"Failed to flush buffer: %v\", err)\n }\n fmt.Println(\"Successfully flushed buffer\")\n}\n\n", "label":"Go" } ] } }, "/api/v1/users/buffer/capacity/{user_id}/{buffer_type}":{ "get":{ "tags":[ "buffer" ], "summary":"Get Processing Buffer Ids", "description":"Get processing buffer ids", "operationId":"get_processing_buffer_ids_api_v1_users_buffer_capacity__user_id___buffer_type__get", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user", "title":"User Id" }, "description":"The ID of the user" }, { "name":"buffer_type", "in":"path", "required":true, "schema":{ "$ref":"#/components/schemas/BlobType", "description":"The type of buffer to flush" }, "description":"The type of buffer to flush" }, { "name":"status", "in":"query", "required":false, "schema":{ "enum":[ "idle", "processing", "failed", "done" ], "type":"string", "description":"The status of the buffer to get", "default":"processing", "title":"Status" }, "description":"The status of the buffer to get" } ], "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/IdsResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\nfrom memobase.core.blob import BlobType\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\nuser = client.get_user('user_id')\nblobs = user.buffer(BlobType.chat)\n\n", "label":"Python" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/blob\"\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get a user\n userID := \"EXISTING_USER_ID\" // Replace with an actual user ID\n user, err := client.GetUser(userID, false)\n if err != nil {\n log.Fatalf(\"Failed to get user: %v\", err)\n }\n\n // Get buffer capacity\n blobIDs, err := user.Buffer(blob.ChatType, \"processing\")\n if err != nil {\n log.Fatalf(\"Failed to get buffer capacity: %v\", err)\n }\n fmt.Printf(\"Found %d blobs in buffer\n\", len(blobIDs))\n}\n\n", "label":"Go" } ] } }, "/api/v1/users/event/{user_id}":{ "get":{ "tags":[ "event" ], "summary":"Get User Events", "operationId":"get_user_events_api_v1_users_event__user_id__get", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user", "title":"User Id" }, "description":"The ID of the user" }, { "name":"topk", "in":"query", "required":false, "schema":{ "type":"integer", "description":"Number of events to retrieve, default is 10", "default":10, "title":"Topk" }, "description":"Number of events to retrieve, default is 10" }, { "name":"max_token_size", "in":"query", "required":false, "schema":{ "type":"integer", "description":"Max token size of returned events", "title":"Max Token Size" }, "description":"Max token size of returned events" }, { "name":"need_summary", "in":"query", "required":false, "schema":{ "type":"boolean", "description":"Whether to return events with summaries", "default":false, "title":"Need Summary" }, "description":"Whether to return events with summaries" } ], "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/UserEventsDataResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\nu = client.get_user(uid)\n\nevents = u.event(topk=10, max_token_size=1000, need_summary=True)\n\n", "label":"Python" }, { "lang":"javascript", "source":"// To use the JavaScript SDK, install the package:\n// npm install @memobase/memobase\n\nimport { MemoBaseClient } from '@memobase/memobase';\n\nconst client = new MemoBaseClient(process.env.MEMOBASE_PROJECT_URL, process.env.MEMOBASE_API_KEY);\nconst user = await client.getUser(userId);\n\nconst events = await user.event();\n\n", "label":"JavaScript" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get a user\n userID := \"EXISTING_USER_ID\" // Replace with an actual user ID\n user, err := client.GetUser(userID, false)\n if err != nil {\n log.Fatalf(\"Failed to get user: %v\", err)\n }\n\n // Get user events\n events, err := user.Event(10, nil, false)\n if err != nil {\n log.Fatalf(\"Failed to get events: %v\", err)\n }\n\n fmt.Printf(\"Found %d events\n\", len(events))\n}\n\n", "label":"Go" } ] } }, "/api/v1/users/event/{user_id}/{event_id}":{ "put":{ "tags":[ "event" ], "summary":"Update User Event", "operationId":"update_user_event_api_v1_users_event__user_id___event_id__put", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user", "title":"User Id" }, "description":"The ID of the user" }, { "name":"event_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the event", "title":"Event Id" }, "description":"The ID of the event" } ], "requestBody":{ "required":true, "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/EventData", "description":"Event data to update" } } } }, "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/BaseResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\nuid = client.add_user()\nu = client.get_user(uid)\n# ... insert messages to user\n\nevents = u.event(topk=5)\neid = events[0].id\n\nu.update_event(eid, {\"event_tip\": \"The event is about...\"})\nprint(u.event(topk=1))\n\n", "label":"Python" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get a user\n userID := \"EXISTING_USER_ID\" // Replace with an actual user ID\n user, err := client.GetUser(userID, false)\n if err != nil {\n log.Fatalf(\"Failed to get user: %v\", err)\n }\n\n // Update an event\n eventID := \"EXISTING_EVENT_ID\" // Replace with an actual event ID\n eventData := map[string]interface{}{\"event_tip\": \"The event is about...\"}\n err = user.UpdateEvent(eventID, eventData)\n if err != nil {\n log.Fatalf(\"Failed to update event: %v\", err)\n }\n fmt.Printf(\"Successfully updated event with ID: %s\n\", eventID)\n}\n\n", "label":"Go" } ] }, "delete":{ "tags":[ "event" ], "summary":"Delete User Event", "operationId":"delete_user_event_api_v1_users_event__user_id___event_id__delete", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user", "title":"User Id" }, "description":"The ID of the user" }, { "name":"event_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the event", "title":"Event Id" }, "description":"The ID of the event" } ], "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/BaseResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\nuid = client.add_user()\nu = client.get_user(uid)\n# ... insert messages to user\n\nevents = u.event(topk=1)\nprint(events)\n\neid = events[0].id\nu.delete_event(eid)\n\nprint(u.event(topk=1))\n\n", "label":"Python" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get a user\n userID := \"EXISTING_USER_ID\" // Replace with an actual user ID\n user, err := client.GetUser(userID, false)\n if err != nil {\n log.Fatalf(\"Failed to get user: %v\", err)\n }\n\n // Delete an event\n eventID := \"EXISTING_EVENT_ID\" // Replace with an actual event ID\n err = user.DeleteEvent(eventID)\n if err != nil {\n log.Fatalf(\"Failed to delete event: %v\", err)\n }\n fmt.Printf(\"Successfully deleted event with ID: %s\n\", eventID)\n}\n\n", "label":"Go" } ] } }, "/api/v1/users/event/search/{user_id}":{ "get":{ "tags":[ "event" ], "summary":"Search User Events", "operationId":"search_user_events_api_v1_users_event_search__user_id__get", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user", "title":"User Id" }, "description":"The ID of the user" }, { "name":"query", "in":"query", "required":true, "schema":{ "type":"string", "description":"The query to search for", "title":"Query" }, "description":"The query to search for" }, { "name":"topk", "in":"query", "required":false, "schema":{ "type":"integer", "description":"Number of events to retrieve, default is 10", "default":10, "title":"Topk" }, "description":"Number of events to retrieve, default is 10" }, { "name":"similarity_threshold", "in":"query", "required":false, "schema":{ "type":"number", "description":"Similarity threshold, default is 0.2", "default":0.2, "title":"Similarity Threshold" }, "description":"Similarity threshold, default is 0.2" }, { "name":"time_range_in_days", "in":"query", "required":false, "schema":{ "type":"integer", "description":"Only allow events within the past few days, default is 180", "default":180, "title":"Time Range In Days" }, "description":"Only allow events within the past few days, default is 180" } ], "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/UserEventsDataResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\nfrom memobase.core.blob import ChatBlob\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\nuid = client.add_user()\nu = client.get_user(uid)\n\nb = ChatBlob(messages=[\n {\n \"role\": \"user\",\n \"content\": \"Hi, I'm here again\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Hi, Gus! How can I help you?\"\n }\n])\nu.insert(b)\nu.flush(sync=True)\n\nevents = u.search_event('query')\nprint(events)\n\n", "label":"Python" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get a user\n userID := \"EXISTING_USER_ID\" // Replace with an actual user ID\n user, err := client.GetUser(userID, false)\n if err != nil {\n log.Fatalf(\"Failed to get user: %v\", err)\n }\n\n // Search for events\n events, err := user.SearchEvent(\"query\", 10, 0.7, 7)\n if err != nil {\n log.Fatalf(\"Failed to search events: %v\", err)\n }\n\n fmt.Printf(\"Found %d events\n\", len(events))\n}\n\n", "label":"Go" } ] } }, "/api/v1/users/event_gist/search/{user_id}":{ "get":{ "tags":[ "event_gist" ], "summary":"Search User Event Gists", "operationId":"search_user_event_gists_api_v1_users_event_gist_search__user_id__get", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user", "title":"User Id" }, "description":"The ID of the user" }, { "name":"query", "in":"query", "required":true, "schema":{ "type":"string", "description":"The query to search for", "title":"Query" }, "description":"The query to search for" }, { "name":"topk", "in":"query", "required":false, "schema":{ "type":"integer", "description":"Number of events to retrieve, default is 10", "default":10, "title":"Topk" }, "description":"Number of events to retrieve, default is 10" }, { "name":"similarity_threshold", "in":"query", "required":false, "schema":{ "type":"number", "description":"Similarity threshold, default is 0.2", "default":0.2, "title":"Similarity Threshold" }, "description":"Similarity threshold, default is 0.2" }, { "name":"time_range_in_days", "in":"query", "required":false, "schema":{ "type":"integer", "description":"Only allow events within the past few days, default is 180", "default":180, "title":"Time Range In Days" }, "description":"Only allow events within the past few days, default is 180" } ], "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/UserEventGistsDataResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\nfrom memobase import MemoBaseClient\nfrom memobase.core.blob import ChatBlob\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\nuid = client.add_user()\nu = client.get_user(uid)\n\nb = ChatBlob(messages=[\n {\n \"role\": \"user\",\n \"content\": \"Hi, I'm here again\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Hi, Gus! How can I help you?\"\n }\n])\nu.insert(b)\nu.flush(sync=True)\n\nevents = u.search_event_gist('query')\nprint(events)\n", "label":"Python" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n \"github.com/memodb-io/memobase/src/client/memobase-go/blob\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get a user\n userID := \"EXISTING_USER_ID\" // Replace with an actual user ID\n user, err := client.GetUser(userID, false)\n if err != nil {\n log.Fatalf(\"Failed to get user: %v\", err)\n }\n\n // Insert chat to generate event\n chat := &blob.ChatBlob{\n BaseBlob: blob.BaseBlob{Type: blob.ChatType},\n Messages: []blob.OpenAICompatibleMessage{\n {Role: \"user\", Content: \"Hi, I'm here again\"},\n {Role: \"assistant\", Content: \"Hi, Gus! How can I help you?\"},\n },\n }\n _, err = user.Insert(chat, false)\n if err != nil {\n log.Fatalf(\"Failed to insert chat: %v\", err)\n }\n\n // Flush to process the chat\n err = user.Flush(blob.ChatType, true)\n if err != nil {\n log.Fatalf(\"Failed to flush: %v\", err)\n }\n\n // Search for event gists\n gistEvents, err := user.SearchEventGist(\"query\")\n if err != nil {\n log.Fatalf(\"Failed to search event gists: %v\", err)\n }\n\n fmt.Printf(\"Found %d event gists\\n\", len(gistEvents))\n for _, event := range gistEvents {\n fmt.Printf(\"Event ID: %s, Content: %s, Similarity: %.2f\\n\", \n event.ID, event.GistData.Content, event.Similarity)\n }\n}\n\n", "label":"Go" } ] } }, "/api/v1/users/context/{user_id}":{ "get":{ "tags":[ "context" ], "summary":"Get User Context", "operationId":"get_user_context_api_v1_users_context__user_id__get", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user", "title":"User Id" }, "description":"The ID of the user" }, { "name":"max_token_size", "in":"query", "required":false, "schema":{ "type":"integer", "description":"Max token size of returned Context", "default":1000, "title":"Max Token Size" }, "description":"Max token size of returned Context" }, { "name":"prefer_topics", "in":"query", "required":false, "schema":{ "type":"array", "items":{ "type":"string" }, "description":"Rank prefer topics at first to try to keep them in filtering, default order is by updated time", "title":"Prefer Topics" }, "description":"Rank prefer topics at first to try to keep them in filtering, default order is by updated time" }, { "name":"only_topics", "in":"query", "required":false, "schema":{ "type":"array", "items":{ "type":"string" }, "description":"Only return profiles with these topics, default is all", "title":"Only Topics" }, "description":"Only return profiles with these topics, default is all" }, { "name":"max_subtopic_size", "in":"query", "required":false, "schema":{ "type":"integer", "description":"Max subtopic size of the same topic in returned Context", "title":"Max Subtopic Size" }, "description":"Max subtopic size of the same topic in returned Context" }, { "name":"topic_limits_json", "in":"query", "required":false, "schema":{ "type":"string", "description":"Set specific subtopic limits for topics in JSON, for example {\"topic1\": 3, \"topic2\": 5}. The limits in this param will override `max_subtopic_size`.", "title":"Topic Limits Json" }, "description":"Set specific subtopic limits for topics in JSON, for example {\"topic1\": 3, \"topic2\": 5}. The limits in this param will override `max_subtopic_size`." }, { "name":"profile_event_ratio", "in":"query", "required":false, "schema":{ "type":"number", "description":"Profile event ratio of returned Context", "default":0.6, "title":"Profile Event Ratio" }, "description":"Profile event ratio of returned Context" }, { "name":"require_event_summary", "in":"query", "required":false, "schema":{ "type":"boolean", "description":"Whether to require event summary in returned Context", "default":false, "title":"Require Event Summary" }, "description":"Whether to require event summary in returned Context" }, { "name":"chats_str", "in":"query", "required":false, "schema":{ "type":"string", "description":"Pass the recent chats to enable context search. \nMemobase will use those chats to search for relevant events.\nIt's a list of chats in OpenAI Message format, for example: [{\"role\": \"user\", \"content\": \"Hello\"}, {\"role\": \"assistant\", \"content\": \"Hi\"}].\n\n**NOTICE**\n- It will increase your latency by 0.1-1 seconds, because Memobase will use Embedding to search for relevant profiles and events.\n- It will cost your Memobase tokens, roughly 100~200 tokens per chat based on the profile size.\n- The profiles in the context will not be searched by the `chats_str`.\n- If you want also search profiles, see `full_profile_and_only_search_event` query parameter.\n", "title":"Chats Str" }, "description":"Pass the recent chats to enable context search. \nMemobase will use those chats to search for relevant events.\nIt's a list of chats in OpenAI Message format, for example: [{\"role\": \"user\", \"content\": \"Hello\"}, {\"role\": \"assistant\", \"content\": \"Hi\"}].\n\n**NOTICE**\n- It will increase your latency by 0.1-1 seconds, because Memobase will use Embedding to search for relevant profiles and events.\n- It will cost your Memobase tokens, roughly 100~200 tokens per chat based on the profile size.\n- The profiles in the context will not be searched by the `chats_str`.\n- If you want also search profiles, see `full_profile_and_only_search_event` query parameter.\n" }, { "name":"event_similarity_threshold", "in":"query", "required":false, "schema":{ "type":"number", "description":"Event similarity threshold of returned Context", "default":0.2, "title":"Event Similarity Threshold" }, "description":"Event similarity threshold of returned Context" }, { "name":"time_range_in_days", "in":"query", "required":false, "schema":{ "type":"integer", "description":"Only allow events within the past few days, default is 180", "default":180, "title":"Time Range In Days" }, "description":"Only allow events within the past few days, default is 180" }, { "name":"customize_context_prompt", "in":"query", "required":false, "schema":{ "type":"string", "description":"Customize context prompt template.\n- use `{profile_section}` to refer to the profile section\n- use `{event_section}` to refer to the event section\n\nFor example:\n```\n# Memory\nUnless the user has relevant queries, do not actively mention those memories in the conversation.\n## User Background:\n{profile_section}\n\n## Latest Events:\n{event_section}\n```\n", "title":"Customize Context Prompt" }, "description":"Customize context prompt template.\n- use `{profile_section}` to refer to the profile section\n- use `{event_section}` to refer to the event section\n\nFor example:\n```\n# Memory\nUnless the user has relevant queries, do not actively mention those memories in the conversation.\n## User Background:\n{profile_section}\n\n## Latest Events:\n{event_section}\n```\n" }, { "name":"full_profile_and_only_search_event", "in":"query", "required":false, "schema":{ "type":"boolean", "description":"If you pass `chats_str` and set this to `False`, Memobase will search for relevant profiles and events at the same time.\n**NOTICE**\n- It will increase your latency by 2-5(based on the profile size) seconds, because Memobase will use LLM and Embedding to search for relevant profiles and events.\n- It will cost your Memobase tokens, roughly 100~1000 tokens per chat based on the profile size.\n", "default":true, "title":"Full Profile And Only Search Event" }, "description":"If you pass `chats_str` and set this to `False`, Memobase will search for relevant profiles and events at the same time.\n**NOTICE**\n- It will increase your latency by 2-5(based on the profile size) seconds, because Memobase will use LLM and Embedding to search for relevant profiles and events.\n- It will cost your Memobase tokens, roughly 100~1000 tokens per chat based on the profile size.\n" }, { "name":"fill_window_with_events", "in":"query", "required":false, "schema":{ "type":"boolean", "description":"If set to `True`, Memobase will fill the token window with the rest events.", "default":false, "title":"Fill Window With Events" }, "description":"If set to `True`, Memobase will fill the token window with the rest events." } ], "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/UserContextDataResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } }, "x-code-samples":[ { "lang":"python", "source":"# To use the Python SDK, install the package:\n# pip install memobase\n\nfrom memobase import MemoBaseClient\n\nclient = MemoBaseClient(project_url='PROJECT_URL', api_key='PROJECT_TOKEN')\n\ncontext = u.context()\n\n", "label":"Python" }, { "lang":"javascript", "source":"// To use the JavaScript SDK, install the package:\n// npm install @memobase/memobase\n\nimport { MemoBaseClient } from '@memobase/memobase';\n\nconst client = new MemoBaseClient(process.env.MEMOBASE_PROJECT_URL, process.env.MEMOBASE_API_KEY);\nconst user = await client.getUser(userId);\n\nconst context = await user.context();\n\n", "label":"JavaScript" }, { "lang":"go", "source":"// To use the Go SDK, install the package:\n// go get github.com/memodb-io/memobase/src/client/memobase-go@latest\n\nimport (\n \"fmt\"\n \"log\"\n\n \"github.com/memodb-io/memobase/src/client/memobase-go/core\"\n)\n\nfunc main() {\n projectURL := \"YOUR_PROJECT_URL\"\n apiKey := \"YOUR_API_KEY\"\n // Initialize the client\n client, err := core.NewMemoBaseClient(\n projectURL,\n apiKey,\n )\n if err != nil {\n log.Fatalf(\"Failed to create client: %v\", err)\n }\n\n // Get user context\n userID := \"EXISTING_USER_ID\" // Replace with an actual user ID\n user, err := client.GetUser(userID, false)\n if err != nil {\n log.Fatalf(\"Failed to get user: %v\", err)\n }\n\n context, err := user.Context(nil)\n if err != nil {\n log.Fatalf(\"Failed to get context: %v\", err)\n }\n fmt.Printf(\"User context: %s\n\", context)\n}\n\n", "label":"Go" } ] } }, "/api/v1/users/roleplay/proactive/{user_id}":{ "post":{ "tags":[ "roleplay" ], "summary":"Infer Proactive Topics", "description":"Provide interest detection and personalized topics", "operationId":"infer_proactive_topics_api_v1_users_roleplay_proactive__user_id__post", "parameters":[ { "name":"user_id", "in":"path", "required":true, "schema":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "description":"The ID of the user", "title":"User Id" }, "description":"The ID of the user" }, { "name":"topk", "in":"query", "required":false, "schema":{ "type":"integer", "description":"Number of profiles to retrieve, default is all", "title":"Topk" }, "description":"Number of profiles to retrieve, default is all" }, { "name":"max_token_size", "in":"query", "required":false, "schema":{ "type":"integer", "description":"Max token size of returned profile content, default is all", "title":"Max Token Size" }, "description":"Max token size of returned profile content, default is all" }, { "name":"prefer_topics", "in":"query", "required":false, "schema":{ "type":"array", "items":{ "type":"string" }, "description":"Rank prefer topics at first to try to keep them in filtering, default order is by updated time", "title":"Prefer Topics" }, "description":"Rank prefer topics at first to try to keep them in filtering, default order is by updated time" }, { "name":"only_topics", "in":"query", "required":false, "schema":{ "type":"array", "items":{ "type":"string" }, "description":"Only return profiles with these topics, default is all", "title":"Only Topics" }, "description":"Only return profiles with these topics, default is all" }, { "name":"max_subtopic_size", "in":"query", "required":false, "schema":{ "type":"integer", "description":"Max subtopic size of the same topic in returned profile, default is all", "title":"Max Subtopic Size" }, "description":"Max subtopic size of the same topic in returned profile, default is all" }, { "name":"topic_limits_json", "in":"query", "required":false, "schema":{ "type":"string", "description":"Set specific subtopic limits for topics in JSON, for example {\"topic1\": 3, \"topic2\": 5}. The limits in this param will override `max_subtopic_size`.", "title":"Topic Limits Json" }, "description":"Set specific subtopic limits for topics in JSON, for example {\"topic1\": 3, \"topic2\": 5}. The limits in this param will override `max_subtopic_size`." } ], "requestBody":{ "required":true, "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/ProactiveTopicRequest", "description":"The body of the request" } } } }, "responses":{ "200":{ "description":"Successful Response", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/ProactiveTopicResponse" } } } }, "422":{ "description":"Validation Error", "content":{ "application/json":{ "schema":{ "$ref":"#/components/schemas/HTTPValidationError" } } } } } } } }, "components":{ "schemas":{ "BaseResponse":{ "properties":{ "data":{ "anyOf":[ { "additionalProperties":true, "type":"object" }, { "type":"null" } ], "title":"Data", "description":"Response data payload" }, "errno":{ "$ref":"#/components/schemas/CODE", "description":"Error code, 0 means success", "default":0 }, "errmsg":{ "type":"string", "title":"Errmsg", "description":"Error message, empty when success", "default":"" } }, "type":"object", "title":"BaseResponse" }, "BillingData":{ "properties":{ "token_left":{ "anyOf":[ { "type":"integer" }, { "type":"null" } ], "title":"Token Left", "description":"Total token left" }, "next_refill_at":{ "anyOf":[ { "type":"string", "format":"date-time" }, { "type":"null" } ], "title":"Next Refill At", "description":"Next refill time" }, "project_token_cost_month":{ "type":"integer", "title":"Project Token Cost Month", "description":"Token cost of this project for this month" } }, "type":"object", "required":[ "project_token_cost_month" ], "title":"BillingData" }, "BillingResponse":{ "properties":{ "data":{ "anyOf":[ { "$ref":"#/components/schemas/BillingData" }, { "type":"null" } ], "description":"Response containing token left" }, "errno":{ "$ref":"#/components/schemas/CODE", "description":"Error code, 0 means success", "default":0 }, "errmsg":{ "type":"string", "title":"Errmsg", "description":"Error message, empty when success", "default":"" } }, "type":"object", "title":"BillingResponse" }, "BlobData":{ "properties":{ "blob_type":{ "$ref":"#/components/schemas/BlobType" }, "blob_data":{ "additionalProperties":true, "type":"object", "title":"Blob Data" }, "fields":{ "anyOf":[ { "additionalProperties":true, "type":"object" }, { "type":"null" } ], "title":"Fields" }, "created_at":{ "anyOf":[ { "type":"string", "format":"date-time" }, { "type":"null" } ], "title":"Created At" }, "updated_at":{ "anyOf":[ { "type":"string", "format":"date-time" }, { "type":"null" } ], "title":"Updated At" } }, "type":"object", "required":[ "blob_type", "blob_data" ], "title":"BlobData" }, "BlobDataResponse":{ "properties":{ "data":{ "anyOf":[ { "$ref":"#/components/schemas/BlobData" }, { "type":"null" } ], "description":"Response containing blob data" }, "errno":{ "$ref":"#/components/schemas/CODE", "description":"Error code, 0 means success", "default":0 }, "errmsg":{ "type":"string", "title":"Errmsg", "description":"Error message, empty when success", "default":"" } }, "type":"object", "title":"BlobDataResponse" }, "BlobInsertData":{ "properties":{ "id":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "title":"Id", "description":"The UUID identifier" }, "chat_results":{ "anyOf":[ { "items":{ "$ref":"#/components/schemas/ChatModalResponse" }, "type":"array" }, { "type":"null" } ], "title":"Chat Results", "description":"List of chat modal data" } }, "type":"object", "required":[ "id" ], "title":"BlobInsertData" }, "BlobInsertResponse":{ "properties":{ "data":{ "anyOf":[ { "$ref":"#/components/schemas/BlobInsertData" }, { "type":"null" } ], "description":"Response containing blob insert data" }, "errno":{ "$ref":"#/components/schemas/CODE", "description":"Error code, 0 means success", "default":0 }, "errmsg":{ "type":"string", "title":"Errmsg", "description":"Error message, empty when success", "default":"" } }, "type":"object", "title":"BlobInsertResponse" }, "BlobType":{ "type":"string", "enum":[ "chat", "summary", "doc", "image", "code", "transcript" ], "title":"BlobType" }, "CODE":{ "type":"integer", "enum":[ 0, 400, 401, 403, 404, 405, 409, 422, 500, 501, 502, 503, 504, 520 ], "title":"CODE" }, "ChatModalAPIResponse":{ "properties":{ "data":{ "anyOf":[ { "items":{ "$ref":"#/components/schemas/ChatModalResponse" }, "type":"array" }, { "type":"null" } ], "title":"Data", "description":"Response containing chat modal data" }, "errno":{ "$ref":"#/components/schemas/CODE", "description":"Error code, 0 means success", "default":0 }, "errmsg":{ "type":"string", "title":"Errmsg", "description":"Error message, empty when success", "default":"" } }, "type":"object", "title":"ChatModalAPIResponse" }, "ChatModalResponse":{ "properties":{ "event_id":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" }, { "type":"null" } ], "title":"Event Id", "description":"The event's unique identifier" }, "add_profiles":{ "anyOf":[ { "items":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ] }, "type":"array" }, { "type":"null" } ], "title":"Add Profiles", "description":"List of added profiles' ids" }, "update_profiles":{ "anyOf":[ { "items":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ] }, "type":"array" }, { "type":"null" } ], "title":"Update Profiles", "description":"List of updated profiles' ids" }, "delete_profiles":{ "anyOf":[ { "items":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ] }, "type":"array" }, { "type":"null" } ], "title":"Delete Profiles", "description":"List of deleted profiles' ids" } }, "type":"object", "required":[ "event_id", "add_profiles", "update_profiles", "delete_profiles" ], "title":"ChatModalResponse" }, "ContextData":{ "properties":{ "context":{ "type":"string", "title":"Context", "description":"Context string" } }, "type":"object", "required":[ "context" ], "title":"ContextData" }, "DailyUsage":{ "properties":{ "date":{ "type":"string", "title":"Date", "description":"The date" }, "total_insert":{ "type":"integer", "title":"Total Insert", "description":"The total insert", "default":0 }, "total_success_insert":{ "type":"integer", "title":"Total Success Insert", "description":"The total update", "default":0 }, "total_input_token":{ "type":"integer", "title":"Total Input Token", "description":"The total input token", "default":0 }, "total_output_token":{ "type":"integer", "title":"Total Output Token", "description":"The total output token", "default":0 } }, "type":"object", "required":[ "date" ], "title":"DailyUsage" }, "EventData":{ "properties":{ "profile_delta":{ "anyOf":[ { "items":{ "$ref":"#/components/schemas/ProfileDelta" }, "type":"array" }, { "type":"null" } ], "title":"Profile Delta", "description":"List of profile data" }, "event_tip":{ "anyOf":[ { "type":"string" }, { "type":"null" } ], "title":"Event Tip", "description":"Event tip" }, "event_tags":{ "anyOf":[ { "items":{ "$ref":"#/components/schemas/EventTag" }, "type":"array" }, { "type":"null" } ], "title":"Event Tags", "description":"List of event tags" } }, "type":"object", "title":"EventData" }, "EventGistData":{ "properties":{ "content":{ "type":"string", "title":"Content", "description":"The event gist content" } }, "type":"object", "required":[ "content" ], "title":"EventGistData" }, "EventTag":{ "properties":{ "tag":{ "type":"string", "title":"Tag", "description":"The event tag" }, "value":{ "type":"string", "title":"Value", "description":"The event tag value" } }, "type":"object", "required":[ "tag", "value" ], "title":"EventTag" }, "HTTPValidationError":{ "properties":{ "detail":{ "items":{ "$ref":"#/components/schemas/ValidationError" }, "type":"array", "title":"Detail" } }, "type":"object", "title":"HTTPValidationError" }, "IdData":{ "properties":{ "id":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "title":"Id", "description":"The UUID identifier" } }, "type":"object", "required":[ "id" ], "title":"IdData" }, "IdResponse":{ "properties":{ "data":{ "anyOf":[ { "$ref":"#/components/schemas/IdData" }, { "type":"null" } ], "description":"Response containing a single ID" }, "errno":{ "$ref":"#/components/schemas/CODE", "description":"Error code, 0 means success", "default":0 }, "errmsg":{ "type":"string", "title":"Errmsg", "description":"Error message, empty when success", "default":"" } }, "type":"object", "title":"IdResponse" }, "IdsData":{ "properties":{ "ids":{ "items":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ] }, "type":"array", "title":"Ids", "description":"List of UUID identifiers" } }, "type":"object", "required":[ "ids" ], "title":"IdsData" }, "IdsResponse":{ "properties":{ "data":{ "anyOf":[ { "$ref":"#/components/schemas/IdsData" }, { "type":"null" } ], "description":"Response containing multiple IDs" }, "errno":{ "$ref":"#/components/schemas/CODE", "description":"Error code, 0 means success", "default":0 }, "errmsg":{ "type":"string", "title":"Errmsg", "description":"Error message, empty when success", "default":"" } }, "type":"object", "title":"IdsResponse" }, "OpenAICompatibleMessage":{ "properties":{ "role":{ "type":"string", "enum":[ "user", "assistant" ], "title":"Role" }, "content":{ "type":"string", "title":"Content" }, "alias":{ "anyOf":[ { "type":"string" }, { "type":"null" } ], "title":"Alias" }, "created_at":{ "anyOf":[ { "type":"string" }, { "type":"null" } ], "title":"Created At" } }, "type":"object", "required":[ "role", "content" ], "title":"OpenAICompatibleMessage" }, "ProactiveTopicData":{ "properties":{ "action":{ "type":"string", "enum":[ "new_topic", "continue" ], "title":"Action", "description":"The action to take" }, "topic_prompt":{ "anyOf":[ { "type":"string" }, { "type":"null" } ], "title":"Topic Prompt", "description":"The topic prompt, insert it to your latest user message or system prompt" } }, "type":"object", "required":[ "action" ], "title":"ProactiveTopicData" }, "ProactiveTopicRequest":{ "properties":{ "messages":{ "items":{ "$ref":"#/components/schemas/OpenAICompatibleMessage" }, "type":"array", "title":"Messages", "description":"The latest messages between user/assistant" }, "agent_context":{ "anyOf":[ { "type":"string" }, { "type":"null" } ], "title":"Agent Context", "description":"The agent's roleplay prompt" } }, "type":"object", "required":[ "messages" ], "title":"ProactiveTopicRequest" }, "ProactiveTopicResponse":{ "properties":{ "data":{ "anyOf":[ { "$ref":"#/components/schemas/ProactiveTopicData" }, { "type":"null" } ], "description":"Response containing proactive topic data" }, "errno":{ "$ref":"#/components/schemas/CODE", "description":"Error code, 0 means success", "default":0 }, "errmsg":{ "type":"string", "title":"Errmsg", "description":"Error message, empty when success", "default":"" } }, "type":"object", "title":"ProactiveTopicResponse" }, "ProfileConfigData":{ "properties":{ "profile_config":{ "anyOf":[ { "type":"string" }, { "type":"null" } ], "title":"Profile Config", "description":"Profile config string" } }, "type":"object", "required":[ "profile_config" ], "title":"ProfileConfigData" }, "ProfileConfigDataResponse":{ "properties":{ "data":{ "anyOf":[ { "$ref":"#/components/schemas/ProfileConfigData" }, { "type":"null" } ], "description":"Response containing profile config data" }, "errno":{ "$ref":"#/components/schemas/CODE", "description":"Error code, 0 means success", "default":0 }, "errmsg":{ "type":"string", "title":"Errmsg", "description":"Error message, empty when success", "default":"" } }, "type":"object", "title":"ProfileConfigDataResponse" }, "ProfileData":{ "properties":{ "id":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "title":"Id", "description":"The profile's unique identifier" }, "content":{ "type":"string", "title":"Content", "description":"User profile content value" }, "created_at":{ "type":"string", "format":"date-time", "title":"Created At", "description":"Timestamp when the profile was created" }, "updated_at":{ "type":"string", "format":"date-time", "title":"Updated At", "description":"Timestamp when the profile was last updated" }, "attributes":{ "anyOf":[ { "additionalProperties":true, "type":"object" }, { "type":"null" } ], "title":"Attributes", "description":"User profile attributes in JSON, containing 'topic', 'sub_topic'" } }, "type":"object", "required":[ "id", "content" ], "title":"ProfileData" }, "ProfileDelta":{ "properties":{ "content":{ "type":"string", "title":"Content", "description":"The profile content" }, "attributes":{ "anyOf":[ { "additionalProperties":true, "type":"object" }, { "type":"null" } ], "title":"Attributes", "description":"User profile attributes in JSON, containing 'topic', 'sub_topic'" } }, "type":"object", "required":[ "content", "attributes" ], "title":"ProfileDelta" }, "ProjectUsersData":{ "properties":{ "users":{ "items":{ }, "type":"array", "title":"Users", "description":"The user list" }, "count":{ "type":"integer", "title":"Count", "description":"The user count", "default":0 } }, "type":"object", "required":[ "users" ], "title":"ProjectUsersData" }, "ProjectUsersDataResponse":{ "properties":{ "data":{ "anyOf":[ { "$ref":"#/components/schemas/ProjectUsersData" }, { "type":"null" } ], "description":"Response containing the users" }, "errno":{ "$ref":"#/components/schemas/CODE", "description":"Error code, 0 means success", "default":0 }, "errmsg":{ "type":"string", "title":"Errmsg", "description":"Error message, empty when success", "default":"" } }, "type":"object", "title":"ProjectUsersDataResponse" }, "UsageResponse":{ "properties":{ "data":{ "anyOf":[ { "items":{ "$ref":"#/components/schemas/DailyUsage" }, "type":"array" }, { "type":"null" } ], "title":"Data", "description":"Response containing the daily usage" }, "errno":{ "$ref":"#/components/schemas/CODE", "description":"Error code, 0 means success", "default":0 }, "errmsg":{ "type":"string", "title":"Errmsg", "description":"Error message, empty when success", "default":"" } }, "type":"object", "title":"UsageResponse" }, "UserContextDataResponse":{ "properties":{ "data":{ "anyOf":[ { "$ref":"#/components/schemas/ContextData" }, { "type":"null" } ], "description":"Response containing user context" }, "errno":{ "$ref":"#/components/schemas/CODE", "description":"Error code, 0 means success", "default":0 }, "errmsg":{ "type":"string", "title":"Errmsg", "description":"Error message, empty when success", "default":"" } }, "type":"object", "title":"UserContextDataResponse" }, "UserContextImport":{ "properties":{ "context":{ "type":"string", "title":"Context", "description":"The user context you want to import to Memobase" } }, "type":"object", "required":[ "context" ], "title":"UserContextImport" }, "UserData":{ "properties":{ "data":{ "anyOf":[ { "additionalProperties":true, "type":"object" }, { "type":"null" } ], "title":"Data", "description":"User additional data in JSON" }, "id":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" }, { "type":"null" } ], "title":"Id", "description":"User ID in UUIDv4/5" }, "created_at":{ "anyOf":[ { "type":"string", "format":"date-time" }, { "type":"null" } ], "title":"Created At", "description":"Timestamp when the user was created" }, "updated_at":{ "anyOf":[ { "type":"string", "format":"date-time" }, { "type":"null" } ], "title":"Updated At", "description":"Timestamp when the user was last updated" } }, "type":"object", "title":"UserData" }, "UserDataResponse":{ "properties":{ "data":{ "anyOf":[ { "$ref":"#/components/schemas/UserData" }, { "type":"null" } ], "description":"Response containing user data" }, "errno":{ "$ref":"#/components/schemas/CODE", "description":"Error code, 0 means success", "default":0 }, "errmsg":{ "type":"string", "title":"Errmsg", "description":"Error message, empty when success", "default":"" } }, "type":"object", "title":"UserDataResponse" }, "UserEventData":{ "properties":{ "id":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "title":"Id", "description":"The event's unique identifier" }, "event_data":{ "$ref":"#/components/schemas/EventData", "description":"User event data in JSON" }, "created_at":{ "type":"string", "format":"date-time", "title":"Created At", "description":"Timestamp when the event was created" }, "updated_at":{ "type":"string", "format":"date-time", "title":"Updated At", "description":"Timestamp when the event was last updated" }, "similarity":{ "anyOf":[ { "type":"number" }, { "type":"null" } ], "title":"Similarity", "description":"Similarity score" } }, "type":"object", "required":[ "id" ], "title":"UserEventData" }, "UserEventGistData":{ "properties":{ "id":{ "anyOf":[ { "type":"string", "format":"uuid4" }, { "type":"string", "format":"uuid5" } ], "title":"Id", "description":"The event gist's unique identifier" }, "gist_data":{ "$ref":"#/components/schemas/EventGistData", "description":"User event gist data" }, "created_at":{ "type":"string", "format":"date-time", "title":"Created At", "description":"Timestamp when the event gist was created" }, "updated_at":{ "type":"string", "format":"date-time", "title":"Updated At", "description":"Timestamp when the event gist was last updated" }, "similarity":{ "anyOf":[ { "type":"number" }, { "type":"null" } ], "title":"Similarity", "description":"Similarity score" } }, "type":"object", "required":[ "id" ], "title":"UserEventGistData" }, "UserEventGistsData":{ "properties":{ "gists":{ "items":{ "$ref":"#/components/schemas/UserEventGistData" }, "type":"array", "title":"Gists", "description":"List of user event gists" } }, "type":"object", "required":[ "gists" ], "title":"UserEventGistsData" }, "UserEventGistsDataResponse":{ "properties":{ "data":{ "anyOf":[ { "$ref":"#/components/schemas/UserEventGistsData" }, { "type":"null" } ], "description":"Response containing user event gists" }, "errno":{ "$ref":"#/components/schemas/CODE", "description":"Error code, 0 means success", "default":0 }, "errmsg":{ "type":"string", "title":"Errmsg", "description":"Error message, empty when success", "default":"" } }, "type":"object", "title":"UserEventGistsDataResponse" }, "UserEventsData":{ "properties":{ "events":{ "items":{ "$ref":"#/components/schemas/UserEventData" }, "type":"array", "title":"Events", "description":"List of user events" } }, "type":"object", "required":[ "events" ], "title":"UserEventsData" }, "UserEventsDataResponse":{ "properties":{ "data":{ "anyOf":[ { "$ref":"#/components/schemas/UserEventsData" }, { "type":"null" } ], "description":"Response containing user events" }, "errno":{ "$ref":"#/components/schemas/CODE", "description":"Error code, 0 means success", "default":0 }, "errmsg":{ "type":"string", "title":"Errmsg", "description":"Error message, empty when success", "default":"" } }, "type":"object", "title":"UserEventsDataResponse" }, "UserProfileResponse":{ "properties":{ "data":{ "anyOf":[ { "$ref":"#/components/schemas/UserProfilesData" }, { "type":"null" } ], "description":"Response containing user profiles" }, "errno":{ "$ref":"#/components/schemas/CODE", "description":"Error code, 0 means success", "default":0 }, "errmsg":{ "type":"string", "title":"Errmsg", "description":"Error message, empty when success", "default":"" } }, "type":"object", "title":"UserProfileResponse" }, "UserProfilesData":{ "properties":{ "profiles":{ "items":{ "$ref":"#/components/schemas/ProfileData" }, "type":"array", "title":"Profiles", "description":"List of user profiles" } }, "type":"object", "required":[ "profiles" ], "title":"UserProfilesData" }, "ValidationError":{ "properties":{ "loc":{ "items":{ "anyOf":[ { "type":"string" }, { "type":"integer" } ] }, "type":"array", "title":"Location" }, "msg":{ "type":"string", "title":"Message" }, "type":{ "type":"string", "title":"Error Type" } }, "type":"object", "required":[ "loc", "msg", "type" ], "title":"ValidationError" } }, "securitySchemes":{ "BearerAuth":{ "type":"http", "scheme":"bearer" } } }, "security":[ { "BearerAuth":[ ] } ] }