-
Notifications
You must be signed in to change notification settings - Fork 63
Adding lakebase short term memory blog post #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
matthewmoorcroft
merged 4 commits into
databricks-solutions:main
from
bcheng004:bcheng004/how-to-build-ai-agents-with-conversation-memory-using-lakebase
Jan 15, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
477 changes: 477 additions & 0 deletions
477
...o-build-ai-agents-with-conversation-memory-using-lakebase/00-data-uc-function-setup.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
178 changes: 178 additions & 0 deletions
178
...-build-ai-agents-with-conversation-memory-using-lakebase/01-lakebase-instance-setup.ipynb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 0, | ||
| "metadata": { | ||
| "application/vnd.databricks.v1+cell": { | ||
| "cellMetadata": { | ||
| "byteLimit": 2048000, | ||
| "rowLimit": 10000 | ||
| }, | ||
| "inputWidgets": {}, | ||
| "nuid": "1247c05c-b447-4270-a9d2-d704eae0af9e", | ||
| "showTitle": true, | ||
| "tableResultSettingsMap": {}, | ||
| "title": "Install and Restart Databricks SDK Library" | ||
| } | ||
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "%pip install -U -qqqq databricks-sdk\n", | ||
| "dbutils.library.restartPython()" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 0, | ||
| "metadata": { | ||
| "application/vnd.databricks.v1+cell": { | ||
| "cellMetadata": { | ||
| "byteLimit": 2048000, | ||
| "rowLimit": 10000 | ||
| }, | ||
| "inputWidgets": {}, | ||
| "nuid": "80b655ec-94f8-4933-b8a9-507726f11fa9", | ||
| "showTitle": true, | ||
| "tableResultSettingsMap": {}, | ||
| "title": "Initialize WorkspaceClient in Databricks SDK" | ||
| } | ||
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "from databricks.sdk import WorkspaceClient\n", | ||
| "\n", | ||
| "w = WorkspaceClient()" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 0, | ||
| "metadata": { | ||
| "application/vnd.databricks.v1+cell": { | ||
| "cellMetadata": { | ||
| "byteLimit": 2048000, | ||
| "rowLimit": 10000 | ||
| }, | ||
| "inputWidgets": {}, | ||
| "nuid": "2d404a67-9778-403f-a3e2-180a12080f49", | ||
| "showTitle": true, | ||
| "tableResultSettingsMap": {}, | ||
| "title": "Create and Wait for Database Instance in Databricks SDK" | ||
| } | ||
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "from databricks.sdk.service.database import DatabaseInstance\n", | ||
| "from datetime import timedelta\n", | ||
| "\n", | ||
| "database_instance = DatabaseInstance(\n", | ||
| " name=\"<INSERT LAKEBASE NAME>\",\n", | ||
| " capacity=\"CU_1\",\n", | ||
| " enable_pg_native_login=True,\n", | ||
| ")\n", | ||
| "w.database.create_database_instance_and_wait(\n", | ||
| " database_instance=database_instance, timeout=timedelta(minutes=20)\n", | ||
| ")" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 0, | ||
| "metadata": { | ||
| "application/vnd.databricks.v1+cell": { | ||
| "cellMetadata": { | ||
| "byteLimit": 2048000, | ||
| "rowLimit": 10000 | ||
| }, | ||
| "inputWidgets": {}, | ||
| "nuid": "5e800fad-2727-4bfb-835c-33f61e84a815", | ||
| "showTitle": false, | ||
| "tableResultSettingsMap": {}, | ||
| "title": "" | ||
| } | ||
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "from databricks.sdk.service.database import (\n", | ||
| " DatabaseInstanceRole,\n", | ||
| " DatabaseInstanceRoleAttributes,\n", | ||
| " DatabaseInstanceRoleIdentityType,\n", | ||
| " DatabaseInstanceRoleMembershipRole,\n", | ||
| ")\n", | ||
| "\n", | ||
| "database_instance_role = DatabaseInstanceRole(\n", | ||
| " attributes=DatabaseInstanceRoleAttributes(\n", | ||
| " bypassrls=False,\n", | ||
| " createdb=False,\n", | ||
| " createrole=False,\n", | ||
| " ),\n", | ||
| " identity_type=DatabaseInstanceRoleIdentityType.SERVICE_PRINCIPAL,\n", | ||
| " membership_role=DatabaseInstanceRoleMembershipRole.DATABRICKS_SUPERUSER,\n", | ||
| " name=\"<INSERT SERVICE PRINCIPAL CLIENT ID>\",\n", | ||
| ")\n", | ||
| "w.database.create_database_instance_role(\n", | ||
| " instance_name=\"<INSERT LAKEBASE NAME>\", database_instance_role=database_instance_role\n", | ||
| ")" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 0, | ||
| "metadata": { | ||
| "application/vnd.databricks.v1+cell": { | ||
| "cellMetadata": { | ||
| "byteLimit": 2048000, | ||
| "rowLimit": 10000 | ||
| }, | ||
| "inputWidgets": {}, | ||
| "nuid": "491ba59f-142c-4067-8103-597660b0a681", | ||
| "showTitle": false, | ||
| "tableResultSettingsMap": {}, | ||
| "title": "" | ||
| } | ||
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "from databricks.sdk.service.database import DatabaseCatalog\n", | ||
| "\n", | ||
| "w.database.create_database_catalog(\n", | ||
| " catalog=DatabaseCatalog(\n", | ||
| " name=\"<INSERT DATABASE CATALOG NAME>\",\n", | ||
| " database_instance_name=\"<INSERT LAKEBASE NAME>\",\n", | ||
| " database_name=\"databricks_postgres\",\n", | ||
| " create_database_if_not_exists=True,\n", | ||
| " )\n", | ||
| ")" | ||
| ] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "application/vnd.databricks.v1+notebook": { | ||
| "computePreferences": { | ||
| "hardware": { | ||
| "accelerator": null, | ||
| "gpuPoolId": null, | ||
| "memory": null | ||
| } | ||
| }, | ||
| "dashboards": [], | ||
| "environmentMetadata": { | ||
| "base_environment": "", | ||
| "environment_version": "3" | ||
| }, | ||
| "inputWidgetPreferences": null, | ||
| "language": "python", | ||
| "notebookMetadata": { | ||
| "pythonIndentUnit": 2 | ||
| }, | ||
| "notebookName": "01-lakebase-instance-setup", | ||
| "widgets": {} | ||
| }, | ||
| "language_info": { | ||
| "name": "python" | ||
| } | ||
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 0 | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.